Beispiel #1
0
    public bool OnReceiveQuestInfoAck(ERandomwarsQuestErrorCode errorCode, QuestInfo questInfo)
    {
        UI_Main.Get().obj_IndicatorPopup.SetActive(false);

        // var anchPos = rts_Content.anchoredPosition;
        // anchPos.y = 0;
        // rts_Content.anchoredPosition = anchPos;

        if (errorCode == ERandomwarsQuestErrorCode.Success)
        {
            dateTime = DateTime.Now.AddSeconds(questInfo.RemainResetTime);

            dailyRewardID       = questInfo.DayRewardInfo.DayRewardId;
            arrIsDailyRewardGet = questInfo.DayRewardInfo.DayRewardState;

            var dataDailyReward = new TDataQuestDayReward();
            if (TableManager.Get().QuestDayReward.GetData(questInfo.DayRewardInfo.DayRewardId, out dataDailyReward))
            {
                TDataItemList itemData;
                if (TableManager.Get().ItemList.GetData(item => item.id == dataDailyReward.rewardItem01, out itemData))
                {
                    arrImage_Reward[0].sprite = FileHelper.GetIcon(itemData.itemIcon);
                }
                if (TableManager.Get().ItemList.GetData(item => item.id == dataDailyReward.rewardItem02, out itemData))
                {
                    arrImage_Reward[1].sprite = FileHelper.GetIcon(itemData.itemIcon);
                }
                // if (TableManager.Get().ItemList.GetData(item => item.id == dataDailyReward.rewardItem03, out itemData))
                // {
                //     arrImage_Reward[2].sprite = FileHelper.GetIcon(itemData.itemIcon);
                // }

                arrText_Reward[0].text = $"x{dataDailyReward.rewardItemValue01}";
                arrText_Reward[1].text = $"x{dataDailyReward.rewardItemValue02}";
                arrText_Reward[2].text = $"x{dataDailyReward.rewardItemValue03}";

                arrBtn_Reward[0].interactable = !arrIsDailyRewardGet[0];
                arrBtn_Reward[1].interactable = !arrIsDailyRewardGet[1];
                arrBtn_Reward[2].interactable = !arrIsDailyRewardGet[2];
            }

            list.Clear();
            for (int i = 0; i < questInfo.QuestData.Length || i < listSlot.Count; i++)
            {
                if (i >= questInfo.QuestData.Length)
                {
                    listSlot[i].gameObject.SetActive(false);
                    continue;
                }
                listSlot[i].gameObject.SetActive(true);
                list.Add(questInfo.QuestData[i]);
                listSlot[i].Initialize(questInfo.QuestData[i]);
            }
        }

        Open();

        return(true);
    }
Beispiel #2
0
    public bool OnReceiveQuestRewardAck(ERandomwarsQuestErrorCode errorCode, QuestData[] arrayQuestData, ItemBaseInfo[] arrayRewardInfo)
    {
        UI_Main.Get().obj_IndicatorPopup.SetActive(false);

        if (errorCode == ERandomwarsQuestErrorCode.Success)
        {
            UI_Main.Get().AddReward(arrayRewardInfo, btn_Reward.transform.position);

            UI_Popup_Quest.QuestUpdate(arrayQuestData);
            UI_Main.Get().questPopup.InfoCallback();
        }

        return(true);
    }
Beispiel #3
0
    bool OnReceiveQuestDailyRewardAck(ERandomwarsQuestErrorCode errorCode, QuestData[] arrayQuestData, ItemBaseInfo[] arrayRewardInfo, QuestDayReward dailyRewardInfo)
    {
        UI_Main.Get().obj_IndicatorPopup.SetActive(false);

        if (errorCode == ERandomwarsQuestErrorCode.Success)
        {
            arrIsDailyRewardGet = dailyRewardInfo.DayRewardState;
            // List<ItemBaseInfo> list = new List<ItemBaseInfo>();
            //
            // foreach (var reward in arrayRewardInfo)
            // {
            //     var data = new TDataItemList();
            //     if (TableManager.Get().ItemList.GetData(reward.ItemId, out data))
            //     {
            //         switch (data.id)
            //         {
            //             case 1:             // 골드
            //                 UserInfoManager.Get().GetUserInfo().gold += reward.Value;
            //                 UI_GetProduction.Get().Initialize(ITEM_TYPE.GOLD, mousePos, Mathf.Clamp(reward.Value, 5, 20));
            //                 break;
            //             case 2:             // 다이아
            //                 UserInfoManager.Get().GetUserInfo().diamond += reward.Value;
            //                 UI_GetProduction.Get().Initialize(ITEM_TYPE.DIAMOND, mousePos, Mathf.Clamp(reward.Value, 5, 20));
            //                 break;
            //             default: // 주사위
            //             {
            //                 ItemBaseInfo rw = new ItemBaseInfo();
            //                 rw.ItemId = reward.ItemId;
            //                 rw.Value = reward.Value;
            //                 list.Add(rw);
            //             }
            //                 break;
            //         }
            //     }
            // }
            //
            // if (list.Count > 0)
            // {
            //     UI_Main.Get().gerResult.Initialize(list.ToArray(), false, false);
            // }

            UserInfoManager.Get().GetUserInfo().AddItem(arrayRewardInfo, mousePos);

            QuestUpdate(arrayQuestData);

            InfoCallback();
        }

        return(true);
    }