コード例 #1
0
ファイル: GraphicsImpl.cs プロジェクト: ptklatt/UtinniPlugins
 public void RenderSkeletons(bool value)
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         UtinniCore.Utinni.SkeletalAppearance.skeleton.SetRenderSkeleton(value);
     });
 }
コード例 #2
0
ファイル: GraphicsImpl.cs プロジェクト: ptklatt/UtinniPlugins
 public void ReloadTextures()
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         Graphics.ReloadTextures();
     });
 }
コード例 #3
0
ファイル: GraphicsImpl.cs プロジェクト: ptklatt/UtinniPlugins
 public void EnableWireframe(bool value)
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         directx9.ToggleWireframe();
     });
 }
コード例 #4
0
        public WorldSnapshotImpl(ISnapshotPanel snapshotPanel, IEditorPlugin editorPlugin, HotkeyManager hotkeyManager)
        {
            this.snapshotPanel = snapshotPanel;
            this.editorPlugin  = editorPlugin;
            this.hotkeyManager = hotkeyManager;

            GameCallbacks.AddInstallCallback(OnInstallCallback);
            GameCallbacks.AddSetupSceneCall(OnSetupSceneCallback);
            GameCallbacks.AddCleanupSceneCall(OnCleanupCallback);
            ObjectCallbacks.AddOnTargetCallback(OnTarget);

            ImGuiCallbacks.AddOnEnabledCallback(OnGizmoEnabled);
            ImGuiCallbacks.AddOnDisabledCallback(OnGizmoDisabled);
            ImGuiCallbacks.AddOnPositionChangedCallback(OnPositionChanged);
            ImGuiCallbacks.AddOnRotationChangedCallback(OnRotationChanged);

            hotkeyManager.Add(new Hotkey("ToggleSnapshotNodeEditingMode", "Toggle Snapshot Node Editing Mode", "Oemtilde", ToggleNodeEditing, true));
            hotkeyManager.Add(new Hotkey("SaveSnapshot", "Save Snapshot", "Control + S", Save, true));
            hotkeyManager.Add(new Hotkey("CopySnapshotNode", "Copy Snapshot Node", "Control + C", CopyNode, true, true, true));
            hotkeyManager.Add(new Hotkey("PasteSnapshotNode", "Paste Snapshot Node", "Control + V", PasteNode, true, true, true));
            hotkeyManager.Add(new Hotkey("DuplicateSnapshotNode", "Duplicate Snapshot Node", "Control + D", DuplicateNode, true, true, true));
            hotkeyManager.Add(new Hotkey("DeleteSnapshotNode", "Delete Snapshot Node", "Delete", RemoveNode, true, true, true));

            hotkeyManager.Add(new Hotkey("SetGizmoTranslateOperationMode", "Set Gizmo Operation Mode to Translate", "Control + Q", SetOperationModeToTranslateHotkey, true, false, true));
            hotkeyManager.Add(new Hotkey("SetGizmoRotationOperationMode", "Set Gizmo Operation Mode to Rotation", "Control + E", SetOperationModeToRotationHotkey, true, false, true));
            hotkeyManager.Add(new Hotkey("ToggleGizmoSnap", "Toggle Gizmo Snap", "Control + B", ToggleGizmoSnapHotkey, true, false, true));
        }
コード例 #5
0
 public void RestartMusic()
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         CuiManager.RestartMusic();
     });
 }
コード例 #6
0
        private static int EntryPoint(string args)
        {
            if (!initialized)
            {
                initialized = true;
                Application.EnableVisualStyles();

                Log.Setup();

                // Load plugins from the /Plugins/ directory
                PluginLoader pluginLoader = new PluginLoader();

                // Initialize callbacks that aren't purely editor related
                GameCallbacks.Initialize();
                GroundSceneCallbacks.Initialize();
                ObjectCallbacks.Initialize();
                CuiCallbacks.Initialize();

                if (UtinniCore.Utinni.utinni.GetConfig().GetBool("Editor", "enableEditorMode"))
                {
                    Application.Run(new FormMain(pluginLoader));
                }
            }
            return(0);
        }
コード例 #7
0
 public void ReloadUi()
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         UtinniCore.Utinni.CuiMisc.cui_misc.ReloadUi();
     });
 }
コード例 #8
0
        private void OnDragEnter(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.Text)) // ToDo custom format
            {
                this.Focus();
                this.BringToFront();
                if (dragDropObject == null)
                {
                    e.Effect = DragDropEffects.Copy;
                    string dragData = (string)e.Data.GetData(DataFormats.Text); // ToDo custom format

                    hasValidDragLocation = false;
                    GameCallbacks.AddPreMainLoopCall(() =>
                    {
                        CreateDragDropObject(dragData);
                    });
                }
                else
                {
                    CleanUpDragDropObject();
                    e.Effect = DragDropEffects.None;
                }
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }
        }
コード例 #9
0
 public void Reload()
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         GroundScene.Get().ReloadTerrain();
     });
 }
コード例 #10
0
 public void Unload()
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         Game.CleanupScene();
     });
 }
コード例 #11
0
 public void Load(string sceneName, string avatarObjectFilename)
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         Game.LoadScene(sceneName, avatarObjectFilename);
     });
 }
コード例 #12
0
 private void CleanUpDragDropObject()
 {
     GameCallbacks.AddMainLoopCall(() =>
     {
         dragDropObject.Remove();
         dragDropObject = null;
     });
 }
コード例 #13
0
ファイル: GamePlayer.cs プロジェクト: l0stfake7/MSCMP
        /// <summary>
        /// Handle drop of the object.
        /// </summary>
        private void DropObject()
        {
            Logger.Log("Drop object " + pickedUpGameObject);
            pickedUpGameObject = null;

            if (GameCallbacks.onObjectRelease != null)
            {
                GameCallbacks.onObjectRelease(true);
            }
        }
コード例 #14
0
ファイル: GamePlayer.cs プロジェクト: l0stfake7/MSCMP
        /// <summary>
        /// Handle throw of the object.
        /// </summary>
        private void ThrowObject()
        {
            Logger.Log("Throwed object " + pickedUpGameObject);
            pickedUpGameObject = null;

            if (GameCallbacks.onObjectRelease != null)
            {
                GameCallbacks.onObjectRelease(false);
            }
        }
コード例 #15
0
ファイル: GamePlayer.cs プロジェクト: l0stfake7/MSCMP
        /// <summary>
        /// Handle pickup of the object.
        /// </summary>
        private void PickupObject()
        {
            pickedUpGameObject = pickupFsm.Fsm.GetFsmGameObject("PickedObject").Value;
            Logger.Log("PickupObject " + pickedUpGameObject);

            if (GameCallbacks.onObjectPickup != null)
            {
                GameCallbacks.onObjectPickup(pickedUpGameObject);
            }
        }
コード例 #16
0
        public GroundSceneImpl(IScenePanel scenePanel, HotkeyManager hotkeyManager)
        {
            this.scenePanel = scenePanel;

            GameCallbacks.AddInstallCallback(OnInstallCallback);
            GameCallbacks.AddSetupSceneCall(OnSetupSceneCallback);
            GameCallbacks.AddCleanupSceneCall(OnCleanupCallback);

            Task updateView = UpdateView();
        }
コード例 #17
0
        public PlayerObjectImpl(IPlayerPanel sceneAvailability, HotkeyManager hotkeyManager)
        {
            this.playerPanel = sceneAvailability;
            GameCallbacks.AddSetupSceneCall(OnSetupSceneCallback);
            GameCallbacks.AddCleanupSceneCall(OnCleanupCallback);
            GroundSceneCallbacks.AddCameraChangeCallback(OnCameraChangeCallback);

            hotkeyManager.Add(new Hotkey("PlayerHalfSpeed", "Half the Player speed", "F4", HalfSpeed, true, true, true));
            hotkeyManager.Add(new Hotkey("PlayerDoubleSpeed", "Double the Player speed", "F5", DoubleSpeed, true, true, true));
            // hotkeyManager.Add(new Hotkey("ToggleDefaultSpeed", "Shift, Control + F6", ToggleFreeCam, false)); ToDo
        }
コード例 #18
0
        public UndoRedoManager(Action onUpdateCommandsCallback, Action undoCallback, Action redoCallback)
        {
            UndoCommands = new Stack <IUndoCommand>();
            RedoCommands = new Stack <IUndoCommand>();

            this.onUpdateCommandsCallback = onUpdateCommandsCallback;
            this.undoCallback             = undoCallback;
            this.redoCallback             = redoCallback;

            GameCallbacks.AddCleanupSceneCall(OnCleanupCallback);
        }
コード例 #19
0
ファイル: FreeCamImpl.cs プロジェクト: ptklatt/UtinniPlugins
        public FreeCamImpl(IFreeCamPanel sceneAvailability, HotkeyManager hotkeyManager)
        {
            this.freeCamPanel = sceneAvailability;
            GameCallbacks.AddSetupSceneCall(OnSetupSceneCallback);
            GameCallbacks.AddCleanupSceneCall(OnCleanupCallback);
            GroundSceneCallbacks.AddCameraChangeCallback(OnCameraChangeCallback);

            hotkeyManager.Add(new Hotkey("ToggleFreeCam", "Toggle FreeCam", "Shift + Tab", ToggleFreeCam, true, true, true));
            hotkeyManager.Add(new Hotkey("CameraHalfSpeed", "Half the Camera speed", "F4", HalfSpeed, true, true, true));
            hotkeyManager.Add(new Hotkey("CameraDoubleSpeed", "Double the Camera speed", "F5", DoubleSpeed, true, true, true));
            // hotkeyManager.Add(new Hotkey("ToggleDefaultSpeed", "Shift, Control + F6", ToggleFreeCam, false)); ToDo
        }
コード例 #20
0
ファイル: HotkeyManager.cs プロジェクト: ptklatt/Utinni
        public void ProcessInput(Keys modifierKeys, Keys key, bool isGameFocused)
        {
            if (!Enabled)
            {
                return;
            }

            foreach (var pair in Hotkeys)
            {
                Hotkey hotkey = pair.Value;
                if (hotkey.Enabled && hotkey.ModifierKeys == modifierKeys && hotkey.Key == key) // ToDo figure out a way to have some hotkeys only work if the game has focus
                {
                    if (hotkey.OnGameFocusOnly && !isGameFocused)
                    {
                        continue;
                    }

                    if (hotkey.OverrideGameInput)
                    {
                        // Not happy about this solution, but works, ToDo find a better way
                        GameCallbacks.AddPreMainLoopCall(() =>
                        {
                            UtinniCore.Utinni.CuiIo.cui_io.EnableKeyboard(false);

                            hotkey.OnDownCallback();

                            // ToDo really far from perfect, occasionally doesn't proper block a call

                            GameCallbacks.AddMainLoopCall(() =>
                            {
                                GameCallbacks.AddPreMainLoopCall(() =>
                                {
                                    UtinniCore.Utinni.CuiIo.cui_io.EnableKeyboard(true);
                                });
                            });
                        });
                    }
                    else
                    {
                        hotkey.OnDownCallback();
                    }
                }
            }
        }
コード例 #21
0
ファイル: MiscImpl.cs プロジェクト: ptklatt/UtinniPlugins
 public MiscImpl(ISceneAvailability sceneAvailability)
 {
     this.sceneAvailability = sceneAvailability;
     GameCallbacks.AddSetupSceneCall(OnSetupSceneCallback);
     GameCallbacks.AddCleanupSceneCall(OnCleanupCallback);
 }