public void InitPrize()
 {
     m_ItemSlot1.InitInfo_Item(GetPrizeEquipId(), ItemSlotLogic.OnClickOpenTips);
     m_ItemSlot2.InitInfo_YuanbaoBind();
     m_ItemSlot3.InitInfo_Item(PrizeItemId1, ItemSlotLogic.OnClickOpenTips, PrizeItemNum1.ToString(), true);
     m_ItemSlot4.InitInfo_Item(PrizeItemId2, ItemSlotLogic.OnClickOpenTips, PrizeItemNum2.ToString(), true);
 }
Esempio n. 2
0
 public void InitPrize()
 {
     m_ItemSlot1.InitInfo_YuanbaoBind();
     m_Num1.text = BindYuanBaoNum.ToString();
     m_ItemSlot2.InitInfo_Item(ItemId, ItemSlotLogic.OnClickOpenTips, "", false);
     m_Num2.text = ItemNum.ToString();
 }
 void ShowPrizeItem(ItemSlotLogic itemSlot, int id, int num)
 {
     itemSlot.gameObject.SetActive(true);
     if (id < 0)
     {
         itemSlot.gameObject.SetActive(false);
     }
     else if (id == 0)
     {
         //金币
         itemSlot.InitInfo_Coin(null, num.ToString(), true);
     }
     else if (id == 1)
     {
         //元宝
         itemSlot.InitInfo_Yuanbao(null, num.ToString(), true);
     }
     else if (id == 2)
     {
         //绑定元宝
         itemSlot.InitInfo_YuanbaoBind(null, num.ToString(), true);
     }
     else
     {
         //物品
         itemSlot.InitInfo_Item(id, ItemSlotLogic.OnClickOpenTips, num.ToString(), true);
     }
 }
Esempio n. 4
0
    public void Init()
    {
        Dictionary <int, OnlineAwardLine> DataTab = GameManager.gameManager.PlayerDataPool.AwardActivityData.New7DayOnlineAwardTable;
        List <int> GetList = GameManager.gameManager.PlayerDataPool.AwardActivityData.New7DayGetList;

        if (DataTab != null && ItemPerObj != null && GetList != null)
        {
            if (childWindows.Length < 3 || childWindows[2] == null)
            {
                return;
            }
            Transform par = childWindows[2].transform;
            UIGrid    ug  = childWindows[2].GetComponent <UIGrid>();
            if (ug != null)
            {
                ug.repositionNow = true;
            }
            foreach (KeyValuePair <int, OnlineAwardLine> pair in DataTab)
            {
                if (pair.Value.ID < 0)
                {
                    return;
                }
                GameObject go;
                if (!AwardKeyFindGoDic.TryGetValue(pair.Value.ID, out go))
                {
                    go = GameObject.Instantiate(ItemPerObj) as GameObject;
                    //}
                    if (go != null)
                    {
                        if (GetList[pair.Value.ID] == 1)
                        {
                            go.transform.name = "z" + pair.Value.ID;
                        }
                        else
                        {
                            go.transform.name = pair.Value.ID.ToString();
                        }
                        go.transform.parent        = par;
                        go.transform.localPosition = Vector3.zero;
                        go.transform.localScale    = Vector3.one;
                        //OnlineAwardLine直接操作
                        AwardKeyFindGoDic.Add(pair.Value.ID, go);
                        int sign = 0;
                        if (pair.Value.Exp > 0)
                        {
                            ++sign;
                            Transform tf = go.transform.Find("Item0" + sign + "/ItemSlot");
                            if (tf != null)
                            {
                                ItemSlotLogic isl = tf.GetComponent <ItemSlotLogic>();
                                if (isl != null)
                                {
                                    isl.InitInfo_PlayerExp("x" + pair.Value.Exp, ItemSlotLogic.OnClickOpenTips);
                                }
                            }
                        }
                        if (pair.Value.Money > 0)
                        {
                            ++sign;
                            Transform tf = go.transform.Find("Item0" + sign + "/ItemSlot");
                            if (tf != null)
                            {
                                ItemSlotLogic isl = tf.GetComponent <ItemSlotLogic>();
                                if (isl != null)
                                {
                                    isl.InitInfo_Coin(ItemSlotLogic.OnClickOpenTips, "x" + pair.Value.Money, true);
                                }
                            }
                        }
                        if (pair.Value.BindYuanbao > 0)
                        {
                            ++sign;
                            Transform tf = go.transform.Find("Item0" + sign + "/ItemSlot");
                            if (tf != null)
                            {
                                ItemSlotLogic isl = tf.GetComponent <ItemSlotLogic>();
                                if (isl != null)
                                {
                                    isl.InitInfo_YuanbaoBind(ItemSlotLogic.OnClickOpenTips, "x" + pair.Value.BindYuanbao, true);
                                }
                            }
                        }
                        if (pair.Value.Item1DataID > -1)
                        {
                            if (sign > 2)
                            {
                                return;
                            }
                            ++sign;
                            Transform tf = go.transform.Find("Item0" + sign + "/ItemSlot");
                            if (tf != null)
                            {
                                ItemSlotLogic isl = tf.GetComponent <ItemSlotLogic>();
                                if (isl != null)
                                {
                                    isl.InitInfo_Item(pair.Value.Item1DataID, ItemSlotLogic.OnClickOpenTips, "x" + pair.Value.Item1Count, true);
                                }
                            }
                        }
                        if (pair.Value.Item2DataID > -1)
                        {
                            if (sign > 2)
                            {
                                return;
                            }
                            ++sign;
                            Transform tf = go.transform.Find("Item0" + sign + "/ItemSlot");
                            if (tf != null)
                            {
                                ItemSlotLogic isl = tf.GetComponent <ItemSlotLogic>();
                                if (isl != null)
                                {
                                    isl.InitInfo_Item(pair.Value.Item2DataID, ItemSlotLogic.OnClickOpenTips, "x" + pair.Value.Item2count, true);
                                }
                            }
                        }
                        for (int i = 1; i < 4; ++i)
                        {
                            Transform tf = go.transform.Find("Item0" + i);
                            if (tf != null)
                            {
                                if (i > sign)
                                {
                                    tf.gameObject.SetActive(false);
                                }
                                else
                                {
                                    tf.gameObject.SetActive(true);
                                }
                            }
                        }
                        {
                            Transform tf = go.transform.Find("Reward-Des");
                            if (tf != null)
                            {
                                UILabel ul = tf.GetComponent <UILabel>();
                                if (ul != null)
                                {
                                    ul.text = GCGame.Table.StrDictionary.GetClientDictionaryString(string.Format("#{{{0}}}", ul.curDicID), pair.Value.LeftTime / 60);
                                }
                            }
                        }
                        LabelData labelData;
                        if (!LabelTimeDic.TryGetValue(pair.Value.ID, out labelData))
                        {
                            UILabel   UILabelCounting  = null;
                            UILabel   UILabelAvailable = null;
                            UILabel   UIFinish         = null;
                            Transform tftime           = go.transform.Find("Time");
                            if (tftime != null)
                            {
                                Transform tf0 = tftime.Find("Time-Counting");
                                if (tf0 != null)
                                {
                                    UILabelCounting = tf0.GetComponent <UILabel>();
                                }
                                Transform tf1 = tftime.Find("Time-Available");
                                if (tf1 != null)
                                {
                                    UILabelAvailable = tf1.GetComponent <UILabel>();
                                }
                                Transform tf2 = tftime.Find("Time-Finished");
                                if (tf2 != null)
                                {
                                    UIFinish = tf1.GetComponent <UILabel>();
                                }
                                //buttonPar = go.transform.Find("Reward01-Btn");
                                LabelTimeDic.Add(pair.Value.ID, new LabelData(pair.Value.ID, UILabelCounting, UILabelAvailable, UIFinish, go));
                            }
                        }
                    }
                }
                else if (go != null)
                {
                    if (GetList[pair.Value.ID] == 1)
                    {
                        go.transform.name = "z" + pair.Value.ID;
                    }
                    else
                    {
                        go.transform.name = pair.Value.ID.ToString();
                    }
                }
            }
            if (childWindows.Length > 1)
            {
                UILabel ul = childWindows[1].GetComponent <UILabel>();
                if (ul != null)
                {
                    ul.text = GCGame.Table.StrDictionary.GetClientDictionaryString(string.Format("#{{{0}}}", ul.curDicID), DataTab.Count);
                }
            }
        }
        int nowCountId = GameManager.gameManager.PlayerDataPool.AwardActivityData.New7DayOnlineAwardID;
        int time       = 0;
        Dictionary <int, OnlineAwardLine> dataDic = GameManager.gameManager.PlayerDataPool.AwardActivityData.New7DayOnlineAwardTable;
        OnlineAwardLine data;

        if (!dataDic.TryGetValue(nowCountId, out data))
        {
            if (nowCountId > dataDic.Count - 1)
            {
                time = dataDic[dataDic.Count - 1].LeftTime + (nowCountId - dataDic.Count) * 600;
            }
            else
            {
                return;
            }
        }
        else
        {
            time = data.LeftTime;
        }
        int datalefttime = GameManager.gameManager.PlayerDataPool.AwardActivityData.New7DayLeftTime;

        lastTime = Time.realtimeSinceStartup;
        int livetime = Mathf.RoundToInt(lastTime - GameManager.gameManager.PlayerDataPool.AwardActivityData.New7DayBeginTime);

        pastTime = time - datalefttime + livetime - 1;
        UpdateCountdown();
    }