Exemplo n.º 1
0
        private void OnCompleteBtnClick()
        {
            if (!sTaskOver)
            {
                return;
            }

            sTaskOver = false;
            InputBlockerManager.Instance.Block(InputBlockReason.FUSION_BLOCK_UI_INTERACTION, 0.5f);
            LTWelfareModel.Instance.RequestComplete(Data.TaskId.ToString(), delegate(bool success) {
                if (success)
                {
                    if (LTWelfareEvent.WelfareGrowUpUpdata != null)
                    {
                        LTWelfareEvent.WelfareGrowUpUpdata();
                    }

                    {
                        var ht = Johny.HashtablePool.Claim();
                        ht.Add("0", TitleLabel.text);
                        MessageTemplateManager.ShowMessage(901036, ht, null);
                        Johny.HashtablePool.Release(ht);
                    }

                    System.Action callback = delegate()
                    {
                        if (EB.Sparx.Hub.Instance.LevelRewardsManager.IsLevelUp)
                        {
                            LTMainHudManager.Instance.CheckLevelUp(delegate() {
                                sTaskOver = true;
                            });
                        }
                        else
                        {
                            sTaskOver = true;
                        }
                    };
                    List <LTShowItemData> ItemDatas = TaskStaticData.GetItemRewardList(Data.TaskId);
                    for (int i = 0; i < ItemDatas.Count; i++)
                    {
                        if (ItemDatas[i].id == "hc")
                        {
                            FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.hc, ItemDatas[i].count, "福利成长目标");
                        }
                        if (ItemDatas[i].id == "gold")
                        {
                            FusionTelemetry.CurrencyChangeData.PostEvent(FusionTelemetry.CurrencyChangeData.gold, ItemDatas[i].count, "福利成长目标");
                        }
                    }

                    {
                        var ht = Johny.HashtablePool.Claim();
                        ht.Add("reward", ItemDatas);
                        ht.Add("callback", callback);
                        GlobalMenuManager.Instance.Open("LTShowRewardView", ht);
                    }
                }
                sTaskOver = true;
            });
        }
Exemplo n.º 2
0
 public void OnCompleteTask(EB.Sparx.Response result)
 {
     InputBlockerManager.Instance.UnBlock(InputBlockReason.FUSION_BLOCK_UI_INTERACTION);
     if (result.sucessful)
     {
         if (result.hashtable != null)
         {
             DataLookupsCache.Instance.CacheData(result.hashtable);
         }
         List <LTShowItemData> mlist = TaskStaticData.GetItemRewardList(taskId);
         FusionTelemetry.ItemsUmengCurrency(mlist, "任务获得");
         Hotfix_LT.Data.TaskTemplate taskTpl = Hotfix_LT.Data.TaskTemplateManager.Instance.GetTask(taskId);
         FusionTelemetry.TaskData.PostEvent(taskId, taskTpl.task_name, taskTpl.task_type.ToString());
         if (mlist.Count > 0)
         {
             var ht = Johny.HashtablePool.Claim();
             ht.Add("reward", mlist);
             GlobalMenuManager.Instance.Open("LTShowRewardView", ht);
         }
     }
     else
     {
         result.CheckAndShowModal();
     }
 }
Exemplo n.º 3
0
 public InviteTaskItemData(int taskid, int tasktype, Data.TaskTemplate tasktpl)
 {
     this.taskid   = taskid;
     this.tasktype = tasktype;
     this.taskdes  = tasktpl.target_tips;
     rewarddata    = TaskStaticData.GetItemRewardList(taskid);
 }
Exemplo n.º 4
0
        private void InitItem()
        {
            Hotfix_LT.Data.TaskTemplate tpl  = Hotfix_LT.Data.TaskTemplateManager.Instance.GetTask(mTaskId);
            List <LTShowItemData>       list = TaskStaticData.GetItemRewardList(mTaskId);

            if (list.Count > 0)
            {
                Item.LTItemData = list[0];
                Item.mDMono.gameObject.CustomSetActive(true);
                BtnBox.gameObject.CustomSetActive(true);
            }
        }
Exemplo n.º 5
0
 public override void OnFetchData(EB.Sparx.Response res, int reqInstanceID)
 {
     if (res.sucessful)
     {
         InitState();
         Hotfix_LT.Data.TaskTemplate tpl  = Hotfix_LT.Data.TaskTemplateManager.Instance.GetTask(mTaskId);
         List <LTShowItemData>       list = TaskStaticData.GetItemRewardList(mTaskId);
         for (int i = 0; i < list.Count; i++)
         {
             LTIconNameQuality icon_name_lvl = LTItemInfoTool.GetInfo(list[i].id, list[i].type);
             MessageTemplateManager.ShowMessage(eMessageUIType.FloatingText, string.Format(EB.Localizer.GetString("ID_codefont_in_LTChallengeInstanceHudController_20066"), icon_name_lvl.name, list[i].count));
         }
         Hotfix_LT.Messenger.Raise(EventName.LTChallengeInstaceRewardGet, mLevel);
     }
     else if (res.fatal)
     {
         SparxHub.Instance.FatalError(res.localizedError);
     }
 }
Exemplo n.º 6
0
        public void InitData(LTWelfareGrowUpTaskData data)
        {
            Data = data;
            if (data == null)
            {
                mDMono.gameObject.CustomSetActive(false);
                return;
            }
            Hotfix_LT.Data.TaskTemplate TaskTpl = data.TaskTpl;
            TitleLabel.text = data.TaskTpl.target_tips;
            TitleLabel.transform.GetComponent <UISprite>("LevelSprite").UpdateAnchors();
            List <LTShowItemData> rewardDatas = TaskStaticData.GetItemRewardList(Data.TaskId);

            for (int i = 0; i < ItemList.Count; i++)
            {
                if (Data.hasBattlePass && i == ItemList.Count - 1)
                {
                    List <LTShowItemData> battlePassList = Hotfix_LT.Data.TaskTemplateManager.Instance.GetBattlePassByTaskId(Data.TaskId);
                    var item = battlePassList[0];
                    ItemList[i].LTItemData = new LTShowItemData(item.id, item.count, item.type, false);
                    ItemList[i].mDMono.gameObject.CustomSetActive(true);
                    BattlePassObj.CustomSetActive(true);
                }
                else if (rewardDatas.Count > i)
                {
                    var item = rewardDatas[i];
                    ItemList[i].LTItemData = new LTShowItemData(item.id, item.count, item.type, false);
                    ItemList[i].mDMono.gameObject.CustomSetActive(true);
                }
                else
                {
                    ItemList[i].mDMono.gameObject.CustomSetActive(false);
                }
            }
            ItemGrid.Reposition();
            TipLabel.text = string.Format("{0}/{1}", data.Finished?("[42fe79]" + data.TargetNum) : data.CurNum.ToString(), data.TargetNum);
            SetReceiveBtn();
        }
Exemplo n.º 7
0
        public override void OnLookupUpdate(string dataID, object value)
        {
            base.OnLookupUpdate(dataID, value);
            if (dataID != null)
            {
                m_taskid = 0;
                //dataID: tasks.2010
                int.TryParse(dataID.Remove(0, TaskSystem.TASKPREFIX_LENGTH), out m_taskid);
                string taskState = EB.Dot.String("state", value, "");
                Hotfix_LT.Data.TaskTemplate taskTpl = Hotfix_LT.Data.TaskTemplateManager.Instance.GetTask(m_taskid);
                if (taskTpl == null)
                {
                    return;
                }
                if (dict.ContainsKey(taskTpl.task_type))
                {
                    m_UISprite.spriteName = dict[taskTpl.task_type];
                }
                LTUIUtil.SetText(m_NameLabel, taskTpl.task_name);
                LTUIUtil.SetText(m_TipsLabel, taskTpl.target_tips);
                LTUIUtil.SetText(m_GetPointLabel, "x" + (taskTpl.task_type == (int)eTaskType.Main?taskTpl.achievement_point.ToString():taskTpl.activity_point.ToString()));
                {
                    int needtimes    = EB.Dot.Integer("event_count.target_num", value, 1);
                    int currenttimes = EB.Dot.Integer("event_count.current_num", value, 1);
                    if (m_NeedTimesLabel != null)
                    {
                        //if (taskTpl.task_type == (int)eTaskType.Normal)
                        {
                            if (currenttimes >= needtimes)
                            {
                                currenttimes = needtimes;
                            }
                        }

                        if (taskTpl.task_type == (int)eTaskType.Normal || taskTpl.task_type == (int)eTaskType.Week)
                        {
                            m_NeedTimesLabel2.gameObject.CustomSetActive(false);
                            m_ProgressBar.gameObject.CustomSetActive(true);
                            LTUIUtil.SetText(m_NeedTimesLabel, LT.Hotfix.Utility.ColorUtility.TaskFormatEnoughStr(currenttimes, needtimes));
                            m_ProgressBar.value = currenttimes * 1.0f / needtimes;
                        }
                        else if (taskTpl.task_type == (int)eTaskType.Main)
                        {
                            m_NeedTimesLabel2.gameObject.CustomSetActive(true);
                            m_ProgressBar.gameObject.CustomSetActive(false);
                            LTUIUtil.SetText(m_NeedTimesLabel2, LT.Hotfix.Utility.ColorUtility.TaskFormatEnoughStr(currenttimes, needtimes));
                        }
                    }
                }

                m_TaskState.mDL.DefaultDataID = dataID + ".state";
                int taskid = 0;
                int.TryParse(dataID.Replace(TaskStaticData.TaskPrefix, ""), out taskid);
                if (m_taskid != taskid)
                {
                    Debug.LogError("m_taskid == taskid");
                }

                List <LTShowItemData> rewardDatas = TaskStaticData.GetItemRewardList(taskid);
                List <LTShowItemData> temp        = new List <LTShowItemData>();

                for (int viewIndex = 0; viewIndex < m_RewardItemList.Count; ++viewIndex)
                {
                    if (viewIndex < rewardDatas.Count)
                    {
                        m_RewardItemList[viewIndex].LTItemData
                            = new LTShowItemData(rewardDatas[viewIndex].id, rewardDatas[viewIndex].count, rewardDatas[viewIndex].type, false);
                        //日常任务没有了奖励
                        if (taskTpl.task_type == 1)
                        {
                            m_RewardItemList[viewIndex].mDMono.gameObject.SetActive(true);
                        }
                    }
                    else
                    {
                        m_RewardItemList[viewIndex].mDMono.gameObject.SetActive(false);
                    }
                }
            }
        }