From eb27e5fd31f73b998a4bbd85511a31e40b8c61b7 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 21 十一月 2025 17:03:47 +0800
Subject: [PATCH] 0312 关闭游戏内日志
---
Main/System/Task/TaskManager.cs | 1791 +----------------------------------------------------------
1 files changed, 40 insertions(+), 1,751 deletions(-)
diff --git a/Main/System/Task/TaskManager.cs b/Main/System/Task/TaskManager.cs
index 41632ab..4dbe776 100644
--- a/Main/System/Task/TaskManager.cs
+++ b/Main/System/Task/TaskManager.cs
@@ -5,1802 +5,91 @@
using LitJson;
using System.Text.RegularExpressions;
using System.Text;
+using UnityEngine.Events;
//浠诲姟淇℃伅鐨勫瓨鍌�
/** 浠诲姟缁撴瀯 */
-public class MissionDetailDates
+public class TaskDetailDates
{
- public DateTime Time;//璁板綍鏃堕棿
- public int ID;//浠诲姟ID
- public string Name;//浠诲姟鍚嶇О
- public int Type;//浠诲姟绫诲瀷
- public int NPC_ID;//璧峰NPCID
- public int LV;//鍙帴绛夌骇
- public int ColorLV;//浠诲姟闅惧害
- public string Desclist;//浠诲姟璇︽儏
- public string RewardList;//濂栧姳淇℃伅
- public List<TsakLight> LightList;//浠诲姟鐏俊鎭�
- public string InforList;//浠诲姟瀹屾垚鏉′欢
- public int MissionState;//浠诲姟鐘舵��0鏈帴锛�1杩涜涓紝2鍙彁浜わ紝3宸插畬鎴�,6鐗规畩鍗$骇
- public int descIndex;//浠诲姟鎻忚堪绱㈠紩
+ public int TaskGroup; // 浠诲姟缁勶紝0-涓荤嚎
+ public int TaskID; // 褰撳墠浠诲姟ID锛屽彲鑳戒负0锛岃〃绀鸿鍒嗙粍鏆傛椂娌℃湁浠诲姟
+ public int CurValue; // 褰撳墠杩涘害鍊�
+ public int State; // 浠诲姟鐘舵�� 1-杩涜涓� 2-鍙鍙�
}
-
-public class MissionDict//浠诲姟瀛楀吀淇℃伅
+public enum TaskTypenum//浠诲姟绫诲瀷鍒嗙被
{
- public int MissionId;//浠诲姟ID
-
- public int DictKeyLen;//浠诲姟瀛楀吀涓殑鏌愪釜Key
-
- public string DictKey;//key鐨勯暱搴�
-
- public int DictValue;//璇ey瀵瑰簲鐨勫��
-
+ MainlineTaskType = 0,//涓荤嚎
+ SideQuestsType = 1,//鏀嚎
}
-public class RunTaskAwardRecord
-{
- public int Num;
- public int AwardState;
-}
-
-public struct TsakLight
-{
- public int NpcId;
- public int StateLight;
-}
-
public class TaskManager : GameSystemManager<TaskManager>
{
-
- /** 浠诲姟鎬绘竻鍗� */
- public static bool _globalbool = false;
- public Dictionary<int, MissionDetailDates> allMissionDict = new Dictionary<int, MissionDetailDates>();//浠诲姟鍒濆鍖栨帴鏀跺瓧鍏�
- public Dictionary<int, MissionDetailDates> MainTaskDic = new Dictionary<int, MissionDetailDates>();//涓荤嚎浠诲姟瀛楀吀
- public Dictionary<int, MissionDetailDates> SideQuestsDic = new Dictionary<int, MissionDetailDates>();//鏀嚎浠诲姟瀛楀吀
- public Dictionary<int, MissionDetailDates> BountyDic = new Dictionary<int, MissionDetailDates>();//璧忛噾浠诲姟
- public Dictionary<int, MissionDetailDates> FairyAuDic = new Dictionary<int, MissionDetailDates>();//浠欑洘浠诲姟
- public int FairyAuTaskCount_Day { get; private set; }
- public int FairyAuTaskCount_Round { get; private set; }
- public Dictionary<int, MissionDetailDates> SpecialTask = new Dictionary<int, MissionDetailDates>();//鐗规畩浠诲姟绫诲瀷
- public Dictionary<int, Dictionary<string, string>> _DicTaskInformation = new Dictionary<int, Dictionary<string, string>>();//浠诲姟瀛楀吀鐨勪俊鎭�
- public Dictionary<int, Dictionary<string, int>> ReplaceDic = new Dictionary<int, Dictionary<string, int>>();//key鍊兼浛鎹㈠瓧鍏�
- public Dictionary<int, RunTaskAwardRecord> AwardRecordDic = new Dictionary<int, RunTaskAwardRecord>();//璺戠幆濂栧姳璁板綍
- public Dictionary<int, int> NPCShowDic = new Dictionary<int, int>();//鍏充簬NPC鐨勬樉闅愰棶棰�
-
- Dictionary<int, int> m_ShowNpcCache = new Dictionary<int, int>();
-
- public delegate void OnTaskToAdd(int MissionID, int MissionState, int DiscriptionIndex);
- public static event OnTaskToAdd Event_TaskToAdd;//浠诲姟娣诲姞
- public delegate void OnTaskRefreshes(int _taskId);
- public static event OnTaskRefreshes Event_TaskRefreshes;//浠诲姟鐨勫埛鏂�
- public delegate void OnBounty();//璧忛噾浠诲姟鐨勬坊鍔�
- public static event OnBounty Event_nBounty;
- public delegate void OnFairyAuTask();//浠欑洘浠诲姟鐨勬坊鍔犲拰鍒锋柊
- public static event OnFairyAuTask Event_FairyAuTask;
-
- public delegate void OnTaskInformation(int _id, Dictionary<int, Dictionary<string, string>> _Dic);
- public static event OnTaskInformation Event_TaskInformation;//浠诲姟瀛楀吀淇℃伅
-
- public delegate void OnTaskToDelete(int _taskID);
- public static event OnTaskToDelete Event_TaskToDelete;//浠诲姟鐨勫垹闄�
-
- public delegate void OnBountyRewards(int Number, int AwardState);//鑾峰彇璧忛噾濂栧姳
- public static event OnBountyRewards Event_BountyRewards;
- public int BountyRewardsNumber = 0;//鑾峰彇璧忛噾鍐呭鐨勫鍔卞��
-
- public delegate void OnFairyAuReward(int Number, int AwardState);//浠欑洘濂栧姳
- public static event OnFairyAuReward Event_FairyAuReward;
- public int OnFairyAuNumber = 0;//鑾峰彇浠欑洘鐨勫鍔卞��
-
- public string _conversation = null;//瀵硅瘽鍐呭銆�
- public int _TaskNow = 0;//鑾峰彇褰撳墠浠诲姟ID
- public string _DefaultDialogContent = null;//榛樿瀵硅瘽鍐呭
-
- public delegate void OnMainlineTask(int MissionID, int MissionState);//涓荤嚎浠诲姟浠诲姟鐘舵�佸彉鏇村拰鍒锋柊
- public static event OnMainlineTask Event_MainlineTask;
-
- public delegate void OnTaskResponse(int _nowNPCid, int _nPCLamp, Dictionary<int, int> _dic = null);//NPCNPC鐏姸鎬侊紝鍙帴鍙栦换鍔★紙NPCID锛屼换鍔$伅鐘舵�侊級
- public static event OnTaskResponse Event_TaskResponse;
-
- public static event Action tryGetTaskAwardEvent;//杩欎釜鏄鎴风鍙灏濊瘯鍘婚濂栧氨浼氳Е鍙戯紝涓嶇鏈�鍚庣殑棰嗗缁撴灉銆�
-
- public static event Action<int> CardLevelChange;//鍏充簬浠诲姟鍗℃満鐘舵�佺殑杞彉
-
- public static event Action<int> SideQuestChangeEvent;//鏀嚎浠诲姟鐘舵�佹敼鍙�
-
- public static event Action<int> MainCardLevelChange;//涓荤嚎浠诲姟鍗$骇鐘舵�佹敼鍙�
-
- public static event Action<int> CompletionOfTaskEvent;//浠诲姟瀹屾垚鍥炶皟
-
- public event Action<int> talkNpcIdUpdate;
-
- public event Action<int> taskDescriptionRefresh;
-
- public static event Action TaskCoinTaskEvent;//璧忛噾浠诲姟淇℃伅瀛楀吀鍙樻洿
- public static event Action FairyTaskEvent;//浠欑洘浠诲姟淇℃伅瀛楀吀鍙樻洿
-
- public int NPCid = 0;//鑾峰彇NPCID锛堟墦寮�浠诲姟闈㈡澘鏃讹級銆�
-
- public bool BountyMotionBool = false;//鎺у埗璧忛噾浠诲姟鏄惁鑷姩绉诲姩
- public bool FairyAuBool = false;//鎺у埗浠欑洘浠诲姟鏄惁鑷姩绉诲姩
- public int currentMission { get; private set; }
- public int currentMissionState { get; private set; }
-
- public int GetNowTaskID { get; set; }//鑾峰彇褰撳墠閫変腑鏉$殑浠诲姟ID
-
- private bool isServerPrepare = false;//鎺у埗鏄惁鑷姩杩涜鑷姩浠诲姟
- private int retainTaskID = 0;
- private float BossDelayTimeint = 0;
- public Vector3 UIeffectFabaoVec = new Vector3();//娉曞疂NPC娑堝け鏃惰幏鍙栫殑鍧愭爣
- //----鍏充簬鍓嶆湡鏃犳搷浣滆嚜鍔ㄦ墽琛屼富绾�
- public int TaskAutoLv = 0;
- public int TaskAutoTime = 0;
-
- public bool TaskOverBool = false;
- private int Times = 0;
- private int NeedWaitTime = 4;
-
- public int clientGuardDugeonTask { get; private set; }
-
- List<int[]> priorityTaskChains = new List<int[]>();
-
- List<int> allowAutoTaskMapIds = new List<int>();
-
- private float mainTaskAutoWaitTime = 0f;
- public readonly TaskWait taskWait = new TaskWait();
-
- public List<int> npcImages = new List<int>();
- public List<int> playerJobImages = new List<int>();
-
- //璺宠浆鍒颁换鍔★紝0涓虹疆椤�
- public event Action OnJumpTask;
- private int m_JumpTaskID = 0;
- public int jumpTaskID {
- get { return m_JumpTaskID; }
- set {
- m_JumpTaskID = value;
- OnJumpTask?.Invoke();
- }
- }
-
+ //浠诲姟缁勶細浠诲姟淇℃伅锛涘彧鏈変换鍔″寘娌℃湁鍒犻櫎鍖咃紝鍙互璁や负涓�涓换鍔$粍鍙湁涓�涓换鍔�
+ //public Dictionary<int, TaskDetailDates> allMissionDict = new Dictionary<int, TaskDetailDates>();
+ //涓荤嚎浠诲姟锛屾殏涓斿彧澶勭悊涓荤嚎浠诲姟
+ public TaskDetailDates mainTask = new TaskDetailDates();
+ public event Action OnTaskUpdate;
+ public event Action OnTaskClick;
public override void Init()
{
- // StageLoad.Instance.onStageLoadFinish += onStageLoadFinish;
- // NPCInteractProcessor.s_NpcInteractEvent += NpcInterac;
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
- string BossDelayTime = FuncConfigConfig.Get("BossDelayTime").Numerical1;
- BossDelayTimeint = float.Parse(BossDelayTime);
- var Task_Auto = FuncConfigConfig.Get("TaskAuto");
- TaskAutoLv = int.Parse(Task_Auto.Numerical1);
- TaskAutoTime = int.Parse(Task_Auto.Numerical2);
- mainTaskAutoWaitTime = int.Parse(Task_Auto.Numerical3) / 1000f;
- var mapIds = ConfigParse.GetMultipleStr<int>(Task_Auto.Numerical4);
- if (mapIds != null && mapIds.Length > 0)
- {
- allowAutoTaskMapIds.AddRange(mapIds);
- }
-
- FairyAuTaskCount_Day = int.Parse(FuncConfigConfig.Get("RunTaskCnt").Numerical1.Split('|')[1].Split('_')[1]);
- FairyAuTaskCount_Round = int.Parse(FuncConfigConfig.Get("RunTaskCnt").Numerical2.Split('|')[1].Split('_')[1]);
-
- var cliengGuardConfig = FuncConfigConfig.Get("ClientGuardDungeon");
- clientGuardDugeonTask = int.Parse(cliengGuardConfig.Numerical5);
-
- var funcConfig = FuncConfigConfig.Get("AutoSelectTaskChain");
- var taskChainArray = LitJson.JsonMapper.ToObject<int[][]>(funcConfig.Numerical1);
- if (taskChainArray != null)
- {
- for (int i = 0; i < taskChainArray.Length; i++)
- {
- priorityTaskChains.Add(taskChainArray[i]);
- }
- }
- var config = FuncConfigConfig.Get("NPCTalk");
- npcImages = JsonMapper.ToObject<List<int>>(config.Numerical1);
- playerJobImages = JsonMapper.ToObject<List<int>>(config.Numerical2);
}
public override void Release()
{
- // StageLoad.Instance.onStageLoadFinish -= onStageLoadFinish;
- // NPCInteractProcessor.s_NpcInteractEvent -= NpcInterac;
+ DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent -= OnBeforePlayerDataInitialize;
}
public void OnBeforePlayerDataInitialize()
{
- allMissionDict.Clear();
- MainTaskDic.Clear();
- SideQuestsDic.Clear();
- BountyDic.Clear();
- FairyAuDic.Clear();
- SpecialTask.Clear();
- _DicTaskInformation.Clear();
- ReplaceDic.Clear();
- AwardRecordDic.Clear();
- NPCShowDic.Clear();
- m_ShowNpcCache.Clear();
- _conversation = null;
- _DefaultDialogContent = null;
- _TaskNow = 0;
- BountyRewardsNumber = 0;
- NPCid = 0;
- retainTaskID = 0;
- currentMission = 0;
- _globalbool = false;
- BountyMotionBool = false;
- FairyAuBool = false;
- isServerPrepare = false;
- }
-
- public void OnPlayerLoginOk()
- {
- GlobalTimeEvent.Instance.secondEvent -= secondEvent;
- GlobalTimeEvent.Instance.secondEvent += secondEvent;
- isServerPrepare = true;
- TaskOverBool = false;
- }
-
- // private void onStageLoadFinish()//鍦板浘鍒囨崲鏃惰皟鐢�
- // {
- // var inDungeon = IsDungeon();
- // if (!inDungeon && retainTaskID != 0)
- // {
- // if (ReplaceDic.ContainsKey(retainTaskID))
- // {
- // AutomaticTripToTask(retainTaskID);
- // //int missionState = SideQuestState(retainTaskID);
- // //TaskTerminationToHangUp(retainTaskID, missionState);
- // retainTaskID = 0;
- // }
- // }
- // }
- List<int> ListMissionID = new List<int>();
- public void RefreshMissionState(int MissionID, int MissionState, int DiscriptionIndex)//1.浠诲姟ID,2浠诲姟鐘舵�侊紝3锛屼换鍔℃弿杩癐ndex(鎺ユ敹浠诲姟)
- {
- // TODO YYL
- // try
- // {
- // if (isServerPrepare && MissionState != 3 && MissionID != 2000 && MissionID != 3000)
- // {
- // TaskupToDate = MissionID;
- // }
- // var pytaskM = PyTaskConfig.Get(MissionID);
- // if (pytaskM == null)
- // {
- // return;
- // }
- // if ((pytaskM.type == (int)TaskTypenum.MainlineTaskType || pytaskM.type == (int)TaskTypenum.MainlineTaskTyp2) && MissionState != 0 && MissionState != 3)
- // {
- // currentMission = MissionID;
- // currentMissionState = MissionState;
- // }
- // //浠欑洘浠诲姟瀹屾垚
- // if ((pytaskM.type == 12 || pytaskM.type == 14) && TaskAllocation.Instance.FairyAuAllNumber() >= FairyAuTaskCount_Day)
- // {
- // Event_FairyAuTask();
- // return;
- // }
-
-
- // if (allMissionDict.ContainsKey(MissionID))
- // {
- // int missionState = allMissionDict[MissionID].MissionState;
- // var lastDescriptionIndex = allMissionDict[MissionID].descIndex;
-
- // if (allMissionDict[MissionID].MissionState != MissionState && MissionState == 3 && isServerPrepare)
- // {
- // TaskOverBool = true;
- // taskWait.Push(TaskWaitType.TaskComplete);
- // if (CompletionOfTaskEvent != null)
- // {
- // CompletionOfTaskEvent(MissionID);
- // }
- // }
- // TaskChanges(MissionID, MissionState, DiscriptionIndex);//浠诲姟鐨勭姸鎬佷慨鏀�
-
- // if (missionState == 0 && (MissionState == 1 || MissionState == 2))
- // {
- // if (Event_TaskToAdd != null)//浠诲姟娣诲姞锛堢敤浜庡瓨鍌ㄤ簬韬笂鐨勬湭鎺ュ彇浠诲姟鐨勭壒娈婂鐞嗭級
- // {
- // Event_TaskToAdd(MissionID, MissionState, DiscriptionIndex);
- // }
- // }
- // else
- // {
- // if (Event_TaskRefreshes != null)//鍒锋柊浠诲姟
- // {
- // Event_TaskRefreshes(MissionID);
- // }
- // }
-
- // if (lastDescriptionIndex != DiscriptionIndex)
- // {
- // if (taskDescriptionRefresh != null)
- // {
- // taskDescriptionRefresh(MissionID);
- // }
- // }
-
- // }
- // else
- // {
- // AddMission(MissionID, MissionState, DiscriptionIndex);//浠诲姟鐨勬坊鍔�
- // if (taskDescriptionRefresh != null)
- // {
- // taskDescriptionRefresh(MissionID);
- // }
- // if (Event_TaskToAdd != null)
- // {
- // Event_TaskToAdd(MissionID, MissionState, DiscriptionIndex);
- // }
- // }
- // TaskClassification(MissionID, MissionState);//浠诲姟鍒嗙被
- // IsShowNpC(1);//鏄惁鏄剧ずNPC
- // IsShowNpC(MissionID);//鏄惁鏄剧ずNPC
- // if (isServerPrepare)
- // {
- // AutotaskingPrecedence(isServerPrepare, MissionID);//鏄惁鎵ц鑷姩浠诲姟
- // }
- // TaskTerminationToHangUp(MissionID, MissionState);//缁撴潫璧忛噾鍜屼粰鐩熶换鍔″墠寰�鎸傛満
- // if (Event_TaskResponse != null)//鍙戦�佷换鍔$伅淇℃伅
- // {
- // if (allMissionDict[MissionID].LightList.Equals(default(TsakLight)))
- // {
- // return;
- // }
- // for (int i = 0; i < allMissionDict[MissionID].LightList.Count; i++)
- // {
- // Event_TaskResponse(allMissionDict[MissionID].LightList[i].NpcId, allMissionDict[MissionID].LightList[i].StateLight);
- // }
-
- // }
- // }
- // catch (Exception ex)
- // {
- // Debug.Log(ex.StackTrace);
- // }
-
+ mainTask = new TaskDetailDates();
}
- // public ImpactRankModel.RankAwardItem GetRunTaskRward()//娣诲姞浠诲姟濂栧姳
- // {
- // var runTaskAward = FuncConfigConfig.Get("RunTaskAward");
- // ImpactRankModel.RankAwardItem _award = new ImpactRankModel.RankAwardItem();
- // var _jsonData = LitJson.JsonMapper.ToObject(runTaskAward.Numerical3);
- // var jsonData2 = LitJson.JsonMapper.ToObject(runTaskAward.Numerical4);
- // foreach (string key in _jsonData.Keys)
- // {
- // var _job = int.Parse(key);
- // var _itemArray = LitJson.JsonMapper.ToObject<int[][]>(_jsonData[key].ToJson());
- // for (int j = 0; j < _itemArray.Length; j++)
- // {
- // _award.Add(_job, new Item(_itemArray[j][0], _itemArray[j][1]));
- // }
- // }
- // foreach (string key in jsonData2.Keys)
- // {
- // var _job = int.Parse(key);
- // _award.Add(_job, new Item(2301, 0));
-
- // }
-
- // return _award;
- // }
-
- public int GetLatestMainTaskId()
+ public void UpdateTask(HB110_tagMCTaskInfo netPack)
{
- var taskId = 0;
- //涓荤嚎浠诲姟鐨勯『搴忕敱浠诲姟鍒楄〃鐨勯『搴忓喅瀹� TaskListConfig.GetMissionIndex
- //杩欓噷鏄痓ug锛屼絾鏄洜涓哄彧鏈変竴涓富绾夸换鍔★紝鎵�浠ユ殏鏃朵笉褰卞搷
- foreach (var id in MainTaskDic.Keys)
+ for (int i = 0; i < netPack.TaskList.Length; i++)
{
- if (id > taskId)
+ if (netPack.TaskList[i].TaskGroup == 0)
{
- taskId = id;
- }
- }
- return taskId;
- }
-
- public bool TryGetTaskData(int _taskId, out MissionDetailDates taskData)
- {
- return allMissionDict.TryGetValue(_taskId, out taskData);
- }
-
- void DefaultDialogue()//鍏充簬鎵撳紑榛樿瀵硅瘽鐣岄潰
- {
- // if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing)
- // {
- // return;
- // }
- // bool IsOpenMain = UIManager.Instance.IsOpened<MainWin>();
- // if (!UIManager.Instance.IsOpened<DefaultDialogueBoxWin>() && IsOpenMain)
- // {
- // UIManager.Instance.OpenWindow<DefaultDialogueBoxWin>();
- // UIManager.Instance.CloseWindow<MainInterfaceWin>();
- // }
- // else
- // {
- // if (talkNpcIdUpdate != null)
- // {
- // talkNpcIdUpdate(NPCid);
- // }
- // }
- }
- private void OnEventTalkEvent(int taskID)//NPC瀵硅瘽鍚庣殑寮规
- {
- //if (UIManager.Instance.ExitAnyFullScreenOrMaskWin())
- //{
- // return;
- //}
- //bug: 鍔熻兘寮�鍚紩瀵兼椂锛屾湭鏀跺埌鏈嶅姟绔殑灏佸寘蹇�熷璇濅細瀵艰嚧鍔熻兘寮�鍚紩瀵艰鎵撴柇锛屽鏋滃彧鏄垽鏂璱nGuiding鍙堝鑷存棤娉曠户缁换鍔�
- //瑙e喅鏂规锛�1. 瀵硅瘽鏃跺垽鏂湁寮曞涓斿繀椤荤晫闈㈠湪鎵撳紑鐘舵�侊紱2. 鍔熻兘寮曞椋炲叆鐨勬椂鍊欏鏋滀腑鏂垯鍙栨秷寮曞
-
- // -------------------------TODO YYL-----------------------------------
- // if ((NewBieCenter.Instance.inGuiding && UIManager.Instance.IsOpened<NewBieWin>()) || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing
- // || UIManager.Instance.IsOpened<TreasureChapterWin>())
- // {
- // return;
- // }
-
- // bool IsOpenMain = UIManager.Instance.IsOpened<MainInterfaceWin>();
-
- // var state = 0;
- // if (TryGetCustomTaskState(taskID, out state))
- // {
- // var config = StoryMissionsConfig.GetConfig(taskID, state);
- // if (config != null && NPCid == config.NpcID)
- // {
- // if (!UIManager.Instance.IsOpened<DialogueDuidanceWin>() && IsOpenMain
- // && !UIManager.Instance.ExistAnyFullScreenOrMaskWin())
- // {
- // UIManager.Instance.CloseWindow<MainInterfaceWin>();
- // DialogueDuidanceWin.storyMissionId = config.id;
- // DialogueDuidanceWin.taskId = taskID;
- // UIManager.Instance.OpenWindow<DialogueDuidanceWin>();
- // }
- // return;
- // }
- // }
- // if (!UIManager.Instance.IsOpened<TaskBoxBGMWin>() && IsOpenMain)
- // {
- // UIManager.Instance.CloseWindow<MainInterfaceWin>();
- // UIManager.Instance.OpenWindow<TaskBoxBGMWin>();
- // return;
- // }
- // if (BountyDic.ContainsKey(_TaskNow) || FairyAuDic.ContainsKey(_TaskNow))
- // {
- // if (!ModelCenter.Instance.GetModel<TeamModel>().teamPrepare.isPreparing)
- // {
- // RequestGetTaskAward("OK", _TaskNow);
- // }
- // }
- }
-
-
- private void BountySelfMotion()
- {
- int blank = PackManager.Instance.GetEmptyGridCount(PackType.Item);
- if (blank < 1)//"璇峰厛娓呯悊鑳屽寘鍐嶉鍙栧鍔�
- {
- return;
- }
-
- }
-
- public bool TryGetCustomTaskState(int taskId, out int state)
- {
- state = 0;
- if (ReplaceDic.ContainsKey(taskId))
- {
- var keyValue = ReplaceDic[taskId];
- if (keyValue.ContainsKey("state"))
- {
- state = keyValue["state"];
- return true;
- }
- }
- return false;
- }
-
- void AddMission(int MissionID, int MissionState, int DiscriptionIndex)//娣诲姞浠诲姟
- {
- // TODO YYL
-
- // var config = PyTaskConfig.Get(MissionID);
- // if (config == null)
- // {
- // Debug.LogError(MissionID + "琛ㄦ牸涓笉瀛樺湪姝や换鍔D");
- // return;
- // }
-
- // if (allMissionDict == null)
- // allMissionDict = new Dictionary<int, MissionDetailDates>();
- // MissionDetailDates vDetailData = new MissionDetailDates();
- // vDetailData.Time = DateTime.Now;
- // vDetailData.ID = int.Parse(config.id);
- // vDetailData.Name = config.name;
- // vDetailData.Type = config.type;
- // vDetailData.NPC_ID = config.npcId;
- // vDetailData.LV = config.lv;
- // vDetailData.ColorLV = config.colorLV;
-
- // vDetailData.RewardList = RewardInformation(config.rewardList, DiscriptionIndex);//濂栧姳淇℃伅
- // if (ReplaceDic.ContainsKey(MissionID))
- // {
- // Dictionary<string, int> _dic = ReplaceDic[MissionID];
- // if (_dic.ContainsKey("visit_npc_id") || _dic.ContainsKey("kill_npc_id"))
- // {
- // vDetailData.LightList = CharactersReplace(config.lightList, DiscriptionIndex, int.Parse(config.id));
- // }
- // else
- // {
- // vDetailData.LightList = StrSegmentation(config.lightList, DiscriptionIndex);//浠诲姟淇℃伅鐏�
- // }
- // if (MissionState == 3)
- // {
- // for (int i = 0; i < vDetailData.LightList.Count; i++)
- // {
- // TsakLight TsakLight = new TsakLight();
- // TsakLight.NpcId = vDetailData.LightList[i].NpcId;
- // TsakLight.StateLight = -1;
- // vDetailData.LightList[i] = TsakLight;
- // }
- // }
- // }
- // else
- // {
- // vDetailData.LightList = StrSegmentation(config.lightList, DiscriptionIndex);//浠诲姟淇℃伅鐏�
- // if (MissionState == 3)
- // {
- // for (int i = 0; i < vDetailData.LightList.Count; i++)
- // {
- // TsakLight TsakLight = new TsakLight();
- // TsakLight.NpcId = vDetailData.LightList[i].NpcId;
- // TsakLight.StateLight = -1;
- // vDetailData.LightList[i] = TsakLight;
- // }
- // }
- // }
- // vDetailData.Desclist = TaskDetails(config.descList, DiscriptionIndex);//浠诲姟璇︽儏
- // vDetailData.InforList = StrInforList(config.infoList, DiscriptionIndex);//浠诲姟瀹屾垚鏉′欢
-
-
- // vDetailData.MissionState = MissionState;
- // vDetailData.descIndex = DiscriptionIndex;
-
- // var canSwitchSelectTask = true;
- // if (GetNowTaskID != 0 && !IsMainTaskType(vDetailData.Type))
- // {
- // MissionDetailDates taskData;
- // if (TryGetTaskData(GetNowTaskID, out taskData)
- // && IsMainTaskType(taskData.Type)
- // && taskData.MissionState != 3)
- // {
- // canSwitchSelectTask = false;
- // }
- // }
-
- // if (isServerPrepare && PriorityTaskChainContains(MissionID))
- // {
- // canSwitchSelectTask = true;
- // }
-
- // if (canSwitchSelectTask)
- // {
- // GetNowTaskID = MissionID;
- // }
-
- // allMissionDict.Add(MissionID, vDetailData);//娣诲姞浠诲姟
- }
-
- public bool PriorityTaskChainContains(int taskId)
- {
- for (int i = 0; i < priorityTaskChains.Count; i++)
- {
- if (taskId >= priorityTaskChains[i][0]
- && taskId <= priorityTaskChains[i][1])
- {
- return true;
- }
- }
- return false;
- }
-
- public bool IsMainTaskType(int type)
- {
- return type == (int)TaskTypenum.MainlineTaskType || type == (int)TaskTypenum.MainlineTaskTyp2;
- }
-
- public enum TaskTypenum//浠诲姟绫诲瀷鍒嗙被
- {
- MainlineTaskType = 0,//涓荤嚎
- MainlineTaskTyp2 = 1,
- SideQuestsType2 = 2,//鏀嚎
- SideQuestsType3 = 3,//鏀嚎浠诲姟锛堟湰婧愭硶瀹濇敮绾匡級
- SideQuestsType4 = 4,
- SideQuestsType5 = 5,
- BountyMissionsType6 = 6,//璧忛噾浠诲姟
- BountyMissionsType7 = 7,
- BountyMissionsType8 = 8,
- FairyAuMissionType11 = 11,//浠欑洘浠诲姟
- FairyAuMissionType12 = 12,
- SpecialTaskType13 = 13,//鐗规畩浠诲姟绫诲瀷(鐢ㄤ簬璧忛噾)
- SpecialTaskType14 = 14,//鐗规畩浠诲姟绫诲瀷(鐢ㄤ簬浠欑洘)
- AchievementTask = 15,//鎴愬氨浠诲姟锛堟殏鏈紑鍑轰笓灞炲瓧鍏革級
- SpecialTaskType16 = 16,//鐗规畩浠诲姟绫诲瀷(鐢ㄤ簬娉曞疂)
- SideQuestsType17 = 17,//鏀嚎17-21鏂板
- SideQuestsType18 = 18,
- SideQuestsType19 = 19,
- SideQuestsType20 = 20,//(鍚庣鐗规畩澶勭悊锛屾殏瀹氫笉璁╀娇鐢�)
- SideQuestsType21 = 21,
- //鍚庣画IL寮�鍙戞坊鍔犻璁�
- default1,
- default2,
- default3,
- default4,
- default5,
- default6,
- default7,
- default8,
- default9,
- default10,
- }
-
- void TaskClassification(int _taskID, int MissionState)//浠诲姟鍒嗙被(涓荤嚎浠诲姟,鏀嚎浠诲姟)
- {
- if (!allMissionDict.ContainsKey(_taskID))
- {
- return;
- }
- TaskTypenum type = (TaskTypenum)allMissionDict[_taskID].Type;
- switch (type)
- {
- case TaskTypenum.MainlineTaskType:
- case TaskTypenum.MainlineTaskTyp2:
- {
- if (_taskID != 1)//涓荤嚎浠诲姟锛堟坊鍔犱笌鏇存柊锛�
- {
- if (MainTaskDic.ContainsKey(_taskID))
- {
- MainTaskDic[_taskID] = allMissionDict[_taskID];
- }
- else
- {
- MainTaskDic.Add(_taskID, allMissionDict[_taskID]);
- }
- if (Event_MainlineTask != null)
- {
- Event_MainlineTask(_taskID, MissionState);
- }
- }
-
- }
+ mainTask.TaskGroup = netPack.TaskList[i].TaskGroup;
+ mainTask.TaskID = (int)netPack.TaskList[i].TaskID;
+ mainTask.CurValue = (int)netPack.TaskList[i].CurValue;
+ mainTask.State = netPack.TaskList[i].State;
break;
- case TaskTypenum.SideQuestsType2:
- case TaskTypenum.SideQuestsType3:
- case TaskTypenum.SideQuestsType4:
- case TaskTypenum.SideQuestsType5:
- case TaskTypenum.SideQuestsType17:
- case TaskTypenum.SideQuestsType18:
- case TaskTypenum.SideQuestsType19:
- case TaskTypenum.SideQuestsType20:
- case TaskTypenum.SideQuestsType21:
- {
- if (SideQuestsDic.ContainsKey(_taskID))
- {
- SideQuestsDic[_taskID] = allMissionDict[_taskID];
- }
- else
- {
- SideQuestsDic.Add(_taskID, allMissionDict[_taskID]);
- }
- if (SideQuestChangeEvent != null)
- {
- SideQuestChangeEvent(_taskID);
- }
- }
- break;
- case TaskTypenum.BountyMissionsType6:
- case TaskTypenum.BountyMissionsType7:
- case TaskTypenum.BountyMissionsType8:
- {
-
- if (BountyDic.ContainsKey(_taskID))
- BountyDic[_taskID] = allMissionDict[_taskID];
- else
- BountyDic.Add(_taskID, allMissionDict[_taskID]);
- if (Event_nBounty != null)
- Event_nBounty();
- }
-
- break;
- case TaskTypenum.FairyAuMissionType11:
- case TaskTypenum.FairyAuMissionType12:
- {
- if (FairyAuDic.ContainsKey(_taskID))
- FairyAuDic[_taskID] = allMissionDict[_taskID];
- else
- FairyAuDic.Add(_taskID, allMissionDict[_taskID]);
- if (Event_FairyAuTask != null && MissionState != 3)
- Event_FairyAuTask();
- }
- break;
- case TaskTypenum.SpecialTaskType13:
- case TaskTypenum.SpecialTaskType14:
- case TaskTypenum.SpecialTaskType16:
-
- {
- if (SpecialTask.ContainsKey(_taskID))
- SpecialTask[_taskID] = allMissionDict[_taskID];
- else
- SpecialTask.Add(_taskID, allMissionDict[_taskID]);
- }
- break;
- default:
- break;
- }
-
-
- }
-
- void TaskTypeDeletion(int _taskID)//浠诲姟绫诲瀷鐨勫垹闄�
- {
-
- if (MainTaskDic.ContainsKey(_taskID))//涓荤嚎
- {
- MainTaskDic.Remove(_taskID);
- }
- else if (SideQuestsDic.ContainsKey(_taskID))//鏀嚎
- {
- SideQuestsDic.Remove(_taskID);
- }
- else if (BountyDic.ContainsKey(_taskID))//璧忛噾
- {
- BountyDic.Remove(_taskID);
- if (Event_nBounty != null)
- Event_nBounty();
-
- }
- else if (SpecialTask.ContainsKey(_taskID))//鐗规畩浠诲姟
- {
- SpecialTask.Remove(_taskID);
- }
- else if (FairyAuDic.ContainsKey(_taskID))
- {
- FairyAuDic.Remove(_taskID);
- if (Event_FairyAuTask != null)
- Event_FairyAuTask();
- }
-
-
- }
- string TaskDetails(string _string, int _index)////Json瑙f瀽
- {
- JsonData _Json = JsonMapper.ToObject(_string);
- if (_Json.Count == 1)
- {
- string _TaskDetails = _Json["0"].ToString().Replace("\"", "");
- return _TaskDetails;
- }
- else
- {
- string _TaskDetails = _Json[_index.ToString()].ToString().Replace("\"", "");
- return _TaskDetails;
- }
-
- }
-
-
- List<TsakLight> CharactersReplace(string _string, int _index, int Id)
- {
-
- JsonData _Json = JsonMapper.ToObject(_string);
- List<TsakLight> TsakLightList = new List<TsakLight>();
- TsakLightList.Clear();
- TsakLight taskLight = new TsakLight();
- foreach (var key in _Json.Keys)
- {
- if (int.Parse(key) == _index)
- {
- JsonData _Json1 = _Json[key];
- if (_Json1.Count != 0)
- {
- foreach (var _key in _Json1.Keys)
- {
- string Str = _key.ToString();
- Match match = Regex.Match(Str, pattern);
- if (ReplaceDic.ContainsKey(Id))
- {
- Dictionary<string, int> _dic = ReplaceDic[Id];
- if (_dic.ContainsKey(match.Groups[1].Value))
- {
- taskLight.NpcId = _dic[match.Groups[1].Value];
- taskLight.StateLight = int.Parse(_Json1[_key].ToString());
- TsakLightList.Add(taskLight);
- }
- }
- }
- }
- return TsakLightList;
-
}
}
- return TsakLightList;
- }
-
- string StrInforList(string _string, int _index)
- {
- JsonData _Json = JsonMapper.ToObject(_string);
- foreach (var key in _Json.Keys)
- {
- if (int.Parse(key) == _index)
- {
- JsonData _Json1 = _Json[key];
- if (_Json1.Count != 0)
- {
- foreach (var _key in _Json1.Keys)
- {
- return _Json1[_key].ToString();
- }
- }
- }
- }
-
- return string.Empty;
- }
-
- List<TsakLight> StrSegmentation(string _string, int _index)
- {
- int val;
- JsonData _Json = JsonMapper.ToObject(_string);
- List<TsakLight> TsakLightList = new List<TsakLight>();
- TsakLightList.Clear();
-
- foreach (var key in _Json.Keys)
- {
- if (int.Parse(key) == _index)
- {
- JsonData _Json1 = _Json[key];
- if (_Json1.Count != 0)
- {
- foreach (var _key in _Json1.Keys)
- {
- if (int.TryParse(_key, out val))
- {
- TsakLight taskLight = new TsakLight();
- taskLight.NpcId = int.Parse(_key);
- taskLight.StateLight = int.Parse(_Json1[_key].ToString());
- TsakLightList.Add(taskLight);
- }
- }
- }
- return TsakLightList;
- }
- }
-
- return TsakLightList;
- }
-
- string RewardInformation(string _string, int _index)//濂栧姳淇℃伅
- {
-
- string _occupation = ("J" + PlayerDatas.Instance.baseData.Job).ToString();
- JsonData _Json = JsonMapper.ToObject(_string);
- foreach (var key in _Json.Keys)
- {
- if (int.Parse(key) == _index)
- {
- JsonData _Json1 = _Json[key];
- if (_Json1.Count != 0)
- {
- foreach (var _key in _Json1.Keys)
- {
- if (_key == _occupation)
- return _Json1[_key].ToString();
- else if (_key == "-")
- return _Json1[_key].ToString();
- }
- }
- else
- {
- return null;
- }
- }
- }
- return null;
- }
-
-
- void TaskChanges(int MissionID, int MissionState, int DiscriptionIndex)//瀛樺湪鐨勪换鍔$殑淇敼
- {
- // TODO YYL
- // var pytaskM = PyTaskConfig.Get(MissionID);
- // if (pytaskM == null)
- // return;
- // allMissionDict[MissionID].Time = DateTime.Now;
- // allMissionDict[MissionID].MissionState = MissionState;
- // allMissionDict[MissionID].descIndex = DiscriptionIndex;
- // allMissionDict[MissionID].RewardList = RewardInformation(pytaskM.rewardList, DiscriptionIndex);//濂栧姳淇℃伅
- // allMissionDict[MissionID].Desclist = TaskDetails(pytaskM.descList, DiscriptionIndex);//浠诲姟璇︽儏
- // allMissionDict[MissionID].InforList = StrInforList(pytaskM.infoList, DiscriptionIndex);//浠诲姟瀹屾垚鏉′欢
-
-
- // if (MissionState == 3)
- // {
- // if (allMissionDict[MissionID].LightList.Equals(default(TsakLight)))
- // {
- // return;
- // }
- // for (int i = 0; i < allMissionDict[MissionID].LightList.Count; i++)
- // {
- // TsakLight TsakLight = new TsakLight();
- // TsakLight.NpcId = allMissionDict[MissionID].LightList[i].NpcId;
- // TsakLight.StateLight = -1;
- // allMissionDict[MissionID].LightList[i] = TsakLight;
- // }
- // return;
- // }
- // else
- // {
- // if (ReplaceDic.ContainsKey(MissionID))
- // {
- // Dictionary<string, int> _dic = ReplaceDic[MissionID];
- // if (_dic.ContainsKey("visit_npc_id") || _dic.ContainsKey("kill_npc_id"))
- // {
- // allMissionDict[MissionID].LightList = CharactersReplace(pytaskM.lightList, DiscriptionIndex, allMissionDict[MissionID].ID);
- // }
- // else
- // {
- // allMissionDict[MissionID].LightList = StrSegmentation(pytaskM.lightList, DiscriptionIndex);//浠诲姟淇℃伅鐏�
- // }
- // }
- // else
- // {
- // allMissionDict[MissionID].LightList = StrSegmentation(pytaskM.lightList, DiscriptionIndex);//浠诲姟淇℃伅鐏�
- // }
- // }
- }
-
- public void Task0820(H0820_tagMissionDict info)//0820淇℃伅瀛楀吀
- {
- // TODO YYL
- // Dictionary<string, int> dic = null;
- // ReplaceDic.TryGetValue((int)info.MissionID, out dic);
- // if (dic == null)
- // {
- // dic = new Dictionary<string, int>();
- // StorageNPCDic(info.MissionID, info.DictKey, (int)info.DictValue);
- // dic.Add(info.DictKey, (int)info.DictValue);
- // ReplaceDic.Add((int)info.MissionID, dic);
- // }
- // else
- // {
- // if (dic.ContainsKey(info.DictKey))
- // {
- // StorageNPCDic(info.MissionID, info.DictKey, (int)info.DictValue);
- // dic[info.DictKey] = (int)info.DictValue;
- // if (info.DictKey == "around_allcount")
- // {
- // if (TaskCoinTaskEvent != null)
- // {
- // TaskCoinTaskEvent();
- // }
- // }
- // if (info.DictKey == "around_count_family")
- // {
- // if (FairyTaskEvent != null)
- // {
- // FairyTaskEvent();
- // }
- // }
- // }
- // else
- // {
- // StorageNPCDic(info.MissionID, info.DictKey, (int)info.DictValue);
- // dic.Add(info.DictKey, (int)info.DictValue);
- // }
- // }
+ OnTaskUpdate?.Invoke();
}
- public void RequestGetTaskAward(string _answer, int taskId = 0)
+ public void ClickTask()
{
- // TODO YYL
- // if (taskId == clientGuardDugeonTask)
- // {
- // ClientGuardDungeon.RequestEnter();
- // return;
- // }
- // var sendInfo = new C0802_tagCNPCAnswer();
- // sendInfo.Answer = _answer;
- // sendInfo.AnswerLen = (byte)_answer.Length;
- // GameNetSystem.Instance.SendInfo(sendInfo);
-
- // if (tryGetTaskAwardEvent != null)
- // {
- // tryGetTaskAwardEvent();
- // }
+ OnTaskClick?.Invoke();
}
- public void TaskRefreshes(int _MissionId, int _DictKeyLen, string _DictKey, int _DictValue)//浠诲姟鏁版嵁鐨勫埛鏂帮紙浠诲姟瀛楀吀淇℃伅锛�
+ // 浠诲姟鐘舵�� 1-杩涜涓� 2-鍙鍙�
+ public int GetMainTaskState()
{
-
- if (!_DicTaskInformation.ContainsKey(_MissionId))
- {
- Dictionary<string, string> _dic = new Dictionary<string, string>();
- if (_dic.ContainsKey(_DictKey))
- {
- _dic[_DictKey] = _DictValue.ToString();
- }
- else
- {
- _dic.Add(_DictKey, _DictValue.ToString());
- }
- _DicTaskInformation.Add(_MissionId, _dic);
- string kaji = "kaji";
- if (_DicTaskInformation.ContainsKey(_MissionId) && _DicTaskInformation[_MissionId].ContainsKey(kaji))
- {
- if (MainTaskDic.ContainsKey(_MissionId) && MainCardLevelChange != null && _DictValue == 0)
- {
-
- if (IsGetOnBool)
- {
- GetNowTaskID = _MissionId;
- }
- MainCardLevelChange(_MissionId);
-
- }
- }
- }
- else
- {
- if (_DicTaskInformation[_MissionId].ContainsKey(_DictKey))
- {
- _DicTaskInformation[_MissionId][_DictKey] = _DictValue.ToString();
- if (_DictKey == "kaji" && (_DictValue == 0 || _DictValue == 1))//kaji:0涓轰富绾垮崱绾у彉鏇达紝kaji:1涓洪瓟鏃忓崱绾у彉鏇�
- {
- if (CardLevelChange != null)
- {
- CardLevelChange(_MissionId);
- }
- if (MainTaskDic.ContainsKey(_MissionId))
- {
- if (IsGetOnBool)
- {
- GetNowTaskID = _MissionId;
- }
- if (MainCardLevelChange != null)
- {
- MainCardLevelChange(_MissionId);
- }
- }
- }
- }
- else
- {
- _DicTaskInformation[_MissionId].Add(_DictKey, _DictValue.ToString());
- }
- }
-
-
- if (Event_TaskInformation != null)
- Event_TaskInformation(_MissionId, _DicTaskInformation);
- }
- public void DelMission(int _taskID)//鐪熷疄浠诲姟鍒犻櫎
- {
- if (allMissionDict.ContainsKey(_taskID))
- {
- allMissionDict.Remove(_taskID);
- if (_DicTaskInformation.ContainsKey(_taskID))
- {
- _DicTaskInformation.Remove(_taskID);
- }
- }
- TaskTypeDeletion(_taskID);
- if (Event_TaskToDelete != null)
- {
- Event_TaskToDelete(_taskID);
- }
- }
- bool _bool = false;
- string _conversationA = null;
- public void EventTalk(H0801_tagEventTalk info)//璁块棶浠诲姟鏄惁鍙彁浜�
- {
- NPCid = (int)info.NPCID;
- if (info.Msg == null || info.Msg[0].MsgLen == 0)
- {
- _conversation = _conversationA;
- }
- else
- {
- if (_conversationA != info.Msg[0].Msg)
- {
- _conversation = info.Msg[0].Msg;
- _conversationA = _conversation;
- }
- }
-
- if (_bool)
- {
- if ((int)info.MissionID != 0)
- {
- _TaskNow = (int)info.MissionID;
- OnEventTalkEvent((int)info.MissionID);
- _bool = false;
- return;
- }
- }
-
- for (int i = 0; i < info.Answer.Length; i++)
- {
- string[] str = info.Answer[i].Msg.Split('_');
- int var;
- if (str.Length > 1)
- {
- for (int j = 0; j < info.Answer.Length; j++)
- {
- string[] stX = info.Answer[j].Msg.Split('_');
- if (stX.Length > 1)
- {
- string strXX = stX[stX.Length - 1];
- if (int.TryParse(strXX, out var))
- {
- if (int.Parse(strXX) == GetNowTaskID)
- {
- RequestGetTaskAward(strXX);
- _bool = true;
- return;
- }
- }
- }
- }
- string str1 = str[str.Length - 1];
- RequestGetTaskAward(str1);
- _bool = true;
- return;
- }
- else
- {
- _bool = false;
- if ((int)info.NPCID != 32504001)
- {
- DefaultDialogue();
- }
- return;
- }
- }
+ return mainTask.State;
}
- public string pattern = @"\{(.+)\}";
-
- public int StatusLightQuery(int _NpcID)//鐘舵�佺伅鏌ヨ
+ //杩橀渶瀹屾垚澶氬皯涓换鍔�
+ public int GetNeedFinishTaskCount(int taskID)
{
- int Light = -1;
- foreach (int key in allMissionDict.Keys)
- {
- if (allMissionDict[key].LightList.Equals(default(TsakLight)))
- {
- continue;
- }
- for (int i = 0; i < allMissionDict[key].LightList.Count; i++)
- {
- if (_NpcID == allMissionDict[key].LightList[i].NpcId)
- {
- if (allMissionDict[key].LightList[i].StateLight > Light)
- {
- Light = allMissionDict[key].LightList[i].StateLight;
- }
- }
- }
- }
-
- return Light;
+ var taskConfig = TaskConfig.Get(taskID);
+ return taskConfig.Index - TaskConfig.Get(mainTask.TaskID).Index + 1;
}
- public void DailyFairyTaskMove()//鏃ュ父浠欑洘浠诲姟
+ public int GetMainTaskType()
{
- // TODO YYL
- // if (SpecialTask.Count != 0)
- // {
- // foreach (int key in SpecialTask.Keys)
- // {
- // if (SpecialTask[key].Type == 14 && SpecialTask[key].MissionState != 3)//鏈帴浠诲姟
- // {
- // PlayerDatas.Instance.hero.Behaviour.StopHandupAI();
- // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(key));
- // return;
- // }
- // }
- // }
- // if (FairyAuDic.Count != 0)
- // {
- // foreach (int key in FairyAuDic.Keys)
- // {
- // if (FairyAuDic[key].MissionState != 0 && FairyAuDic[key].MissionState != 3)
- // {
- // PlayerDatas.Instance.hero.Behaviour.StopHandupAI();
- // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(key));
- // return;
- // }
- // }
- // }
- }
- public void DailyBountyMove()//鏃ュ父璧忛噾浠诲姟
- {
- // if (SpecialTask.Count != 0)
- // {
- // foreach (int key in SpecialTask.Keys)
- // {
- // if (SpecialTask[key].Type == 13 && SpecialTask[key].MissionState != 3)//鏈帴浠诲姟
- // {
- // PlayerDatas.Instance.hero.Behaviour.StopHandupAI();
- // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(key));
- // return;
- // }
- // }
- // }
- // if (BountyDic.Count != 0)
- // {
- // foreach (int key in BountyDic.Keys)
- // {
- // if (BountyDic[key].MissionState != 0 && BountyDic[key].MissionState != 3)
- // {
- // PlayerDatas.Instance.hero.Behaviour.StopHandupAI();
- // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(key));
- // return;
- // }
- // }
- // }
- }
-
-
- private void AutotaskingPrecedence(bool automaticityBool, int missionID)//鍏充簬鏄惁鎵ц鑷姩浠诲姟鍜岃嚜鍔ㄤ换鍔$殑浼樺厛绾�
- {
- if (automaticityBool)
- {
- var inDungeon = IsDungeon();
-
- if (inDungeon)//鍒ゆ柇鏄惁鍐嶅壇鏈腑瀵逛换鍔D杩涜鍌ㄥ瓨
- {
- retainTaskID = Autotasking(missionID);
- }
- else
- {
- retainTaskID = 0;
- if (Autotasking(missionID) != 0)
- {
- AutomaticTripToTask(Autotasking(missionID));
- }
- }
- }
- }
-
- private int Autotasking(int taskID)
- {
- foreach (var value in MainTaskDic.Values)
- {
- if (value.MissionState != 0 && value.MissionState != 3)
- {
- if (allMissionDict.ContainsKey(taskID) && (allMissionDict[taskID].Time - value.Time).TotalSeconds <= 1)
- {
- if (ReplaceDic.ContainsKey(value.ID))
- {
- Dictionary<string, int> _dic = ReplaceDic[value.ID];
- if (_dic.ContainsKey("continue") && _dic["continue"] == 1)
- {
- return value.ID;
- }
- }
- }
- }
- }
- if (ReplaceDic.ContainsKey(taskID))
- {
- Dictionary<string, int> _dic = ReplaceDic[taskID];
- if (_dic.ContainsKey("continue") && _dic["continue"] == 1)
- {
- return taskID;
- }
- }
- return 0;
- }
-
-
- public void AutomaticTripToTask(int _taskID)//浠诲姟鑷姩鍓嶅線锛堜换鍔℃坊鍔狅級
- {
- // TODO YYL
- // try
- // {
- // if (!allowAutoTaskMapIds.Contains(PlayerDatas.Instance.baseData.MapID))
- // {
- // return;
- // }
-
- // var _hero = PlayerDatas.Instance.hero;
- // if (_hero != null)
- // {
- // if (MapArea.IsInMapArea(_hero.CurMapArea, MapArea.E_Type.Boss))
- // {
- // return;
- // }
- // }
-
- // if (MainTaskDic.ContainsKey(_taskID))//涓荤嚎浠诲姟
- // {
- // if (MainTaskDic[_taskID].MissionState == 0 || MainTaskDic[_taskID].MissionState == 3)
- // return;
- // if (MainTaskDic.ContainsKey(_taskID))
- // {
- // PlayerDatas.Instance.hero.Behaviour.StopHandupAI();
- // if (PlayerDatas.Instance.baseData.LV != 1)
- // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(_taskID));
- // return;
- // }
- // }
- // if (BountyDic.ContainsKey(_taskID))//璧忛噾浠诲姟
- // {
- // if (BountyDic[_taskID].MissionState == 3 || BountyMotionBool)
- // {
- // return;
- // }
- // else
- // {
- // if (BountyDic.ContainsKey(_taskID))
- // {
- // PlayerDatas.Instance.hero.Behaviour.StopHandupAI();
- // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(_taskID));
- // return;
- // }
- // }
- // }
- // else if (FairyAuDic.ContainsKey(_taskID))//浠欑洘浠诲姟
- // {
- // if (FairyAuDic[_taskID].MissionState == 3 || FairyAuBool)
- // {
- // return;
- // }
- // if (FairyAuDic.ContainsKey(_taskID))
- // {
- // PlayerDatas.Instance.hero.Behaviour.StopHandupAI();
- // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(_taskID));
- // return;
- // }
- // }
- // else if (SideQuestsDic.ContainsKey(_taskID))
- // {
- // if (SideQuestsDic[_taskID].MissionState == 0 || SideQuestsDic[_taskID].MissionState == 3)
- // {
- // return;
- // }
- // else
- // {
- // PlayerDatas.Instance.hero.Behaviour.StopHandupAI();
- // SnxxzGame.Instance.StartCoroutine(WaitForSkillFinished(_taskID));
- // return;
- // }
- // }
- // }
- // catch (Exception ex)
- // {
- // Debug.Log(ex);
- // }
- }
-
- public void RunTaskAwarInfo(HA708_tagMCRunTaskAwardInfo info)//閫氱煡璺戠幆濂栧姳璁板綍
- {
- for (int i = 0; i < info.Cnt; i++)
- {
- if (!AwardRecordDic.ContainsKey(info.InfoList[i].Type))
- {
- RunTaskAwardRecord _RunTaskAwardRecord = new RunTaskAwardRecord();
- _RunTaskAwardRecord.Num = (int)info.InfoList[i].Num;
- _RunTaskAwardRecord.AwardState = info.InfoList[i].AwardState;
- AwardRecordDic.Add(info.InfoList[i].Type, _RunTaskAwardRecord);
- }
- else
- {
- AwardRecordDic[info.InfoList[i].Type].Num = (int)info.InfoList[i].Num;
- AwardRecordDic[info.InfoList[i].Type].AwardState = info.InfoList[i].AwardState;
- }
- if (info.InfoList[i].Type == (int)TaskTypenum.BountyMissionsType7)
- {
- BountyRewardsNumber = (int)info.InfoList[i].Num;
- if (Event_BountyRewards != null)
- Event_BountyRewards((int)info.InfoList[i].Num, info.InfoList[i].AwardState);
- }
- else if (info.InfoList[i].Type == (int)TaskTypenum.FairyAuMissionType12)
- {
- OnFairyAuNumber = (int)info.InfoList[i].Num;
- if (Event_FairyAuReward != null)
- Event_FairyAuReward((int)info.InfoList[i].Num, info.InfoList[i].AwardState);
- }
- }
- }
-
- // private IEnumerator WaitForSkillFinished(int _taskID)
- // {
- // GA_Hero _hero = PlayerDatas.Instance.hero;
-
- // if (_hero == null)
- // {
- // yield break;
- // }
- // while (_hero != null && _hero.SkillMgr.CurCastSkill != null &&
- // _hero.SkillMgr.CurCastSkill.SkillCompelete == false)
- // {
- // yield return null;
- // }
-
- // yield return WaitingForSecondConst.WaitMS500;
-
- // // 濡傛灉鏈夊畧鎶�, 鍒欎笉鎷惧彇
- // var equipIndex = EquipSet.ClientPlaceToServerPlace(new Int2(0, (int)RoleEquipType.Guard));
- // var _itemModel = PackManager.Instance.GetItemByIndex(PackType.Equip, equipIndex);
- // if (_itemModel == null || !GeneralDefine.GuardianPickUpID.Contains(_itemModel.itemId))
- // {
- // float _chkDistanceSqrt;
- // DropItemManager.DropObject _obj = null;
- // while (DropItemManager.HandupTryGetHeroItem(out _obj))
- // {
- // if (DropItemManager.StopMissionPickup)
- // {
- // break;
- // }
- // if (MapTransferUtility.Instance.MapTransferDoType != MapTransferUtility.E_MapTransferDoType.None)
- // {
- // break;
- // }
- // Vector3 _targetPosition = _obj.dropItem.transform.position;
- // _chkDistanceSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, _targetPosition);
- // if (_chkDistanceSqrt > 0.5f)
- // {
- // if (_hero.State != E_ActorState.AutoRun)
- // {
- // _hero.MoveToPosition(_targetPosition);
- // }
- // }
-
- // yield return null;
- // }
- // }
-
- // if (AdventureStage.Instance.IsInAdventureStage)
- // {
- // yield break;
- // }
-
- // if (NewBieCenter.Instance.inGuiding || ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing
- // || UIManager.Instance.IsOpened<TreasureChapterWin>())
- // {
- // yield break;
- // }
-
- // if (UIManager.Instance.IsOpened<TreasureBaseWin>())
- // {
- // yield break;
- // }
-
- // if (UIManager.Instance.IsOpened<MysteriousMissionWin>())
- // {
- // yield break;
- // }
-
- // if (BossShowModel.Instance.BossShowing)
- // {
- // yield break;
- // }
-
- // if (BountyDic.ContainsKey(_taskID) || FairyAuDic.ContainsKey(_taskID))
- // {
- // yield return WaitingForSecondConst.WaitMS800;//缂撳啿涓�绉掑啀杩涜
- // }
-
- // if (MainTaskDic.ContainsKey(_taskID))//涓荤嚎绛夊緟琛ㄧ幇
- // {
- // if (taskWait.wait)
- // {
- // yield return WaitingForSecondConst.GetWaitForSeconds(mainTaskAutoWaitTime);
- // }
- // }
-
- // while(ClientSceneManager.Instance.isWaitPickup)
- // {
- // yield return null;
- // }
-
- // if (GA_Hero.s_MapSwitching)
- // {
- // yield break;
- // }
- // try
- // {
- // TaskMove(_taskID);
- // }
- // catch (Exception ex)
- // {
- // Debug.Log(ex);
- // }
-
- // }
-
-
- public enum TaskStatus//浠诲姟鐘舵��
- {
- None = -5,//娌℃湁
- Normal = 0,//姝e父浠诲姟锛堢豢锛�
- TreasureCardLevel = 1,//娉曞疂鍗$骇锛堢孩锛�
- CardLevel = 2,//绛夌骇鍗$骇锛堢孩锛�
- Completed = 3,//绔嬪嵆瀹屾垚浠诲姟
- }
- public TaskStatus GetTaskStatus(int taskID)
- {
- if (_DicTaskInformation.ContainsKey(taskID) && _DicTaskInformation[taskID].ContainsKey("kaji"))
- {
- var kaji = _DicTaskInformation[taskID]["kaji"];
-
- switch (int.Parse(kaji))
- {
- case 0:
- return TaskStatus.Normal;
- case 1:
- return TaskStatus.TreasureCardLevel;
- case 2:
- return TaskStatus.CardLevel;
- case 3:
- return TaskStatus.Completed;
- default:
- return TaskStatus.None;
- }
- }
- else
- {
- return TaskStatus.None;
- }
-
- }
- private bool IsDungeon()//鍒ゆ柇鏄惁鍦ㄥ壇鏈腑
- {
- return false;
- // if (ClientDungeonStageUtility.isClientDungeon)
- // return true;
- // var mapId = PlayerDatas.Instance.baseData.MapID;
- // var mapConfig = MapConfig.Get(mapId);
- // return mapConfig != null && mapConfig.MapFBType != 0;
- }
- public bool IsGather(int npdId)//鏄惁鑳介噰闆哊PC
- {
- // TODO YYL
- // var taskListConfig = TaskListConfig.Get(currentMission);
- // if (taskListConfig != null)
- // {
- // int[] collectNPCList = taskListConfig.CollectNPC;
- // var isTaskNPC = false;
- // for (int i = 0; i < collectNPCList.Length; i++)
- // {
- // if (collectNPCList[i] == npdId)
- // {
- // isTaskNPC = true;
- // break;
- // }
- // }
- // if (isTaskNPC)
- // {
- // if ((collectNPCList.Length == 1 && collectNPCList[0] == 0) || GetTaskStatus(currentMission) != 0)
- // {
- // return false;
-
- // }
- // }
-
- // }
- return true;
- }
-
- public static bool IsOPenAutoResolve()//浠诲姟闈㈡澘涓嶅紑鍚嚜鍔ㄦ寕鏈虹姸鎬�
- {
- bool _bool = true;
- // TODO YYL
- // if (UIManager.Instance.IsOpened<TaskBoxBGMWin>())
- // {
- // _bool = false;
- // }
- // else if (UIManager.Instance.IsOpened<DefaultDialogueBoxWin>())
- // {
- // _bool = false;
- // }
- // else if (UIManager.Instance.IsOpened<DialogueDuidanceWin>())
- // {
- // _bool = false;
- // }
- return _bool;
- }
-
- private int BOUNTYTASK = 2009;//璧忛噾浠诲姟
- private int FAIRYAUTASK = 3009;//浠欑洘浠诲姟
- private void TaskTerminationToHangUp(int taskID, int MissionState)//(瀹屾垚浠诲姟鍚庡墠寰�鎸傛満鍦扮偣)浠诲姟ID锛屼换鍔$姸鎬�
- {
- // TODO YYL
- // if (!isServerPrepare)
- // {
- // return;
- // }
- // if ((taskID == BOUNTYTASK && MissionState == 1 && !BountyMotionBool && TaskAllocation.Instance.ForRingAllNumber() != 10)
- // || (taskID == FAIRYAUTASK && MissionState == 1 && !FairyAuBool && TaskAllocation.Instance.FairyAuAllNumber() == 70))
- // {
- // var mapModel = ModelCenter.Instance.GetModel<MapModel>();
- // var point = mapModel.GetRecommendHangPoint();
- // var config = MapEventPointConfig.Get(point);
- // MapTransferUtility.Instance.MoveToNPC(config.NPCID);
-
- // }
- }
- public void CompletionOfTask(int TaskID)//浠诲姟瀹屾垚
- {
- CA206_tagCMQuickFinishMission _CA206 = new CA206_tagCMQuickFinishMission();
- _CA206.MissionID = (uint)TaskID;
- _CA206.DoType = 0;
- GameNetSystem.Instance.SendInfo(_CA206);
- }
-
- public int SideQuestState(int TaskID)//鍏充簬鏌ヨ浠诲姟鐨勭姸鎬侊紙-1娌℃湁姝や换鍔★紝0鏈帴,1姝e湪杩涜涓紝2鍙彁浜わ級
- {
- if (allMissionDict.ContainsKey(TaskID))
- {
- return allMissionDict[TaskID].MissionState;
- }
- else
- {
- return -1;
- }
- }
-
- public int GetQuestState(int _taskId)
- {
- if (allMissionDict.ContainsKey(_taskId))
- {
- return allMissionDict[_taskId].MissionState;
- }
- else
- {
- return -1;
- }
- }
- //--------涓昏鐢ㄤ簬璁板綍浠诲姟鍒楄〃閫変腑鏉$殑鏅鸿兘鎬� 锛�-_-||锛�
- public int TaskupToDate = 0;//鑾峰彇鏈�鏂颁换鍔D
- public int GetOnTaskId = 0;
- public bool IsGetOnBool = false;
- private int NeedTime = 10;
- private DateTime dateTimeA;
- public void GetTaskGetOnNow(int TaskID, string DictKey)//璁板綍涓嬩俊鎭瓧鍏哥殑ID
- {
- string key1Str = "on_kill_" + TaskID;
- string key2Str = "get_byid_" + TaskID;
- if (TaskID > 1 && (key1Str == DictKey || key2Str == DictKey))
- {
- GetOnTaskId = TaskID;
- dateTimeA = DateTime.Now;
- }
-
- }
- private void secondEvent()
- {
- TimeSpan timeS = DateTime.Now - dateTimeA;
- int timeSend = timeS.Seconds;
- if (timeSend >= NeedTime)
- {
- IsGetOnBool = true;
- GetOnTaskId = GetNowTaskID;//鑾峰彇褰撳墠閫変腑鐨処D
- }
- else
- {
- IsGetOnBool = false;
- }
-
- if (TaskOverBool)
- {
- Times += 1;
- if (Times >= NeedTime)
- {
- TaskOverBool = false;
- }
- }
- else
- {
- if (Times != 0)
- {
- Times = 0;
- }
- }
- }
-
-
- public bool IsTaskMove()
- {
- bool IsBool = false;
- if (!UIManager.Instance.IsOpened<MainWin>())
- {
- return IsBool;
- }
- if (PlayerDatas.Instance.baseData.LV > TaskAutoLv)
- {
- return IsBool;
- }
- if (GetTaskStatus(currentMission) == TaskStatus.Normal)
- {
- IsBool = true;
- }
- return IsBool;
- }
- public void TaskMove(int _taskID)
- {
- // TODO YYL
- // if (allMissionDict.ContainsKey(_taskID) && !NewBieCenter.Instance.inGuiding)
- // {
- // string _strTest = allMissionDict[_taskID].InforList;
- // string strTask = TaskAllocation.Instance.GetTaskInfo(TASKINFOConfig.Get(_strTest).show_writing, _taskID);
- // HrefAnalysis.Inst.ExcuteHrefEvent(strTask, 0, true);
- // DropItemManager.StopMissionPickup = false;
- // TaskAllocation.Instance.TaskTime = TimeUtility.ServerNow;
- // }
- }
-
- public class TaskWait
- {
- public bool wait
- {
- get
- {
- foreach (var key in taskWaits.Keys)
- {
- if ((Time.realtimeSinceStartup - taskWaits[key]) < 1f)
- {
-#if UNITY_EDITOR
- Debug.LogFormat("<color=#00ffff>鐢变簬{0}寮�濮嬩换鍔$瓑寰�</color>", GetTaskWaitTypeLabel(key));
-#endif
- return true;
- }
- }
- return false;
- }
- }
-
- Dictionary<TaskWaitType, float> taskWaits = new Dictionary<TaskWaitType, float>();
-
- public void Push(TaskWaitType type)
- {
- taskWaits[type] = Time.realtimeSinceStartup;
- }
-
-#if UNITY_EDITOR
- static string GetTaskWaitTypeLabel(TaskWaitType waitType)
- {
- switch (waitType)
- {
- case TaskWaitType.TaskComplete:
- return "涓荤晫闈换鍔″畬鎴愯〃鐜�";
- case TaskWaitType.LevelUp:
- return "鐜╁鍗囩骇琛ㄧ幇";
- case TaskWaitType.TreasureProgress:
- return "娉曞疂杩涘害鏇存柊";
- case TaskWaitType.BetterEquip:
- return "鑾峰緱鏇村ソ瑁呭";
- default:
- return waitType.ToString();
- }
- }
-#endif
- }
-
- public enum TaskWaitType
- {
- TaskComplete,
- LevelUp,
- TreasureProgress,
- BetterEquip,
+ if (mainTask.TaskID == 0)
+ return 0;
+ var taskConfig = TaskConfig.Get(mainTask.TaskID);
+ return taskConfig.TaskType;
}
}
--
Gitblit v1.8.0