/// <summary> /// /// </summary> /// <param name="resid"></param> public void SetupWeapon(int resid) { if (!DataManager.WeaponTable.ContainsKey(resid)) { return; } WeaponTableItem weaponTab = DataManager.WeaponTable[resid] as WeaponTableItem; if (weaponTab == null) { GameDebug.LogError(" WeaponTable没有找到武器 id = " + resid.ToString()); return; } if (resid != mResid) { if (mWeapon != null) { mWeapon.Destroy(); } mResid = resid; mWeapon = new MeshVisual(); mWeapon.CreateWithConfig(AssetConfig.WeaponPath + weaponTab.modelname, OnVisualSuccess, OnVisualFailed, false); } }
public void SetupWing(int resid) { if (!DataManager.WingCommonTable.ContainsKey(resid)) { return; } WingCommonTableItem wingtable = DataManager.WingCommonTable[resid] as WingCommonTableItem; if (wingtable == null) { GameDebug.LogError("WingTable 没有找到 id = " + resid.ToString()); return; } if (resid != mResid) { if (mWing != null) { mWing.Destroy(); } mResid = resid; mWing = new MeshVisual(); WingItemData itemData = PlayerDataPool.Instance.MainData.mWingData.GetWingItemDataById(mResid); string modleName = WingModule.GetModelName(itemData.id, itemData.level); //mWing.CreateWithConfig(AssetConfig.WeaponPath + modleName, } }
protected virtual void DestroyVisual() { if (mVisual != null) { mVisual.Destroy(); mVisual = null; } }
/// <summary> /// 对玩家, 只改变模型; 其他单位模型和武器技能都被改变. /// </summary> public override bool ChangeWeapon(int weaponID) { if (!CanChangeWeapon() || mActiveFlagsContainer[ActiveFlagsDef.DisableChangeWeaponModel] != 0) { return(false); } if (weaponID == -1) { return(false); } //测试武器 if (!DataManager.WeaponTable.ContainsKey(weaponID)) { GameDebug.LogError(dbgGetIdentifier() + " not find weapon id=" + weaponID.ToString()); return(false); } if (mWeaponAttach != null) { DetachVisual(mWeaponAttach); mWeaponAttach.visual.Destroy(); mWeaponAttach = null; } RemoveAttach(AttachMountType.Weapon); if (mWeaponVisual != null) { mWeaponVisual.Destroy(); mWeaponVisual = null; } if (mLastWeaponBuffID != uint.MaxValue) { ErrorHandler.Parse( RemoveSkillBuffByResID(mLastWeaponBuffID), "failed to remove skill buff on skill stopped" ); mLastWeaponBuffID = uint.MaxValue; } mWeaopnRes = DataManager.WeaponTable[weaponID] as WeaponTableItem; mWeaponVisual = new MeshVisual(); if (string.IsNullOrEmpty(mWeaopnRes.modelname)) { onWeaponVisualSucess(); } else { mWeaponVisual.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, onWeaponVisualSucess, onWeaponVisualFail, false); } return(true); }
public void CreateWithConfig(int resid, int[] equiplist, int wingid) { 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, ModuleManager.Instance.FindModule <WingModule>().GetWingLevel(wingid)); } }
public void ChangeWeapon(int weaponid) { if (weaponid == mWeaponID) { return; } BehaviourUtil.StopCoroutine(ChangeWeapon_impl(mWeaponID)); if (!DataManager.WeaponTable.ContainsKey(weaponid)) { return; } if (mWeapon != null) { mWeapon.Destroy(); } foreach (uint effectid in mShowEffect) { SceneManager.Instance.GetCurScene().GetParticleManager().RemoveParticle(effectid); } mShowEffect.Clear(); mWeaponID = weaponid; //BehaviourUtil.StartCoroutine(ChangeWeapon_impl(weaponid)); WeaponTableItem mWeaopnRes = DataManager.WeaponTable[weaponid] as WeaponTableItem; mWeapon = new MeshVisual(); mWeapon.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, null, OnWeaponFailed, false); TransformData trans = new TransformData(); trans.Rot = new Vector3(90, 0, 0); trans.Scale = Vector3.one * mWeaopnRes.scale; ChangeAttach(AttachMountType.Weapon, mWeapon, mWeaopnRes.mountpoint, trans); }