Exemple #1
0
        public static DialogResult Show()
        {
            pauseDialog = new PauseDialog();

            pauseDialog.FormBorderStyle = FormBorderStyle.None;
            pauseDialog.StartPosition   = FormStartPosition.CenterScreen;
            pauseDialog.Size            = new Size(ScreenControl.controlWidth, ScreenControl.controlHeight);
            pauseDialog.BackColor       = Color.DarkGray;

            continueButton          = new Button();
            continueButton.Location = new Point(10, pauseDialog.Height / 2 - ScreenControl.buttonSize.Height - 10);
            continueButton.Text     = "Continue";
            continueButton.Click   += ButtonClick;
            continueButton.Enter   += ScreenControl.buttonEnter;
            continueButton.Leave   += ScreenControl.buttonLeave;
            pauseDialog.Controls.Add(continueButton);

            exitButton          = new Button();
            exitButton.Location = new Point(10, pauseDialog.Height / 2 + 10);
            exitButton.Text     = "Exit Game";
            exitButton.Click   += ButtonClick;
            exitButton.Enter   += ScreenControl.buttonEnter;
            exitButton.Leave   += ScreenControl.buttonLeave;
            pauseDialog.Controls.Add(exitButton);

            ScreenControl.setComponentValues(pauseDialog);

            pauseDialog.ShowDialog();
            return(buttonResult);
        }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        theScreenControl    = GameObject.Find("Screen");
        screenControlScript = theScreenControl.GetComponent <ScreenControl>();
        walls        = new Transform[4];
        wallsInd     = new List <int>();
        wallsIndTemp = new List <int>();


        walls[0] = w1;
        walls[1] = w2;
        walls[2] = w3;
        walls[3] = w4;
        for (int i = 0; i < 4; i++)
        {
            GetRandInt();
        }
        if (screenControlScript.gameStep == 1)
        {
            Destroy(walls[wallsInd[3]].gameObject);
            Destroy(walls[wallsInd[2]].gameObject);
            Destroy(walls[wallsInd[1]].gameObject);
        }

        if (screenControlScript.gameStep == 2)
        {
            Destroy(walls[wallsInd[3]].gameObject);
            Destroy(walls[wallsInd[2]].gameObject);
        }

        if (screenControlScript.gameStep == 3)
        {
            Destroy(walls[wallsInd[3]].gameObject);
        }
    }
    static int Initialize(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 1)
        {
            ScreenControl obj = LuaScriptMgr.GetNetObject <ScreenControl>(L, 1);
            obj.Initialize();
            return(0);
        }
        else if (count == 2)
        {
            ScreenControl obj  = LuaScriptMgr.GetNetObject <ScreenControl>(L, 1);
            object        arg0 = LuaScriptMgr.GetVarObject(L, 2);
            obj.Initialize(arg0);
            return(0);
        }
        else if (count == 3)
        {
            ScreenControl obj  = LuaScriptMgr.GetNetObject <ScreenControl>(L, 1);
            float         arg0 = (float)LuaScriptMgr.GetNumber(L, 2);
            float         arg1 = (float)LuaScriptMgr.GetNumber(L, 3);
            obj.Initialize(arg0, arg1);
            return(0);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: ScreenControl.Initialize");
        }

        return(0);
    }
        public MenuScreen()
        {
            InitializeComponent();

            ScreenControl.setComponentValues(this);
            defaultOverride();
        }
    static int Lua_ToString(IntPtr L)
    {
        ScreenControl obj = LuaScriptMgr.GetNetObject <ScreenControl>(L, 1);

        LuaScriptMgr.Push(L, obj.ToString());
        return(1);
    }
        private void exitButton_Click(object sender, EventArgs e)
        {
            SoundPlayer buttonClick = new SoundPlayer(Properties.Resources.buttonClick);

            buttonClick.Play();
            ScreenControl.changeScreen(this, "MenuScreen");
        }
Exemple #7
0
 /// <summary>
 /// Handles the fish collision events
 /// </summary>
 /// <param name="e">Event type</param>
 private void HandleFishCollision(FishBehaviour.FishCollisionEvents e)
 {
     //Check if its a score hit
     if (e == FishBehaviour.FishCollisionEvents.SCOREHIT)
     {
         //Set the game score
         SetGameScore(gameScore + 1);
         //Check if score can should be increased
         if (gameScore % 10 == 0 && gameSpeed < 11)
         {
             //Increase the speed
             gameSpeed += 1;
             PublishGameSpeedChange();
         }
     }
     else if (e == FishBehaviour.FishCollisionEvents.FISHHIT)
     {
         //Get the screen control
         ScreenControl screenControl = GameObject.Find(Const.screenGameObject).GetComponent <ScreenControl>();
         //Set the score for the finish menu
         screenControl.GetScreen(ScreenControl.SCREENS.FinishMenu).GetComponent <FinishMenuControl>().SetGameScore(gameScore);
         //Reset the game play
         ResetGamePlay();
         //Enable the finish menu screen
         screenControl.EnableScreen(ScreenControl.SCREENS.FinishMenu);
     }
 }
    static int UnInitialize(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        ScreenControl obj = LuaScriptMgr.GetNetObject <ScreenControl>(L, 1);

        obj.UnInitialize();
        return(0);
    }
    static int GetType(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        ScreenControl obj = LuaScriptMgr.GetNetObject <ScreenControl>(L, 1);
        Type          o   = obj.GetType();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Exemple #10
0
 /// <summary>
 /// Main screen upon entering the application
 /// </summary>
 public MainMenu(ScreenControl parentWindow)
     : base(parentWindow)
 {
     InitializeComponent();
     App.ReadOptionsFile();
     App.EnsureOptionsSet();
     App.CreateChessEngine();
     SetBackground();
 }
Exemple #11
0
        public LostScreen()
        {
            InitializeComponent();

            ScreenControl.setComponentValues(this);
            defaultOverride();

            showScores();
        }
    static int ToString(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        ScreenControl obj = LuaScriptMgr.GetNetObject <ScreenControl>(L, 1);
        string        o   = obj.ToString();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Exemple #13
0
        /// <summary>
        /// Add a screen to the list of screens that will be handled.
        /// </summary>
        protected void RegisterScreen(ScreenControl screen)
        {
            if (screen == null)
            {
                throw new System.ArgumentNullException("screen");
            }

            this.screens.Add(screen);
        }
Exemple #14
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 public Settings(ScreenControl parentWindow)
     : base(parentWindow)
 {
     InitializeComponent();
     SetupTextureButtons();
     Difficulty_Slider.SetCurrentValue(SurfaceSlider.ValueProperty, (double)Chess.Properties.Settings.Default.DifficultySetting);
     setDifficultyLabel();
     ObjRecSet();
 }
        public messageScreen1()
        {
            InitializeComponent();

            ScreenControl.setComponentValues(this);
            defaultOverride();
            countTimer.Interval = 1000;
            countTimer.Enabled  = true;
        }
    static int Equals(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 2);
        ScreenControl obj  = LuaScriptMgr.GetNetObject <ScreenControl>(L, 1);
        object        arg0 = LuaScriptMgr.GetVarObject(L, 2);
        bool          o    = obj.Equals(arg0);

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Exemple #17
0
        public GameOverScreen()
        {
            InitializeComponent();

            ScreenControl.setComponentValues(this);

            playButton.Focus();

            defaultOverride();
        }
 private void timer1_Tick(object sender, EventArgs e)
 {
     startUp.Play();
     count++;
     if (count == 3)
     {
         ScreenControl.changeScreen(this, "GameScreen");
         countTimer.Enabled = false;
     }
 }
Exemple #19
0
        public GameBoard(ScreenControl parentWindow)
            : base(parentWindow)
        {
            InitializeComponent();

            this.gameController = new GameController(false, FENConverter.convertFENToPosition(FENConverter.startPosition), false, false);
            ResetDialogs();
            SetTopDialogs();
            ColourBackgrounds();
        }
Exemple #20
0
        public ItemControlBase(ScreenControl screenControl, OSDItem item)
        {
            this.screenControl = screenControl ?? throw new ArgumentNullException(nameof(screenControl));
            this.item          = item ?? throw new ArgumentNullException(nameof(item));

            item.Enabled.Updated += EnabledUpdated;

            Load     += ItemControlLoad;
            Disposed += ItemControlDisposed;
        }
Exemple #21
0
        public MenuScreen()
        {
            InitializeComponent();

            ScreenControl.setComponentValues(this);
            defaultOverride();

            var ufoSound = new System.Windows.Media.MediaPlayer();

            ufoSound.Open(new Uri(Application.StartupPath + "/Resources/ufo_onscreen.wav"));
        }
Exemple #22
0
        public CommonItemControl(ScreenControl screenControl, OSDItem item)
            : base(screenControl, item)
        {
            InitializeComponent();

            label.Text = item.Name;

            checkBox.CheckedChanged += CheckBoxChanged;

            label.MouseClick += (s, e) => DoSelect();
            this.MouseClick  += (s, e) => DoSelect();
        }
Exemple #23
0
        public MenuScreen()
        {
            InitializeComponent();

            ScreenControl.setComponentValues(this);
            defaultOverride();

            p1Graphic.Location = new Point(875, 240);
            p1Cycle.Location   = new Point(875, 200);

            p2Graphic.Location = new Point(115, 240);
            p2Cycle.Location   = new Point(115, 200);
        }
        public void Find_OneNestedControl_ReturnsCorrectResult()
        {
            var screen = new ScreenControl();

            screen.Name = "screen";

            float buttonWidth  = 100;
            float buttonHeight = 40;

            var button1 = new FakeControl(new Area(40, 40, buttonWidth, buttonHeight));

            button1.Name = "button1";

            var button2 = new FakeControl(new Area(5 + 40, 40, buttonWidth, buttonHeight));

            button2.Name = "button2";

            var button3 = new FakeControl(new Area(40, 5 + 40, buttonWidth, buttonHeight));

            button3.Name = "button3";

            var button4 = new FakeControl(new Area(5 + 40, 5, buttonWidth, buttonHeight));

            button4.Name = "button4";

            var container = new ControlContainer(new Area(5 + 40, 5, 300, 300));

            container.Name = "container";

            var button5 = new FakeControl(new Area(10, 10, buttonWidth, buttonHeight));

            button5.Name = "button1";

            var container_button2 = new FakeControl(new Area(5 + 10, 10, buttonWidth, buttonHeight));

            container_button2.Name = "button2";

            container.AddControl(button5);
            container.AddControl(container_button2);

            screen.AddControl(button1);
            screen.AddControl(button2);
            screen.AddControl(button3);
            screen.AddControl(button4);

            screen.AddControl(container);

            var actual = screen.Find("container/button2");

            Assert.AreEqual(container_button2, actual);
        }
    static int get_ScaleRatio(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaDLL.luaL_error(L, "unknown member name ScaleRatio");
        }

        ScreenControl obj = (ScreenControl)o;

        LuaScriptMgr.Push(L, obj.ScaleRatio);
        return(1);
    }
    static int get_DesignAspect(IntPtr L)
    {
        object o = LuaScriptMgr.GetLuaObject(L, 1);

        if (o == null)
        {
            LuaDLL.luaL_error(L, "unknown member name DesignAspect");
        }

        ScreenControl obj = (ScreenControl)o;

        LuaScriptMgr.Push(L, obj.DesignAspect);
        return(1);
    }
Exemple #27
0
        /// <summary>
        /// Open the pause dialog box and gets Cancel or Abort result from it
        /// </summary>
        private void pauseGame()
        {
            gameTimer.Enabled = false;

            DialogResult result = PauseDialog.Show();

            if (result == DialogResult.Cancel)
            {
                gameTimer.Enabled = true;
            }
            if (result == DialogResult.Abort)
            {
                ScreenControl.changeScreen(this, "MenuScreen");
            }
        }
Exemple #28
0
        /// <summary>
        /// Open the pause dialog box and gets Cancel or Abort result from it
        /// </summary>
        private void pauseGame()
        {
            scoreTimer.Enabled = false;
            gameTimer.Enabled  = false;
            rightArrowDown     = leftArrowDown = upArrowDown = downArrowDown = false;

            DialogResult result = PauseDialog.Show();

            if (result == DialogResult.Cancel)
            {
                gameTimer.Enabled = true;
            }
            if (result == DialogResult.Abort)
            {
                ScreenControl.changeScreen(this, "MenuScreen");
            }
        }
    static int Create(IntPtr L)
    {
        int count = LuaDLL.lua_gettop(L);

        if (count == 0)
        {
            ScreenControl obj = new ScreenControl();
            LuaScriptMgr.PushObject(L, obj);
            return(1);
        }
        else
        {
            LuaDLL.luaL_error(L, "invalid arguments to method: ScreenControl.New");
        }

        return(0);
    }
Exemple #30
0
        } //Countsdown until zero

        private void countdown()
        {
            temp--;
            if (temp <= 0)
            {
                gameTimer.Enabled = false;
                rightArrowDown    = leftArrowDown = upArrowDown = downArrowDown = false;
                backSongPlayer.Stop();
                ScreenControl.changeScreen(this, "WinScreen");
            }
            if (heroX > lineLength)
            {
                gameTimer.Enabled = false;
                rightArrowDown    = leftArrowDown = upArrowDown = downArrowDown = false;
                backSongPlayer.Stop();
                ScreenControl.changeScreen(this, "LostScreen");
            }
        }
Exemple #31
0
    // Start is called before the first frame update
    void Start()
    {
        theScreenControl    = GameObject.Find("Screen");
        screenControlScript = theScreenControl.GetComponent <ScreenControl>();
        type = Random.Range(0, 2);

        render = GetComponent <SpriteRenderer>();

        if (type == 0)
        {
            render.sprite = white;
        }

        if (type == 1)
        {
            render.sprite = black;
        }
    }
    private void SetControl(ScreenControl controlObj, EScreenControl control)
    {
        switch (control)
        {
        case EScreenControl.Back:
            controlObj.Set(Back, backIcon);
            break;

        case EScreenControl.Exit:
            controlObj.Set(CloseCurrent, exitIcon);
            break;

        case EScreenControl.ExitToMain:
            controlObj.Set(() => {
                CloseCurrent();
                OpenMain();
            }, exitIcon);
            break;

        case EScreenControl.Expand:
            controlObj.Set(() => {
                //Debug.LogWarning( "ScreenManager: GetControlHandler() Control not Implemented." );
            }, expandIcon);
            break;

        case EScreenControl.Hide:
            controlObj.Set(HideCurrent, hideIcon, showIcon,
                           (m_Open.screen.isHidden) ? ScreenControl.EStartIcon.Icon2 : ScreenControl.EStartIcon.Icon1);
            break;

        case EScreenControl.Shrink:
            controlObj.Set(() => {
                //Debug.LogWarning( "ScreenManager: GetControlHandler() Control not Implemented." );
            }, shrinkIcon);
            break;

        default:
            controlObj.Set(() => {
                //Debug.LogWarning( "ScreenManager: GetControlHandler() Control not Implemented." );
            }, null);
            break;
        }
    }
Exemple #33
0
        public Game(GameSave save, MapType map, MissionType missionType, InteractionMode interactionMode, int seed = -1)
        {
            Log.Debug($"Loading new game (MissionType: '{missionType}', InteractionMode: '{interactionMode}').");

            MissionType     = missionType;
            InteractionMode = interactionMode;

            MapType = map;

            // If seed negative, calculate it.
            Seed         = seed < 0 ? save.Seed + save.Level : seed;
            SharedRandom = new Random(Seed);

            ObjectiveType = MapType.AvailableObjectives[SharedRandom.Next(map.AvailableObjectives.Length)];

            Save  = save;
            Stats = new GameStats(save);

            Editor = InteractionMode == InteractionMode.EDITOR;

            SpellManager     = new SpellCasterManager(this);
            ConditionManager = new ConditionManager(this);

            ScreenControl = new ScreenControl(this);

            World = new World(this, Seed, Save);

            if (!string.IsNullOrEmpty(map.MissionScript) && !Program.DisableScripts)
            {
                var scriptLoader = new MissionScriptLoader(FileExplorer.FindIn(FileExplorer.Scripts, map.MissionScript, ".cs"), map.MissionScript);
                script = scriptLoader.Start(this);
            }
            else
            {
                Log.Debug(Program.DisableScripts ? "Mission scripts are disabled." : "No mission script existing.");
            }

            if (ObjectiveType == ObjectiveType.SURVIVE_WAVES)
            {
                waveController = new WaveController(this);
            }
        }