public GUIColorPickerWindow(GUISystem system, UDim2 size, GUITheme theme,
                             bool closable = true)
     : base(system, size, "Color Picker", theme, closable)
 {
     ColorPicker = new GUIColorPicker(new UDim2(0, 5, 0, 25), new UDim2(1f, -10, 1f, -30), theme);
     AddTopLevel(ColorPicker);
 }
Exemple #2
0
        public SingleplayerMenu(GUISystem system, GUITheme theme, MainWindow mainWindow)
            : base(system, new UDim2(0.35f, 0, 0.3f, 0), "Ace of Spades", theme)
        {
            IsDraggable = false;

            MaxSize = new UDim2(0, 400, 1f, 0);
            MinSize = new UDim2(0, 220, 0, 100);

            GUIButton backBtn = new GUIButton(new UDim2(0, 0, 0, 25), new UDim2(1f, 0, 0, 30),
                                              "Back to Main Menu", TextAlign.Center, theme);

            backBtn.OnMouseClick += (btn, mbtn) =>
            {
                if (mbtn == MouseButton.Left)
                {
                    mainWindow.SwitchScreen("MainMenu");
                }
            };

            GUIButton controlsBtn = new GUIButton(new UDim2(0, 0, 0, 60), new UDim2(1f, 0, 0, 30),
                                                  "View Controls", TextAlign.Center, theme);

            controlsBtn.OnMouseClick += (btn, mbtn) =>
            {
                if (mbtn == MouseButton.Left)
                {
                    mainWindow.StaticGui.ToggleControlsWindow(true);
                }
            };

            AddTopLevel(backBtn, controlsBtn);
        }
        public TerraformWindow(GUISystem system, GUITheme theme)
            : base(system, new UDim2(0.25f, 0, 0.25f, 0), "Terraform Options", theme, false)
        {
            Position = new UDim2(0, 0, 0.75f, 0);
            MinSize  = new UDim2(0, 200, 0, 250);
            MaxSize  = new UDim2(0, 475, 0, 350);

            GUIForm form = new GUIForm(UDim2.Zero, new UDim2(1f, 0, 1f, 0), theme);

            GUILabel     brushSizeLabel;
            GUITextField brushSizeField;

            form.AddLabledTextField("Brush Size:", BrushSize.ToString(), new UDim2(0, 5, 0, 25),
                                    out brushSizeLabel, out brushSizeField);
            brushSizeField.OnTextChanged += BrushSizeField_OnTextChanged;

            GUILabel     riseHeightLabel;
            GUITextField riseHeightField;

            form.AddLabledTextField("Rise Height:", RiseHeight.ToString(), new UDim2(0, 5, 0, 30 + brushSizeLabel.Size.Y.Offset),
                                    out riseHeightLabel, out riseHeightField);
            riseHeightField.OnTextChanged += RiseHeightField_OnTextChanged;

            AddTopLevel(form);
        }
Exemple #4
0
 public SpriteRenderer(MasterRenderer master)
     : base(master)
 {
     SpriteBatch = new SpriteBatch(master.ScreenWidth, master.ScreenHeight);
     GUISystem   = new GUISystem(SpriteBatch);
     shader      = new SpriteShader();
 }
Exemple #5
0
        public StaticGui(MainWindow window, MasterRenderer renderer)
        {
            this.window   = window;
            this.renderer = renderer;

            gsys = renderer.Sprites.GUISystem;

            area = new GUIArea(gsys);
            renderer.Sprites.Add(area);

            BMPFont smallFont  = AssetManager.LoadFont("arial-bold-12");
            BMPFont normalFont = AssetManager.LoadFont("arial-bold-14");
            BMPFont bigFont    = AssetManager.LoadFont("arial-bold-20");
            BMPFont tinyFont   = AssetManager.LoadFont("arial-bold-10");

            GUITheme theme = AssetManager.CreateDefaultGameTheme();

            theme.SetField("SmallFont", smallFont);
            theme.SetField("Font", normalFont);
            theme.SetField("TinyFont", tinyFont);

            controls        = new ControlsWindow(gsys, theme);
            controls.ZIndex = 200;

            // Overlay
            fpsLabel     = new GUILabel(UDim2.Zero, UDim2.Zero, "FPS: --", TextAlign.TopLeft, theme);
            timeLabel    = new GUILabel(new UDim2(1f, 0, 0, 0), UDim2.Zero, "Time: --", TextAlign.TopRight, theme);
            versionLabel = new GUILabel(new UDim2(0, 0, 1f, 0), UDim2.Zero, GameVersion.Current.ToString(),
                                        TextAlign.BottomLeft, theme);
            fpsLabel.Font     = smallFont;
            timeLabel.Font    = smallFont;
            versionLabel.Font = bigFont;

            if (screenshots == null)
            {
                string[] mainMenuFiles = Directory.GetFiles("Content/Textures/MainMenu");
                screenshots = new List <Texture>();

                foreach (string file in mainMenuFiles)
                {
                    // Skip thumbs.db
                    if (file.EndsWith(".db"))
                    {
                        continue;
                    }

                    try { screenshots.Add(GLoader.LoadTexture(file, TextureMinFilter.Linear, TextureMagFilter.Linear, true)); }
                    catch (Exception e) { DashCMD.WriteError("Failed to load main menu background '{1}'. \n{0}", e, file); }
                }
            }

            background        = new GUIFrame(UDim2.Zero, new UDim2(1f, 0, 1f, 0), Image.Blank);
            background.ZIndex = -100;

            area.AddTopLevel(background, fpsLabel, timeLabel, versionLabel);
            gsys.Add(controls);
        }
        public ControlsWindow(GUISystem system, GUITheme theme)
            : base(system, UDim2.Zero, "Controls", theme)
        {
            labels = new List <GUILabel>();
            Setup();
            ZIndex = 100;

            font = theme.GetField <BMPFont>(null, "SmallFont");
        }
        public RectSelector(GUISystem guiSystem)
        {
            m_GUISystem = guiSystem;

            m_RectSelectorControl = new GenericDefaultControl("RectSelector");

            var start   = Vector2.zero;
            var rectEnd = Vector2.zero;

            m_RectSelectAction = new SliderAction(m_RectSelectorControl)
            {
                enable        = (guiState, action) => !IsAltDown(guiState),
                enableRepaint = (guiState, action) =>
                {
                    var size = start - rectEnd;
                    return(size != Vector2.zero && guiState.hotControl == action.ID);
                },
                onSliderBegin = (guiState, control, position) =>
                {
                    start     = guiState.mousePosition;
                    rectEnd   = guiState.mousePosition;
                    m_GUIRect = FromToRect(start, rectEnd);

                    if (onSelectionBegin != null)
                    {
                        onSelectionBegin(this, guiState.isShiftDown);
                    }
                },
                onSliderChanged = (guiState, control, position) =>
                {
                    rectEnd   = guiState.mousePosition;
                    m_GUIRect = FromToRect(start, rectEnd);

                    if (onSelectionChanged != null)
                    {
                        onSelectionChanged(this);
                    }
                },
                onSliderEnd = (guiState, control, position) =>
                {
                    if (onSelectionEnd != null)
                    {
                        onSelectionEnd(this);
                    }
                },
                onRepaint = (guiState, action) =>
                {
                    Handles.BeginGUI();
                    styles.selectionRectStyle.Draw(m_GUIRect, GUIContent.none, false, false, false, false);
                    Handles.EndGUI();
                }
            };

            m_GUISystem.AddControl(m_RectSelectorControl);
            m_GUISystem.AddAction(m_RectSelectAction);
        }
Exemple #8
0
        public ViewNameCharacter(GameSystem game, RenderSystem renderer) : base(game, renderer)
        {
            GUI      = new GUISystem();
            Header   = new Label("Tell me what is your name", GetScreenPoint(0.5f, 0.25f));
            Name     = new GUITextInput(GetScreenPoint(0.5f, 0.5f), MaxNameLength);
            Continue = new GUIButton(GetScreenPoint(0.5f, 0.75f), "Continue", ActionContinue);

            GUI.Add(Name);
            GUI.Add(Continue);
        }
        private void CreateGUISystem(UnityObject target)
        {
            var guiSystem = new GUISystem(m_GUIState);
            var view      = new EditablePathView();

            view.controller = m_Controller;
            view.Install(guiSystem);

            m_GUISystems[target] = guiSystem;
        }
Exemple #10
0
 public void Setup()
 {
     m_GUIState                  = new TestGUIState();
     m_GUISystem                 = new GUISystem(m_GUIState);
     m_Drawer                    = new TestDrawer();
     m_EditablePath              = new EditablePath();
     m_Controller                = new EditablePathController();
     m_Controller.editablePath   = m_EditablePath;
     m_PathEditor                = new PathEditor(m_GUISystem);
     m_PathEditor.drawerOverride = m_Drawer;
     m_PathEditor.controller     = m_Controller;
 }
Exemple #11
0
        public GameScreen(MainWindow window, string name)
        {
            Name     = name;
            Window   = window;
            Renderer = window.Renderer;

            GUISystem = Renderer.Sprites.GUISystem;
            GUIArea   = new GUIArea(GUISystem);
            GUISystem.Add(GUIArea);
            GUIArea.Visible = false;
            Windows         = new HashSet <GUIWindowBase>();
        }
        protected void NGUIRenderControl_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            try
            {
                Point     pt             = this.PointToClient(new Point(e.X, e.Y));
                Vector2   DropPosition   = new Vector2(pt.X, pt.Y);
                GUISystem guiSystem      = GUISystem.Instance;
                Vector2   screenPosition = guiSystem.ClientToScreen(new Vector2(pt.X, pt.Y));

                if (e.Data.GetDataPresent(typeof(NFileEntity)))
                {
                    NFileEntity entity = (NFileEntity)e.Data.GetData(typeof(NFileEntity));
                    m_owner.CreateStyleWindow(entity, screenPosition);
                }
                else
                {
                    //获得进行"Drag"操作中拖动的字符串
                    string controlType = e.Data.GetData(typeof(string)) as string;

                    // 在拖放的位置创建窗口
                    if (!WindowManager.Instance.IsTypeRegedited(controlType))
                    {
                        return;
                    }

                    Window parentWnd = guiSystem.GetTargetWindow(screenPosition);
                    if (parentWnd == null)
                    {
                        parentWnd = guiSystem.RootWindow;
                    }

                    Window wnd = WindowManager.Instance.CreateWindow(controlType, parentWnd);
                    wnd.AbsolutePosition = screenPosition;
                    if (wnd.AbsoluteSize.Length() == 0)
                    {
                        wnd.Width  = new UIDim(0, 150);
                        wnd.Height = new UIDim(0, 100);
                    }
                    parentWnd.AddChild(wnd);

                    // 发送响应事件
                    if (WindowCreated != null)
                    {
                        UIECreateWindowEventArg createEvent = new UIECreateWindowEventArg(wnd);
                        WindowCreated(this, createEvent);
                    }
                }
            }
            catch (System.Exception ex)
            {
                NexusEditor.Program.ShowException(ex, "Drag drop failed!");
            }
        }
        public MultiplayerLoadingBar(GUISystem system, GUITheme theme)
            : base(system, new UDim2(0.8f, 0, 0, 120), "", theme, false)
        {
            IsDraggable = false;

            barAnim  = new FloatAnim();
            byteAnim = new FloatAnim();

            statusLabel = new GUILabel(new UDim2(0.5f, 0, 0.4f, 0), UDim2.Zero, "0/0 bytes", theme);
            bar         = new GUIFrame(new UDim2(0, 5, 1f, -35), new UDim2(0, -10, 0, 30), Image.Blank);

            AddTopLevel(statusLabel, bar);
        }
        public SingleplayerScreen(MainWindow window)
            : base(window, "Singleplayer")
        {
            GUITheme theme = AssetManager.CreateDefaultGameTheme();

            theme.SetField("Font", AssetManager.LoadFont("arial-14"));

            menu           = new SingleplayerMenu(GUISystem, theme, Window);
            menu.OnClosed += Menu_OnClosed;

            GUISystem.Add(menu);
            Windows.Add(menu);
        }
 public void Uninstall(GUISystem guiSystem)
 {
     guiSystem.RemoveControl(m_EdgeControl);
     guiSystem.RemoveControl(m_PointControl);
     guiSystem.RemoveControl(m_LeftTangentControl);
     guiSystem.RemoveControl(m_RightTangentControl);
     guiSystem.RemoveAction(m_CreatePointAction);
     guiSystem.RemoveAction(m_RemovePointAction1);
     guiSystem.RemoveAction(m_RemovePointAction2);
     guiSystem.RemoveAction(m_MovePointAction);
     guiSystem.RemoveAction(m_MoveEdgeAction);
     guiSystem.RemoveAction(m_MoveLeftTangentAction);
     guiSystem.RemoveAction(m_MoveRightTangentAction);
 }
Exemple #16
0
        public ObjectEditWindow(GUISystem system, GUITheme theme)
            : base(system, new UDim2(0.25f, 0, 0.25f, 0), "Edit <Object>", theme, false)
        {
            Position = new UDim2(0, 0, 0.75f, 0);
            MinSize  = new UDim2(0, 200, 0, 250);
            MaxSize  = new UDim2(0, 475, 0, 350);

            elements = new List <GUIElement>();

            form = new GUIForm(UDim2.Zero, new UDim2(1f, 0, 1f, 0), theme);
            AddTopLevel(form);

            Visible = false;
        }
Exemple #17
0
        //bool showGameItems;

        public HUD(MasterRenderer renderer)
        {
            this.renderer = renderer;
            font          = AssetManager.LoadFont("karmasuture-26");

            feed           = new List <FeedItem>();
            hitIndications = new List <HitIndication>();

            if (palletTex == null)
            {
                palletTex = GLoader.LoadTexture("Textures/Gui/palette.png");
                Texture crosshairTex = GLoader.LoadTexture("Textures/Gui/crosshair.png");
                Texture hitmarkerTex = GLoader.LoadTexture("Textures/Gui/hitmarker.png");
                crosshairImage = new Image(crosshairTex);
                hitmarkerImage = new Image(hitmarkerTex);
                hurtRingTex    = GLoader.LoadTexture("Textures/Gui/hurt-ring.png");
                intelTex       = GLoader.LoadTexture("Textures/Gui/intel.png", TextureMinFilter.Nearest, TextureMagFilter.Nearest);
            }

            GUISystem gsys = renderer.Sprites.GUISystem;

            area        = new GUIArea(gsys);
            area.ZIndex = -1;

            theme = GUITheme.Basic;
            theme.SetField("Font", font);
            theme.SetField("SmallFont", AssetManager.LoadFont("arial-bold-14"));
            theme.SetField("Label.TextColor", Color.White);
            theme.SetField("Label.TextShadowColor", new Color(0, 0, 0, 0.6f));

            healthLabel       = new GUILabel(new UDim2(0, 40, 1, -20), UDim2.Zero, "Health: --", TextAlign.BottomLeft, theme);
            ammoLabel         = new GUILabel(new UDim2(1, -50, 1, -25), UDim2.Zero, "", TextAlign.BottomRight, theme);
            crosshair         = new GUIFrame(new UDim2(0.5f, -28, 0.5f, -28), new UDim2(0, 56, 0, 56), crosshairImage);
            hitmarker         = new GUIFrame(new UDim2(0.5f, -43, 0.5f, -43), new UDim2(0, 86, 0, 86), hitmarkerImage);
            hitmarker.Visible = false;

            intelInHand = new GUIFrame(new UDim2(0.5f, -20, 0, 100), new UDim2(0, 40, 0, 40), new Image(intelTex));
            intelPickedUpNotification = new GUILabel(new UDim2(0.5f, 0, 0, 150), UDim2.Zero,
                                                     "You have picked up the intel!", TextAlign.TopCenter, theme);
            intelInHand.Visible = false;
            intelPickedUpNotification.Visible = false;

            crosshair.CapturesMouseClicks   = false;
            hitmarker.CapturesMouseClicks   = false;
            ammoLabel.CapturesMouseClicks   = false;
            healthLabel.CapturesMouseClicks = false;

            area.AddTopLevel(ammoLabel, healthLabel, crosshair, hitmarker, intelInHand, intelPickedUpNotification);
        }
Exemple #18
0
        public ViewMessage(GameSystem game, RenderSystem renderer,
                           string text,
                           IList <MenuOption> options)
            : base(game, renderer)
        {
            GUI           = new GUISystem();
            Text          = new Label(text, GetScreenPoint(0.5f, 0.25f));
            ButtonsLayout = new LinearLayout(LayoutDirection.Vertical, GetScreenPoint(0.5f, 0.6f), Vector2f.Center);

            foreach (var option in options)
            {
                var button = new GUIButton(Vector2.Zero, option.Text, option.Callback);
                ButtonsLayout.Add(button);
                GUI.Add(button);
            }
        }
Exemple #19
0
    // A window which is an overlay over the game
    public ModalWindow(GUISystem gui, float width, float height)
    {
        this.gui = gui;

        this.width  = Screen.width * width;
        this.height = Screen.height * height;

        float centerW = Screen.width / 2;
        float centerH = Screen.height / 2;

        windowRect = new Rect(
            centerW - (this.width / 2),
            centerH - (this.height / 2),
            this.width,
            this.height
            );
    }
        public PaintWindow(GUISystem system, GUITheme theme)
            : base(system, new UDim2(0.25f, 0, 0.25f, 0), "Paint Options", theme, false)
        {
            Position = new UDim2(0, -10, 0.7f, -10);
            MinSize  = new UDim2(0, 200, 0, 250);
            MaxSize  = new UDim2(0, 475, 0, 350);

            GUIForm form = new GUIForm(UDim2.Zero, new UDim2(1f, 0, 1f, 0), theme);

            GUILabel     grainLabel;
            GUITextField grainField;

            form.AddLabledTextField("Grainy Factor:", Grain.ToString(), new UDim2(0, 5, 0, 25),
                                    out grainLabel, out grainField);
            grainField.OnTextChanged += GrainField_OnTextChanged;

            AddTopLevel(form);
        }
    /// <summary>
    /// Starts previewing the given recording.
    /// </summary>
    /// <param name="recordingIdentifier">Recording identifier.</param>
    public void StartPreview(string recordingIdentifier = default(string))
    {
        if (guiSystem == null)
        {
            guiSystem = new GUISystem(gameObject);
        }

        StopPreview();

        this.previewData = Megacool.Instance._GetPreviewDataForRecording(recordingIdentifier);
        if (previewData == null)
        {
            return;
        }

        _playGifIEnumerator = StartCoroutine(
            PreviewMegacoolGif()
            );
    }
        public TranslateTerrainWindow(GUISystem system, GUITheme theme)
            : base(system, new UDim2(0.2f, 0, 0, 175), "Translate Terrain", theme)
        {
            MinSize = new UDim2(0.2f, 0, 0, 175);

            GUIForm form = new GUIForm(new UDim2(0, 5, 0, 25), new UDim2(1f, -5, 1f, -25), theme);

            form.AddLabledTextField("X:", "0", new UDim2(0, 0, 0, 0), out xField);
            form.AddLabledTextField("Y:", "0", new UDim2(0, 0, 0, 35), out yField);
            form.AddLabledTextField("Z:", "0", new UDim2(0, 0, 0, 70), out zField);

            GUIButton applyBtn  = new GUIButton(new UDim2(0, 5, 1f, -40), new UDim2(0, 100, 0, 30), "Apply", theme);
            GUIButton cancelBtn = new GUIButton(new UDim2(1f, -105, 1f, -35), new UDim2(0, 100, 0, 30), "Cancel", theme);

            applyBtn.OnMouseClick  += ApplyBtn_OnMouseClick;
            cancelBtn.OnMouseClick += CancelBtn_OnMouseClick;

            AddTopLevel(form, applyBtn, cancelBtn);
        }
        public ViewChooseProfession(GameSystem game, RenderSystem renderer) : base(game, renderer)
        {
            GUI    = new GUISystem();
            Header = new Label("What is your profession?", GetScreenPoint(0.5f, 0.25f));

            ProfessionsLayout         = new LinearLayout(LayoutDirection.Horizontal, GetScreenPoint(0.5f, 0.5f), Vector2f.Center);
            ProfessionsLayout.Size    = new Vector2((int)Renderer.Size.X, (int)Renderer.Size.Y / 3);
            ProfessionsLayout.Spacing = 3;
            foreach (var profession in Professions.All)
            {
                var button = new GUIButton(
                    Vector2.Zero,
                    profession.Name,
                    () => ChooseProfession(profession)
                    );
                ProfessionsLayout.Add(button);
                GUI.Add(button);
            }
        }
Exemple #24
0
        public GUIWindow(GUISystem system, UDim2 position, UDim2 size, string title, GUITheme theme,
                         bool closable = true, bool createTitleBar = true)
            : base(system, position, size)
        {
            Theme = theme;
            if (createTitleBar)
            {
                TitleBar = new GUILabel(UDim2.Zero, new UDim2(1f, 0, 0, 20), title,
                                        theme.GetField <Color>(Color.White, "Window.TitleBar.TextColor"), theme);
                TitleBar.CapturesMouseClicks = true;
                TitleBar.ZIndex          = 100;
                TitleBar.BackgroundImage = theme.GetField <Image>(Image.CreateBlank(new Color(40, 40, 40)), "Window.TitleBar.BackgroundImage");

                if (closable)
                {
                    ExitButton = new GUIButton(new UDim2(1f, -20, 0, 0), new UDim2(0, 20, 0, 20),
                                               theme.GetField <string>("X", "Window.TitleBar.CloseButton.Text"),
                                               TextAlign.Center,
                                               theme,
                                               theme.GetField <Image>(Image.CreateBlank(new Color(230, 0, 0)), "Window.TitleBar.CloseButton.NormalImage"),
                                               theme.GetField <Image>(Image.CreateBlank(new Color(255, 0, 0)), "Window.TitleBar.CloseButton.HoverImage"),
                                               theme.GetField <Image>(Image.CreateBlank(new Color(200, 0, 0)), "Window.TitleBar.CloseButton.ActiveImage"),
                                               null);
                    ExitButton.Parent        = TitleBar;
                    ExitButton.OnMouseClick += (btn, mbtn) =>
                    {
                        Visible = false;
                    };
                }
            }

            BackgroundFrame = new GUIFrame(new UDim2(0, 0, 0, createTitleBar ? 20 : 0), new UDim2(1f, 0, 1f, createTitleBar ? -20 : 0),
                                           theme.GetField <Image>(Image.CreateBlank(new Color(70, 70, 70, 200)), "Window.BackgroundImage"));
            BackgroundFrame.ZIndex = -100;

            if (createTitleBar)
            {
                SetDragHandle(TitleBar);
                AddTopLevel(TitleBar);
            }
            AddTopLevel(BackgroundFrame);
        }
Exemple #25
0
        public static Placeable Create(AuroraUTP utp, AuroraGIT.APlaceable gitData)
        {
            if (guiSystem == null)
            {
                guiSystem = GameObject.Find("GUI System").GetComponent <GUISystem>();
            }
            GameObject gameObject;

            //get the resource reference for this object, which we'll use as it's in-engine name
            string name = utp.TemplateResRef;

            //get the appearance row number in placeables.2da
            int appearance = (int)utp.Appearance;

            //get the model name for this appearance id
            string modelRef = Resources.Load2DA("placeables")[appearance, "modelname"];

            if (modelRef == "PLC_Invis")
            {
                gameObject = new GameObject(name);
            }
            else
            {
                gameObject      = Resources.LoadModel(modelRef);
                gameObject.name = name;
            }

            //add the template component to the new object
            Placeable placeable = gameObject.AddComponent <Placeable>();

            placeable.template = utp;
            placeable.gitData  = gitData;

            LookAtHook hook = gameObject.GetComponentInChildren <LookAtHook>();

            if (hook != null)
            {
                hook.obj = placeable;
            }

            return(placeable);
        }
        protected override void OnClientInitialized()
        {
            // Initialize remotes
            channel.AddRemoteEvent("Client_UnloadWorld", R_UnloadWorld);
            channel.AddRemoteEvent("Client_Announcement", R_Announcement);
            channel.AddRemoteEvent("Client_AddFeedItem", R_AddFeedItem);
            channel.AddRemoteEvent("Client_ChatItem", R_ChatItem);
            channel.AddRemoteEvent("Client_SwitchGamemode", R_SwitchGamemode);
            channel.AddRemoteEvent("Client_TeamWon", R_TeamWon);

            // Create the leaderboard
            leaderboard = new Leaderboard(GUISystem, theme, netPlayerComponent);
            GUISystem.Add(leaderboard);
            Windows.Add(leaderboard);

            // Enable some debugging
            InitializeCMD();

            base.OnClientInitialized();
        }
Exemple #27
0
        private void InitUI()
        {
            GUI = new GUISystem();
            string text = string.Format("You are in the {0}\nWhat do you want to do?", Location.DisplayName);

            CityText           = new Label(text, GetScreenPoint(0.5f, 0.25f));
            ButtonsLayout      = new LinearLayout(LayoutDirection.Vertical, GetScreenPoint(0.5f, 0.75f), Vector2f.Center);
            ButtonsLayout.Size = GetScreenPoint(0.5f, 0.35f);

            foreach (var interactable in Location.Interactables)
            {
                var button = new GUIButton(Vector2.Zero, interactable.MenuText, () => interactable.Interact(Game));
                ButtonsLayout.Add(button);
                GUI.Add(button);
            }
            var travel = new GUIButton(Vector2.Zero, "Travel", () => Travel());

            ButtonsLayout.Add(travel);
            GUI.Add(travel);
        }
        public EditorUI(MasterRenderer renderer, EditorScreen screen)
        {
            this.renderer = renderer;
            this.screen   = screen;

            GUISystem gsys = renderer.Sprites.GUISystem;

            area = new GUIArea(gsys);
            renderer.Sprites.Add(area);

            theme = EditorTheme.Glass;


            GenBar(renderer.ScreenWidth);

            openFileWindow = new FileBrowserWindow(gsys, theme, new UDim2(0.75f, 0, 0.75f, 0), "Open Model",
                                                   FileBrowserMode.OpenFile, new string[] { ".aosm" },
                                                   (window) =>
            {
                if (File.Exists(window.FileName))
                {
                    screen.LoadModel(window.FileName);
                }
            });

            saveFileWindow = new FileBrowserWindow(gsys, theme, new UDim2(0.75f, 0, 0.75f, 0), "Save Model",
                                                   FileBrowserMode.Save, new string[] { ".aosm" },
                                                   (window) =>
            {
                string fullPath = Path.Combine(window.CurrentDirectory, window.FileName);

                if (!Path.HasExtension(fullPath))
                {
                    fullPath += ".aosm";
                }

                screen.SaveModel(fullPath);
            });

            gsys.Add(openFileWindow, saveFileWindow);
        }
Exemple #29
0
    void Start()
    {
        inputSystem            = GetComponent <InputSystem> ();
        guiSystem              = GetComponent <GUISystem> ();
        players                = new List <Player> ();
        walkableTileHighlights = new List <Transform> ();

        var allPlayersOnScene = Object.FindObjectsOfType <Player> ();

        foreach (var player in allPlayersOnScene)
        {
            players.Add(player);
        }

        if (tileSelector != null)
        {
            Selector_MoveTo(0, -5);
        }

        State = GameState.BATTLE;
    }
        public ConnectWindow(GUISystem system, GUITheme theme, UDim2 size) 
            : base(system, size, "Connect to server", theme)
        {
            GUILabel endPointLabel = new GUILabel(new UDim2(0, 10, 0, 50), UDim2.Zero, "Server Address:",
                TextAlign.Left, theme);
            Vector2 labelSize = endPointLabel.Font.MeasureString(endPointLabel.Text);
            endPointField = new GUITextField(new UDim2(0, labelSize.X + 20, 0, 35),
                new UDim2(1f, -labelSize.X - 30, 0, 30), "", TextAlign.Left, theme);

            GUILabel nameLabel = new GUILabel(new UDim2(0, 10, 0, 100), UDim2.Zero, "Player Name:",
                TextAlign.Left, theme);
            labelSize = nameLabel.Font.MeasureString(nameLabel.Text);
            playerField = new GUITextField(new UDim2(0, labelSize.X + 20, 0, 85),
                new UDim2(1f, -labelSize.X - 30, 0, 30), "Player", TextAlign.Left, theme);
            playerField.MaxLength = 60;

            connectBtn = new GUIButton(new UDim2(0, 10, 1f, -40), new UDim2(0, 100, 0, 30), "Connect", theme);
            connectBtn.OnMouseClick += (btn, mbtn) => { TryConnect(); };

            AddTopLevel(endPointLabel, endPointField, nameLabel, playerField, connectBtn);
        }
Exemple #31
0
    // Use this for initialization
    public void StartLevel()
    {
        Debug.Log("PlanePilot started with "+ this.gameObject.name);
        Application.targetFrameRate = 60;
        gui = GameObject.FindGameObjectWithTag("GUISystem").GetComponent<GUISystem>();
        gui.setMaxHealths(healths);
        if(SharedVars.Inst.lastPlayedLevel == "firstLevel")
        {
            targetsLeft.text = "Goats left: "+ goatsLeft;
        } else if(SharedVars.Inst.lastPlayedLevel == "secondLevel")
        {
            targetsLeft.text = "Supplies picked: "+ goatsLeft;
        }

        //Time.timeScale = 0f;
    }