Beispiel #1
0
    public override void read(ErlKVMessage message)
    {
        ErlType data = message.getValue("msg") as ErlType;

        if (data != null)
        {
            if (!(data is  ErlArray))
            {
                string str = (data as ErlAtom).Value;
                if (str == "center_logout")
                {
                    MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("mining_no_enemy_team"));
                }
                else if (str == "search_consume_limit")
                {
                    MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("search_consume_limit"));
                }
                else if (str == "none")
                {
                    MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("mining_no_enemy_team"));
                }
                else if (str == "timeout")
                {
                    MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("mining_timeout"));
                }
                else if (str == "rob_close")
                {
                    MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("mining_rob_close"));
                }

                if (this.callback != null)
                {
                    callback(false);
                }
            }
            else
            {
                ErlArray         arr  = data as ErlArray;
                EnemyMineralInfo info = new EnemyMineralInfo();
                int i = 0;
                info.serverName  = arr.Value[i++].getValueString();
                info.playerName  = arr.Value[i++].getValueString();
                info.HeadIconId  = StringKit.toInt(arr.Value[i++].getValueString());
                info.playerLevel = arr.Value[i++].getValueString();
                info.localId     = StringKit.toInt(arr.Value[i++].getValueString());
                info.sid         = StringKit.toInt(arr.Value[i++].getValueString());
                info.combat      = StringKit.toInt(arr.Value[i++].getValueString());
                info.count       = StringKit.toInt(arr.Value[i++].getValueString());
                ErlArray teamInfo = arr.Value[i++] as ErlArray;
                for (int j = 0; j < teamInfo.Value.Length; j++)
                {
                    ErlArray role = teamInfo.Value[j] as ErlArray;
                    info.roles[j] = "0";
                    info.evoLv[j] = "0";
                    if (role != null)
                    {
                        info.roles[j] = role.Value[0].getValueString();
                        info.evoLv[j] = role.Value[1].getValueString();
                    }
                }
                MiningManagement.Instance.AddEnemyMineral(info);
                MiningManagement.Instance.SearchTimes++; //ËÑË÷´ÎÊý¼Ó1
                if (this.callback != null)
                {
                    callback(true);
                }
            }
        }
    }
 public void AddEnemyMineral(EnemyMineralInfo enemyInfo)
 {
     this.enemyMineralInfo = enemyInfo;
 }
    public override void read(ErlKVMessage message)
    {
        ErlType data = message.getValue("msg") as ErlType;

        if (data != null)
        {
            if (!(data is  ErlArray))
            {
                string str = (data as ErlAtom).Value;
                if (str == "none")
                {
                    MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("mining_no_enemy_team"));
                }
                else if (str == "rob_close")
                {
                    MessageWindow.ShowAlert(LanguageConfigManager.Instance.getLanguage("mining_rob_close"));
                }
            }
            else
            {
                ErlArray         arr  = data as ErlArray;
                EnemyMineralInfo info = new EnemyMineralInfo();
                int i = 0;
                info.serverName  = arr.Value [i++].getValueString();
                info.playerName  = arr.Value [i++].getValueString();
                info.HeadIconId  = StringKit.toInt(arr.Value [i++].getValueString());
                info.playerLevel = arr.Value [i++].getValueString();
                info.localId     = StringKit.toInt(arr.Value [i++].getValueString());
                info.sid         = StringKit.toInt(arr.Value [i++].getValueString());
                info.combat      = StringKit.toInt(arr.Value [i++].getValueString());
                //info.count = StringKit.toInt(arr.Value[i++].getValueString());

                ErlList counts = arr.Value [i++] as ErlList;
                for (int j = 0; j < counts.Value.Length; j++)
                {
                    ErlArray arr_1 = counts.Value [j] as ErlArray;
                    if (arr_1.Value [0].getValueString() == "goods")
                    {
                        ErlArray goods = arr_1.Value [1] as ErlArray;
                        info.count = StringKit.toInt(goods.Value [1].getValueString());
                    }
                    else if (arr_1.Value [0].getValueString() == "money")
                    {
                        info.count = StringKit.toInt(arr_1.Value [1].getValueString());
                    }
                }

                ErlArray teamInfo = arr.Value [i++] as ErlArray;
                ErlArray tempArray;
                for (int j = 0; j < teamInfo.Value.Length; j++)
                {
                    //地雷,暂时这么处理
                    tempArray = teamInfo.Value [j] as ErlArray;
                    if (tempArray == null)
                    {
                        info.roles [j] = "0";
                        info.evoLv [j] = "0";
                    }
                    else
                    {
                        info.roles [j] = tempArray.Value [0].getValueString();
                        info.evoLv [j] = tempArray.Value [1].getValueString();
                    }
                }
                MiningManagement.Instance.AddEnemyMineral(info);
                if (this.callback != null)
                {
                    callback();
                }
            }
        }
    }
Beispiel #4
0
    public void ShowEnemyInfo(bool b)
    {
        searchAnim.transform.parent.gameObject.SetActive(false);
        searchAnim.Stop();
        searchMoney.text         = MiningManagement.Instance.GetSearchMineralConsume();
        searchMoney2.text        = MiningManagement.Instance.GetSearchMineralConsume();
        centerOnChild.onFinished = PageTurned;
        if (!b)
        {
            if (pageIndex == 2)
            {
                fightButtonGroup.SetActive(true);
                fightInfo.SetActive(true);
            }

            if (playerRoleInPage3 != null)
            {
                for (int i = 0; i < 5; i++)
                {
                    playerRoleInPage3[i].gameObject.SetActive(true);
                }
            }
            return;
        }



        pageIndex = 2;
        pageObj[2].gameObject.SetActive(true);
        fightButtonGroup.SetActive(true);
        fightInfo.SetActive(true);
        if (playerRoleInPage3 != null)
        {
            for (int i = 0; i < 5; i++)
            {
                playerRoleInPage3[i].gameObject.SetActive(true);
            }
        }
        EnemyMineralInfo enemyInfo = MiningManagement.Instance.GetEnemyMineral();

        ResourcesManager.Instance.LoadAssetBundleTexture(UserManager.Instance.getIconPath(enemyInfo.HeadIconId), enemyIcon);
        enemyLevel.text      = enemyInfo.playerLevel;
        enemyName.text       = enemyInfo.playerName;
        enemyServerName.text = enemyInfo.serverName;
        enemyCombat.text     = enemyInfo.combat.ToString();
        pillageResCount.text = enemyInfo.count.ToString();
        ResourcesManager.Instance.LoadAssetBundleTexture("texture/backGround/" + MiningManagement.Instance.GetMineralBackgroundBySid(enemyInfo.sid), backgorundsInPage[2]);
        int type = MiningManagement.Instance.GetMiningSampleBySid(enemyInfo.sid).type;

        if (type == (int)MiningTypePage.MiningGold)
        {
            pillageResType.spriteName = "gold4";
        }
        else
        {
            pillageResType.spriteName = "gem1";
        }
        HideTeam();

        //		SetShowPage (pageIndex);
        UpdatePageInfo();
    }