Пример #1
0
    public void RefreshModelByModelAvata(string modelAvataCode, Action callback)
    {
        if (_isRefreshingModel)
        {
            //Debug.LogError("代码编写错误:重复调用了同一个RefreshModelByModelAvata");
            return;
        }
        _isRefreshingModel = true;
        var tmp = modelAvataCode.Split('#');

        string modelId  = tmp[0];
        string weaponId = "";

        if (tmp.Length >= 2)
        {
            weaponId = tmp[1];
        }

        if (_outLooking == null)
        {
            _isRefreshingModel = false;
            return;
        }

        //跟当前一致,不需要替换
        if (_outLooking.m_ModelId == modelId)
        {
            _isRefreshingModel = false;
            return;
        }

        _outLooking.m_ModelId    = modelId;
        _outLooking.m_WeaponName = weaponId;
        _outLooking.OnChange(() =>
        {
            _isRefreshingModel = false;

            if (callback != null)
            {
                callback();
            }
        });
    }
Пример #2
0
    public override void OnInspectorGUI()
    {
        this.serializedObject.Update();
        myScript = (CustomOutlooking)target;

        xiakeIndex  = GetRoleModelSet().IndexOf(myScript.m_ModelId);
        weaponIndex = GetWeaponNameSet().IndexOf(myScript.m_WeaponName);


        EditorGUILayout.Space();
        EditorGUILayout.LabelField("开始配装");

        var xiakeopts = GetRoleModelSet();

        xiakeIndex = EditorGUILayout.Popup(new GUIContent("侠客模型"), xiakeIndex, xiakeopts.ToArray());
        if (xiakeIndex > 0)
        {
            var oldxiakeName = xiakeopts[xiakeIndex];
            myScript.m_ModelId = oldxiakeName;
        }

        var weaponopts = GetWeaponNameSet();

        weaponIndex = EditorGUILayout.Popup(new GUIContent("Weapon"), weaponIndex, weaponopts.ToArray());
        if (weaponIndex > 0)
        {
            var weaponName = weaponopts[weaponIndex];
            //Debug.Log("选择的武器是:" + weaponName);
            myScript.m_WeaponName = weaponName;
        }

        if (GUILayout.Button("实装配置"))
        {
            myScript.OnChange();
            EditorSceneManager.MarkAllScenesDirty();
        }

        EditorGUILayout.Space();

        if (GUILayout.Button("关闭XRay!警告:编辑器模式关闭的是sharedMeterials,也就是一关关掉所有,一定要记得开"))
        {
            myScript.CloseXRay();
        }

        EditorGUILayout.Space();
        if (GUILayout.Button("打开XRay"))
        {
            myScript.OpenXRay();
        }

        EditorGUILayout.Space();
        if (GUILayout.Button("角色着地"))
        {
            PlaceOnTheGround();
        }

        EditorGUILayout.Space();
        if (GUILayout.Button("重载配置(修改xml后动态点击生效)"))
        {
            RoleModelSet.Clear();
            WeaponSet.Clear();
        }

        EditorGUILayout.Space();
        EditorGUILayout.LabelField("其他");
        DrawDefaultInspector();
    }