Exemplo n.º 1
0
    /// <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);
        }
    }
Exemplo n.º 2
0
    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);
    }
Exemplo n.º 3
0
    public void ChangeAttach(AttachMountType type, string path, string mount)
    {
        MeshVisual visual = new MeshVisual();

        visual.CreateWithConfig(path, null, null, false);
        ChangeAttach(type, visual, mount);
    }
Exemplo n.º 4
0
    /// <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);
    }
Exemplo n.º 5
0
    public void btnCreatePlayer()
    {
        //PlayerInitParam param = new PlayerInitParam();
        //param.player_data = new PlayerData();
        //param.player_data.classs = 1;
        //player = new Player();

        //player.Init(param);
        //player.LoadModel();

        MeshVisual visual = new MeshVisual();

        visual.CreateWithConfig("role_male_roledefault", null, null);
    }
Exemplo n.º 6
0
    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);
        }
    }
Exemplo n.º 7
0
    public void ChangeWing(int wingid, uint winglv)
    {
        if (mWingID == wingid && mWingLv == winglv)
        {
            return;
        }
        mWingID = wingid;
        mWingLv = winglv;

        WingCommonTableItem commonRes = DataManager.WingCommonTable[wingid] as WingCommonTableItem;

        if (commonRes == null)
        {
            return;
        }
        string     modelName = WingModule.GetModelName(wingid, winglv);
        MeshVisual visual    = new MeshVisual();

        visual.CreateWithConfig(AssetConfig.WeaponPath + modelName, null, null, false);
        ChangeAttach(AttachMountType.Wing, visual, commonRes.modelSlot);
    }
Exemplo n.º 8
0
    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);
    }
Exemplo n.º 9
0
    private IEnumerator ChangeWeapon_impl(int weaponid)
    {
        WeaponTableItem mWeaopnRes = DataManager.WeaponTable[weaponid] as WeaponTableItem;

        if (mWeapon != null)
        {
            mWeapon.Destroy();
        }

        if (mWeaopnRes == null)
        {
            yield break;
        }

        while (mVisual == null || !mVisual.IsCompleteOrDestroy)
        {
            yield return(1);
        }

        mChangingWeaponID = weaponid;
        mWeapon           = new MeshVisual();
        mWeapon.CreateWithConfig(AssetConfig.WeaponPath + mWeaopnRes.modelname, OnWeaponSuccess, OnWeaponFailed, false);
    }
Exemplo n.º 10
0
 public void btnLoadSkeletal()
 {
     visual = new MeshVisual();
     visual.CreateWithConfig(animInput.value, null, null, true);
 }