public static string ToLineString(this excel_cha_list excel) { string rst = string.Empty; rst += tostring(excel.id); rst += '\t'; rst += tostring(excel.name); rst += '\t'; rst += tostring(excel.type); rst += '\t'; rst += tostring(excel.race); rst += '\t'; rst += tostring(excel.path); rst += '\t'; rst += tostring(excel.halfSize); rst += '\t'; rst += tostring(excel.portrait); return(rst); }
// cha_list static void init_cha_list(string[] datas) { excel_cha_list excel = new excel_cha_list(); parse_int(datas[0], out excel.id); parse_string(datas[1], out excel.name); parse_int(datas[2], out excel.type); parse_int(datas[3], out excel.race); parse_string(datas[4], out excel.path); parse_float(datas[5], out excel.halfSize); parse_string(datas[6], out excel.portrait); excel_cha_list.Add(excel); }
void OnInitPlayers(byte[] data) { NotifyStartGame startGame = ProtoBufUtils.Deserialize <NotifyStartGame>(data); excel_scn_list scnList = SceneSystem.Instance.mCurrentScene.mScnLists; GameController.mServerStartTime = startGame.ServerStartTime; GameController.mClientStartTime = Time.realtimeSinceStartup; for (int i = 0; i < startGame.Players.Count; ++i) { ScnPlayerInfo playerInfo = startGame.Players[i]; excel_cha_class chaClass = excel_cha_class.Find(mScnLists.temp); if (chaClass == null) { continue; } excel_cha_list chaList = excel_cha_list.Find(chaClass.chaListID); GameObject o = ResourceSystem.Load <GameObject>(chaList.path); if (o != null) { GameObject mainPlayer = GameObject.Instantiate(o); Player player = mainPlayer.GetComponent <Player>(); player.gid = playerInfo.GID; player.UserID = playerInfo.UserID; player.mChaList = chaList; mainPlayer.transform.position = new Vector3(82.51f, 7.25f, 34.82f); mainPlayer.transform.localScale = new Vector3(chaList.scale[0], chaList.scale[1], chaList.scale[2]); mPlayersList.Add(player); mCharacterList.Add(player); mPlayers.Add(player.gid, player); mCharacters.Add(player.gid, player); if (GameController.mUserInfo.uid == playerInfo.UserID) { player.mEvent += TargetChgEvent; MessageSystem.Instance.MsgDispatch(MessageType.OnSetChaClass, chaClass); GameController.OnPlayerInit(player); } } //ResourceSystem.LoadAsync<GameObject>(chaList.path, (obj) => //{ // GameObject o = obj as GameObject; // if (o != null) // { // GameObject mainPlayer = GameObject.Instantiate(o); // Player player = mainPlayer.GetComponent<Player>(); // player.gid = playerInfo.GID; // player.UserID = playerInfo.UserID; // player.mChaList = chaList; // mainPlayer.transform.position = new Vector3(82.51f, 7.25f, 34.82f); // mainPlayer.transform.localScale = new Vector3(chaList.scale[0], chaList.scale[1], chaList.scale[2]); // mPlayersList.Add(player); // mCharacterList.Add(player); // mPlayers.Add(player.gid, player); // mCharacters.Add(player.gid, player); // if (GameController.mUserInfo.uid == playerInfo.UserID) // { // player.mEvent += TargetChgEvent; // MessageSystem.Instance.MsgDispatch(MessageType.OnSetChaClass, chaClass); // GameController.OnPlayerInit(player); // } // } //}); } }