private void ReadBorn(XmlElement xml) { XmlNodeList bornList = XmlRead.GetList(xml, "born_pos"); m_dicBornData.Clear(); foreach (XmlNode node in bornList) { XmlElement ele = node as XmlElement; BornData pBorn = DataBase.CreateInstance <BornData>(); pBorn.FromXml(ele); int team = 0; XmlRead.Attr(ele, "team", ref team); if (m_dicBornData.ContainsKey(team)) { m_dicBornData[team].Add(pBorn); } else { m_dicBornData[team] = new List <BornData>() { pBorn }; } } }
private void InitPlayerInfo(MapData pMapData) { Dictionary <int, int> m_dicTeamCount = new Dictionary <int, int>(); for (int i = 0; i < m_stBattleInfo.m_listPlayers.Count; ++i) { PlayerInfo playerInfo = m_stBattleInfo.m_listPlayers[i]; CharacterInstructionData pData = GameGOW.Get().DataMgr.GetCharacterInstructionByID(playerInfo.m_iInstructionID); //pData.default_name = playerInfo.m_strName; CharacterLogic logic = GameGOW.Get().CharacterMgr.CreateCharacter(playerInfo.m_iPlayerUID, pData); if (!m_dicTeamCount.ContainsKey(playerInfo.m_iTeam)) { m_dicTeamCount[playerInfo.m_iTeam] = 0; } BornData pBornData = pMapData.GetBornData(playerInfo.m_iTeam, m_dicTeamCount[playerInfo.m_iTeam]++); logic.Position = new UnityEngine.Vector2(pBornData.pos_x, pBornData.pos_y); logic.m_pInfo.m_iFacing = pBornData.face; logic.m_pInfo.m_iMoveEnergy = playerInfo.m_iMoveEnergy; logic.m_pInfo.m_iAddEnergy = playerInfo.m_iAddEnergy; logic.m_pInfo.m_iMaxMoveEnergy = playerInfo.m_iMoveEnergy; logic.m_pInfo.m_bIsInRound = m_iCurrentRoundPlayerIndex == i; logic.m_pInfo.m_iTeam = playerInfo.m_iTeam; logic.m_pInfo.m_iHP = playerInfo.m_iHP; logic.m_pInfo.m_iMaxHP = playerInfo.m_iHP; AddPlayerResult(playerInfo.m_iPlayerUID, playerInfo.m_iTeam); } m_iPlayerCount = m_stBattleInfo.m_listPlayers.Count; }