Ejemplo n.º 1
0
    void UpdateSignInPropState()
    {
        ClearGird();
        byte Indx = 0;
        int  day  = PlayerRole.Instance.CheckManager.GetNowDay();

        foreach (KeyValuePair <byte, ushort> map in FishConfig.Instance.m_CheckInfo.CheckDayReward)
        {
            SignInPropReward prop = new SignInPropReward();
            GameObject       go   = GameObject.Instantiate(m_BasePropItem) as GameObject;
            prop.Init(go.transform);
            SetPropInfo(prop, map.Key, map.Value);
            go.SetActive(true);
            m_UIGrid[Indx % 5].AddChild(go.transform);
            go.transform.localScale = Vector3.one;
            Indx++;
        }
        if (day > 10 && day <= 20)
        {
            m_ScrollTrans.localPosition = new Vector3(0, 270, 0);
            m_UIPanel.clipOffset        = new Vector2(0, -270);
        }
        else if (day > 20 && day <= 30)
        {
            m_ScrollTrans.localPosition = new Vector3(0, 500, 0);
            m_UIPanel.clipOffset        = new Vector2(0, -500);
        }
        else if (day > 30)
        {
            m_ScrollTrans.localPosition = new Vector3(0, 600, 0);
            m_UIPanel.clipOffset        = new Vector2(0, -600);
        }
    }
    void SetPropInfo(SignInPropReward prop, byte day, ushort rewardID)
    {
        tagRewardOnce pReward = FishConfig.Instance.GetRewardOnceByID(rewardID);

        if (pReward == null)
        {
            return;
        }
        uint ItemID = pReward.RewardItemVec[0].ItemID;

        if (FishConfig.Instance.m_ItemInfo.m_ItemMap.ContainsKey(ItemID) != true)
        {
            return;
        }
        prop.m_PropReward.spriteName = FishConfig.Instance.m_ItemInfo.m_ItemMap[ItemID].ItemIcon;
        prop.m_DateTime.text         = day.ToString();
        prop.m_IndxDay = day;

        //当前已经签 到
        if (PlayerRole.Instance.CheckManager.IsCheckByDay(day))
        {
            prop.m_PropReward.color      = new Color(0.5f, 0.5f, 0.5f);
            prop.m_PropRewardBg[0].color = new Color(0.5f, 0.5f, 0.5f);
            prop.m_PropRewardBg[1].color = new Color(0.5f, 0.5f, 0.5f);
            prop.m_PropNum.text          = "";
            prop.m_AlreadyGetFlag.SetActive(true);
            prop.m_PropHight.SetActive(false);

            string bgName = GetRewardBgName(0);
            prop.m_PropRewardBg[0].spriteName = bgName;
            prop.m_PropRewardBg[1].spriteName = bgName;
        }
        else
        {
            prop.m_PropNum.text = pReward.RewardItemVec[0].ItemSum.ToString();

            //int NowDay= SystemTime.Instance.GetSystemDateTime.Day;//1-31
            int NowDay = PlayerRole.Instance.CheckManager.GetNowDay();
            if (day == NowDay)
            {
                prop.m_PropHight.SetActive(true);
                string bgName = GetRewardBgName(1);
                prop.m_PropRewardBg[0].spriteName = bgName;
                prop.m_PropRewardBg[1].spriteName = bgName;
            }
            else if (day < NowDay)
            {
                prop.m_PropReward.color      = new Color(0.5f, 0.5f, 0.5f);
                prop.m_PropRewardBg[0].color = new Color(0.5f, 0.5f, 0.5f);
                prop.m_PropRewardBg[1].color = new Color(0.5f, 0.5f, 0.5f);

                string bgName = GetRewardBgName(2);
                prop.m_PropRewardBg[0].spriteName = bgName;
                prop.m_PropRewardBg[1].spriteName = bgName;
            }
        }
    }