Пример #1
0
        public bool TryToWakeUp(string cause)
        {
            if (!State.IsSleeping)
            {
                return(false);
            }

            if (mChildEditor != null)
            {
                GUIEditor <MessageCancelDialogResult> editor = mChildEditor.GetComponent <GUIEditor <MessageCancelDialogResult> >();
                editor.ActionCancel(WorldClock.AdjustedRealTime);
                return(false);
            }

            Player.Local.Position = mLastBed.BedsidePosition;
            Player.Local.State.Transform.Position = Player.Local.Position;
            Player.Local.RestoreControl(false);
            Player.Get.AvatarActions.ReceiveAction(AvatarAction.SurvivalWakeUp, WorldClock.AdjustedRealTime);
            WorldClock.Get.SetTargetSpeed(1.0f);
            State.IsSleeping            = false;
            State.LastSleepInterruption = cause;
            double timeSlept = WorldClock.SecondsToHours(WorldClock.AdjustedRealTime - State.StartSleepTime);

            if (timeSlept > Globals.WellRestedHours)
            {
                AddCondition("WellRested");
            }
            return(true);
        }
Пример #2
0
        public override void PropertyChanged(string propertyName, object oldValue)
        {
            GUIEditor editor          = (GUIEditor)_guiController.ActivePane.Control;
            GUI       itemBeingEdited = editor.GuiToEdit;

            _guiEditor_OnControlsChanged(editor.GuiToEdit);

            if (propertyName == "Name")
            {
                OnItemIDChanged(itemBeingEdited);
            }
        }
Пример #3
0
        public override void PropertyChanged(string propertyName, object oldValue)
        {
            GUIEditor editor = (GUIEditor)_guiController.ActivePane.Control;

            _guiEditor_OnControlsChanged(editor.GuiToEdit);

            if (propertyName == "Name")
            {
                foreach (ContentDocument doc in _documents.Values)
                {
                    doc.Name = ((GUIEditor)doc.Control).GuiToEdit.WindowTitle;
                }
            }
        }
Пример #4
0
 private void RePopulateTreeView()
 {
     _guiController.ProjectTree.RemoveAllChildNodes(this, TOP_LEVEL_COMMAND_ID);
     _guiController.ProjectTree.StartFromNode(this, TOP_LEVEL_COMMAND_ID);
     foreach (GUI gui in _agsEditor.CurrentGame.GUIs)
     {
         _guiController.ProjectTree.AddTreeLeaf(this, "GUI" + gui.ID, gui.ID.ToString() + ": " + gui.Name, "GUIIcon");
     }
     if (_documents.ContainsValue(_guiController.ActivePane))
     {
         GUIEditor editor = (GUIEditor)_guiController.ActivePane.Control;
         _guiController.ProjectTree.SelectNode(this, "GUI" + editor.GuiToEdit.ID);
     }
     else if (_agsEditor.CurrentGame.GUIs.Count > 0)
     {
         _guiController.ProjectTree.SelectNode(this, "GUI0");
     }
 }
Пример #5
0
 private void ShowOrAddPane(GUI chosenGui)
 {
     if (!_documents.ContainsKey(chosenGui))
     {
         List <MenuCommand> toolbarIcons = CreateToolbarIcons();
         GUIEditor          editor       = new GUIEditor(chosenGui, toolbarIcons);
         editor.OnControlsChanged += new GUIEditor.ControlsChanged(_guiEditor_OnControlsChanged);
         editor.OnGuiNameChanged  += new GUIEditor.GuiNameChanged(_guiEditor_OnGuiNameChanged);
         _documents.Add(chosenGui, new ContentDocument(editor, chosenGui.WindowTitle, this, ConstructPropertyObjectList(chosenGui)));
         _documents[chosenGui].SelectedPropertyGridObject = chosenGui;
         if (chosenGui is NormalGUI)
         {
             _documents[chosenGui].ToolbarCommands = toolbarIcons;
         }
     }
     _guiController.AddOrShowPane(_documents[chosenGui]);
     _guiController.ShowCuppit("The GUI Editor is where you set up the GUIs in your game. Use the buttons in the toolbar to add controls, and the property grid on the right to edit the selected control's properties.", "GUI Editor introduction");
 }
Пример #6
0
    void OnGUI()
    {
        if (GUI.Button(new Rect(Screen.width / 2 + 10, Screen.height - 65, 100, 50), "End Match"))
        {
            GUIEditor.setText("", "");
            SceneManager.LoadScene("Menu");
        }

        if (GUI.Button(new Rect(Screen.width / 2 - 110, Screen.height - 65, 100, 50), "Restart Match"))
        {
            //Application.LoadLevel(Application.loadedLevel);
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }

        if (winner == 1)
        {
            GUI.DrawTexture(new Rect((Screen.width / 2) - (redWinScreen.width / 2), (Screen.height / 2) - (redWinScreen.height / 2), redWinScreen.width, redWinScreen.height), redWinScreen);
        }
        else if (winner == -1)
        {
            GUI.DrawTexture(new Rect((Screen.width / 2) - (blueWinScreen.width / 2), (Screen.height / 2) - (blueWinScreen.height / 2), blueWinScreen.width, blueWinScreen.height), blueWinScreen);
        }
    }
Пример #7
0
    // Use this for initialization
    void Awake()
    {
        camera = Camera.main.GetComponent <CameraScript>();

        redHealth  = startingHealth;
        blueHealth = startingHealth;

        redPlayer.setup(false, this, PlayerPrefs.GetString("RED_AI"));
        bluePlayer.setup(true, this, PlayerPrefs.GetString("BLUE_AI"));

        redHealthIndicator.setup(startingHealth);
        blueHealthIndicator.setup(startingHealth);

        GUIEditor.setText(PlayerPrefs.GetString("BLUE_AI"), PlayerPrefs.GetString("RED_AI"));

        for (int i = 0; i < belts.Length; i++)
        {
            belts[i].setup(this);
            belts[i].redButton.setup(buttonCooldown);
            belts[i].blueButton.setup(buttonCooldown);
            belts[i].bomb.setup(initialBombSpeed, bombAcceleration);
        }
    }
Пример #8
0
        private void ShowOrAddPane(GUI chosenGui)
        {
            ContentDocument document;

            if (!_documents.TryGetValue(chosenGui, out document) ||
                document.Control.IsDisposed)
            {
                List <MenuCommand> toolbarIcons = CreateToolbarIcons();
                GUIEditor          editor       = new GUIEditor(chosenGui, toolbarIcons);
                editor.OnControlsChanged += new GUIEditor.ControlsChanged(_guiEditor_OnControlsChanged);
                editor.OnGuiNameChanged  += new GUIEditor.GuiNameChanged(_guiEditor_OnGuiNameChanged);
                document = new ContentDocument(editor, chosenGui.WindowTitle,
                                               this, ICON_KEY, ConstructPropertyObjectList(chosenGui));
                _documents[chosenGui] = document;
                document.SelectedPropertyGridObject = chosenGui;
                if (chosenGui is NormalGUI)
                {
                    document.ToolbarCommands = toolbarIcons;
                }
            }
            document.TreeNodeID = GetNodeID(chosenGui);
            _guiController.AddOrShowPane(document);
        }
Пример #9
0
        private void ShowOrAddPane(GUI chosenGui)
        {
            ContentDocument document;

            if (!_documents.TryGetValue(chosenGui, out document) ||
                document.Control.IsDisposed)
            {
                List <MenuCommand> toolbarIcons = CreateToolbarIcons();
                GUIEditor          editor       = new GUIEditor(chosenGui, toolbarIcons);
                editor.OnControlsChanged += new GUIEditor.ControlsChanged(_guiEditor_OnControlsChanged);
                editor.OnGuiNameChanged  += new GUIEditor.GuiNameChanged(_guiEditor_OnGuiNameChanged);
                document = new ContentDocument(editor, chosenGui.WindowTitle,
                                               this, ICON_KEY, ConstructPropertyObjectList(chosenGui));
                _documents[chosenGui] = document;
                document.SelectedPropertyGridObject = chosenGui;
                if (chosenGui is NormalGUI)
                {
                    document.ToolbarCommands = toolbarIcons;
                }
            }
            document.TreeNodeID = GetNodeID(chosenGui);
            _guiController.AddOrShowPane(document);
            _guiController.ShowCuppit("The GUI Editor is where you set up the GUIs in your game. Use the buttons in the toolbar to add controls, and the property grid on the right to edit the selected control's properties.", "GUI Editor introduction");
        }
Пример #10
0
        protected override void OnKeyDown(KeyboardKeyEventArgs e)
        {
            base.OnKeyDown(e);
            input.handleKeydown(e);

            if (e.Control && e.Key == Key.O)
            {
                var open = new OpenFileDialog();
                open.Multiselect = false;
                open.Title       = "StoneVox - Open File";
                open.DefaultExt  = ".qb";

                open.FileOk += (s, o) =>
                {
                    Client.OpenGLContextThread.Add(() =>
                    {
                        ImportExportUtil.Import(open.FileName);
                    });
                };

                Thread thread = new Thread(() =>
                {
                    open.ShowDialog();
                });

                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            if (e.Control && e.Key == Key.S)
            {
                var save = new SaveFileDialog();
                save.Title      = "StoneVox - Save File";
                save.Filter     = "StoneVox Project (.svp)|*.svp|Qubicle Binary (.qb)|*.qb|Wavefront OBJ (.obj)|*.obj|All files (*.*)|*.*";
                save.DefaultExt = ".svp";

                save.FileOk += (s, t) =>
                {
                    QbModel model = manager.ActiveModel;
                    model.name = save.FileName.Split('\\').Last();
                    if (model.name.Contains('.'))
                    {
                        model.name = model.name.Split('.').First();
                    }
                    broadcaster.Broadcast(Message.ModelRenamed, model, model.name);
                    ImportExportUtil.Export(save.FileName.Split('\\').Last().Replace(model.name, ""), model.name, Path.GetDirectoryName(save.FileName), model);
                };

                Thread thread = new Thread(() =>
                {
                    save.ShowDialog();
                });

                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
            }
            else if (e.Control && e.Key == Key.F12)
            {
                GUIEditor editor = new GUIEditor();
                editor.Show();
            }
            //else if (e.Key == Key.T)
            //{
            //    Stopwatch w = Stopwatch.StartNew();
            //    var model = Singleton<QbManager>.INSTANCE.ActiveMatrix;

            //    Colort color = new Colort(1f, 0f, 0f);

            //    var volume = new VoxelVolume()
            //    {
            //        minx = 0,
            //        maxx = 100,
            //        miny = 0,
            //        maxy = 100,
            //        minz = 0,
            //        maxz = 100
            //    };

            //    model.Add(volume, ref color);

            //    w.Stop();
            //    Console.WriteLine("add " + w.ElapsedMilliseconds.ToString());
            //}
            //else if (e.Key == Key.T)
            //{
            //    Stopwatch w = Stopwatch.StartNew();
            //    var model = Singleton<QbManager>.INSTANCE.ActiveMatrix;

            //    Colort color = new Colort(1f, 0f, 0f);
            //    for (int x = 0; x < 100; x++)
            //        for (int z = 0; z < 100; z++)
            //        for (int y = 0; y< 100; y++)
            //                model.Add(x, y, z, color);

            //    w.Stop();
            //    Console.WriteLine("add " +w.ElapsedMilliseconds.ToString());
            //}

            //else if (e.Key == Key.Y)
            //{
            //    Stopwatch w = Stopwatch.StartNew();
            //    var model = Singleton<QbManager>.INSTANCE.ActiveMatrix;

            //    Colort color = new Colort(1f, 0f, 0f);
            //    for (int x = 0; x < 100; x++)
            //        for (int z = 0; z < 100; z++)
            //            for (int y = 0; y < 100; y++)

            //                model.Remove(x, y, z);

            //    w.Stop();
            //    Console.WriteLine("earse " + w.ElapsedMilliseconds.ToString());
            //}
        }
Пример #11
0
 private void ShowOrAddPane(GUI chosenGui)
 {
     if (!_documents.ContainsKey(chosenGui))
     {
         List<MenuCommand> toolbarIcons = CreateToolbarIcons();
         GUIEditor editor = new GUIEditor(chosenGui, toolbarIcons);
         editor.OnControlsChanged += new GUIEditor.ControlsChanged(_guiEditor_OnControlsChanged);
         editor.OnGuiNameChanged += new GUIEditor.GuiNameChanged(_guiEditor_OnGuiNameChanged);
         _documents.Add(chosenGui, new ContentDocument(editor, chosenGui.WindowTitle, this, ConstructPropertyObjectList(chosenGui)));
         _documents[chosenGui].SelectedPropertyGridObject = chosenGui;
         if (chosenGui is NormalGUI)
         {
             _documents[chosenGui].ToolbarCommands = toolbarIcons;
         }
     }
     _guiController.AddOrShowPane(_documents[chosenGui]);
     _guiController.ShowCuppit("The GUI Editor is where you set up the GUIs in your game. Use the buttons in the toolbar to add controls, and the property grid on the right to edit the selected control's properties.", "GUI Editor introduction");
 }