virtual protected bool ChangeModel(int model) { if (model == -1) { return(false); } if (!DataManager.ModelTable.ContainsKey(model)) { return(false); } ModelTableItem modelTab = DataManager.ModelTable[model] as ModelTableItem; if (modelTab == null) { GameDebug.LogError(dbgGetIdentifier() + " 没有找到模型 id = " + model.ToString()); return(false); } DestroyVisual(); mModelResID = model; mVisual = new MeshVisual(); mVisual.CreateWithConfig(modelTab.filename, onVisualSucess, onVisualFail, true); return(true); }
protected override void onModelLoaded(GameObject obj) { base.onModelLoaded(obj); if (mModelResID >= 0) { ModelTableItem modelRes = DataManager.ModelTable[mModelResID] as ModelTableItem; float initScale = modelRes.scale * 1000; float newScale = GetPropertyValue((int)PropertyTypeEnum.PropertyTypeScale_Rate) * initScale / 100f; if (!Mathf.Approximately(initScale, newScale)) { onPropertyChanged((int)PropertyTypeEnum.PropertyTypeScale_Rate, initScale, newScale); } } }
public void SetupCharacter(int resid, int[] equiplist, int wingid, uint winglevel) { if (!DataManager.ModelTable.ContainsKey(resid)) { return; } ModelTableItem modelTab = DataManager.ModelTable[resid] as ModelTableItem; if (modelTab == null) { GameDebug.LogError(" DataManager没有找到模型 id = " + resid.ToString()); return; } if (resid != mResid) { if (mVisual != null) { mVisual.Destroy(); } mResid = resid; mVisual = new MeshVisual(); mVisual.CreateWithConfig(modelTab.filename, OnVisualSuccess, OnVisualFailed, true); } else { mInvalidAnim = true; } //切换装备 //TODO:装备相关的表和数据都还没有做好,做好了在这里处理 ApplyEquipConfig(equiplist); if (wingid < 0) { RemoveAttach(AttachMountType.Wing); } else { ChangeWing(wingid, winglevel); } }
public void ShowPlayer(int playerid) { if (mPlayerID == playerid) { return; } mPlayerID = playerid; if (mActivePlayer != null) { mActivePlayer.Destroy(); } CreatePlayerItem table = DataManager.CreatePlayerTable[playerid] as CreatePlayerItem; if (table == null) { return; } ModelTableItem modeltable = DataManager.ModelTable[table.modelid] as ModelTableItem; if (modeltable == null) { return; } if (mActivePlayer != null) { mActivePlayer.Destroy(); } mActivePlayer = new SimpleModel(); mActivePlayer.CreateWithConfig(table.modelid, null, table.wingid); mActivePlayer.ChangeWeapon(table.weaponid); mActivePlayer.Position = sPos; mActivePlayer.Scale = sScale; mActivePlayer.RotationY = -120; mActivePlayer.ParticleMng = mParticleMng; }
virtual protected void onModelLoaded(GameObject obj) { obj.layer = GetObjectLayer(); if (mVisual != null && mVisual.Visual != null) { mVisual.Visual.tag = GetObjectTag(); } if (DataManager.ModelTable.ContainsKey(mModelResID)) { ModelTableItem modelTab = DataManager.ModelTable[mModelResID] as ModelTableItem; obj.transform.localScale = Vector3.one * modelTab.scale; } mStateController = new MecanimStateController(); mStateController.Setup(mVisual.AnimManager, this); }