private void OnApplicationClose(INoticeBase <int> obj) { IsKingClientInfo clientInfo = mLocalClient.ClientInfo; Heros.SyncHerosToClient(ref clientInfo); Save(); }
public void InitPlayer() { mLocalClient = new LocalClient(); mLocalClient.Sync(); IsKingClientInfo clientInfo = mLocalClient.ClientInfo; Heros.Init(ref clientInfo); }
public void Init(ref IsKingClientInfo clientInfo) { if (clientInfo.heros == default || clientInfo.heros.Length == 0) { mNewHeros = new int[] { 0, 1, 2, 3, 4, 5, 6, 7 }; Consts.D_PLAYER.DataNotify(Consts.DN_GET_HEROS_ITEMS); } else { SyncHerosFromClient(ref clientInfo); } }
public void SyncHerosFromClient(ref IsKingClientInfo clientInfo) { HeroItem[] heroItems = clientInfo.heros; int max = heroItems.Length; HeroItem item; for (int i = 0; i < max; i++) { item = heroItems[i]; "log".Log("Sync existed hero"); AddHero(item.id, ref item); } }
public void SyncHerosToClient(ref IsKingClientInfo clientInfo) { int max = mHeros.Size; HeroItem item; HeroFields fields; clientInfo.heros = new HeroItem[max]; for (int i = 0; i < max; i++) { item = new HeroItem(); fields = mHeros.GetValueByIndex(i); fields.ParseToHeroItem(ref item); clientInfo.heros[i] = item; } }