路线产生逻辑微调

This commit is contained in:
lishuo 2021-04-15 17:09:35 +08:00
parent 62938ec6ae
commit 92e43c2cd8
21 changed files with 3375 additions and 1829 deletions

View File

@ -1,44 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CameraRectAutoFit : MonoBehaviour
{
float targetaspect = 16.0f / 9.0f;
// Start is called before the first frame update
void Start()
{
// determine the game window's current aspect ratio
float windowaspect = (float)Screen.width / (float)Screen.height;
// current viewport height should be scaled by this amount
float scaleheight = windowaspect / targetaspect;
// obtain camera component so we can modify its viewport
Camera camera = Camera.main;
// if scaled height is less than current height, add letterbox
if (scaleheight <= 1.0f)
{
Rect rect = camera.rect;
rect.width = 1.0f;
rect.height = scaleheight;
rect.x = 0;
rect.y = (1.0f - scaleheight) / 2.0f;
camera.rect = rect;
}
else // add pillarbox
{
float scalewidth = 1.0f / scaleheight;
Rect rect = camera.rect;
rect.width = scalewidth;
rect.height = 1.0f;
rect.x = (1.0f - scalewidth) / 2.0f;
rect.y = 0;
camera.rect = rect;
}
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 10897b204f40f6c4a9202250110f0a27
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9a0a7989900f2c34abeee17c663d08dc guid: 217cb7caed5f7fb49b339428b1d80974
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -199,7 +199,7 @@ RectTransform:
m_AnchorMin: {x: 1, y: 0} m_AnchorMin: {x: 1, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0}
m_AnchoredPosition: {x: -16, y: 14.5} m_AnchoredPosition: {x: -16, y: 14.5}
m_SizeDelta: {x: 12, y: 9} m_SizeDelta: {x: 16, y: 16}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &9075509681674056080 --- !u!222 &9075509681674056080
CanvasRenderer: CanvasRenderer:
@ -247,7 +247,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: adb30198aa32dd140b5750692dd48104, type: 3} m_Script: {fileID: 11500000, guid: adb30198aa32dd140b5750692dd48104, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
radius: 4 radius: 8
--- !u!1 &5549514346347886652 --- !u!1 &5549514346347886652
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -33,8 +33,8 @@ namespace Assets.Scenes.Ride.Scripts
#region #region
protected Vector2d nextlatlong; //下一个点的坐标 protected Vector2d nextlatlong; //下一个点的坐标
protected bool isStart;//开始或者暂停 //protected bool isStart;//开始或者暂停
protected bool isQuit;//true 中途退出 或者到达终点 public bool isQuit;//true 中途退出 或者到达终点
protected bool isMajor;//是否是主人公 protected bool isMajor;//是否是主人公
protected MapDataModel mapData; protected MapDataModel mapData;
protected int userId; protected int userId;
@ -59,7 +59,6 @@ namespace Assets.Scenes.Ride.Scripts
public double TotalClimb { get => totalClimb; } public double TotalClimb { get => totalClimb; }
public int UserId { get => userId; } public int UserId { get => userId; }
public bool IsStart { get => isStart; }
public double Speed { get => speed; } public double Speed { get => speed; }
public double Power { get => power; } public double Power { get => power; }
public double Cadance { get => cadance; } public double Cadance { get => cadance; }
@ -79,20 +78,17 @@ namespace Assets.Scenes.Ride.Scripts
//开始骑行 //开始骑行
public void SetStart() public void SetStart()
{ {
isStart = true;
mainController.isStart = true; mainController.isStart = true;
startTime = DateTime.Now; startTime = DateTime.Now;
} }
//继续骑行 //继续骑行
public void SetContinue() public void SetContinue()
{ {
isStart = true;
mainController.isStart = true; mainController.isStart = true;
} }
//暂停骑行 //暂停骑行
public void SetPause() public void SetPause()
{ {
isStart = false;
mainController.isStart = false; mainController.isStart = false;
//characterAnimator.SetBool("IsRide", false); //characterAnimator.SetBool("IsRide", false);
} }
@ -126,7 +122,6 @@ namespace Assets.Scenes.Ride.Scripts
mapData = mainController.GetMapData();//获取路书信息 mapData = mainController.GetMapData();//获取路书信息
nextlatlong = new Vector2d(mapData.List[0].Point[0], mapData.List[0].Point[1]);//初始化人物位置 TODO加上之前骑行距离 nextlatlong = new Vector2d(mapData.List[0].Point[0], mapData.List[0].Point[1]);//初始化人物位置 TODO加上之前骑行距离
cyclingExcutor = mainController.cyclingController; cyclingExcutor = mainController.cyclingController;
isStart = mainController.isStart;
} }
protected virtual void Excute() protected virtual void Excute()
@ -135,6 +130,7 @@ namespace Assets.Scenes.Ride.Scripts
timer -= Time.deltaTime; timer -= Time.deltaTime;
if (timer <= 0)//定时器 一秒执行一次 if (timer <= 0)//定时器 一秒执行一次
{ {
SendTcp();
Run(); Run();
timer = 1.0f; timer = 1.0f;
} }
@ -143,16 +139,23 @@ namespace Assets.Scenes.Ride.Scripts
protected virtual void Run() protected virtual void Run()
{ {
ComputeNextSlope();//计算下一个坡度相关数据 ComputeNextSlope();//计算下一个坡度相关数据
SendTcp();
if (mainController.isStart) if (mainController.isStart)
{ {
ticks++; if (index > 0)
//计算累计爬升
var diff = mapData.List[CurrentIndex].Elevation - elevation;
if (diff > 0)
{ {
totalClimb += diff; totalClimb = 0;
//计算累计爬升
for (int i = 1; i <= index; i++)
{
var diff = mapData.List[i].Elevation - mapData.List[i - 1].Elevation;
if (diff > 0)
{
totalClimb += diff;
}
}
} }
ticks++;
Compute();//接受蓝牙设备数据计算 Compute();//接受蓝牙设备数据计算
//characterAnimator.SetBool("IsRide", false);//初始化动画状态 //characterAnimator.SetBool("IsRide", false);//初始化动画状态
if (totalDistance <= mapData.TotalDistance) if (totalDistance <= mapData.TotalDistance)
@ -178,7 +181,7 @@ namespace Assets.Scenes.Ride.Scripts
//characterAnimator.SetBool("ReachEnd", true);//到达终点 //characterAnimator.SetBool("ReachEnd", true);//到达终点
//Task.Run(() => { });//异步上传数据 //Task.Run(() => { });//异步上传数据
Upload(); Upload();
isStart = false; //mainController.isStart = false;
isQuit = true; isQuit = true;
} }
} }
@ -241,6 +244,7 @@ namespace Assets.Scenes.Ride.Scripts
{ {
double sumDistance = 0; double sumDistance = 0;
var pointList = mapData.List; var pointList = mapData.List;
int preIndex = 0;
for (int i = 0; i < pointList.Count; i++) for (int i = 0; i < pointList.Count; i++)
{ {
sumDistance += pointList[i].Distance; sumDistance += pointList[i].Distance;
@ -250,6 +254,7 @@ namespace Assets.Scenes.Ride.Scripts
break; break;
} }
} }
preIndex = index > 0 ? index - 1:0;
//计算当前海拔和坡度 //计算当前海拔和坡度
elevation = pointList[index].Elevation; elevation = pointList[index].Elevation;
currentSlope = pointList[index].Grade; currentSlope = pointList[index].Grade;

View File

@ -43,9 +43,9 @@ public class CyclingController : DeviceServiceMonoBase
//var result = GetTestData(); //var result = GetTestData();
MapDataModel result = mapApi.GetData(RouteId); MapDataModel result = mapApi.GetData(RouteId);
#if !UNITY_EDITOR
var antConnected = CheckAnt();//初始化ant+设备 var antConnected = CheckAnt();//初始化ant+设备
#endif
//if (!antConnected) //if (!antConnected)
//{ //{
// throw new Exception("请先连接设备"); // throw new Exception("请先连接设备");
@ -98,6 +98,11 @@ public class CyclingController : DeviceServiceMonoBase
throw new System.Exception("fail to get route data"); throw new System.Exception("fail to get route data");
} }
} }
private void Start()
{
UIManager.Instance.MainPanel = this.transform.Find("SingleUI/Panel").GetComponent<PFUIPanel>();
UIManager.Instance.ModalsPanel = this.transform.Find("SingleUI/ModalPanel").GetComponent<PFUIPanel>();
}
private void InitParam() private void InitParam()
{ {

View File

@ -8,24 +8,48 @@ namespace Assets.Scenes.Ride.Scripts
//[ExecuteInEditMode] //[ExecuteInEditMode]
public class LoadingPanelController : MonoBehaviour public class LoadingPanelController : MonoBehaviour
{ {
[SerializeField]
GameObject _content;
[SerializeField] [SerializeField]
Text _text; Text _text;
[SerializeField] [SerializeField]
AnimationCurve _curve; AnimationCurve _curve;
Text mapName;
AbstractMap _map; AbstractMap _map;
void Awake() Text level;
{ Text distance;
_map = FindObjectOfType<AbstractMap>(); Text elevaction;
_map.OnInitialized += _map_OnInitialized; Text slope;
_map.OnTileFinished += _map_OnTileFinished; Text rideNum;
_map.OnEditorPreviewEnabled += OnEditorPreviewEnabled; Text uploadByUserName;
_map.OnEditorPreviewDisabled += OnEditorPreviewDisabled;
_map.OnUpdated += _map_OnUpdated; private void Start()
{
var root = transform.parent.parent.parent;
_map = root.Find("Map").GetComponent<AbstractMap>();
var cyclingController = root.GetComponent<CyclingController>();
mapName = transform.Find("MapName").GetComponent<Text>();
level = transform.Find("level/Text").GetComponent<Text>();
elevaction = transform.Find("Elevaction").GetComponent<Text>();
slope = transform.Find("Slope").GetComponent<Text>();
rideNum = transform.Find("RideNum").GetComponent<Text>();
uploadByUserName = transform.Find("UploadByUserName").GetComponent<Text>();
var mapdata = cyclingController.GetMapData();
var route = cyclingController.GetRoute();
mapName.text = route.RouteInstance.Name;
level.text = route.RouteInstance.Hard;
elevaction.text = route.RouteInstance.EleDifference.ToString("g0");
slope.text = route.RouteInstance.AverageGrade.ToString() + "%";
rideNum.text = route.RouteInstance.TheHeat.ToString();
uploadByUserName.text = route.RouteInstance.UserId.ToString();
_map.OnInitialized += _map_OnInitialized;
_map.OnTileFinished += _map_OnTileFinished;
_map.OnEditorPreviewEnabled += OnEditorPreviewEnabled;
_map.OnEditorPreviewDisabled += OnEditorPreviewDisabled;
_map.OnUpdated += _map_OnUpdated;
} }
private void _map_OnUpdated() private void _map_OnUpdated()
@ -35,7 +59,7 @@ namespace Assets.Scenes.Ride.Scripts
private void _map_OnTileFinished(global::Mapbox.Unity.MeshGeneration.Data.UnityTile obj) private void _map_OnTileFinished(global::Mapbox.Unity.MeshGeneration.Data.UnityTile obj)
{ {
transform.gameObject.SetActive(false); //transform.gameObject.SetActive(false);
Debug.Log("_map_OnTileFinished"); Debug.Log("_map_OnTileFinished");
} }
@ -51,32 +75,24 @@ namespace Assets.Scenes.Ride.Scripts
return; return;
if (s == ModuleState.Finished) if (s == ModuleState.Finished)
{ {
//transform.gameObject.SetActive(false); transform.gameObject.SetActive(false);
} }
else if (s == ModuleState.Working) else if (s == ModuleState.Working)
{ {
// Uncommment me if you want the loading screen to show again
// when loading new tiles.
//_content.SetActive(true);
} }
}; };
} }
void OnEditorPreviewEnabled() void OnEditorPreviewEnabled()
{ {
//transform.gameObject.SetActive(false); transform.gameObject.SetActive(false);
Debug.Log("OnEditorPreviewEnabled");
} }
void OnEditorPreviewDisabled() void OnEditorPreviewDisabled()
{ {
//transform.gameObject.SetActive(true); transform.gameObject.SetActive(true);
Debug.Log("OnEditorPreviewDisabled");
} }
void Update() void Update()
{ {
var t = _curve.Evaluate(Time.time); var t = _curve.Evaluate(Time.time);

View File

@ -21,7 +21,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
{ {
get get
{ {
return 10688;//CurrentUser.Id; return CurrentUser.Id;
} }
} }
/// <summary> /// <summary>

View File

@ -62,7 +62,8 @@ namespace Assets.Scenes.Ride.Scripts
} }
if (scrollrect.verticalNormalizedPosition >= 1) if (scrollrect.verticalNormalizedPosition >= 1)
{ {
pageIndex--; if(pageIndex > 0)
pageIndex--;
//RefreshList(); //RefreshList();
} }
} }

View File

@ -28,7 +28,7 @@ namespace Assets.Scenes.Ride.Scripts
private string _speed = string.Empty; private string _speed = string.Empty;
private string _distance = string.Empty; private string _distance = string.Empty;
private string _ratio = string.Empty; private string _ratio = string.Empty;
private Texture countryTexture;
private void Awake() private void Awake()
{ {
Head = transform.Find("Head").GetComponent<RawImage>(); Head = transform.Find("Head").GetComponent<RawImage>();
@ -37,6 +37,7 @@ namespace Assets.Scenes.Ride.Scripts
Speed = transform.Find("Speed").GetComponent<Text>(); Speed = transform.Find("Speed").GetComponent<Text>();
Distance = transform.Find("Distance").GetComponent<Text>(); Distance = transform.Find("Distance").GetComponent<Text>();
Ratio = transform.Find("Ratio").GetComponent<Text>(); Ratio = transform.Find("Ratio").GetComponent<Text>();
countryTexture = Resources.Load<Sprite>("Images/flag_China_Person").texture;
} }
public void setRatio(string ratio) public void setRatio(string ratio)
@ -51,7 +52,9 @@ namespace Assets.Scenes.Ride.Scripts
{ {
if (!_headUrl.Equals(url)) if (!_headUrl.Equals(url))
{ {
StartCoroutine(DownloadImage(Head, url)); Head.texture = App.CurrentUserHeadTexture;
//Utils.DisplayImage(StartCoroutine, Head, url);
//StartCoroutine(DownloadImage(Head, url));
var rect = ((RectTransform)Head.transform).rect; var rect = ((RectTransform)Head.transform).rect;
Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial")); Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0)); material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
@ -82,7 +85,9 @@ namespace Assets.Scenes.Ride.Scripts
{ {
if (!_countryUrl.Equals(url)) if (!_countryUrl.Equals(url))
{ {
StartCoroutine(DownloadImage(Country, url)); Country.texture = countryTexture;
//Utils.DisplayImage(StartCoroutine, Country, url);
//StartCoroutine(DownloadImage(Country, url));
var rect = ((RectTransform)Country.transform).rect; var rect = ((RectTransform)Country.transform).rect;
Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial")); Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0)); material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));

View File

@ -31,9 +31,10 @@ namespace Assets.Scenes.Ride.Scripts
cadance = mainController.UpdateCadence(); cadance = mainController.UpdateCadence();
weight = App.CurrentUser.Weight; weight = App.CurrentUser.Weight;
bicycleWeight = App.CurrentUser.BicycleWeight; bicycleWeight = App.CurrentUser.BicycleWeight;
Debug.Log(power);
power = 2000;//测试功率 //#if UNITY_EDITOR
// power = 2000;//测试功率
//#endif
speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight); speed = Helper.CalculateSpeed(elevation, currentSlope, power, weight, bicycleWeight);
distance = mainController.UpdateDistance(speed); distance = mainController.UpdateDistance(speed);
totalDistance += distance; totalDistance += distance;
@ -61,7 +62,7 @@ namespace Assets.Scenes.Ride.Scripts
//上传数据 //上传数据
public override void Upload() public override void Upload()
{ {
mainController.isStart = false;
string imageFileName = base.CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f)); string imageFileName = base.CaptureCamera(Camera.main, new Rect(Screen.width * 0f, Screen.height * 0f, Screen.width * 0.5f, Screen.height * 0.5f));
cyclingExcutor.recorderData.IsCompleted = totalDistance == mapData.TotalDistance; cyclingExcutor.recorderData.IsCompleted = totalDistance == mapData.TotalDistance;
cyclingExcutor.recorderData.EndDistance = totalDistance; cyclingExcutor.recorderData.EndDistance = totalDistance;

View File

@ -129,7 +129,7 @@ namespace Assets.Scenes.Ride.Scripts
Vector3 viewPos = Camera.main.WorldToViewportPoint(position); Vector3 viewPos = Camera.main.WorldToViewportPoint(position);
Vector3 dir = (position - camreatra.localPosition).normalized; Vector3 dir = (position - camreatra.localPosition).normalized;
float dot = Vector3.Dot(camreatra.forward, dir); float dot = Vector3.Dot(camreatra.forward, dir);
if (dot > -1 && viewPos.x >= -1 && viewPos.x <= 2 && viewPos.y >= -1 && viewPos.y <= 2) if (dot > -0.1 && viewPos.x >= -0.1 && viewPos.x <= 1.1 && viewPos.y >= -0.1 && viewPos.y <= 1.1)
{ {
return true; return true;
} }

View File

@ -236,9 +236,13 @@ namespace Assets.Scenes.Ride.Scripts
} }
private void SaveRide() private void SaveRide()
{ {
playerController.Upload(); playerController.SetPause();
//SceneManager.LoadScene("MainScene"); if (playerController.TotalTicks > 0 && !playerController.isQuit )
quitPanel.SetActive(false); {
playerController.Upload();
quitPanel.SetActive(false);
}
SceneManager.LoadScene("MainScene");
} }
private void CancelQuit() private void CancelQuit()
{ {
@ -253,12 +257,19 @@ namespace Assets.Scenes.Ride.Scripts
//结束游戏 //结束游戏
private void StopRide() private void StopRide()
{ {
quitPanel.SetActive(true); if (playerController.TotalTicks > 0)
{
quitPanel.SetActive(true);
}
else
{
SceneManager.LoadScene("MainScene");
}
} }
//显示设备连接 //显示设备连接
private void ShowDevicePanel() private void ShowDevicePanel()
{ {
UIManager.ShowCustom(UIManager.Instance.DevicePanel, transform.Find("Panel").gameObject); UIManager.Show(UIManager.Instance.DevicePanel, transform.Find("Panel").GetComponent<PFUIPanel>());
} }
//显示设置 //显示设置
private void ShowSettingPanel() private void ShowSettingPanel()
@ -342,6 +353,7 @@ namespace Assets.Scenes.Ride.Scripts
} }
var v = (endIndex - chartAddNum) % maxCacheDataNumber; var v = (endIndex - chartAddNum) % maxCacheDataNumber;
MoveChartMarkPoint(v); MoveChartMarkPoint(v);
App.CurrentUserHeadTexture = img.texture;
} }
} }
void AddOneData(int index) void AddOneData(int index)

View File

@ -24,5 +24,6 @@ public static class App
/// </summary> /// </summary>
public static System.Collections.Generic.Dictionary<string, string> MainSceneParam = new Dictionary<string, string>(); public static System.Collections.Generic.Dictionary<string, string> MainSceneParam = new Dictionary<string, string>();
public static IDictionary<string,Texture> TextureCache = new Dictionary<string, Texture>(); public static IDictionary<string,Texture> TextureCache = new Dictionary<string, Texture>();
public static Texture CurrentUserHeadTexture;
public static SelectParamModel selectParam; public static SelectParamModel selectParam;
} }

View File

@ -10,7 +10,7 @@ using UnityEngine.EventSystems;
namespace Assets.Scripts.UI.Control namespace Assets.Scripts.UI.Control
{ {
[RequireComponent(typeof(Button))] [RequireComponent(typeof(Button))]
public class PFUIButton : PFUIComponentBase public class PfUIButton : PFUIComponentBase
{ {
public enum Type public enum Type
{ {

View File

@ -20,7 +20,7 @@ public class Tips : MonoBehaviour
private Text Count; private Text Count;
private Text Distance; private Text Distance;
private Text TotalClimb; private Text TotalClimb;
private PFUIButton pFUIButton; private PfUIButton pFUIButton;
private void Awake() private void Awake()
{ {
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial")); var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
@ -34,7 +34,7 @@ public class Tips : MonoBehaviour
Distance = this.transform.Find("Distance").GetComponent<Text>(); Distance = this.transform.Find("Distance").GetComponent<Text>();
TotalClimb = this.transform.Find("TotalClimb").GetComponent<Text>(); TotalClimb = this.transform.Find("TotalClimb").GetComponent<Text>();
pFUIButton = this.transform.Find("Ride").GetComponent<PFUIButton>(); pFUIButton = this.transform.Find("Ride").GetComponent<PfUIButton>();
UIManager.AddEvent(pFUIButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (e) => { UIManager.AddEvent(pFUIButton.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, (e) => {
App.RouteIdParam = _model.Id; App.RouteIdParam = _model.Id;
SceneManager.LoadScene("Ride"); SceneManager.LoadScene("Ride");

View File

@ -27,7 +27,7 @@ public class ConnectDeviceModal : PFUIPanel
private Image Logo; private Image Logo;
private UnityEngine.Object deviceItem; private UnityEngine.Object deviceItem;
private VerticalLayoutGroup content; private VerticalLayoutGroup content;
private PFUIButton connectBtn; private PfUIButton connectBtn;
private Dictionary<ushort, DeviceItem> deviceList; private Dictionary<ushort, DeviceItem> deviceList;
protected override void Awake() protected override void Awake()
@ -60,7 +60,7 @@ public class ConnectDeviceModal : PFUIPanel
deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem"); deviceItem = Resources.Load("UI/Prefab/Device/DeviceItem");
connectBtn = container.Find("ConnectBtn").GetComponent<PFUIButton>(); connectBtn = container.Find("ConnectBtn").GetComponent<PfUIButton>();
UIManager.AddEvent(connectBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => UIManager.AddEvent(connectBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
{ {

View File

@ -37,7 +37,8 @@ public class DeviceController : PFUIPanel
UIManager.AddEvent(mReturnBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => UIManager.AddEvent(mReturnBtn.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
{ {
//UIManager.ShowHomePanel(); //UIManager.ShowHomePanel();
UIManager.CloseModal(); //UIManager.CloseModal();
this.Close();
})); }));
var bg = this.transform.Find("Status").Find("Bg"); var bg = this.transform.Find("Status").Find("Bg");

View File

@ -247,7 +247,7 @@ public class MapListController : PFUIPanel
var obj = Instantiate(map); var obj = Instantiate(map);
obj.GetComponent<MapItem>().Initial(item); obj.GetComponent<MapItem>().Initial(item);
//obj.SendMessage("Initial", ); //obj.SendMessage("Initial", );
obj.transform.parent = content.transform; obj.transform.SetParent(content.transform);
obj.transform.localScale = new Vector3(1, 1, 1); obj.transform.localScale = new Vector3(1, 1, 1);
} }
} }

View File

@ -47,7 +47,7 @@ namespace Assets.Scripts
if (isPlaying) if (isPlaying)
{ {
child.parent = null; child.SetParent(null);
UnityEngine.Object.Destroy(child.gameObject); UnityEngine.Object.Destroy(child.gameObject);
} }
else UnityEngine.Object.DestroyImmediate(child.gameObject); else UnityEngine.Object.DestroyImmediate(child.gameObject);