public override void read(ErlKVMessage message)
    {
        ErlType erl = message.getValue("msg") as ErlType;

        if (erl is ErlArray)
        {
            GodsWarFinalUserInfo        user;
            List <GodsWarFinalUserInfo> infos = new List <GodsWarFinalUserInfo>();
            ErlArray erlarry = erl as ErlArray;
            for (int i = 0; i < erlarry.Value.Length; i++)
            {
                user = new GodsWarFinalUserInfo();
                user.bytesRead(erlarry.Value[i] as ErlArray);
                infos.Add(user);
            }
            if (infos != null)
            {
                GodsWarManagerment.Instance.finalInfoList = infos;
            }
            if (callback != null)
            {
                callback();
            }
        }
        else
        {
            MessageWindow.ShowAlert(erl.getValueString());
            if (callback != null)
            {
                callback = null;
            }
        }
    }
Example #2
0
 /// <summary>
 /// 初始化item
 /// </summary>
 public void initItem(GodsWarFinalUserInfo winner, int value, string replayId, WindowBase win, CallBack callbck)
 {
     this.fatherWindow = win;
     this.winner       = winner;
     this.repalyId     = replayId;
     this.value        = value;
     this.callback     = callbck;
     initButton();
     initUI();
 }
 /// <summary>
 /// 初始化item
 /// </summary>
 public void initItem(GodsWarFinalUserInfo user, int type, int index, int localID, WindowBase win, CallBack callbck)
 {
     this.fatherWindow = win;
     this.user         = user;
     this.type         = type;
     this.index        = index;
     this.localID      = localID;
     this.callback     = callbck;
     initButton();
     initUI();
 }
    /// <summary>
    /// 初始化UI
    /// </summary>
    public void initUI(int big_id, int yu_ming, GodsWarFinalUserInfo info, WindowBase win)
    {
        this.user    = info;
        this.big_id  = big_id;
        this.yu_ming = yu_ming;

        lblName.text            = info.name;
        lblSeverName.text       = info.serverName;
        viewButton.fatherWindow = win;
        viewButton.onClickEvent = doViewEvent;
        setSuportInfo();
    }
 /// <summary>
 /// 初始化UI
 /// </summary>
 public void initUI()
 {
     info = GodsWarManagerment.Instance.singlePlayer;
     if (info == null)
     {
         return;
     }
     lblName.text      = name;
     lblSuportNum.text = LanguageConfigManager.Instance.getLanguage("godsWar_67", info.suportPlayerNum.ToString());
     lblPower.text     = LanguageConfigManager.Instance.getLanguage("godsWar_68", info.power.ToString());
     lblSeverName.text = LanguageConfigManager.Instance.getLanguage("godsWar_69", info.serverName);
     loadCards();
 }
    public override void read(ErlKVMessage message)
    {
        ErlType erl = message.getValue("msg") as ErlType;

        if (erl is ErlArray)
        {
            ErlArray arr = erl as ErlArray;
            if (arr.Value.Length == 2)
            {
                GodsWarFinalUserInfo        user;
                List <GodsWarFinalUserInfo> infos = new List <GodsWarFinalUserInfo>();
                for (int i = 0; i < arr.Value.Length; i++)
                {
                    ErlArray tmp = arr.Value[i] as ErlArray;
                    user = new GodsWarFinalUserInfo();
                    user.bytesReadThree(tmp);
                    infos.Add(user);
                }
                if (infos.Count > 0)
                {
                    GodsWarManagerment.Instance.pvpGodsWarFinalInfo = infos;
                }
            }
            else
            {
                GodsWarFinalUserInfo baseUser = new GodsWarFinalUserInfo();
                baseUser.bytesReadFour(arr);
                GodsWarManagerment.Instance.singlePlayer = baseUser;
            }
            if (callback != null)
            {
                callback();
            }
            MaskWindow.UnlockUI();
        }
        else
        {
            MessageWindow.ShowAlert(erl.getValueString());
            if (callback != null)
            {
                callback = null;
            }
            MaskWindow.UnlockUI();
        }
    }
 /// <summary>
 /// 初始化半决赛ui
 /// </summary>
 public void initGoupChapingUI(GodsWarFinalPoint point)
 {
     FPortManager.Instance.getFPort <GodsWarGetPlayerInfoFPort> ().access(type, index, point.localID, () => {
         List <GodsWarFinalUserInfo> user = GodsWarManagerment.Instance.pvpGodsWarFinalInfo;
         for (int j = 0; j < user.Count; j++)
         {
             if (point.isHaveWinner == -1)
             {
                 return;
             }
             isOpenShenMo = true;
             if (user [j].serverName == point.winner.serverName && user [j].uid == point.winner.uid)
             {
                 ResourcesManager.Instance.LoadAssetBundleTexture(UserManager.Instance.getIconPath(user [j].headIcon), winnerIcon);
                 lblWinner.text = user [j].name + "." + user [j].serverName;
                 winner         = user [j];
                 winnerIconButton.GetComponent <Collider> ().enabled = true;
             }
         }
     });
 }
    /// <summary>
    /// 初始化数据(index,1: 圣域战场 2:魔域战场 0:神域战场)
    /// </summary>
    public void initData()
    {
        users = manager.finalInfoList;
        for (int i = 0; i < points.Length; i++)
        {
            GodsWarFinalUserInfo info = new GodsWarFinalUserInfo();
            for (int j = 0; j < users.Count; j++)
            {
                if (users [j].index - 1 == i)
                {
                    info = users [j];
                }
            }
            Utils.RemoveAllChild(points [i].transform);
            GameObject go = NGUITools.AddChild(points [i], userInfoPrefab);
            GodsWarFinalUserInfoItem item = go.transform.GetComponent <GodsWarFinalUserInfoItem> ();
            item.initUI(type, index, info, this);
        }

        OnDataLoadPointInfo();
    }
    /// <summary>
    /// 解析元数据
    /// </summary>
    public void bytesRead(ErlArray erl)
    {
        if (erl.Value.Length == 0)
        {
            return;
        }
        int pos = 0;

        //取得点位id
        localID = StringKit.toInt(erl.Value[pos++].getValueString());

        //取得对战玩家
        players = new GodsWarFinalUserInfo[2];
        for (int i = 0; i < players.Length; i++)
        {
            players[i] = new GodsWarFinalUserInfo();
            players[i].bytesReadTwo(erl.Value[pos++] as ErlArray);
        }

        //取得赢家
        ErlType mp = erl.Value[pos++] as ErlType;

        if (mp is ErlArray)
        {
            winner = new GodsWarFinalUserInfo();
            winner.bytesReadTwo(mp as ErlArray);
        }
        else
        {
            isHaveWinner = -1;
        }

        //取得输家
        for (int i = 0; i < players.Length; i++)
        {
            if (isHaveWinner != -1)
            {
                if (players[i].serverName != winner.serverName || players[i].uid != winner.uid)
                {
                    loser = new GodsWarFinalUserInfo();
                    loser = players[i];
                }
            }
        }

        //取得战报ids
        ErlArray arr = erl.Value[pos++] as ErlArray;

        replayIDs = new string[arr.Value.Length];
        for (int i = 0; i < replayIDs.Length; i++)
        {
            replayIDs[i] = arr.Value[i].getValueString();
        }

        //获得胜利者列表(与战报对应)
        ErlArray tt = erl.Value[pos++] as ErlArray;

        winnerSingle = new GodsWarFinalUserInfo[tt.Value.Length];
        for (int i = 0; i < tt.Value.Length; i++)
        {
            winnerSingle[i] = new GodsWarFinalUserInfo();
            winnerSingle[i].bytesReadTwo(tt.Value[i] as ErlArray);
        }

        //取得被支持的玩家
        ErlType pt = erl.Value[pos++] as ErlType;

        if (pt is ErlArray)
        {
            suporter = new GodsWarFinalUserInfo();
            suporter.bytesReadTwo(pt as ErlArray);
        }
        else
        {
            isSuport = -1;
        }
    }
Example #10
0
    public override void read(ErlKVMessage message)
    {
        ErlType erl = message.getValue("msg") as ErlType;

        if (erl is ErlArray)
        {
            GodsWarFinalPoint           user;
            GodsWarFinalUserInfo        finaluser;
            List <GodsWarFinalUserInfo> fianlInfo;
            List <GodsWarFinalPoint>    infos;

            ErlArray erlarry = erl as ErlArray;
            int      pos     = 0;
            ErlArray array   = erlarry.Value[pos++] as ErlArray;
            if (array.Value.Length > 0)
            {
                fianlInfo = new List <GodsWarFinalUserInfo>();
                for (int i = 0; i < array.Value.Length; i++)
                {
                    finaluser = new GodsWarFinalUserInfo();
                    finaluser.bytesReadFive(array.Value[i] as ErlArray);
                    if (finaluser.uid != null)
                    {
                        fianlInfo.Add(finaluser);
                    }
                }
                if (fianlInfo != null)
                {
                    GodsWarManagerment.Instance.shenMoUserlist = fianlInfo;
                }
            }

            ErlArray tmp = erlarry.Value[pos++] as ErlArray;
            if (tmp.Value.Length > 0)
            {
                infos = new List <GodsWarFinalPoint>();

                for (int j = 0; j < tmp.Value.Length; j++)
                {
                    user = new GodsWarFinalPoint();
                    user.bytesRead(tmp.Value[j] as ErlArray);
                    if (user.localID != 0)
                    {
                        infos.Add(user);
                    }
                }
                if (infos != null)
                {
                    GodsWarManagerment.Instance.shenMoPointlist = infos;
                }
            }

            if (callback != null)
            {
                callback();
            }
        }
        else
        {
            MessageWindow.ShowAlert(erl.getValueString());
            if (callback != null)
            {
                callback = null;
            }
        }
    }
    /// <summary>
    /// 初始化神魔对战点位信息
    /// </summary>
    public void initPointShenMoItem()
    {
        List <GodsWarFinalUserInfo> shenmoUser = GodsWarManagerment.Instance.shenMoUserlist;

        finalPoints = GodsWarManagerment.Instance.shenMoPointlist;
        if (finalPoints != null)
        {
            if (shenmoUser != null)
            {
                for (int i = 0; i < shenmoUser.Count; i++)
                {
                    Utils.RemoveAllChild(pointShenMo [shenmoUser [i].yu_ming - 1].transform);
                    GameObject           go   = NGUITools.AddChild(pointShenMo [shenmoUser [i].yu_ming - 1], shemMoItemPrefab);
                    GodsWarShenMoItem    item = go.GetComponent <GodsWarShenMoItem> ();
                    GodsWarFinalUserInfo user = new GodsWarFinalUserInfo();
                    if (finalPoints.Count > 0)
                    {
                        if (finalPoints[0].isHaveWinner != -1)
                        {
                            user = finalPoints[0].winner;
                        }
                    }
                    if (user.serverName != null)
                    {
                        if (user.serverName == shenmoUser[i].serverName && user.uid == shenmoUser[i].uid)
                        {
                            item.initEnemyInfo(shenmoUser [i].uid, shenmoUser [i].serverName, shenmoUser [i].name, shenmoUser [i].headIcon, type, index, false);
                        }
                        else
                        {
                            item.initEnemyInfo(shenmoUser [i].uid, shenmoUser [i].serverName, shenmoUser [i].name, shenmoUser [i].headIcon, type, index, true);
                        }
                    }
                    else
                    {
                        item.initEnemyInfo(shenmoUser [i].uid, shenmoUser [i].serverName, shenmoUser [i].name, shenmoUser [i].headIcon, type, index, false);
                    }
                    item.fatherWindow = this;
                }
            }
            if (finalPoints [0].replayIDs.Length <= 0)
            {
                if (finalPoints [0].isSuport == -1)
                {
                    zhanOrReplay.gameObject.SetActive(true);
                    zhanOrReplay.textLabel.text = LanguageConfigManager.Instance.getLanguage("godsWar_124");
                    zhanOrReplay.onClickEvent   = doZhanEvent;
                }
                else
                {
                    zhanOrReplay.gameObject.SetActive(false);
                }
            }
            else
            {
                zhanOrReplay.gameObject.SetActive(true);
                zhanOrReplay.textLabel.text = LanguageConfigManager.Instance.getLanguage("godsWar_125");
                zhanOrReplay.onClickEvent   = doRepalyEvent;
            }
        }
    }