private void ModelView() { { var __list3 = Characters; var __listCount3 = __list3.Count; for (var __i3 = 0; __i3 < __listCount3; ++__i3) { var model = __list3[__i3]; { if (null != model) { model.Destroy(); } } } } Characters.Clear(); var controllerBase = UIManager.Instance.GetController(UIConfig.TeamFrame); if (controllerBase == null) { return; } var teamData = controllerBase.GetDataModel("") as TeamDataModel; if (teamData == null) { return; } for (var i = 0; i < 5; i++) { var one = teamData.TeamList[i]; if (one.Level == 0) { continue; } var i1 = i; one.Equips[12] = -1; Characters.Add(ObjFakeCharacter.Create(one.TypeId, one.Equips, character => { var xform = character.gameObject.transform; xform.parent = TeamMemberCellLogics[i1].ModelRoot.transform; xform.localPosition = new Vector3(0f, -110f, 0f); xform.localScale = new Vector3(138, 138, 138); xform.forward = Vector3.back; xform.gameObject.SetLayerRecursive(LayerMask.NameToLayer(GAMELAYER.UI)); }, LayerMask.NameToLayer(GAMELAYER.UI))); } }
private void RefreshModel() { var info = PlayerDataManager.Instance.BattleUnionMaster; if (null == info) { return; } var dataId = info.TypeId; var objId = info.Id; var equip = info.EquipsModel; var name = info.Name; var allianceName = string.Empty; var battleDic = PlayerDataManager.Instance._battleCityDic; foreach (var item in battleDic) { if (item.Value.Type == 0) { allianceName = item.Value.Name; break; } } /* * var info = ObjManager.Instance.MyPlayer; * var dataId = info.GetDataId(); * var objId = info.GetObjId(); * var equip = info.EquipList; * var name = info.Name; * var allianceName = "WWWWW"; */ if (mFackeCharacter != null) { mFackeCharacter.Destroy(); } mFackeCharacter = ObjFakeCharacter.Create(dataId, equip, character => { if (null == mFackeCharacter) { character.Destroy(); return; } if (character.GetObjId() != mFackeCharacter.GetObjId()) { character.Destroy(); return; } var collider = character.gameObject.AddComponent <CapsuleCollider>(); collider.center = new Vector3(0, 1, 0); collider.height = 2; //character.transform.parent = transform; character.transform.position = gameObject.transform.position + Offset; character.transform.forward = Quaternion.Euler(ForwardAngle.x, ForwardAngle.y, ForwardAngle.z) * Vector3.forward; character.transform.localScale = Scale; //var anis = character.gameObject.GetComponentsInChildren<Animation>(); //StartCoroutine(StopAni(0.8f)); var titles = new Dictionary <int, string>(); titles.Add(2000, allianceName); titles.Add(5000, allianceName); character.CreateNameBoard(name, titles); }, 0, false, -1, objId); mFackeCharacter.SetObjId(objId); //mFackeCharacter.OnWingLoadedCallback = OnWingLoaded; mFackeCharacter.gameObject.layer = LayerMask.NameToLayer("ObjLogic"); }
//�ӳ���ObjCharacter private void CreateChar(int dataId, bool bsync, Dictionary <int, int> dictEquip = null, Action <ObjFakeCharacter> callback = null, int elfId = -1, int layer = 5) { if (null != BackgroundWidget) { if (null != BackgroundWidget.drawCall) { CustomRenderQueue = BackgroundWidget.drawCall.renderQueue + +1; CustomRenderQueue += BackgroundWidget.SkippedRenderQueue / 2; } } Character = ObjFakeCharacter.Create(dataId, dictEquip, character => { if (Character.GetObjId() != character.GetObjId()) { character.Destroy(); return; } var xform = Character.gameObject.transform; //Character.gameObject.SetLayerRecursive(LayerMask.NameToLayer(GAMELAYER.UI)); xform.parent = gameObject.transform; xform.localPosition = Vector3.zero; xform.localScale = Vector3.one; xform.forward = Vector3.back; if (null != callback) { callback(Character); if (-1 != elfId) { if (null == ElfCreator) { ElfCreator = gameObject.AddComponent <CreateFakeCharacter>(); ElfCreator.CustomRenderQueue = CustomRenderQueue; } ElfCreator.DestroyFakeCharacter(); var tbElf = Table.GetElf(elfId); if (tbElf == null) { return; } var elfDataId = tbElf.ElfModel; var tableCharacter = Table.GetCharacterBase(elfDataId); if (null == tableCharacter) { return; } var tempUniqueId = UniqueId; ElfCreator.Create(elfDataId, null, elf => { if (character.State == ObjState.Deleted) { elf.Destroy(); return; } if (!gameObject.active) { ElfCreator.Character = null; elf.Destroy(); return; } if (null == Character) { ElfCreator.Character = null; elf.Destroy(); return; } // if (tempUniqueId != UniqueId) // { // ElfCreator.Character = null; // elf.Destroy(); // return; // } var t = elf.gameObject.transform; t.parent = Character.gameObject.transform.parent; t.forward = Vector3.back; //var angle = Character.gameObject.transform.localRotation.eulerAngles.y - 90.0f; var scale = tbElf.CameraZoom * 0.0001f; if (scale <= 0) { Logger.Debug("!!!tbElf.CameraZoom<=0"); scale = 1; } var heightOffset = tbElf.Offset * 0.0001f; var temp = ElfOffset + new Vector3(0, heightOffset, 0f); t.localPosition = temp; t.localScale = Vector3.one * scale; t.parent = Character.gameObject.transform.parent; }, -1, false, layer); } } }, layer, bsync, CustomRenderQueue, UniqueId++); }
private void RefreshModel() { var info = PlayerDataManager.Instance.BattleMishiMaster; if (null == info) { if (null != mFackeCharacter) { mFackeCharacter.Destroy(); mFackeCharacter.OnWingLoadedCallback = null; mFackeCharacter = null; } return; } var dataId = info.TypeId; var objId = info.Id; var equip = info.EquipsModel; var name = String.Format(GameUtils.GetDictionaryText(300000059), info.Name); /* * var info = ObjManager.Instance.MyPlayer; * var dataId = info.GetDataId(); * var objId = info.GetObjId(); * var equip = info.EquipList; * var name = info.Name; * var allianceName = "WWWWW"; */ if (mFackeCharacter != null) { mFackeCharacter.Destroy(); } mFackeCharacter = ObjFakeCharacter.Create(dataId, equip, character => { if (null == mFackeCharacter) { character.Destroy(); return; } if (character.GetObjId() != mFackeCharacter.GetObjId()) { character.Destroy(); return; } var collider = character.gameObject.AddComponent <CapsuleCollider>(); collider.center = new Vector3(0, 1, 0); collider.height = 2; //character.transform.parent = transform; character.transform.position = gameObject.transform.position + Offset; character.transform.forward = Quaternion.Euler(ForwardAngle.x, ForwardAngle.y, ForwardAngle.z) * Vector3.forward; character.transform.localScale = Scale; //var anis = character.gameObject.GetComponentsInChildren<Animation>(); //StartCoroutine(StopAni(0.8f)); character.CreateNameBoard(name); }, 0, false, -1, objId); mFackeCharacter.SetObjId(objId); //mFackeCharacter.OnWingLoadedCallback = OnWingLoaded; mFackeCharacter.gameObject.layer = LayerMask.NameToLayer("ObjLogic"); mFackeCharacter.iType = (int)eFakeCharacterTypeDefine.MieShiFakeCharacterType; }
private void RefreshModel(PlayerInfoMsg info) { if (ObjManager.Instance.ObjPool.ContainsKey((ulong)GetNpcObjId(professionIndex))) { ObjManager.Instance.RemoveObj((ulong)GetNpcObjId(professionIndex)); } if (null == info) { var init = new InitNPCData(); var npcId = GetNpcId(professionIndex); var tbSceneNpc = Table.GetSceneNpc(npcId); if (null == tbSceneNpc) { return; } var tbNpc = Table.GetNpcBase(tbSceneNpc.DataID); if (null == tbNpc) { return; } var tbCharacterBase = Table.GetCharacterBase(tbSceneNpc.DataID); if (null == tbCharacterBase) { return; } init.DataId = tbSceneNpc.DataID; init.ObjId = (ulong)tbSceneNpc.DataID * 1000; init.Name = tbNpc.Name; init.Level = tbNpc.Level; init.HpMax = init.HpNow = tbCharacterBase.Attr[13]; init.MpMax = init.MpNow = tbCharacterBase.Attr[14]; init.DirX = (float)Math.Cos(tbSceneNpc.FaceDirection); init.DirZ = (float)Math.Sin(tbSceneNpc.FaceDirection); init.X = (float)tbSceneNpc.PosX; init.Z = (float)tbSceneNpc.PosZ; init.Y = GameLogic.GetTerrainHeight(init.X, init.Z); ObjManager.Instance.CreateNPCAsync(init); return; } var dataId = info.TypeId; var objId = info.Id; var equip = info.EquipsModel; var name = info.Name; var allianceName = string.Empty; var battleDic = PlayerDataManager.Instance._battleCityDic; foreach (var item in battleDic) { if (item.Value.Type == 0) { allianceName = item.Value.Name; break; } } /* * var info = ObjManager.Instance.MyPlayer; * var dataId = info.GetDataId(); * var objId = info.GetObjId(); * var equip = info.EquipList; * var name = info.Name; * var allianceName = "WWWWW"; */ if (mFackeCharacter != null) { mFackeCharacter.Destroy(); } mFackeCharacter = ObjFakeCharacter.Create(dataId, equip, character => { if (null == mFackeCharacter) { character.Destroy(); return; } if (character.GetObjId() != mFackeCharacter.GetObjId()) { character.Destroy(); return; } var collider = character.gameObject.AddComponent <CapsuleCollider>(); collider.center = new Vector3(0, 1, 0); collider.height = 2; //character.transform.parent = transform; character.transform.position = gameObject.transform.position + Offset; character.transform.rotation = Quaternion.Euler(0, 180f, 0); //character.transform.forward = Quaternion.Euler(ForwardAngle.x, ForwardAngle.y, ForwardAngle.z) * Vector3.forward; character.transform.localScale = Scale; int inde = 0; switch (info.TypeId) { case 0: inde = 460; break; case 1: inde = 461; break; case 2: inde = 462; break; } var tab_Config = DataTable.Table.GetClientConfig(inde); if (null != tab_Config) { var titles = new Dictionary <int, string>(); var tabid = 0; if (int.TryParse(tab_Config.Value, out tabid)) { titles.Add(tabid, null); character.CreateNameBoard(name, titles); } } }, 0, false, -1, objId); mFackeCharacter.SetObjId(objId); //mFackeCharacter.OnWingLoadedCallback = OnWingLoaded; mFackeCharacter.gameObject.layer = LayerMask.NameToLayer("ObjLogic"); mFackeCharacter.iType = (int)OBJ.TYPE.FAKE_FIGHTLEADER; }