Exemplo n.º 1
0
    /// <summary>
    /// 获取结义界面信息
    /// </summary>
    protected void S2C_GetSwornWndInfo(Pt pt)
    {
        pt_wsorn_brother_info_d540 msg = pt as pt_wsorn_brother_info_d540;

        if (msg != null)
        {
            //for (int i = 0; i < msg.brothers_info.Count; i++)
            //{
            //    Debug.Log("   d540结义兄弟id:" + msg.brothers_info[i].uid + "      ,结义任务数:" + swornTask.Count + "  , 积分 : " + msg.brothers_frendship_integer);
            //}
            if (msg.brothers_info.Count <= 0)
            {
                data = null;
            }
            else
            {
                if (data == null)
                {
                    data = new SwornData(msg);
                }
                else
                {
                    data.Updata(msg);
                }
            }
        }
        if (OnSwornListUpdata != null)
        {
            OnSwornListUpdata();
        }
    }
Exemplo n.º 2
0
 protected void UnRegist()
 {
     MsgHander.UnRegist(0xD540, S2C_GetSwornWndInfo);
     MsgHander.UnRegist(0xD543, S2C_GetRewardInfo);
     MsgHander.UnRegist(0xD547, S2C_BrokeUp);
     MsgHander.UnRegist(0xD690, S2C_GetSwornBrother);
     data = null;
     isTakeAwared.Clear();
 }
Exemplo n.º 3
0
    /// <summary>
    /// 分道扬镳成功
    /// </summary>
    protected void S2C_BrokeUp(Pt pt)
    {
        pt_req_break_brother_d547 msg = pt as pt_req_break_brother_d547;

        if (msg != null)
        {
            data = null;
        }
        if (OnSwornListUpdata != null)
        {
            OnSwornListUpdata();
        }
    }
Exemplo n.º 4
0
    void Show()
    {
        data = GameCenter.swornMng.data;
        if (Task != null)
        {
            if (taskDes != null)
            {
                taskDes.text = Task.SimpleDesUntilComplete;
            }
            if (pathFindBtn != null)
            {
                UIEventListener.Get(pathFindBtn.gameObject).onClick = delegate
                {
                    GameCenter.taskMng.CurfocusTask = Task;
                    GameCenter.taskMng.GoTraceTask(Task);
                }
            }
            ;

            if (friendName.Length > 0)
            {
                for (int i = 0; i < friendName.Length; i++)
                {
                    if (friendName[i] != null)
                    {
                        if (i < data.brothers.Count)
                        {
                            int id = data.brothers[i].uid;
                            friendName[i].text = "[e7ffe8]" + data.brothers[i].name;
                            if (taskProgress.ContainsKey(id))
                            {
                                if (taskProgress[id].ContainsKey(Task.ID))
                                {
                                    friendName[i].text = "[6ef574]" + data.brothers[i].name;//任务完成了名字变绿
                                }
                            }
                        }
                        else
                        {
                            friendName[i].gameObject.SetActive(false);
                        }
                    }
                }
            }
        }
    }
}
Exemplo n.º 5
0
    /// <summary>
    /// 点击宝箱
    /// </summary>
    void OnClickTakeReward(GameObject go)
    {
        int val = (int)UIEventListener.Get(go.gameObject).parameter;

        if (takeAward != null)
        {
            takeAward.SetActive(true);
        }
        if (isTakeAwared.Count > val && isTakeAwared[val].state == 1)//已经领取
        {
            if (takeBtn != null)
            {
                takeBtn.gameObject.SetActive(false);
            }
            if (alreadyTake != null)
            {
                alreadyTake.gameObject.SetActive(true);
            }
        }
        else
        {
            if (takeBtn != null)
            {
                takeBtn.gameObject.SetActive(true);
            }
            if (alreadyTake != null)
            {
                alreadyTake.gameObject.SetActive(false);
            }
        }
        if (closeItemBtn != null)
        {
            UIEventListener.Get(closeItemBtn.gameObject).onClick = delegate { if (takeAward != null)
                                                                              {
                                                                                  takeAward.SetActive(false);
                                                                              }
            }
        }
        ;
        if (rewardDesLab != null)
        {
            rewardDesLab.text = ConfigMng.Instance.GetUItext(83, new string[1] {
                (brothers.Count * (val + 1)).ToString()
            });
        }
        for (int j = 0, max = awardsItems.Length; j < max; j++)
        {
            if (takeBtn != null && takeBtn.gameObject.activeSelf)
            {
                UISpriteEx takeEx = takeBtn.GetComponentInChildren <UISpriteEx>();
                if (data.taskNum < brothers.Count * (val + 1))//没有达到领取条件
                {
                    if (takeEx != null)
                    {
                        takeEx.IsGray = UISpriteEx.ColorGray.Gray;
                    }
                }
                else
                {
                    if (takeEx != null)
                    {
                        takeEx.IsGray = UISpriteEx.ColorGray.normal;
                    }
                    UIEventListener.Get(takeBtn.gameObject).onClick = delegate
                    {
                        if (takeAward != null)
                        {
                            takeAward.SetActive(false);
                        }
                        GameCenter.swornMng.C2S_ReqTakeBoxReward(val + 1);
                    };
                }
            }
            if (data.Reward(val).Count > j)
            {
                awardsItems[j].FillInfo(new EquipmentInfo(data.Reward(val)[j].eid, data.Reward(val)[j].count, EquipmentBelongTo.PREVIEW));
            }
            else
            {
                awardsItems[j].gameObject.SetActive(false);
            }
        }
    }

    void Refresh()
    {
        if (noSworn != null)
        {
            noSworn.SetActive(false);
        }
        if (takeAward != null)
        {
            takeAward.SetActive(false);
        }
        data = GameCenter.swornMng.data;
        if (data == null)
        {
            if (task != null)
            {
                task.SetActive(false);
            }
            if (sworn != null)
            {
                sworn.SetActive(false);
            }
            if (noSworn != null)
            {
                noSworn.SetActive(true);
            }
            if (page == 1)
            {
                GameCenter.messageMng.AddClientMsg(503);
            }
            return;
        }
        brothers = data.brothers;
        if (page == 0)//结义
        {
            if (task != null)
            {
                task.SetActive(false);
            }
            if (sworn != null)
            {
                sworn.SetActive(true);
            }
            swornL.SwornData = data;
            for (int i = 0; i < brothers.Count; i++)
            {
                if (brothers[i].uid == data.playerId)
                {
                    swornR[0].Brother = brothers[i];
                    break;
                }
            }
            for (int i = 1; i < swornR.Count; i++)
            {
                if (brothers.Count > i)
                {
                    swornR[i].Brother = brothers[i];
                }
                else
                {
                    swornR[i].gameObject.SetActive(false);
                }
            }
        }
        else//任务
        {
            RefreshSwornTask();
        }
    }

    void RefreshSwornTask()
    {
        if (sworn != null)
        {
            sworn.SetActive(false);
        }
        if (task != null)
        {
            task.SetActive(true);
        }
        for (int i = 0, max = taskUi.Count; i < max; i++)
        {
            if (GameCenter.swornMng.swornTask.Count > i)
            {
                taskUi[i].Task = GameCenter.swornMng.swornTask[i];
            }
        }
        if (integral != null)
        {
            integral.value = (float)data.taskNum / (brothers.Count * 3);
            integral.thumb.transform.localPosition = new Vector3(integral.thumb.transform.localPosition.x, -33);
        }
        if (integralVal != null)
        {
            integralVal.text = data.taskNum + "/" + brothers.Count * 3;
        }
        if (integralLab.Length > 0)
        {
            for (int i = 0; i < integralLab.Length; i++)
            {
                integralLab[i].text = (brothers.Count * (i + 1)).ToString();
                BoxOpenUi openbox = box[i].GetComponent <BoxOpenUi>();
                if (openbox != null)
                {
                    if (isTakeAwared.Count > i)
                    {
                        if (isTakeAwared[i].state == 1)//已经领取
                        {
                            openbox.show(true);
                        }
                        else
                        {
                            openbox.show(false);
                        }
                    }
                }
            }
        }
        if (box.Length > 0)
        {
            for (int i = 0; i < box.Length; i++)
            {
                UIEventListener.Get(box[i].gameObject).onClick  -= OnClickTakeReward;
                UIEventListener.Get(box[i].gameObject).onClick  += OnClickTakeReward;
                UIEventListener.Get(box[i].gameObject).parameter = i;
            }
        }
    }
}