private void OnClickGameEndBtn(GameObject obj) { UIToggle btn = obj.transform.GetComponent <UIToggle>(); int taskid = (int)btn.Data; if (taskid <= 0) { return; } GUIGuoChang.Show(); Globals.Instance.MGUIManager.CreateWindow <GUITaskTalkView>(delegate(GUITaskTalkView gui){ NGUITools.SetActive(this.gameObject, false); TaskConfig tk = Globals.Instance.MDataTableManager.GetConfig <TaskConfig>(); TaskConfig.TaskObject element = null; bool hasData = tk.GetTaskObject(taskid, out element); if (!hasData) { return; } gui.PlayLocalTalk(element.Task_Talk_ID, delegate() { gui.DestroyThisGUI(); NGUITools.SetActive(this.gameObject, true); }); GUIGuoChang.SetTweenPlay(0, delegate() { }); }); }
private void TaskAcceptDeal(int taskid) { TaskConfig.TaskObject element = null; TaskConfig task = Globals.Instance.MDataTableManager.GetConfig <TaskConfig>(); bool hasData = task.GetTaskObject(taskid, out element); if (!hasData) { return; } GUIGuoChang.Show(); if (element.Progress_Count <= 0) { GUIRadarScan.Show(); if (element.Is_End == 1) { if (element.Is_Perfect_End == 1) { NetSender.Instance.RequestTaskCompleteReq(taskid); } else { GUITaskTalkView taskview = Globals.Instance.MGUIManager.GetGUIWindow <GUITaskTalkView>(); if (taskview != null) { taskview.DestroyThisGUI(); } Globals.Instance.MGUIManager.CreateWindow <GUIGameOutcome>(delegate(GUIGameOutcome guiGameOutcome) { guiGameOutcome.EnterGameOutcome(taskid); GUIGuoChang.SetTweenPlay(0, delegate() {}); }); } } else { NetSender.Instance.RequestTaskCompleteReq(taskid); } } else { GUITaskTalkView taskview = Globals.Instance.MGUIManager.GetGUIWindow <GUITaskTalkView>(); if (taskview != null) { taskview.DestroyThisGUI(); } Globals.Instance.MGUIManager.CreateWindow <GUIPhotoGraph>(delegate(GUIPhotoGraph gui) { GUIGuoChang.SetTweenPlay(0, delegate() { // EliminationMgr.Instance.GameFieldAnimationEndStartGame (); }); GUIMain guimain = Globals.Instance.MGUIManager.GetGUIWindow <GUIMain>(); if (guimain != null) { guimain.SetVisible(false); } gui.DrawReadyView(); }); } }
public void ShowAgainChallengeInformation(sg.GS2C_Challenge_Again_Info_Res res) { NGUITools.SetActive(MemoryInformation, false); NGUITools.SetActive(ChallengeInformation, true); FreeNum.text = res.againNum.ToString(); int playerTotalScore = 0; HelpUtil.DelListInfo(ChallengeUIGrid.transform); foreach (sg.GS2C_Challenge_Again_Info_Res.TaskCompleteInfo info in res.taskCompleteInfo) { GameObject item = GameObject.Instantiate(ChallengeTaskItem) as GameObject; item.transform.parent = ChallengeUIGrid.transform; item.transform.localScale = Vector3.one; item.transform.localPosition = Vector3.zero; item.name = "ChallengeTaskItem" + info.taskId; UISprite gradeSprite = item.transform.Find("GradeSprite").GetComponent <UISprite>(); UILabel taskName = item.transform.Find("TaskName").GetComponent <UILabel>(); UILabel totalScore = item.transform.Find("TotalScore").GetComponent <UILabel>(); UIButton challengeBtn = item.transform.Find("ChallengeBtn").GetComponent <UIButton>(); GameObject star = item.transform.Find("Star").gameObject; string[] str = { "PurpSprite", "YelloSprite" }; string[] strbg = { "PurpBgSprite", "YelloBgSprite" }; for (int i = 1; i <= FinalEvaluation(info.grade); i++) { UISprite bg = star.transform.Find(strbg[i - 1]).GetComponent <UISprite>(); UISprite sprite = star.transform.Find(str[i - 1]).GetComponent <UISprite>(); NGUITools.SetActive(bg.gameObject, false); NGUITools.SetActive(sprite.gameObject, true); } playerTotalScore += info.totalScore; gradeSprite.spriteName = HangyeDengji[FinalEvaluation(info.grade)]; totalScore.text = info.totalScore.ToString(); TaskConfig.TaskObject element = null; bool ishas = taskConfig.GetTaskObject(info.taskId, out element); if (!ishas) { return; } taskName.text = element.Name; challengeBtn.Data = info.taskId; UIEventListener.Get(challengeBtn.gameObject).onClick += OnClickChallengeBtn; } ChallengeUIGrid.sorting = UIGrid.Sorting.Custom; ChallengeUIGrid.repositionNow = true; ChallengeUIGrid.Reposition(); CheckpointLabel.text = res.taskCompleteInfo.Count.ToString(); ScoreLabel.text = playerTotalScore.ToString(); }
//================ 任务流程 ------------------------ // public void TravelTaskIDRes(int taskid) { // this.SetVisible(false); GUIGuoChang.Show(); GUIGameOutcome guiGameOutcome = Globals.Instance.MGUIManager.GetGUIWindow <GUIGameOutcome>(); if (guiGameOutcome != null) { guiGameOutcome.IsReturnMainScene = false; guiGameOutcome.Close(); } GUITravel guiTravel = Globals.Instance.MGUIManager.GetGUIWindow <GUITravel>(); if (guiTravel != null) { guiTravel.IsReturnMainScene = false; guiTravel.Close(); } GUIPhotoGraph guiPhotoGraph = Globals.Instance.MGUIManager.GetGUIWindow <GUIPhotoGraph>(); if (guiPhotoGraph != null) { guiPhotoGraph.IsReturnMainScene = false; guiPhotoGraph.Close(); } GUIMemory guiMemory = Globals.Instance.MGUIManager.GetGUIWindow <GUIMemory>(); if (guiMemory != null) { NGUITools.SetActive(guiMemory.gameObject, false); } Globals.Instance.MGUIManager.CreateWindow <GUITaskTalkView>(delegate(GUITaskTalkView gui){ TaskConfig tk = Globals.Instance.MDataTableManager.GetConfig <TaskConfig>(); TaskConfig.TaskObject element = null; bool hasData = tk.GetTaskObject(taskid, out element); if (!hasData) { return; } gui.PlayLocalTalk(element.Task_Talk_ID, delegate() { TaskAcceptDeal(taskid); }); }); }
public void LoadPropInfo(int taskId) { TaskConfig.TaskObject element = null; bool hasData = taskConfig.GetTaskObject(taskId, out element); if (!hasData) { return; } PlayerData playerData = Globals.Instance.MGameDataManager.MActorData; Dictionary <int, ItemSlotData> clothDic = playerData.ClothDatas; if (element.Progress_Count > 0) { List <int> themeLst = StrParser.ParseDecIntList(element.Theme_Effect, 0); List <int> limitLst = StrParser.ParseDecIntList(element.Material_Effect, 0); //可使用的衣服类型 foreach (KeyValuePair <int, PropItem> v in MPropItemDic) { if (limitLst.Contains(v.Key)) { if (clothDic.ContainsKey(v.Key)) { ItemSlotData slotData = clothDic [v.Key]; if (slotData.MItemData != null && themeLst.Contains(slotData.MItemData.BasicData.ItemConfigElement.Item_Style)) { MPropItemDic [v.Key].InitUse(slotData); } else { MPropItemDic [v.Key].InitNoLock(slotData); } } else { MPropItemDic [v.Key].InitNoUse(); } } else { MPropItemDic [v.Key].NoOpenProp(); } } } }
public void ShowMemoInformation() { HelpUtil.DelListInfo(DateUIGrid.transform); Dictionary <int, int> lineDayDic = new Dictionary <int, int>(); List <int> lineDayList = new List <int>(); foreach (KeyValuePair <int, int> mPair in Globals.Instance.MTaskManager._mFinishedList) { int taskid = mPair.Key; TaskConfig.TaskObject taskObject = null; bool ishas = task.GetTaskObject(taskid, out taskObject); if (!ishas) { return; } int lineDayTime = mPair.Value + taskObject.Memo_Time_Start; lineDayDic.Add(mPair.Key, lineDayTime); lineDayList.Add(lineDayTime); } for (int i = 0; i < lineDayList.Count - 1; i++) { for (int j = 0; j < lineDayList.Count - i - 1; j++) { if (lineDayList[j] < lineDayList[j + 1]) { int t = lineDayList[j + 1]; lineDayList[j + 1] = lineDayList[j]; lineDayList[j] = t; } } } List <int> lineDayDesc = new List <int>(); for (int i = 0; i < lineDayList.Count; i++) { foreach (KeyValuePair <int, int> mPair in lineDayDic) { if (mPair.Value == lineDayList[i] && !lineDayDesc.Contains(mPair.Key)) { lineDayDesc.Add((mPair.Key)); } } } for (int i = 0; i < lineDayDesc.Count; i++) { int taskid = lineDayDesc[i]; int completeLineDay = Globals.Instance.MTaskManager._mFinishedList[taskid]; GameObject memoItem = GameObject.Instantiate(MemoItem) as GameObject; memoItem.transform.parent = DateUIGrid.transform; memoItem.transform.localScale = Vector3.one; memoItem.transform.localPosition = Vector3.zero; memoItem.name = "MemoItem" + getNumOrString(i); UILabel memoLabel = memoItem.transform.Find("MemoLabel").GetComponent <UILabel>(); if (i == 0) { UISprite newSprite = memoItem.transform.Find("NewSprite").GetComponent <UISprite>(); NGUITools.SetActive(newSprite.gameObject, true); } TaskConfig.TaskObject taskObject = null; bool ishas = task.GetTaskObject(taskid, out taskObject); if (!ishas) { return; } string lineDayStart = mStartTime.AddDays(completeLineDay + taskObject.Memo_Time_Start).ToString("yyyy-MM-dd"); string lineDayEnd = mStartTime.AddDays(completeLineDay + taskObject.Memo_Time_End).ToString("yyyy-MM-dd"); if (taskObject.Memo_Time_Start != taskObject.Memo_Time_End) { memoLabel.text = string.Format(Globals.Instance.MDataTableManager.GetWordText(6005), lineDayStart, lineDayEnd) + taskObject.Memo_Desc; } else { memoLabel.text = string.Format(Globals.Instance.MDataTableManager.GetWordText(6004), lineDayStart) + taskObject.Memo_Desc; } } DateUIGrid.sorting = UIGrid.Sorting.Custom; DateUIGrid.repositionNow = true; }
public void UpdateMainTask() { if (mPlayerDate.MainTaskIDList.Count > 0) { AllFunctionBtn.transform.localScale = Vector3.zero; GotoBtn.transform.localScale = Vector3.one; if (mPlayerDate.MainTaskIDList.Count > 1) { if (!(mPlayerDate.MainTaskIDList[0].taskState == (int)TaskManager.TaskState.PASS) && !(mPlayerDate.MainTaskIDList[0].taskState == (int)TaskManager.TaskState.UNPASS)) { GUIGuoChang.Show(); // NetSender.Instance.RequestTaskAcceptReq(mPlayerDate.MainTaskIDList[0].taskId,0); Globals.Instance.MTaskManager.StartNextTask(mPlayerDate.MainTaskIDList[0].taskId); } else { ShowTaskSettlement(mPlayerDate.MainTaskIDList[0]); } } else { if (!(mPlayerDate.MainTaskIDList[0].taskState == (int)TaskManager.TaskState.PASS) && !(mPlayerDate.MainTaskIDList[0].taskState == (int)TaskManager.TaskState.UNPASS)) { if (NowCheckGuideTask(mPlayerDate.MainTaskIDList[0].taskId)) { return; } if (mPlayerDate.MainTaskIDList[0].taskId != mMainTaskID) { mMainTaskID = mPlayerDate.MainTaskIDList[0].taskId; TaskConfig.TaskObject taskObject = null; bool ishas = taskConfig.GetTaskObject(mMainTaskID, out taskObject); if (!ishas) { return; } if (taskObject.Is_Delay == 0 || mPlayerDate.MainTaskIDList[0].passCount > 0) { GUIGuoChang.Show(); // NetSender.Instance.RequestTaskAcceptReq(mPlayerDate.MainTaskIDList[0].taskId,0); Globals.Instance.MTaskManager.StartNextTask(mPlayerDate.MainTaskIDList[0].taskId); return; } MainTaskLabel.text = taskObject.Task_Desc; } } else { ShowTaskSettlement(mPlayerDate.MainTaskIDList[0]); } } } else { AllFunctionBtn.transform.localScale = Vector3.one; GotoBtn.transform.localScale = Vector3.zero; MainTaskLabel.text = ""; if (UpdateTimeLine) { GUIRadarScan.Show(); NetSender.Instance.C2GSTaskPlaceReq((int)TaskManager.TaskCategory.CHANGEDATE, -1); } } UpdateTimeLine = false; }
public void ShowSuccessReward(sg.GS2C_Task_Complete_Res res) { this.gameObject.SetActive(true); foreach (sg.GS2C_Task_Complete_Res.TaskReward reward in res.rewards) { if (reward.rewardType == (int)TaskRewardTypeEnum.GET_ARTTST) { RewardObj.SetActive(false); FansRewardObj.SetActive(true); WarshipConfig config = Globals.Instance.MDataTableManager.GetConfig <WarshipConfig>(); WarshipConfig.WarshipObject warshipElement = null; config.GetWarshipElement(reward.itemId, out warshipElement); if (warshipElement == null) { return; } FansName.text = warshipElement.Name; FansIcon.mainTexture = Resources.Load("Icon/FansIcon/" + warshipElement.Fans_Icon, typeof(Texture2D)) as Texture2D; return; } } RewardObj.SetActive(true); FansRewardObj.SetActive(false); mCurrentfinishLv = res.finishLv; TaskID = res.taskId; CompleteBtn.Data = res.nextTaskId; TaskConfig task = Globals.Instance.MDataTableManager.GetConfig <TaskConfig>(); bool hasData = task.GetTaskObject(res.taskId, out element); if (!hasData) { return; } ScoreSlider.value = (EliminationMgr.Score * 1f) / EliminationMgr.Instance.star3; float baseX = 630f / EliminationMgr.Instance.star3; float baseX2 = 630f / 2f; float star1X = baseX * EliminationMgr.Instance.star1 - baseX2; Star1Obj.transform.localPosition = new Vector3(star1X, Star1Obj.transform.localPosition.y, Star1Obj.transform.localPosition.z); float star2X = baseX * EliminationMgr.Instance.star2 - baseX2; Star2Obj.transform.localPosition = new Vector3(star2X, Star2Obj.transform.localPosition.y, Star2Obj.transform.localPosition.z); float star3X = baseX * EliminationMgr.Instance.star3 - baseX2; Star3Obj.transform.localPosition = new Vector3(star3X, Star3Obj.transform.localPosition.y, Star3Obj.transform.localPosition.z); if (EliminationMgr.Score >= EliminationMgr.Instance.star1) { Star1Anim.SetActive(true); } if (EliminationMgr.Score >= EliminationMgr.Instance.star2) { Star2Anim.SetActive(true); } if (EliminationMgr.Score >= EliminationMgr.Instance.star3) { Star3Anim.SetActive(true); } CurrentScore.text = EliminationMgr.Score.ToString(); List <string[]> RewardArray = ParsingRewards(element.Rewards); if (RewardArray.Count > 0) { for (int i = 0; i < RewardArray.Count; i++) { switch (StrParser.ParseDecInt(RewardArray[i][0], -1)) { case (int)TaskRewardTypeEnum.ROLE_ATTR: switch (StrParser.ParseDecInt(RewardArray[i][1], -1)) { case (int)BaseRewardType.MONEY: MoneyBaseReward = StrParser.ParseDecInt(RewardArray[i][2], -1); break; case (int)BaseRewardType.DIAMOND: DiamondBaseReward = StrParser.ParseDecInt(RewardArray[i][2], -1); break; } break; case (int)TaskRewardTypeEnum.FANS_NUM: FansBaseReward = StrParser.ParseDecInt(RewardArray[i][2], -1); break; } } } NGUITools.SetActive(RewardItem1.gameObject, false); NGUITools.SetActive(RewardItem2.gameObject, false); int RewardItemState = 0; foreach (sg.GS2C_Task_Complete_Res.TaskReward reward in res.rewards) { switch (reward.rewardType) { case (int)TaskRewardTypeEnum.ITEM: ItemConfig item = Globals.Instance.MDataTableManager.GetConfig <ItemConfig>(); ItemConfig.ItemElement ItemEle = null; bool hasDataItem = item.GetItemElement(reward.itemId, out ItemEle); if (!hasDataItem) { return; } if (RewardItemState == 0) { RewardItemState = 1; NGUITools.SetActive(RewardItem1.gameObject, true); RewardItem1.mainTexture = Resources.Load("Icon/ItemIcon/" + ItemEle.Icon, typeof(Texture2D)) as Texture2D; if (reward.num > 1) { RewardItem1Name.text = Globals.Instance.MDataTableManager.GetWordText(reward.itemId) + "X" + reward.num; } else { RewardItem1Name.text = Globals.Instance.MDataTableManager.GetWordText(reward.itemId); } addItemOne = RewardItem1; addItemNameLabelOne = RewardItem1Name; addMoneyList.Add(1, reward.clothAddMoney); Debug.Log(" 1 -- reward.clothAddMoney = " + reward.clothAddMoney); } else { NGUITools.SetActive(RewardItem2.gameObject, true); RewardItem2.mainTexture = Resources.Load("Icon/ItemIcon/" + ItemEle.Icon, typeof(Texture2D)) as Texture2D; if (reward.num > 1) { RewardItem2Name.text = Globals.Instance.MDataTableManager.GetWordText(reward.itemId) + "X" + reward.num; } else { RewardItem2Name.text = Globals.Instance.MDataTableManager.GetWordText(reward.itemId); } addItemTwo = RewardItem2; addItemNameLabelTwo = RewardItem2Name; addMoneyList.Add(2, reward.clothAddMoney); Debug.Log(" 2 -- reward.clothAddMoney = " + reward.clothAddMoney); } break; case (int)TaskRewardTypeEnum.POSTURE: break; case (int)TaskRewardTypeEnum.ROLE_ATTR: switch (reward.itemId) { case (int)BaseRewardType.MONEY: MoneyAppraisalReward = reward.num - MoneyBaseReward; if (MoneyAppraisalReward > 0) { RewardMoneyNum.text = "[000000]" + MoneyBaseReward + "[-]" + "[00A542]" + " + " + MoneyAppraisalReward.ToString() + "[-]"; } else { RewardMoneyNum.text = "[000000]" + MoneyBaseReward + "[-]"; } break; case (int)BaseRewardType.DIAMOND: DiamondAppraisalReward = reward.num - DiamondBaseReward; if (DiamondAppraisalReward > 0) { RewardDiamondNum.text = "[000000]" + DiamondBaseReward + "[-]" + "[00A542]" + " + " + DiamondAppraisalReward.ToString() + "[-]"; } else { RewardDiamondNum.text = "[000000]" + DiamondBaseReward + "[-]"; } break; case (int)BaseRewardType.ACTING: break; case (int)BaseRewardType.CHARM: break; } break; case (int)TaskRewardTypeEnum.FANS_NUM: FansAppraisalReward = reward.num - FansBaseReward; if (FansAppraisalReward > 0) { RewardFansNum.text = "[000000]" + FansBaseReward.ToString() + "[-]" + "[00A542]" + " + " + FansAppraisalReward.ToString() + "[-]"; } else { RewardFansNum.text = "[000000]" + FansBaseReward.ToString() + "[-]"; } break; case (int)TaskRewardTypeEnum.UNKNOWNTYPE: break; } } addMoney(); }