private void OnMapCharacterEnter(object sender, MapCharacterEnterResponse response) { Debug.LogFormat("OnMapCharacterEnter:Map:{0} Count:{1}", response.mapId, response.Characters.Count); foreach (var cha in response.Characters) { if (User.Instance.CurrentCharacterInfo == null || (cha.Type == CharacterType.Player && User.Instance.CurrentCharacterInfo.Id == cha.Id)) {//当前角色切换地图 User.Instance.CurrentCharacterInfo = cha; if (User.Instance.CurrentCharacter == null) { User.Instance.CurrentCharacter = new Character(cha); } else { User.Instance.CurrentCharacter.UpdateInfo(cha); } User.Instance.CharacterInited(); CharacterManager.Instance.AddCharacter(User.Instance.CurrentCharacter); continue; } CharacterManager.Instance.AddCharacter(new Character(cha)); } if (CurrentMapId != response.mapId) { this.EnterMap(response.mapId); this.CurrentMapId = response.mapId; } }
void OnCharacterEnter(object sender, MapCharacterEnterResponse response) { Debug.LogFormat("OnCharacterEnter::{0}", response.mapId); NCharacterInfo nCharacterInfo = response.Characters[0]; User.Instance.CurrentCharacter = nCharacterInfo; SceneManager.Instance.LoadScene(DataManager.Instance.Maps[response.mapId].Resource); }
private void OnCharEnterMapa(object sender, MapCharacterEnterResponse message) { Debug.Log(" MapCharacterEnterResponse"); int mapid = message.mapId; Common.Data.MapDefine mapDefine = DataManager.Instance.Maps[mapid]; SceneManager.Instance.LoadScene(mapDefine.Resource); }
private void OnCharacterEnter(object sender, MapCharacterEnterResponse message) { Debug.LogFormat("MapCharacterEnterRequest:{0}", message.mapId); NCharacterInfo info = message.Characters[0]; if (User.Instance.CurrentCharacter == null) { User.Instance.CurrentCharacter = info; } // SceneManager.Instance.LoadScene(DataManager.Instance.Maps[message.mapId].Resource); }
private void OnMapEnter(object sender, MapCharacterEnterResponse message) { foreach (var character in message.Characters) { if (Models.User.Instance.CurrentCharacter == null && character.Id == Models.User.Instance.CurrentCharacterDbId) { Models.User.Instance.CurrentCharacter = character; } CharacterManager.Instance.AddCharcter(character); } if (CurrMapId != message.mapId) { EnterMap(message.mapId); CurrMapId = message.mapId; } }
private void OnMapCharacterEnter(object sender, MapCharacterEnterResponse response) { Debug.LogFormat("OnMapCharacterEnter:Map:{0} Count:{1}", response.mapId, response.Characters.Count); foreach (var cha in response.Characters) { if (User.Instance.CurrentCharacter.Id == cha.Id) {//当前角色切换地图 User.Instance.CurrentCharacter = cha; } CharacterManager.Instance.AddCharacter(cha); } if (CurrentMapId != response.mapId) { this.EnterMap(response.mapId); this.CurrentMapId = response.mapId; } }
private void OnMapCharacterEnter(object sender, MapCharacterEnterResponse message) { Debug.LogFormat("OnMapCharacterEnter:Map:{0} Count:{1}", message.mapId, message.Characters.Count); foreach (var cha in message.Characters) { if (User.Instance.CurrentCharacter == null || (cha.Type == CharacterType.Player && User.Instance.CurrentCharacter.Id == cha.Id)) { User.Instance.CurrentCharacter = cha;//更新角色的其他信息 } //加入角色管理器 CharacterManager.Instance.AddCharacter(cha); //判断是否是当前地图 //不是,进入正确地图,更改当前地图 if (CurrentMapId != message.mapId) { EnterMap(message.mapId); CurrentMapId = message.mapId; } } }
private void OnMapCharacterEnter(object sender, MapCharacterEnterResponse response) { Debug.LogFormat("OnMapCharacterEnter:{0} [{1}]", response.Characters, response.mapId); Debug.Log($"CurrentCharacterID:{User.Instance.CurrentCharacter.Id}"); foreach (NCharacterInfo nCharacter in response.Characters) { Debug.Log($"nCharacterID:{nCharacter.Id}"); if (User.Instance.CurrentCharacter == null || (nCharacter.Type == CharacterType.Player && nCharacter.Id == User.Instance.CurrentCharacter.Id)) { User.Instance.CurrentCharacter = nCharacter; } CharacterManager.Instance.AddCharacter(nCharacter); } if (response.mapId != this.currentMapId) { EnterMap(response.mapId); this.currentMapId = response.mapId; } }
private void OnMapCharacterEnter(object sender, MapCharacterEnterResponse response) { Debug.LogFormat("OnMapCharacterEnter:Map:{0} Count:{1}", response.mapId, response.Characters.Count); foreach (var character in response.Characters) { if (Models.User.Instance.CurrentCharacter.Id == character.Id) { Models.User.Instance.CurrentCharacter = character; } if (CharacterManager.Instance.Characters.ContainsKey(character.Entity.Id)) { CharacterManager.Instance.RemoveCharacter(character.Entity.Id); } CharacterManager.Instance.AddCharacter(character); } if (this.curMapId != response.mapId) { this.EnterMap(response.mapId); this.curMapId = response.mapId; } }
/// <summary> /// this method is automatically called when map service receive a response of /// a character enter map /// </summary> /// <param name="sender"></param> /// <param name="response"></param> private void OnMapCharacterEnter(object sender, MapCharacterEnterResponse response) { Debug.LogFormat("OnMapCharacterEnter:Map:{0} Count:{1}", response.mapId, response.Characters.Count); //update current map if (CurrentMapID != response.mapId) { SwitchMap(response.mapId); CurrentMapID = response.mapId; } foreach (var cha in response.Characters) { //if find user controlled character, update User model if (Models.User.Instance.currentCharacter.Id == cha.Id) { Models.User.Instance.currentCharacter = cha; Debug.LogFormat("the current player is {0}", cha.Name); } //add all the characters in the current map to charactermanager CharacterManager.Instance.AddCharacter(cha); } }