Ejemplo n.º 1
0
 public override void Info(object obj)
 {
     base.Info(obj);
     item            = (GoldHandItemData)obj;
     jewelCount.text = item.jewelCount + "";
     goldCount.text  = item.goldCount + "";
     if (item.isCrit)
     {
         cirtObj.SetActive(true);
         //critCount.gameObject.SetActive(true);
         //critCount.text = "[dc2be5]" + "X"+item.critCount + ""+"[-]";
         if (item.critCount == 2)
         {
             cirt2.gameObject.SetActive(true);
         }
         if (item.critCount == 5)
         {
             cirt5.gameObject.SetActive(true);
         }
         if (item.critCount == 10)
         {
             cirt10.gameObject.SetActive(true);
         }
         if (index >= UIGoldHand.Instance.lastDataCount && item.critCount == 2)
         {
             UIGoldHand.Instance.towBaojiEffect.gameObject.SetActive(false);
             UIGoldHand.Instance.towBaojiEffect.gameObject.SetActive(true);
         }
         else if (index >= UIGoldHand.Instance.lastDataCount && item.critCount == 5)
         {
             UIGoldHand.Instance.fiveBaojiEffect.gameObject.SetActive(false);
             UIGoldHand.Instance.fiveBaojiEffect.gameObject.SetActive(true);
         }
         else if (index >= UIGoldHand.Instance.lastDataCount && item.critCount == 10)
         {
             UIGoldHand.Instance.tenBaojiEffect.gameObject.SetActive(false);
             UIGoldHand.Instance.tenBaojiEffect.gameObject.SetActive(true);
         }
     }
     else
     {
         cirtObj.SetActive(false);
         critCount.gameObject.SetActive(false);
     }
 }
Ejemplo n.º 2
0
    public bool UseGoldHandResult(CReadPacket packet)
    {
        Debug.Log("UseGoldHandResult");
        Dictionary <string, object> data = packet.data;

        object[] infoList = data["info"] as object[];
        int      resolt   = int.Parse(data["ret"].ToString());

        if (resolt == 0)
        {
            //playerData.GetInstance().goldHand.curcount = int.Parse(data["curtimes"].ToString());
            //if (playerData.GetInstance().goldHand.curcount < 0)
            //{
            //    playerData.GetInstance().goldHand.curcount = 0;
            //}
            if (data.ContainsKey("max"))
            {
                playerData.GetInstance().goldHand.maxcount = int.Parse(data["max"].ToString());
            }
            if (data.ContainsKey("bat"))
            {
                playerData.GetInstance().goldHand.alreadyUseCount = int.Parse(data["bat"].ToString());
            }
            if (data.ContainsKey("bal"))
            {
                playerData.GetInstance().goldHand.id = int.Parse(data["bal"].ToString());
            }
            if (data.ContainsKey("balt"))
            {
                playerData.GetInstance().goldHand.time = int.Parse(data["balt"].ToString());
            }
            playerData.GetInstance().RoleMoneyHadler(MoneyType.Gold, UInt32.Parse(data["goldsum"].ToString()));
            playerData.GetInstance().RoleMoneyHadler(MoneyType.Diamond, UInt32.Parse(data["diamondsum"].ToString()));
            UIGoldHand.Instance.lastDataCount = playerData.GetInstance().goldHand.goldHandList.Count;
            for (int i = 0; i < infoList.Length; i++)
            {
                Dictionary <string, object> infoDataDic = infoList[i] as Dictionary <string, object>;
                GoldHandItemData            itemdata    = new GoldHandItemData();
                itemdata.goldCount  = int.Parse(infoDataDic["golds"].ToString());
                itemdata.jewelCount = int.Parse(infoDataDic["diamonds"].ToString());
                itemdata.critCount  = int.Parse(infoDataDic["times"].ToString());
                //1倍就是它自己,2倍比1倍多1倍。
                if (itemdata.critCount > 1)
                {
                    itemdata.isCrit = true;
                }
                else
                {
                    itemdata.isCrit = false;
                }
                playerData.GetInstance().goldHand.goldHandList.Add(itemdata);
            }
        }
        else
        {
            Debug.Log(string.Format("点金手失败:{0}", data["desc"].ToString()));
            //UIPromptBox.Instance.ShowLabel(data["desc"].ToString());
            //Control.ShowGUI(GameLibrary.UIPromptBox);
            Control.ShowGUI(UIPanleID.UIPromptBox, EnumOpenUIType.DefaultUIOrSecond, false, data["desc"].ToString());
        }
        return(true);
    }