Example #1
0
    public void LoadPrevScreen()
    {
        if (Active3DScreen && ActiveScreen)
        {
            ActiveScreen.HideScreen();

            //ищем активный
            arrayScreens.Remove(ActiveScreen.gameObject);
            Destroy(ActiveScreen.gameObject);
            ActiveScreen = null;

            PrevActive.ShowScreen();
            ActiveScreen = PrevActive;
            return;
        }


        if (ActiveScreen && PrevActive)
        {
            ActiveScreen.HideScreen();

            //ищем активный
            arrayScreens.Remove(ActiveScreen.gameObject);
            Destroy(ActiveScreen.gameObject);
            ActiveScreen = null;

            PrevActive.ShowScreen();
            ActiveScreen = PrevActive;
            return;
        }
    }
 public void removeScreen(AbstractScreen screen)
 {
     if (screens.Contains(screen))
     {
         screens.Remove(screen);
     }
 }
        public override void Draw(AbstractScreen screen, GameTime gameTime)
        {
            SpriteBatch.Begin();

            base.Draw(screen, gameTime);

            SpriteBatch.End();
        }
Example #4
0
 public void ResumeGameScreen()
 {
     GlobalOptions.GetGuiLayer().ResumeTimer();
     if (ActiveScreen)
     {
         PrevActive = ActiveScreen;
         ActiveScreen.HideScreen();
         Debug.Log("Hide " + ActiveScreen.gameObject.name);
     }
 }
Example #5
0
        public void SetParentOrigin(Vector2 newPos, AbstractScreen currentScreen)
        {
            if (currentScreen == null || currentScreen.Viewport == null)
            {
                return;
            }
            Vector2 m = currentScreen.GetMargin();

            origin  = currentScreen.ViewportToScreen(new Vector2(m.x + currentScreen.Viewport.ActualWidth * 0.51f, (int)(m.y)));
            origin += newPos;
            SetPosition();
        }
Example #6
0
    public void LoadScreenByName(string instr)
    {
        if (instr == "")
        {
            return;
        }
        AbstractScreen curScreenScript;
        GameObject     newLoadedScreen = null;

        if (ActiveScreen)
        {
            PrevActive = ActiveScreen;
            ActiveScreen.HideScreen();
        }

        //ищем в загруженных скринах
        for (int j = 0; j < arrayScreens.Count; j++)
        {
            //нашли
            if ((arrayScreens[j] as GameObject).transform.name == instr)
            {
                newLoadedScreen = (arrayScreens[j] as GameObject);
                break;
            }
        }

        if (!newLoadedScreen)
        {
            newLoadedScreen = Instantiate(Resources.Load("Screens/" + instr)) as GameObject;
            newLoadedScreen.transform.name = instr;
            arrayScreens.Add(newLoadedScreen);
        }
        curScreenScript = (newLoadedScreen.GetComponent("AbstractScreen") as AbstractScreen);
        //3d сцена
        if (curScreenScript.Game3DScreen)
        {
            Debug.Log("3dScreen " + instr);
            ActiveScreen = null;
            if (Active3DScreen)
            {
                Active3DScreen.HideObjects();
            }
            Active3DScreen = curScreenScript;
            Active3DScreen.ShowScreen();
        }
        else
        {
            //Debug.Log ("2dScreen "+instr);
            ActiveScreen = curScreenScript;
            ActiveScreen.ShowScreen();
        }
    }
Example #7
0
        public Browser(Form gameForm, AbstractScreen currentScreen)
        {
            mutCache = new System.Threading.Mutex();    //mutex for browser list

            condReset = new ManualResetEvent(false);    //condition to make the thread wait

            Vector2 m = currentScreen.GetMargin();

            origin     = currentScreen.ViewportToScreen(new Vector2(m.x + currentScreen.Viewport.ActualWidth * 0.51f, (int)(m.y)));
            dimensions = currentScreen.ViewportToScreen(new Vector2(currentScreen.Viewport.ActualWidth * 0.47f, (int)currentScreen.Viewport.ActualHeight - m.y - currentScreen.GetTextVSpacing()));


            this.gameForm = gameForm;

            InitializeComponent();

            CreateBrowser();

            this.Activated += new System.EventHandler(this.Browser_Activated); // dopiero po zakonczeniu i po zrobieniu Show() (ktore z kolei wywoła onLoad, potem Hide)
            this.Load      += new System.EventHandler(this.Browser_Load);
            this.Shown     += new System.EventHandler(this.Browser_Shown);
        }
        public override int AddControlsInfoToGui(Window guiWindow, GUI mGui, int left, int top, int initialTopSpacing, float width, float textVSpacing, uint fontSize)
        {
            int  y           = initialTopSpacing;
            int  h           = (int)textVSpacing;
            uint oldFontSize = mGui.mFontSize;

            int leftOrg = left;

            // przesuniecie o szerokosc guzika (fontsize) + fontSize
            left += (int)(fontSize + fontSize);

            //imgVDiff = 0;


            OverlayContainer c;

            y += (int)(h * 1);
            c  = guiWindow.createStaticText(new Vector4(left - 10, top + y, width, h), LanguageResources.GetString(LanguageKey.Controls));
            AbstractScreen.SetOverlayColor(c, new ColourValue(1.0f, 0.8f, 0.0f), new ColourValue(0.9f, 0.7f, 0.0f));


            mGui.mFontSize = fontSize;
            float spaceSize = ViewHelper.MeasureText(mGui.mFont, " ", mGui.mFontSize);
            float imgSize   = fontSize;
            float imgVDiff  = -Mogre.Math.Abs(imgSize - fontSize) * 0.5f;

            y += (int)(h * 1.5f);
            var pos = new Vector4(left, top + y, width, h);

            c =
                guiWindow.createStaticText(pos,
                                           LanguageResources.GetString(LanguageKey.Engine) + ": " + KeyMap.GetName(KeyMap.Instance.Engine) + " (" + LanguageResources.GetString(LanguageKey.Hold) + ")");


            Setup(mGui, guiWindow);
            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.Engine);

            // "Engine: E (hold)");
            y += (int)(h * 1);


            AddChangeButton(new Vector2(leftOrg, top + y), fontSize, LanguageKey.AccelerateBreakTurn);

            if (KeyMap.Instance.Left == KeyCode.KC_LEFT && KeyMap.Instance.Right == KeyCode.KC_RIGHT)
            {
                string ctrl1  = LanguageResources.GetString(LanguageKey.AccelerateBreakTurn) + ": ";
                float  width1 = ViewHelper.MeasureText(mGui.mFont, ctrl1, mGui.mFontSize);

                c =
                    guiWindow.createStaticText(new Vector4(left, top + y, width, h), ctrl1);


                guiWindow.createStaticImage(new Vector4(left + width1, top + y + imgVDiff, imgSize, imgSize), "arrow_left.png");
                guiWindow.createStaticImage(new Vector4(left + width1 + imgSize + spaceSize * 0.5f, top + y + imgVDiff, imgSize, imgSize), "arrow_right.png");
            }
            else
            {
                c =
                    guiWindow.createStaticText(new Vector4(left, top + y, width, h),
                                               LanguageResources.GetString(LanguageKey.AccelerateBreakTurn) + ": " + KeyMap.GetName(KeyMap.Instance.Left) + "/" + KeyMap.GetName(KeyMap.Instance.Right));
            }


            y += (int)(h * 1);

            AddChangeButton(new Vector2(leftOrg, top + y), fontSize, LanguageKey.Pitch);


            if (KeyMap.Instance.Up == KeyCode.KC_UP && KeyMap.Instance.Down == KeyCode.KC_DOWN)
            {
                string ctrl2  = LanguageResources.GetString(LanguageKey.Pitch) + ": ";
                float  width2 = ViewHelper.MeasureText(mGui.mFont, ctrl2, mGui.mFontSize);

                c =
                    guiWindow.createStaticText(new Vector4(left, top + y, width, h), ctrl2);

                guiWindow.createStaticImage(new Vector4(left + width2, top + y + imgVDiff, imgSize, imgSize), "arrow_up.png");
                guiWindow.createStaticImage(new Vector4(left + width2 + imgSize + spaceSize * 0.5f, top + y + imgVDiff, imgSize, imgSize), "arrow_down.png");
            }
            else
            {
                c =
                    guiWindow.createStaticText(new Vector4(left, top + y, width, h),
                                               LanguageResources.GetString(LanguageKey.Pitch) + ": " + KeyMap.GetName(KeyMap.Instance.Up) + "/" + KeyMap.GetName(KeyMap.Instance.Down));
            }



            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.Spin) + ": " + KeyMap.GetName(KeyMap.Instance.Spin));

            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.Spin);


            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.Gear) + ": " + KeyMap.GetName(KeyMap.Instance.Gear));
            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.Gear);


            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.Gun) + ": " + KeyMap.GetName(KeyMap.Instance.Gun));
            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.Gun);

            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.Bombs) + "/" + LanguageResources.GetString(LanguageKey.Rockets) + ": " + KeyMap.GetName(KeyMap.Instance.Bombs));
            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.Bombs);

            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.Camera) + ": " + KeyMap.GetName(KeyMap.Instance.Camera));
            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.Camera);

            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.Zoomin) + ": " + KeyMap.GetName(KeyMap.Instance.ZoomIn));
            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.Zoomin);

            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.Zoomout) + ": " + KeyMap.GetName(KeyMap.Instance.ZoomOut));
            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.Zoomout);

            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.BulletTimeEffect) + ": " + KeyMap.GetName(KeyMap.Instance.BulletTimeEffect));
            AddChangeButton(new Vector2(leftOrg, pos.y), fontSize, LanguageKey.BulletTimeEffect);


            y  += (int)(h * 1);
            pos = new Vector4(left, top + y, width, h);
            c   = guiWindow.createStaticText(pos,
                                             LanguageResources.GetString(LanguageKey.RearmEndMission) + ": " + KeyMap.GetName(KeyMap.Instance.Bombs));


            mGui.mFontSize = oldFontSize;

            return(y + top);
        }
 public void addScreen(AbstractScreen screen)
 {
     screens.Add(screen);
 }