예제 #1
0
    public override void OnUIEventHandler(EventId eventId, params object[] args)
    {
        if (eventId == EventId.OnFinished)
        {
            NetMessage.SCFinishBattle proto = args[0] as NetMessage.SCFinishBattle;
            if (proto == null)
            {
                return;
            }

            int rewardCount = 0;
            if (proto.rewards.Count > 0)
            {
                moneyObj.SetActive(true);
                moneyLabel.text = string.Format("X{0}", proto.rewards[0].num);
                moneyObj.SetActive(false);
                ++rewardCount;
            }
            if (rewardCount == 2)
            {
                lineObj.SetActive(true);
            }
            else if (rewardCount == 1)
            {
                chestObj.transform.localPosition = moneyObj.transform.localPosition = lineObj.transform.localPosition;
            }
        }

        if (eventId == EventId.OnFriendFollowResult)
        {
            // 关注好友结果
            int  userId = (int)args[0];
            bool follow = (bool)args[1]; // 关注或者取消关注行动
            NetMessage.ErrCode errCode = (NetMessage.ErrCode)args[2];
            if (errCode == NetMessage.ErrCode.EC_Ok)
            {
                Tips.Make(Tips.TipsType.FlowUp, LanguageDataProvider.GetValue(815), 1.0f);
                for (int i = 0; i < 4; i++)
                {
                    UILabel ID = btnAttention[i].transform.Find("useid").GetComponent <UILabel>();
                    if (ID == null || string.IsNullOrEmpty(ID.text))
                    {
                        continue;
                    }

                    int useID = int.Parse(ID.text);
                    if (userId == useID)
                    {
                        btnAttention[i].SetActive(false);
                    }
                }
            }
        }
    }
예제 #2
0
 public override void OnUIEventHandler(EventId eventId, params object[] args)
 {
     if (eventId == EventId.OnFinished)
     {
         haveResult = true;
         if (args.Length > 0)
         {
             proto = args [0] as NetMessage.SCFinishBattle;
         }
     }
     else if (eventId == EventId.OnFinishedColor)
     {
         Color winColor = (Color)args [0];
         lineSingleRenderer.color = winColor;
         linePvpRenderer.color    = winColor;
         winTeam = args[1] as Team;
     }
 }