YanCheng_Metrology/Assets/Scripts/Project/Objects/Other/MobileController.cs

88 lines
2.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using LitJson;
using Newtonsoft.Json;
using System.Reflection;
public class MobileController : PermanentTriggerBase
{
public int downIndex = 0;
protected override void OnMEnter()
{
base.OnMEnter();
if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
{
_highlight.SetHighlighted(true);
}
}
protected override void OnMExit()
{
if (GameManager.RunModelMgr.ModeType != E_ModeType.Study)
_highlight.SetHighlighted(false);
base.OnMExit();
}
protected override void OnMDown()
{
switch (downIndex)
{
case 0:
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, false) == 0)
{
GameManager.UIMgr.ShowPanel<UI_ReceiveTaskPanel>(E_UI_Layer.Mid, (panel) =>
{
panel.Init(triggerName, Input.mousePosition);
});
downIndex = 1;
}
_highlight.SetHighlighted(false);
break;
case 1:
GameManager.UIMgr.ShowPanel<UI_PlayerSessionPanel>(E_UI_Layer.Mid, (panel) =>
{
panel.Init(triggerName, "我是xxx供电所人员到xxx地方开展经互感器接入式低压电能计量装置安装作业。", PlayerTalk);
});
_highlight.SetHighlighted(false);
downIndex = 2;
break;
}
}
private void PlayerTalk(string triggerName)
{
if (GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, false) == 0)
{
GameManager.UIMgr.ShowPanel<UI_CustomSessionPanel>(E_UI_Layer.Mid, (panel) =>
{
panel.Init(triggerName, "好的", (intTemp) =>
{
ScoreManager.instance.Check(triggerName, "工作预约完成");
GameManager.ProcessMgr.IsRightSubProcessStepsTriggerID(triggerName, true);
GameManager.UIMgr.HidePanel<UI_CustomSessionPanel>();
});
});
}
}
/// <summary>
/// 断线重连的状态保存与读取
/// </summary>
/// <param name="triggerInfo"></param>
public override void LoadCurrentTriggerStat(string triggerInfo)
{
if (triggerInfo != "")
{
this.downIndex = int.Parse(triggerInfo);
}
}
public override string SaveCurrentTriggerStat()
{
PropertyInfo[] properties = this.GetType().GetProperties();
return downIndex.ToString();
//throw new NotImplementedException();
}
}