Main editor class.
You usually don't need to do changes here. Instead create a class that inherites from MBEditorEmitterTypeHandler or MBEditorParameterHandler to create your custom GUI
Inheritance: EditorWindow
 protected internal override void OnEditorTick(float dt)
 {
     base.OnEditorTick(dt);
     if (!MBEditor.IsEntitySelected(this.GameEntity))
     {
         return;
     }
     DebugExtensions.RenderDebugCircleOnTerrain(this.Scene, this.GameEntity.GetGlobalFrame(), 4f, 2852192000U);
     DebugExtensions.RenderDebugCircleOnTerrain(this.Scene, this.GameEntity.GetGlobalFrame(), 6f, 2868838400U);
 }
Example #2
0
        protected internal override bool OnCheckForProblems()
        {
            bool flag = base.OnCheckForProblems();

            if ((NativeObject)this.Scene.FindEntitiesWithTag("ditch_filler").FirstOrDefault <GameEntity>((Func <GameEntity, bool>)(df => df.HasTag(this.SideTag))) != (NativeObject)null)
            {
                if (this.DitchNavMeshID_1 >= 0 && !this.Scene.IsAnyFaceWithId(this.DitchNavMeshID_1))
                {
                    MBEditor.AddEntityWarning(this.GameEntity, "Couldn't find any face with 'DitchNavMeshID_1' id.");
                    flag = true;
                }
                if (this.DitchNavMeshID_2 >= 0 && !this.Scene.IsAnyFaceWithId(this.DitchNavMeshID_2))
                {
                    MBEditor.AddEntityWarning(this.GameEntity, "Couldn't find any face with 'DitchNavMeshID_2' id.");
                    flag = true;
                }
                if (this.GroundToBridgeNavMeshID_1 >= 0 && !this.Scene.IsAnyFaceWithId(this.GroundToBridgeNavMeshID_1))
                {
                    MBEditor.AddEntityWarning(this.GameEntity, "Couldn't find any face with 'GroundToBridgeNavMeshID_1' id.");
                    flag = true;
                }
                if (this.GroundToBridgeNavMeshID_2 >= 0 && !this.Scene.IsAnyFaceWithId(this.GroundToBridgeNavMeshID_2))
                {
                    MBEditor.AddEntityWarning(this.GameEntity, "Couldn't find any face with 'GroundToBridgeNavMeshID_1' id.");
                    flag = true;
                }
                if (this.BridgeNavMeshID_1 >= 0 && !this.Scene.IsAnyFaceWithId(this.BridgeNavMeshID_1))
                {
                    MBEditor.AddEntityWarning(this.GameEntity, "Couldn't find any face with 'BridgeNavMeshID_1' id.");
                    flag = true;
                }
                if (this.BridgeNavMeshID_2 >= 0 && !this.Scene.IsAnyFaceWithId(this.BridgeNavMeshID_2))
                {
                    MBEditor.AddEntityWarning(this.GameEntity, "Couldn't find any face with 'BridgeNavMeshID_2' id.");
                    flag = true;
                }
            }
            return(flag);
        }
Example #3
0
    void OnEnable()
    {
        _instance = this;
        autoRepaintOnSceneChange = true;

        mGizmos = (MBGizmoFlags)System.Enum.Parse(typeof(MBGizmoFlags), EditorPrefs.GetInt("MagicalBox_DrawGizmos").ToString());
        mGizmosSelected = (MBGizmoFlags)System.Enum.Parse(typeof(MBGizmoFlags), EditorPrefs.GetInt("MagicalBox_DrawGizmosSelected").ToString());
        mAutoSelect=EditorPrefs.GetBool("MagicalBox_AutoSelect");
        mEditorUpdateInterval = EditorPrefs.GetFloat("MagicalBox_EditorUpdateInterval");
        mParametersAutoToggleSelected = EditorPrefs.GetBool("MagicalBox_AutoToggleParams");
        mTexLifeAnimated = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/LifeAnim.png", typeof(Texture)) as Texture;
        mTexBirthAnimated = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/BirthAnim.png", typeof(Texture)) as Texture;
        mTexClose = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/Close.png", typeof(Texture)) as Texture;
        mTexPlay = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/Play.png", typeof(Texture)) as Texture;
        mTexStop = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/Stop.png", typeof(Texture)) as Texture;
        mTexHalt = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/Halt.png", typeof(Texture)) as Texture;
        mTexSynchronize = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/Synchronize.png", typeof(Texture)) as Texture;
        mTexToggleZoom = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/ToggleZoom.png", typeof(Texture)) as Texture;
        mTexEMTrail = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/MBEmitterTrail.png", typeof(Texture)) as Texture;
        mTexMuted = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/Mute.png", typeof(Texture)) as Texture;
        mTexUnMuted = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/UnMute.png", typeof(Texture)) as Texture;
        mTexHourglass = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/Hourglass.png", typeof(Texture)) as Texture;
        mTexAutoSelect = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/AutoSelect.png", typeof(Texture)) as Texture;
        mTexUpdateInterval = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/UpdateInterval.png", typeof(Texture)) as Texture;
        mTexParamOrderUp = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/ParamOrderUp.png", typeof(Texture)) as Texture;
        mTexParamOrderDown = Resources.LoadAssetAtPath("Assets/Magical Box/Editor/Resources/ParamOrderDown.png", typeof(Texture)) as Texture;

        // Get a list of classes that derive from MBObject
        Assembly asm = Assembly.GetAssembly(typeof(MBParameter));
        System.Type[] types = asm.GetTypes();

        foreach (System.Type T in types) {
            if (T.BaseType == typeof(MBObject)) {
                Texture tex = Resources.LoadAssetAtPath("Assets/Gizmos/" + T.Name + ".png", typeof(Texture)) as Texture;
                if (tex)
                    mObjectIcons.Add(T, tex);
            }
        }
        Initialize();
    }
Example #4
0
    void OnDisable()
    {
        _instance = null;

        EditorPrefs.SetInt("MagicalBox_DrawGizmos", (int)mGizmos);
        EditorPrefs.SetInt("MagicalBox_DrawGizmosSelected", (int)mGizmosSelected);
        EditorPrefs.SetBool("MagicalBox_AutoSelect", mAutoSelect);
        EditorPrefs.SetFloat("MagicalBox_EditorUpdateInterval", mEditorUpdateInterval);
        EditorPrefs.SetBool("MagicalBox_AutoToggleParams", mParametersAutoToggleSelected);
    }