コード例 #1
0
        // updates the tab list page items depending on item selected
        private void ResultListView_ItemActivate(Object sender, EventArgs e)
        {
            Console.WriteLine("test fam");
            WebClient client = new WebClient();

            client.Proxy = null;
            Stream       stream = client.OpenRead("http://services.runescape.com/m=itemdb_rs/bestiary/beastData.json?beastid=" + (string)json1[Convert.ToInt32(ResultListView.SelectedItems[0].Index)]["value"]);
            StreamReader reader = new StreamReader(stream);
            var          json   = reader.ReadToEnd();

            json2 = JsonConvert.DeserializeObject <BeastData>(json);
            // Basic Information
            ItemNameLabel.Text    = json2.name;
            DescriptionLabel.Text = json2.description;
            ItemIDLabel.Text      = json2.id.ToString();
            AggresiveLabel.Text   = json2.aggresive.ToString();
            AttackableLabel.Text  = json2.attackable.ToString();
            MembersLabel.Text     = json2.members.ToString();
            // combat stats
            XpLabel.Text         = json2.xp.ToString();
            SlayerCatLabel.Text  = json2.slayercat;
            LevelLabel.Text      = json2.level.ToString();
            WeaknessLabel.Text   = json2.weakness;
            PoisonousLabel.Text  = json2.poisonous.ToString();
            LifePointsLabel.Text = json2.lifepoints.ToString();
            AttackLabel.Text     = json2.attack.ToString();
            RangedLabel.Text     = json2.ranged.ToString();
            MagicLabel.Text      = json2.magic.ToString();
        }
コード例 #2
0
    /// <summary>
    /// 显示神兽信息界面
    /// </summary>
    /// <param name="item"></param>
    /// <param name="playerData"></param>
    /// <param name="beastData"></param>
    private void ShowBeastInfo(IXUIListItem item, PlayerData playerData, BeastData beastData)
    {
        if (item != null && playerData != null && beastData != null)
        {
            item.SetText("NickNameAndLevel/Label_Player_Name", playerData.Name);
            item.SetText("NickNameAndLevel/Label_Player_Level", "LV" + playerData.Level);
            item.SetSprite("Icon/Sprite_Player_Icon", playerData.Icon);
            DataBeastlist beastList = GameData <DataBeastlist> .dataMap[beastData.BeastTypeId];
            if (beastList != null)
            {
                //取得皮肤数据
                DataSuit suit = null;
                GameData <DataSuit> .dataMap.TryGetValue(beastData.BeastTypeId, out suit);

                //神兽名字
                string beastName = string.IsNullOrEmpty(beastList.NickName) ? "" : ("-" + beastList.NickName);
                //神兽皮肤名字
                string beastNickname = (suit == null) ? beastList.Name : suit.Name;
                item.SetText("Label_Beast_Name", string.Format("{0}{1}", beastNickname, beastName));
                //设置神兽皮肤
                IXUIPicture beastSkin = item.GetUIObject("Picture_Beast_Skin") as IXUIPicture;
                if (beastSkin != null)
                {
                    beastSkin.SetVisible(true);
                    beastSkin.SetTexture(string.Format("Texture/Beast/{0}", (suit == null) ? beastList.ModelFile : suit.PicName));
                }
            }
            else
            {
                item.SetVisible(false);
            }
            item.Id = playerData.PlayerId;
            item.SetVisible(true);
        }
    }
コード例 #3
0
ファイル: RoomManager.cs プロジェクト: githuanl/NewBeastGame
        public void ConfirmBeast(long beastId)
        {
            PlayerData playerData = this.GetPlayerData(beastId);
            BeastData  beastData  = this.GetBeastData(beastId);

            if (playerData != null && beastData != null)
            {
                if (this.m_dicPlayerInGameBeastData.ContainsKey(playerData.PlayerId))
                {
                    this.m_dicPlayerInGameBeastData[playerData.PlayerId].Add(beastData);
                }
                else
                {
                    m_log.Error("没有找到玩家ID对应的神兽数据");
                }
                DataBeastlist dataList = null;
                GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataList);

                if (dataList != null)
                {
                    DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.OnRecvChat(playerData.Name, dataList.Name, dataList.NickName, beastData.IsRandom, playerData.CampType);

                    DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.ShowCampTypeEffect(beastId);
                }
            }
        }
コード例 #4
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    public void RefreshSkill(BeastData oBeastData)
    {
        if (base.Prepared)
        {
            if (oBeastData != null)
            {
                if (Singleton <RoomManager> .singleton.RepeatSelectBeastInAllCamp == 0)
                {
                    this.SetSelectBeastId(oBeastData.Id, oBeastData.BeastTypeId);
                }
                else
                {
                    for (int i = 0; i < base.uiBehaviour.m_ourBeastList.Count; i++)
                    {
                        IXUIListItem itemByIndex = base.uiBehaviour.m_ourBeastList.GetItemByIndex(i);
                        BeastData    beastData   = Singleton <RoomManager> .singleton.GetBeastData(itemByIndex.Id);

                        if (oBeastData.Id == beastData.Id)
                        {
                            this.SetSelectBeastId(oBeastData.Id, oBeastData.BeastTypeId);
                        }
                    }
                }
                IXUIListItem item = this.GetCampTypeListItem(oBeastData.Id);
                if (item != null)
                {
                    this.RefreshPlayerInfo(item, oBeastData);
                }
                this.RefreshSkill(oBeastData.Id, oBeastData.Skills);
            }
        }
    }
コード例 #5
0
ファイル: RoomManager.cs プロジェクト: githuanl/NewBeastGame
        /// <summary>
        /// 取得该玩家的神兽数据
        /// </summary>
        /// <param name="beastId"></param>
        /// <returns></returns>
        public BeastData GetBeastData(long beastId)
        {
            BeastData result;

            foreach (var current in this.m_listOurPlayers)
            {
                BeastData beastData = current.Beasts.Find((BeastData data) => data.Id == beastId);
                if (beastData != null)
                {
                    result = beastData;
                    return(result);
                }
            }
            foreach (var current in this.m_listEnemyPlayers)
            {
                BeastData data = current.Beasts.Find((BeastData data1) => data1.Id == beastId);
                if (data != null)
                {
                    result = data;
                    return(result);
                }
            }
            result = null;
            return(result);
        }
コード例 #6
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    /// <summary>
    /// 刷新该item是否被选择,如果选择就播放选择的动画
    /// </summary>
    /// <param name="uiItem"></param>
    /// <param name="unRoleId"></param>
    private void RefreshItemEnable(IXUIListItem uiItem, long unRoleId)
    {
        if (uiItem != null)
        {
            bool      enableSelect = false;
            BeastData beastData    = Singleton <RoomManager> .singleton.GetBeastData(unRoleId);

            if (beastData != null && beastData.PlayerId == Singleton <PlayerRole> .singleton.ID)
            {
                switch (Singleton <RoomManager> .singleton.BeastSelectType)
                {
                case EGameBeastSelectType.GAME_BEAST_SELECT_TYPE_MATCH:
                    enableSelect = true;
                    break;

                case EGameBeastSelectType.GAME_BEAST_SELECT_TYPE_RANK:
                    //if (this.m_unTurnRoleId == unRoleId || beastData.HTypeId > 0u)
                    //{
                    //     enableSelect = true;
                    // }
                    break;
                }
            }
            uiItem.SetEnableSelect(enableSelect);
        }
    }
コード例 #7
0
        //private static void MakeMove(MoveData data)
        //{
        //	MoveType move = (MoveType)Activator.CreateInstance(Type.GetType(data.MoveType), data);
        //	move.OnUse();
        //}

        private static void ReadBeastData(XmlNode root)
        {
            BeastData data = new BeastData
            {
                dataName    = currentPack.Name + "." + GetContent(root, "dataName"),
                Name        = GetContent(root, "Name"),
                Description = GetContent(root, "Description"),
                ModelClass  = GetValidClass(GetContent(root["Model"], "class", "BeastModel")),
                ModelProps  = root["Model"]["modelProps"]
            };

            //Adjust texture path for model
            foreach (XmlNode node in data.ModelProps["textures"].ChildNodes)
            {
                node.InnerText = Path.Combine(currentPack.TexturesFolder, "Beasts", node.InnerText + ".png");
            }

            //Essences
            data.Essences = new List <string>();
            foreach (XmlNode node in root["Essences"].ChildNodes)
            {
                data.Essences.Add(Constants.GetValid("Essence_" + node.InnerXml));
            }

            //Stats
            data.Stats = new Dictionary <string, Stat>();
            foreach (XmlNode node in root["Stats"].ChildNodes)
            {
                try
                {
                    Stat temp = new Stat(float.Parse(GetContent(node, "Base")), GetContent(node, "Grade", "Grade"));
                    data.Stats.Add("Stat_" + node.Name, temp);
                }
                catch (ArgumentException e)
                {
                    Debug.LogWarningFormat("Stats in {0} contains duplicate entry.\n" + e, data.dataName);
                }
            }

            //LearnSet
            //TODO: allow support for inheriting from previous xmute stages (which is a WHOLE OTHER BEAST)
            data.LearnSet = new SortedDictionary <int, string>();
            foreach (XmlNode node in root["LearnSet"].ChildNodes)
            {
                try
                {
                    //TODO: Allow specifying in the XML what namespace to use
                    data.LearnSet.Add(int.Parse(GetContent(node, "level")), currentPack.Name + "." + GetContent(node, "dataName"));
                }
                catch (ArgumentException e)
                {
                    Debug.LogWarningFormat("Tried to add duplicate entry {0} into {1}'s learnset.\n" + e, GetContent(node, "dataName"), data.dataName);
                }
            }

            Database <BeastData> .Add(data);
        }
コード例 #8
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    /// <summary>
    /// 选择该神兽
    /// </summary>
    /// <param name="unBeastMarkId"></param>
    public void SelectRole(long unBeastMarkId)
    {
        if (unBeastMarkId != 0 && base.Prepared)
        {
            //根据神兽id取得我方神兽列表中的item,如果不为为空就选中该item
            IXUIListItem itemId = base.uiBehaviour.m_ourBeastList.GetItemById(unBeastMarkId);
            if (itemId != null)
            {
                base.uiBehaviour.m_ourBeastList.SetSelectedItemById(unBeastMarkId);
            }
            else
            {
                //如果为空,就去敌方列表中找,找到选中
                itemId = base.uiBehaviour.m_enmeyBeastList.GetItemById(unBeastMarkId);
                if (itemId != null)
                {
                    base.uiBehaviour.m_enmeyBeastList.SetSelectedItemById(unBeastMarkId);
                }
            }
            BeastData beastData = Singleton <RoomManager> .singleton.GetBeastData(unBeastMarkId);

            if (beastData != null)
            {
                //显示技能
                //this.ShowAllSkill(beastData.BeastTypeId);
                //刷新神兽选择列表的状态
                this.RefreshBeastSelectStatus();
                //显示选择后的神兽信息
                this.ShowBeastInfo(beastData.BeastTypeId);
                //刷新装备
                this.RefreshEquip(beastData.Id, beastData.BeastTypeId);
                //刷新提示
                this.RefreshTip(unBeastMarkId);
                if (Singleton <RoomManager> .singleton.IsObserver)
                {
                    this.ShowBeastSelect();
                }
                else
                {
                    //如果已经被选择的话,就显示皮肤选择界面
                    if (beastData.IsSelected)
                    {
                        this.ShowSkinSelect();
                        base.uiBehaviour.m_BeastList.SetVisible(false);
                    }
                    //否则显示神兽界面选择
                    else
                    {
                        this.ShowBeastSelect();
                    }
                }
                this.IsSelected             = beastData.IsSelected;
                this.m_nCurEquipSelectIndex = beastData.EquipIndex;
            }
        }
    }
コード例 #9
0
ファイル: Beast.cs プロジェクト: bianchengxiaobei/BeastGame
    public Beast(BeastData beastData)
    {
        if (null == beastData)
        {
            this.m_bIsErrorBeast = true;
            this.m_skillManager  = new SkillGameManager(0);
        }
        else
        {
            this.m_bIsErrorBeast = false;
            DataBeastlist dataBeast = null;
            GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataBeast);

            if (dataBeast != null)
            {
                this.MaxMoveDis = dataBeast.Move;
                this.Hp         = dataBeast.Hp;
                if (dataBeast.Skill_1 > 0)
                {
                    this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_1);
                }
                if (dataBeast.Skill_2 > 0)
                {
                    this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_2);
                }
                if (dataBeast.Skill_3 > 0)
                {
                    this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_3);
                }
                if (dataBeast.Skill_4 > 0)
                {
                    this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_4);
                }
            }
            else
            {
                this.m_log.Error(string.Format("null == beastConfig: beastData.BeastTypeId=:{0}", beastData.BeastTypeId));
            }
            this.m_unBeastId     = beastData.Id;
            this.m_unPlayerId    = beastData.PlayerId;
            this.m_dwBeastTypeId = beastData.BeastTypeId;
            this.m_eCampType     = beastData.CampType;
            this.m_unHp          = beastData.Hp;
            this.m_suitId        = beastData.SuitId;
            this.m_skillManager  = new SkillGameManager(this.m_unBeastId);
            this.m_skillManager.AddSkill(1, false);
            foreach (var skillData in beastData.Skills)
            {
                this.m_skillManager.AddSkill(skillData, false, ESkillActivateType.SKILL_ACTIVATE_TYPE_INVALID);
            }
        }
    }
コード例 #10
0
ファイル: RoomManager.cs プロジェクト: githuanl/NewBeastGame
        /// <summary>
        /// 根据神兽ID取得神兽对应的头像Icon
        /// </summary>
        /// <param name="beastId"></param>
        /// <returns></returns>
        public string GetBeastIcon(long beastId)
        {
            BeastData beastData = this.GetBeastData(beastId);
            string    result    = string.Empty;

            if (beastData != null)
            {
                DataBeastlist beastList = GameData <DataBeastlist> .dataMap[beastData.BeastTypeId];
                if (beastList != null)
                {
                    result = beastList.IconFile;
                }
            }
            return(result);
        }
コード例 #11
0
    /// <summary>
    /// 根据神兽数据创建神兽,加入到缓存m_dicAllBeastId字典中
    /// </summary>
    /// <param name="beastData">神兽数据</param>
    /// <returns></returns>
    public Beast CreateBeast(BeastData beastData)
    {
        Beast beast = new Beast(beastData);

        if (beast != null)
        {
            this.m_dicAllBeastId[beast.Id] = beast;
            beast.SetVisible(false);
        }
        else
        {
            this.m_log.Error("beast == null");
        }
        return(beast);
    }
コード例 #12
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    private void RefreshPlayerInfo(IXUIListItem item, BeastData beast)
    {
        //DataBeastlist dataBeast = GameData<DataBeastlist>.dataMap[beast.BeastTypeId];
        DataBeastlist dataBeast = null;

        GameData <DataBeastlist> .dataMap.TryGetValue(beast.BeastTypeId, out dataBeast);

        IXUISprite icon = item.GetUIObject("Sprite_Icon") as IXUISprite;

        if (dataBeast != null)
        {
            //如果是自己的阵营,就显示头像。地方就显示随机头像
            if (beast.CampType == Singleton <PlayerRole> .singleton.CampType)
            {
                icon.SetSprite(dataBeast.IconFile, UIManager.singleton.GetAtlasName(EnumAtlasType.Beast, dataBeast.IconFile));
            }
            else
            {
                //icon.SetSprite("Window");
                icon.SetSprite(dataBeast.IconFile, UIManager.singleton.GetAtlasName(EnumAtlasType.Beast, dataBeast.IconFile));
            }
        }
        else
        {
            if (beast.BeastTypeId == this.m_unRandomBeastID)
            {
                icon.SetSprite("9");
            }
        }
        bool     visible   = Singleton <RoomManager> .singleton.IsObserver || Singleton <PlayerRole> .singleton.CampType == beast.CampType;
        IXUIList equipList = item.GetUIObject("List_Equip") as IXUIList;

        if (equipList != null)
        {
        }
        else
        {
            XLog.Log.Error("null == uiListEquip");
        }
        this.RefreshItemEnable(item, beast.Id);
        IXUIObject uiObject = item.GetUIObject("Texture_Shadow");

        if (uiObject != null)
        {
            uiObject.SetVisible(false);
        }
        item.Id = beast.Id;
    }
コード例 #13
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    /// <summary>
    /// 是否能选择其他神兽,如果选择过了就不能再次选择
    /// </summary>
    /// <returns>true表示选择过了,false表示没有</returns>
    private bool CanSelectOtherBeast()
    {
        IXUIListItem selectItem = base.uiBehaviour.m_ourBeastList.GetSelectedItem();
        bool         result;

        if (selectItem == null)
        {
            result = false;
        }
        else
        {
            BeastData beastData = Singleton <RoomManager> .singleton.GetBeastData(selectItem.Id);

            result = (beastData != null && beastData.IsSelected);
        }
        return(result);
    }
コード例 #14
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    /// <summary>
    /// 我方的玩家选择神兽
    /// </summary>
    /// <param name="item"></param>
    /// <returns></returns>
    private bool OnListOurBeastSelect(IXUIListItem item)
    {
        bool result;

        if (item == null || item.Id == 0u)
        {
            result = false;
        }
        else
        {
            this.m_lBeastIdCurrent = item.Id;
            BeastData data = Singleton <RoomManager> .singleton.GetBeastData(this.m_lBeastIdCurrent);

            this.SelectRole(this.m_lBeastIdCurrent);
            result = true;
        }
        return(result);
    }
コード例 #15
0
        public void ConfirmBeast(long beastId)
        {
            PlayerData playerData = this.GetPlayerData(beastId);
            BeastData  beastData  = this.GetBeastData(beastId);

            if (playerData != null && beastData != null)
            {
                DataBeastlist dataList = null;
                GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataList);

                if (dataList != null)
                {
                    DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.OnRecvChat(playerData.Name, dataList.Name, dataList.NickName, beastData.IsRandom, playerData.CampType);

                    DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.ShowCampTypeEffect(beastId);
                }
            }
        }
コード例 #16
0
ファイル: RoomManager.cs プロジェクト: githuanl/NewBeastGame
 /// <summary>
 /// 根据玩家的神兽Id取得玩家信息
 /// </summary>
 /// <param name="beastId"></param>
 /// <returns></returns>
 private PlayerData GetPlayerData(long beastId)
 {
     foreach (var playerOur in this.m_listOurPlayers)
     {
         BeastData beastData = playerOur.Beasts.Find((BeastData beast) => beast.Id == beastId);
         if (beastData != null)
         {
             return(playerOur);
         }
     }
     foreach (var playerEnemy in this.m_listEnemyPlayers)
     {
         BeastData beastData = playerEnemy.Beasts.Find((BeastData data) => data.Id == beastId);
         if (beastData != null)
         {
             return(playerEnemy);
         }
     }
     return(null);
 }
コード例 #17
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
 private void RefreshPlayerInfo(IXUIListItem uiListItem, PlayerData playerData, BeastData beast, ECampType eCampType)
 {
     if (beast != null)
     {
         this.SetSelectBeastId(beast.Id, beast.BeastTypeId);
         Debug.Log("Our BeastId:" + beast.Id);
         if (playerData != null && uiListItem != null)
         {
             uiListItem.Clear();
             IXUILabel label = uiListItem.GetUIObject("Label_PlayerName") as IXUILabel;
             if (label != null)
             {
                 label.SetText(playerData.Name);
             }
             if (Singleton <RoomManager> .singleton.MathMode != EnumMathMode.EnumMathMode_Story)
             {
                 uiListItem.SetText("Label_Sequence", GetSequence(eCampType, uiListItem.Index).ToString());
             }
             this.RefreshPlayerInfo(uiListItem, beast);
         }
     }
 }
コード例 #18
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    /// <summary>
    /// 刷新操作提示,比如请选择神兽,确认装备等
    /// </summary>
    /// <param name="unBeastId"></param>
    public void RefreshTip(long unBeastId)
    {
        string strId = string.Empty;

        if (Singleton <RoomManager> .singleton.IsObserver)
        {
            strId = "DlgRoom.IsObservering";
        }
        else
        {
            strId = "DlgRoom.PleaseSelectHero";
            if (0 != unBeastId)
            {
                BeastData beastData = Singleton <RoomManager> .singleton.GetBeastData(unBeastId);

                if (beastData != null && beastData.IsSelected)
                {
                    strId = "DlgRoom.FinishHeroSelect";
                }
            }
        }
        base.uiBehaviour.m_Label_Tips.SetText(StringConfigMgr.GetString(strId));
    }
コード例 #19
0
ファイル: Player.cs プロジェクト: bianchengxiaobei/BeastGame
    public Player(PlayerData playerData)
    {
        if (null != playerData)
        {
            this.m_bIsErrorPlayer = false;
            this.m_unPlayerId     = playerData.PlayerId;
            this.m_eCampType      = playerData.CampType;
            this.m_strPlayerName  = playerData.Name;
            this.m_bIsLostConnect = playerData.IsReconnect;
            this.m_bIsRole        = (Singleton <PlayerRole> .singleton.ID == this.m_unPlayerId);
            this.m_listBeastId.Clear();
            for (int i = 0; i < playerData.Beasts.Count; i++)
            {
                BeastData beastData = playerData.Beasts[i];
                this.m_listBeastId.Add(beastData.Id);
                Beast beast = Singleton <BeastManager> .singleton.CreateBeast(beastData);

                if (null != beast)
                {
                }
            }
        }
    }
コード例 #20
0
ファイル: RoomManager.cs プロジェクト: githuanl/NewBeastGame
        public void RecvConfirmBeast(long beastId)
        {
            BeastData data = Singleton <RoomManager> .singleton.GetBeastData(beastId);

            if (data != null)
            {
                data.IsSelected = true;
                if (data.IsRandom)
                {
                    if (data.PlayerId == Singleton <PlayerRole> .singleton.ID)
                    {
                        DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.IsSelected = data.IsSelected;
                    }
                }
                else
                {
                    this.ConfirmBeast(beastId);
                }
                if (data.PlayerId == Singleton <PlayerRole> .singleton.ID)
                {
                    DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.ShowCurSelectRole();
                }
            }
        }
コード例 #21
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    private void ShowCampTypeEffect(IXUIListItem item)
    {
        if (item != null)
        {
            bool      flag      = true;
            BeastData beastData = Singleton <RoomManager> .singleton.GetBeastData(item.Id);

            if (beastData != null && beastData.BeastTypeId > -1 && beastData.IsSelected)
            {
                flag = false;
            }
            IXUISprite mask = item.GetUIObject("UnSelectMask") as IXUISprite;
            if (mask != null)
            {
                bool flag1 = item.Id > 0 && flag;
                if (flag1 && Singleton <RoomManager> .singleton.BeastSelectType == EGameBeastSelectType.GAME_BEAST_SELECT_TYPE_RANK && this.m_lBeastIdCurrent != item.Id)
                {
                    flag1 = false;
                }
                mask.SetVisible(flag1);
            }
            else
            {
                Debug.Log("mask == null");
            }
            if (item.Id == this.m_lBeastIdCurrent)
            {
                this.IsSelected = !flag;
                this.RefreshTip(item.Id);
                if (!flag && !Singleton <RoomManager> .singleton.IsObserver)
                {
                    this.ShowSkinSelect();
                }
            }
        }
    }
コード例 #22
0
ファイル: DlgRoom.cs プロジェクト: githuanl/NewBeastGame
    /// <summary>
    /// 是否成功选择神兽,如果成功就返回神兽的TypeID
    /// </summary>
    /// <param name="unBeastTypeId"></param>
    /// <returns></returns>
    private bool IsSucSelectBeast(ref int unBeastTypeId)
    {
        if (Singleton <RoomManager> .singleton.IsObserver)
        {
            return(true);
        }
        if (Singleton <RoomManager> .singleton.EGamePhase == EGamePhase.GAME_PHASE_BANNING)
        {
            return(true);
        }
        IXUIListItem selectItem = base.uiBehaviour.m_ourBeastList.GetSelectedItem();

        if (selectItem == null)
        {
            //这里要处理错误提示信息
            return(false);
        }
        BeastData beastData = Singleton <RoomManager> .singleton.GetBeastData(selectItem.Id);

        if (beastData == null)
        {
            return(false);
        }
        if (beastData.IsSelected)
        {
            unBeastTypeId = beastData.BeastTypeId;
            return(false);
        }
        if (this.m_unRandomBeastID == unBeastTypeId)
        {
            return(true);
        }
        bool flag = false;

        //可以和对方重复选择一个神兽
        if (Singleton <RoomManager> .singleton.RepeatSelectBeastInAllCamp == 1)
        {
            flag = true;
            for (int i = 0; i < base.uiBehaviour.m_ourBeastList.Count; i++)
            {
                IXUIListItem itemByIndex = base.uiBehaviour.m_ourBeastList.GetItemByIndex(i);
                BeastData    data        = Singleton <RoomManager> .singleton.GetBeastData(itemByIndex.Id);

                //如果队友选了这个神兽,自己就不能再选择
                if (data.BeastTypeId == unBeastTypeId)
                {
                    flag = false;
                }
            }
        }
        foreach (var current in this.m_dicRoleSelectBeastID)
        {
            if (flag)
            {
                break;
            }
            if (current.Value > 0u && current.Value == unBeastTypeId)
            {
                if (selectItem.Id == current.Key)
                {
                    return(false);
                }
                unBeastTypeId = beastData.BeastTypeId;
                BeastData otherBeastData = Singleton <RoomManager> .singleton.GetBeastData(current.Key);

                if (otherBeastData.PlayerId == beastData.PlayerId)
                {
                    //说明自己选择过了
                }
                else
                {
                    //重复选择神兽
                }
                return(false);
            }
        }
        return(true);
    }
コード例 #23
0
ファイル: RoomManager.cs プロジェクト: githuanl/NewBeastGame
        /// <summary>
        /// 玩家进入房间,初始化房间内所有玩家的数据
        /// </summary>
        /// <param name="ulRoomId"></param>
        /// <param name="oEmpireMemberList"></param>
        /// <param name="oLeagueMemberList"></param>
        /// <param name="uMapid"></param>
        public void OnPlayerEnter(long ulRoomId, List <CRoomMemberData> oEmpireMemberList, List <CRoomMemberData> oLeagueMemberList, uint uMapid)
        {
            this.m_ulRoomId = ulRoomId;
            this.m_unMapId  = uMapid;
            List <PlayerData> empireList = new List <PlayerData>();
            List <PlayerData> leagueList = new List <PlayerData>();

            //初始化empire方的玩家信息
            for (int i = 0; i < oEmpireMemberList.Count; i++)
            {
                CRoomMemberData data       = oEmpireMemberList[i];
                PlayerData      playerData = new PlayerData(data.m_unPlayerID, ECampType.CAMP_EMPIRE);
                //初始化角色姓名,头像,等级
                playerData.Name  = data.m_strName;
                playerData.Icon  = data.m_strIcon;
                playerData.Level = data.m_unLevel;
                //初始化角色拥有的神兽信息
                for (int j = 0; j < data.m_lBeastList.Count; j++)
                {
                    BeastData beastData = new BeastData(playerData.PlayerId, data.m_lBeastList[j], ECampType.CAMP_EMPIRE);
                    playerData.Beasts.Add(beastData);
                }
                //如果房间内的玩家刚好是自己本身,这说明没有重连
                if (data.m_unPlayerID == Singleton <PlayerRole> .singleton.ID)
                {
                    Singleton <PlayerRole> .singleton.CampType = ECampType.CAMP_EMPIRE;
                    playerData.IsReconnect = false;
                }
                //如果不是自己,则判断重连标记是否等1,是的话就是重连
                else
                {
                    playerData.IsReconnect = (data.m_btIsReconnecting == 1);
                }
                empireList.Add(playerData);
                this.m_dicPlayerInGameBeastData[data.m_unPlayerID] = new List <BeastData>();
            }
            //再初始化league方玩家的信息
            for (int i = 0; i < oLeagueMemberList.Count; i++)
            {
                CRoomMemberData data       = oLeagueMemberList[i];
                PlayerData      playerData = new PlayerData(data.m_unPlayerID, ECampType.CAMP_LEAGUE);
                //初始化角色姓名,头像,等级
                playerData.Name  = data.m_strName;
                playerData.Icon  = data.m_strIcon;
                playerData.Level = data.m_unLevel;
                Debug.Log("BeastList:" + data.m_lBeastList.Count);
                //初始化角色拥有的神兽信息
                for (int j = 0; j < data.m_lBeastList.Count; j++)
                {
                    Debug.Log("init beastdata");
                    BeastData beastData = new BeastData(playerData.PlayerId, data.m_lBeastList[j], ECampType.CAMP_LEAGUE);
                    playerData.Beasts.Add(beastData);
                }
                //如果房间内的玩家刚好是自己本身,初始化自身的阵营
                if (data.m_unPlayerID == Singleton <PlayerRole> .singleton.ID)
                {
                    Singleton <PlayerRole> .singleton.CampType = ECampType.CAMP_LEAGUE;
                    playerData.IsReconnect = false;
                }
                else
                {
                    playerData.IsReconnect = (data.m_btIsReconnecting == 1);
                }
                leagueList.Add(playerData);
                this.m_dicPlayerInGameBeastData[data.m_unPlayerID] = new List <BeastData>();
            }
            if (ECampType.CAMP_LEAGUE == Singleton <PlayerRole> .singleton.CampType)
            {
                this.m_listOurPlayers   = leagueList;
                this.m_listEnemyPlayers = empireList;
            }
            else
            {
                this.m_listEnemyPlayers = leagueList;
                this.m_listOurPlayers   = empireList;
            }
            DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.Refresh();
        }
コード例 #24
0
ファイル: RoomManager.cs プロジェクト: githuanl/NewBeastGame
        /// <summary>
        /// 玩家确认选择该神兽
        /// </summary>
        /// <param name="unRoleId"></param>
        /// <param name="unBeastTypeId"></param>
        /// <param name="unBeastLevel"></param>
        /// <param name="oSkillList"></param>
        /// <param name="btIsRandom"></param>
        /// <param name="nSuitId"></param>
        public void OnPlayerSelectBeast(long unRoleId, int unBeastTypeId, int unBeastLevel, ref List <int> oSkillList, byte btIsRandom, int nSuitId)
        {
            BeastData beastData = null;

            foreach (var current in this.m_listEnemyPlayers)
            {
                for (int i = 0; i < current.Beasts.Count; i++)
                {
                    BeastData beast = current.Beasts[i];
                    if (beast.Id == unRoleId)
                    {
                        beastData         = beast;
                        beast.BeastTypeId = unBeastTypeId;
                        beast.BeastLevel  = unBeastLevel;
                        beast.IsRandom    = (btIsRandom > 0);
                        beast.SuitId      = nSuitId;
                        beast.Skills.Clear();
                        foreach (var skill in oSkillList)
                        {
                            SkillGameData data = new SkillGameData(skill);
                            beast.Skills.Add(data);
                        }
                    }
                }
            }
            foreach (var current in this.m_listOurPlayers)
            {
                for (int i = 0; i < current.Beasts.Count; i++)
                {
                    BeastData beast = current.Beasts[i];
                    if (beast.Id == unRoleId)
                    {
                        beastData         = beast;
                        beast.BeastTypeId = unBeastTypeId;
                        beast.BeastLevel  = unBeastLevel;
                        beast.IsRandom    = (btIsRandom > 0);
                        beast.SuitId      = nSuitId;
                        beast.Skills.Clear();
                        foreach (var skill in oSkillList)
                        {
                            SkillGameData data = new SkillGameData(skill);
                            beast.Skills.Add(data);
                        }
                    }
                }
            }
            if (beastData != null)
            {
                if (!beastData.IsRandom)
                {
                    DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.RefreshPlayerInfo(beastData);

                    if (beastData.Id == DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.CurSelectBeastId)
                    {
                    }
                }
                if (beastData.PlayerId == Singleton <PlayerRole> .singleton.ID)
                {
                    CBeastData data = new CBeastData(unBeastTypeId, 0, unBeastLevel, nSuitId);
                    data.m_oSkillList.AddRange(oSkillList);
                    data.m_oSuitList.Add(nSuitId);
                    Singleton <PlayerRole> .singleton.AddTempBeastData(data);
                }
            }
            else
            {
                this.m_log.Error("null == beastDataCur:unBeastId:" + unRoleId);
            }
            BeastData beastData1 = this.GetBeastData(unRoleId);

            if (beastData.PlayerId == Singleton <PlayerRole> .singleton.ID)
            {
                //刷新技能
                DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.RefreshSkill(beastData1);
            }
        }