Exemplo n.º 1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="getRewards"></param>
    private void updateGetRewardList(PacketStructChallengeGetReward[] getRewards)
    {
        if (getRewards != null ||
            getRewards.Length == 0)
        {
            IsViewFlag = false;
            rewardList[TAB_REWARD_GET].Clear();

            for (int i = 0; i < getRewards.Length; i++)
            {
                MasterDataChallengeReward master = MasterFinder <MasterDataChallengeReward> .Instance.Find(getRewards[i].fix_id);

                if (master == null)
                {
                    continue;
                }

                ChallengeRewardContext newData = new ChallengeRewardContext();


                newData.SetData(getRewards[i], master);

                rewardList[TAB_REWARD_GET].Add(newData);
            }

            if (rewardList[TAB_REWARD_GET].Count != 0)
            {
                IsViewFlag = true;
            }
        }
    }
Exemplo n.º 2
0
    public void CopyData(ChallengeRewardContext context)
    {
        m_GetReward  = context.GetReward;
        m_GetMaster  = context.GetMaster;
        m_InfoReward = context.InfoReward;

        IsActiveTitleBar = context.IsActiveTitleBar;
        TitleBarText     = context.TitleBarText;
    }
Exemplo n.º 3
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="index"></param>
    /// <param name="recyclableItem"></param>
    /// <returns></returns>
    public RectTransform GetItem(int index, RectTransform recyclableItem)
    {
        if (null == recyclableItem)
        {
            // 初回ロード時はinstantateItemCountで指定した回数分だけitemがnullで来るので、ここで生成してあげる
            // 以降はitemが再利用されるため、Reflesh()しない限りnullは来ない
            recyclableItem = Instantiate(itemPrefab).GetComponent <RectTransform>();

            ChallengeRewardContext item = new ChallengeRewardContext();
            item.DidSelectItem = OnSelectItem;

            recyclableItem.gameObject.GetComponent <M4uContextRoot>().Context = item;

            ChallengeRewardListItem listItem = recyclableItem.gameObject.GetComponent <ChallengeRewardListItem>();

            viewItems.Add(listItem);

            //位置調整
            RectTransform offset = recyclableItem.gameObject.GetComponent <ChallengeRewardListItem>().Offset;
            float         posX   = recyclableItem.sizeDelta.x * -0.5f;
            offset.anchoredPosition = new Vector2(posX, offset.anchoredPosition.y);
        }

        {
            if (RewardList.Count > index)
            {
                ChallengeRewardListItem listItem = recyclableItem.gameObject.GetComponent <ChallengeRewardListItem>();
                listItem.itemIndex = index;


                ChallengeRewardContext item = listItem.Context;
                item.CopyData(RewardList[index]);
                switch (TabIndex)
                {
                case 0:
                    item.setupInfo(m_ChallengeInfo);
                    break;

                case 1:
                    item.setupGet(ChallengeRewardContext.REWARD_ACHIIEVE);
                    break;
                }
            }
        }

        return(recyclableItem);
    }
Exemplo n.º 4
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="infoRewards"></param>
    private void updateInfoRewardList(PacketStructChallengeInfoReward[] infoRewards)
    {
        if (infoRewards != null ||
            infoRewards.Length == 0)
        {
            rewardList[TAB_REWARD_LIST].Clear();

            int mode = 0;
            for (int i = 0; i < infoRewards.Length; i++)
            {
                ChallengeRewardContext newData = new ChallengeRewardContext();
                newData.SetData(infoRewards[i]);
                switch (mode)
                {
                case 0:
                {
                    if (infoRewards[i].type < 4)
                    {
                        newData.SetTitleBar(GameTextUtil.GetText("growth_boss_18"));
                        mode = 1;
                    }
                    else
                    {
                        newData.SetTitleBar(GameTextUtil.GetText("growth_boss_19"));
                        mode = 2;
                    }
                }
                break;

                case 1:
                {
                    if (infoRewards[i].type >= 4)
                    {
                        newData.SetTitleBar(GameTextUtil.GetText("growth_boss_19"));
                        mode = 2;
                    }
                }
                break;

                default:
                    break;
                }

                rewardList[TAB_REWARD_LIST].Add(newData);
            }
        }
    }
Exemplo n.º 5
0
    public void OnSelectItem(ChallengeRewardContext data)
    {
        if (data.GetReward == null)
        {
            return;
        }

        SoundUtil.PlaySE(SEID.SE_MENU_OK);

        int event_id = m_ChallengeInfo.event_id;

        int[] reward_ids = new int[1];
        reward_ids[0] = data.GetReward.fix_id;
        int[] loop_cnts = new int[1];
        loop_cnts[0] = data.GetReward.loop_count;

        SendGetChallengeReward(event_id, reward_ids, loop_cnts);
    }