public CampDock(Vector2 position, ControlManager controlManager)
            : base(position, controlManager)
        {
            Thumbnail = new ImageButton96(
                 GameGraphics.GetTexture("trainingcamp_96").SourceTexture, ThumbnailPosition);

            Controls.Add(Thumbnail);

            #region create buttons for the farmer
            ImageButton48 createSwordsmanBtn = new ImageButton48(
              GameGraphics.GetTexture("swordsman_create_button").SourceTexture,
              ButtonsPositions[0]);
            createSwordsmanBtn.Click += new System.EventHandler(createSwordsmanBtn_Click);
            Controls.Add(createSwordsmanBtn);

            ImageButton48 createKnightBtn = new ImageButton48(
              GameGraphics.GetTexture("knight_create_button").SourceTexture,
              ButtonsPositions[1]);
            createKnightBtn.Click += new System.EventHandler(createKnightBtn_Click);
            Controls.Add(createKnightBtn);
            #endregion

            // add all controls
            AddControls();
        }
        public GameWorld(ControlManager controlManagerRef)
        {
            ControlManagerRef = controlManagerRef;
            Map = new TileMap(200, 400);
            MainPlayer = new GamePlayer(this);
            MainPlayer.Name = "Osama Abulail";
            int cloudsCount = (Map.MapWidth*Map.MapHeight)/(20*20);
            CloudManager = new CloudManager(Map, cloudsCount, CloudDirection.West, 0.5f);
            MovementManager = new UnitMovementManager(this);
            SelectionManager = new UnitSelectionManager(this);
            DockManager = new DockManager(ControlManagerRef);
            UpperStatusBar = new UpperStatusBar(new Vector2(10, 0), MainPlayer, ControlManagerRef);

            _trees = new List<Tree>();

            // generate random trees.
            Random r = new Random();
            for (int i = 0; i < 4000; i++)
            {
                Point treeLoc = new Point(r.Next(0,Map.MapWidth), r.Next(0,Map.MapHeight));
                if (Map.MapCellAt(treeLoc).Walkable)
                {
                    Tree t = new Tree("tree" + r.Next(1, 26), this, treeLoc);
                    _trees.Add(t);
                }
            }

            // border
            _border = new PictureBox(GameGraphics.GetTexture("gameplay_border").SourceTexture,
               new Rectangle(0, 0, 1366, 768));
            ControlManagerRef.Add(_border);
        }
        public UpperStatusBar(Vector2 Position,GamePlayer context, ControlManager controlManager)
        {
            this.ControlManager = controlManager;
            this.Context = context;
            this.OriginPosition = Position;

            #region setting labels
            resources = new Label();
            resources.SpriteFont = GameFonts.GetFont("f5");
            resources.Color = LabelColor;
            resources.SetPosition(GetAbsolutePosition(90,3));
            resources.Text = "Resources: "+Context.Resources;
            ControlManager.Add(resources);

            score = new Label();
            score.SpriteFont = GameFonts.GetFont("f5");
            score.Color = LabelColor;
            score.SetPosition(GetAbsolutePosition(90+160, 3));
            score.Text = "Score: " + Context.Score;
            ControlManager.Add(score);

            elapsedTime = new Label();
            elapsedTime.SpriteFont = GameFonts.GetFont("f5");
            elapsedTime.Color = LabelColor;
            elapsedTime.SetPosition(GetAbsolutePosition(90+160+160, 3));
            elapsedTime.Text = "Population: "+Context.Population;
            ControlManager.Add(elapsedTime);
            #endregion
        }
        public void CanUseAreControlsValid()
        {
            //asign
            var controlManager = new ControlManager();
            var xForm = new XForm();

            xForm.Root = new XContainer { Name = "BaseContainer" };

            var xAttribute = new XAttribute<string>("StringAttribute") { Name = "StringAttribute", Value = "StringAttribute", Use = XAttributeUse.Required };
            var xContainer = new XContainer { Name = "ChildContainer", Value = "ChildContainerValue", ParentContainer = xForm.Root, MaxOccurs = 1234, MinOccurs = 0 };
            xContainer.Attributes.Add(xAttribute);
            var xElement = new XElement { Name = "Element", Value = "ElementValue" };
            xContainer.Elements.Add(xElement);

            xForm.Root.Attributes.Add(xAttribute);
            xForm.Root.Containers.Add(xContainer);
            xForm.Root.Elements.Add(xElement);
            xContainer.Value = "test";

            //action
            controlManager.GetGroupBoxGui(xForm.Root, xForm.Root);
            var areControlsValid = controlManager.AreControlsValid();

            //assert
            Assert.False(areControlsValid);
        }
	public override void Start()
	{
		base.Start();

		_control = ControlManager.Instance;
		_dialogueController = DialogueController.Instance;
	}
 public LoadScreen(Game game, ScreenManager manager)
     : base(game)
 {
     Content = Game.Content;
     this.manager = manager;
     Controls = new ControlManager();
 }
Esempio n. 7
0
 protected override void LoadContent()
 {
     ContentManager Content = Game.Content;
     SpriteFont menuFont = Content.Load<SpriteFont>(@"Fonts\Segue");
     _controlManager = new ControlManager(menuFont);
     base.LoadContent();
 }
 public GameOverMessage(Game game, ScreenManager manager)
     : base(game)
 {
     Content = Game.Content;
     this.manager = manager;
     Controls = new ControlManager();
 }
 public CharacterGeneratorScreen(Game game, ScreenManager screenManager)
     : base(game)
 {
     Content = Game.Content;
     manager = screenManager;
     Controls = new ControlManager();
 }
Esempio n. 10
0
        protected override void LoadContent()
        {
            ContentManager content = this.gameRef.Content;
            SpriteFont menuFont = content.Load<SpriteFont>(@"Fonts\ControlFont");
            this.controlManager = new ControlManager(menuFont);

            base.LoadContent();
        }
Esempio n. 11
0
        protected override void LoadContent()
        {
            var content = Game.Content;
            var menuFont = content.Load<SpriteFont>(@"Fonts\ControlFont");
            ControlManager = new ControlManager(menuFont);

            base.LoadContent();
        }
Esempio n. 12
0
        public BaseScreen(GameStateManager manager)
            : base(manager)
        {
            SpriteFont menuFont = Content.Load<SpriteFont>("SpriteFonts\\ControlFont");
            ControlManager = new ControlManager(menuFont);

            PlayerIndexInControl = PlayerIndex.One;
        }
 public EditorScreen(Game game, ScreenManager screenManager)
     : base(game)
 {
     Content = Game.Content;
     manager = screenManager;
     Controls = new ControlManager();
     toMove = null;
 }
	public void Start()
	{
		_controlManager = ControlManager.Instance;
		_movement = GetComponent<PedestrianMovement>();
		_sprite = GetComponentInChildren<AsvarduilSpriteSystem>();

		_currentIdleHook = FindCurrentIdleHook();
	}
	public override void Start()
	{
		base.Start();

		_entityText = GetComponent<EntityText>();
		_controlManager = ControlManager.Instance;
		_dialogueController = DialogueController.Instance;
	}
Esempio n. 16
0
 public DialogueWindow(Rectangle dialogueScreen, Label dialogue, ControlManager manager)
 {
     _dialogueScreen = dialogueScreen;
     _dialogue = dialogue;
     _dialogue.Size =
     _dialogue.Position = new Vector2((_dialogueScreen.X - 300),(_dialogueScreen.Y));
     _dialogue.Color = Color.LightGreen;
     Manager = manager;
 }
        protected override void LoadContent()
        {
            ContentManager content = Game.Content;

            SpriteFont mainFont = content.Load<SpriteFont>(@"MainFont");
            controlManager = new ControlManager(mainFont);

            base.LoadContent();
        }
Esempio n. 18
0
        protected override void LoadContent()
        {
            ContentManager content = Game.Content;

            var controlFont = content.Load<SpriteFont>(@"Graphics\Fonts\ControlFont");
            ControlManager = new ControlManager(controlFont);

            base.LoadContent();
        }
Esempio n. 19
0
        protected override void LoadContent()
        {
            ContentManager Content = GameRef.Content;

            SpriteFont menuFont = Content.Load<SpriteFont>("menuFont");  // This loads the default font for the game
            ControlManager = new ControlManager(menuFont);

            base.LoadContent();
        }
        protected override void LoadContent()
        {
            ContentManager content = Game.Content;

            Extentions.LoadAllGameContent(content);

            SpriteFont menuFont = GameFonts.GetFont("f3");
            ControlManager = new ControlManager(menuFont);
            base.LoadContent();
        }
 // Use this for initialization
 void Start()
 {
     controlManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<ControlManager>();
     controlManager.GetControl(PlayerActions.Jump);
     tutorialText.text = "Controls! \n" +
         "Control Menu: P \n" +
         "Jump: " + controlManager.GetControl(PlayerActions.Jump) + "\n" +
         "Move Left: " + controlManager.GetControl(PlayerActions.MoveLeft) + "\n" +
         "Move Right: " + controlManager.GetControl(PlayerActions.MoveRight) + "\n";
 }
Esempio n. 22
0
        public BaseGameState(Game game, GameStateManager manager)
            : base(game, manager)
        {
            GameRef = (DnK)game;

            playerIndexInControl = PlayerIndex.One;

            var controlFont = GameRef.Content.Load<SpriteFont>("Graphics/Fonts/ControlFont");
            ControlManager = new ControlManager(controlFont);
        }
 public ResourceBuilding(Vector2 position, string assetName, int range, int food, int maxFood, int medicine, int maxMedicine)
     : base(position, assetName, range)
 {
     Food = food;
     MaxFood = maxFood;
     Medicine = medicine;
     MaxMedicine = maxMedicine;
     IsAlive = true;
     Controls = new ControlManager();
 }
    // Use this for initialization
    public virtual void Start()
    {
        charControl = gameObject.GetComponent<CharacterController> ();
        controls = GameObject.Find("Game Manager").GetComponent<ControlManager>();

        animCont = gameObject.GetComponent<Animator> ();
        robotMesh = this.transform.FindChild ("OVWSCharEngAnim").gameObject;

        audioOut = GetComponent<AudioSource> ();
    }
        public FarmerDock(Vector2 position, ControlManager controlManager)
            : base(position, controlManager)
        {
            Thumbnail = new ImageButton96(
                 GameGraphics.GetTexture("farmer_96").SourceTexture, ThumbnailPosition);
            Controls.Add(Thumbnail);

            #region create buttons for the farmer
            #endregion

            // add all controls
            AddControls();
        }
Esempio n. 26
0
        public void CanUseSave()
        {
            //asign
            var controlManager = new ControlManager();
            var xContainer = new XContainer();
            xContainer.Value = "test";

            //action
            controlManager.GetGroupBoxGui(xContainer, xContainer);
            controlManager.Save();

            //assert
        }
Esempio n. 27
0
        public Unit()
        {
            Speed = MaxSpeed;
            IsAnimating = false;
            PreviousDirection = Direction.North;
            IsWithinTargetRange = true;

            Controls = new ControlManager();

            _waypoints = new WaypointList();

            _energyTextures = new List<Texture2D>();
        }
    void Start()
    {
        cameraDragging = false;
        controls = GameObject.Find("Game Manager").GetComponent<ControlManager>();
        pingCount = 0;
        pingLimit = 5;
        pingOverload = false;
        overloadDuration = 6f;

        overloadStyle = new GUIStyle ();
        overloadStyle.normal.textColor = new Color (210, 0, 0);
        overloadStyle.fontStyle = FontStyle.Bold;
        overloadStyle.fontSize = 40;
        pingHUD = new GUIStyle ();
        pingHUD.normal.textColor = new Color (0, 200, 255);
        pingHUD.fontStyle = FontStyle.Bold;
        pingHUD.fontSize = 25;
    }
        public HouseDock(Vector2 position, ControlManager controlManager)
            : base(position, controlManager)
        {
            Thumbnail = new ImageButton96(
                 GameGraphics.GetTexture("house_96").SourceTexture, ThumbnailPosition);
            Controls.Add(Thumbnail);

            #region create buttons for the farmer
            ImageButton48 createFarmerBtn = new ImageButton48(
                GameGraphics.GetTexture("farmer_create_button").SourceTexture,
                ButtonsPositions[0]);
            createFarmerBtn.Click += new System.EventHandler(createFarmerBtn_Click);
            Controls.Add(createFarmerBtn);

            #endregion

            //last statement - add all controls to the control manager
            AddControls();
        }
        public StableDock(Vector2 position, ControlManager controlManager)
            : base(position, controlManager)
        {
            Thumbnail = new ImageButton96(
                 GameGraphics.GetTexture("stable_96").SourceTexture, ThumbnailPosition);
            Controls.Add(Thumbnail);

            #region create buttons for the farmer
            ImageButton48 createHorsemanBtn = new ImageButton48(
               GameGraphics.GetTexture("horseman_create_button").SourceTexture,
               ButtonsPositions[0]);
            createHorsemanBtn.Click += new System.EventHandler(createHorsemanBtn_Click);
            Controls.Add(createHorsemanBtn);

            #endregion

            // add all controls
            AddControls();
        }
Esempio n. 31
0
 //  선언되고 단 한번만 실행
 private void Awake()
 {
     instance = this;
 }
Esempio n. 32
0
        private void CreateControls(ContentManager Content)
        {
            backgroundImage = new PictureBox(
                Game.Content.Load <Texture2D>(@"Backgrounds\titlescreen"),
                GameRef.ScreenRectangle);

            ControlManager.Add(backgroundImage);

            string skillPath = Content.RootDirectory + @"\Game\Skills\";

            string[] skillFiles = Directory.GetFiles(skillPath, "*.xnb");

            for (int i = 0; i < skillFiles.Length; i++)
            {
                skillFiles[i] = @"Game\Skills\" +
                                Path.GetFileNameWithoutExtension(skillFiles[i]);
            }

            List <SkillData> skillData = new List <SkillData>();

            Vector2 nextControlPosition = new Vector2(300, 150);

            pointsRemaining          = new Label();
            pointsRemaining.Text     = "Skill Points: " + unassignedPoints.ToString();
            pointsRemaining.Position = nextControlPosition;

            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f;

            ControlManager.Add(pointsRemaining);

            foreach (string s in skillFiles)
            {
                SkillData data = Content.Load <SkillData>(s);

                Label label = new Label
                {
                    Text     = data.Name,
                    Type     = data.Name,
                    Position = nextControlPosition
                };

                Label value = new Label
                {
                    Text     = "0",
                    Position = new Vector2(
                        nextControlPosition.X + 350,
                        nextControlPosition.Y)
                };

                LinkLabel linkLabel = new LinkLabel
                {
                    TabStop  = true,
                    Text     = "+",
                    Type     = data.Name,
                    Position = new Vector2(
                        nextControlPosition.X + 450,
                        nextControlPosition.Y)
                };

                nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f;
                linkLabel.Selected    += addSkillLabel_Selected;
                ControlManager.Add(label);
                ControlManager.Add(value);
                ControlManager.Add(linkLabel);
                skillLabels.Add(new SkillLabelSet(label, value, linkLabel));
            }
            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f;

            LinkLabel undoLabel = new LinkLabel
            {
                Text     = "Undo",
                Position = nextControlPosition,
                TabStop  = true
            };

            undoLabel.Selected    += new EventHandler(undoLabel_Selected);
            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f;

            ControlManager.Add(undoLabel);

            LinkLabel acceptLabel = new LinkLabel
            {
                Text     = "Accept Changes",
                Position = nextControlPosition,
                TabStop  = true
            };

            acceptLabel.Selected += new EventHandler(acceptLabel_Selected);

            ControlManager.Add(acceptLabel);
            ControlManager.NextControl();
        }
Esempio n. 33
0
        private void Main_Load(object sender, EventArgs e)
        {
            pIssuePanel = new IssuePanel_SG();
            metroPanel1.Controls.Add(pIssuePanel);

            pVoidPanel = new VoidPanel();
            metroPanel2.Controls.Add(pVoidPanel);

            pSearchPanel = new SearchPanel();
            metroPanel3.Controls.Add(pSearchPanel);

            pPreferencesPanel = new PreferencesPanel();
            metroPanel4.Controls.Add(pPreferencesPanel);

            pRefundCalculatorPanel = new RefundCalculator();
            metroPanel5.Controls.Add(pRefundCalculatorPanel);


            metroPanel1.Location = new Point(139, 40);
            metroPanel2.Location = new Point(139, 40);
            metroPanel3.Location = new Point(139, 40);
            metroPanel4.Location = new Point(139, 40);
            metroPanel5.Location = new Point(139, 40);

            metroPanel1.Size = new Size(nWidth, nHeight);
            metroPanel2.Size = new Size(nWidth, nHeight);
            metroPanel3.Size = new Size(nWidth, nHeight);
            metroPanel4.Size = new Size(nWidth, nHeight);
            metroPanel5.Size = new Size(nWidth, nHeight);

            pIssuePanel.Size            = new Size(nWidth, nHeight);
            pVoidPanel.Size             = new Size(nWidth, nHeight);
            pSearchPanel.Size           = new Size(nWidth, nHeight);
            pPreferencesPanel.Size      = new Size(nWidth, nHeight);
            pRefundCalculatorPanel.Size = new Size(nWidth, nHeight);

            metroPanel1.Visible = true;
            metroPanel2.Visible = false;
            metroPanel3.Visible = false;
            metroPanel4.Visible = false;
            metroPanel5.Visible = false;
            metroPanel1.Refresh();

            /*
             * metroPanel1.Visible = false;
             * metroPanel2.Visible = true;
             * metroPanel3.Visible = false;
             * metroPanel4.Visible = false;
             * metroPanel2.Refresh();
             */

            this.Activate();
            //backgroundWorker1.RunWorkerAsync();
            //단말기 초기 세팅 시 환경설정 화면으로 전환

            //Main2_SizeChanged(null,null);

            //최초생성시 좌표, 크기 조정여부 등록함. 화면별로 Manager 를 가진다.
            this.Size        = new Size(1195, 728);
            m_CtlSizeManager = new ControlManager(this);

            //종횡 늘림
            m_CtlSizeManager.addControlMove(metroPanel1, false, false, true, true);
            m_CtlSizeManager.addControlMove(metroPanel2, false, false, true, true);
            m_CtlSizeManager.addControlMove(metroPanel3, false, false, true, true);
            m_CtlSizeManager.addControlMove(metroPanel4, false, false, true, true);
            m_CtlSizeManager.addControlMove(metroPanel5, false, false, true, true);

            m_CtlSizeManager.addControlMove(pIssuePanel, false, false, true, true);
            m_CtlSizeManager.addControlMove(pVoidPanel, false, false, true, true);
            m_CtlSizeManager.addControlMove(pSearchPanel, false, false, true, true);
            m_CtlSizeManager.addControlMove(pPreferencesPanel, false, false, true, true);
            m_CtlSizeManager.addControlMove(pRefundCalculatorPanel, false, false, true, true);

            //종늘림
            m_CtlSizeManager.addControlMove(TIL_LINE_1, false, false, false, true);
            m_CtlSizeManager.addControlMove(TIL_EMPTY_1, false, false, false, true);

            //횡이동
            m_CtlSizeManager.addControlMove(TIL_USERNAME, false, true, false, false);
            m_CtlSizeManager.addControlMove(TIL_NETWORK, false, true, false, false);
            m_CtlSizeManager.addControlMove(TIL_EMPTY_2, false, true, false, false);

            //m_CtlSizeManager.addControlMove(pictureBox_Outlet, false, true, false, false);
            m_CtlSizeManager.addControlMove(label_Copyright, false, true, false, false);

            if (m_CtlSizeManager != null)
            {
                m_CtlSizeManager.MoveControls();
            }
        }
Esempio n. 34
0
        public async Task <object> GetSelectionAsync(Func <bool> isCancelled = null, int?startFocus = null)
        {
            focus = startFocus ?? focus;

            foreach (MenuItemUI item in menuItems)
            {
                item.UnHighlight();
            }

            menuItems[focus].Highlight();

            while (true)
            {
                int oldFocus = focus;

                // Handle player input
                if (ControlManager.GetInputPressed(ControlManager.Up) || ControlManager.GetAxisPressed(ControlManager.Vertical, true))
                {
                    focus--;
                }
                if (ControlManager.GetInputPressed(ControlManager.Down) || ControlManager.GetAxisPressed(ControlManager.Vertical, false))
                {
                    focus++;
                }

                // Cap focus
                if (focus < 0)
                {
                    focus = 0;
                }
                if (focus >= menuItems.Count)
                {
                    focus = menuItems.Count - 1;
                }

                // Handle moved selection
                if (focus != oldFocus)
                {
                    foreach (MenuItemUI item in menuItems)
                    {
                        item.UnHighlight();
                    }

                    menuItems[focus].Highlight();

                    if (!string.IsNullOrWhiteSpace(moveSound))
                    {
                        AudioManager.PlaySoundEffect(moveSound);
                    }
                }

                // Execute context action
                if (menuItems[focus].ContextAction != null)
                {
                    menuItems[focus].ContextAction(menuItems[focus]);
                }

                // Return selected option
                if (ControlManager.GetInputPressed(ControlManager.Accept))
                {
                    // Play select sound
                    if (!string.IsNullOrWhiteSpace(menuItems[focus].SelectSound))
                    {
                        AudioManager.PlaySoundEffect(menuItems[focus].SelectSound);
                    }
                    else if (!string.IsNullOrWhiteSpace(selectSound))
                    {
                        AudioManager.PlaySoundEffect(selectSound);
                    }

                    return(menuItems[focus].Data);
                }

                // Cancel
                if (
                    (ControlManager.GetInputPressed(ControlManager.Deny) && cancelable || queueCancel) ||
                    (isCancelled != null && isCancelled())
                    )
                {
                    if (!string.IsNullOrWhiteSpace(cancelSound))
                    {
                        AudioManager.PlaySoundEffect(cancelSound);
                    }

                    return(null);
                }

                await new WaitForUpdate();
            }
        }
Esempio n. 35
0
        public void CreateControls(ContentManager Content)
        {
            backgroundImage = new PictureBox(
                Game.Content.Load <Texture2D>(@"Backgrounds\Sombrero"),
                GameRef.ScreenRectangle);
            ControlManager.Add(backgroundImage);

            //List<ResourceData> resourceData = new List<ResourceData>();

            Vector2 nextControlPosition = new Vector2(300, 100);

            remainingResources          = new Label();
            remainingResources.Text     = "Total Resources: " + unassignedResources.ToString();
            remainingResources.Position = nextControlPosition;

            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f;

            ControlManager.Add(remainingResources);

            MoneyLabel          = new Label();
            MoneyLabel.Text     = "Money";
            MoneyLabel.Position = nextControlPosition;

            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 5f;

            ControlManager.Add(MoneyLabel);

            Label Money = new Label();

            Money.Text     = "Initial Amount";
            Money.Position = nextControlPosition;

            LinkLabel linkLabel = new LinkLabel();

            linkLabel.TabStop  = true;
            linkLabel.Text     = "+";
            linkLabel.Position = new Vector2(nextControlPosition.X + 350, nextControlPosition.Y);

            linkLabel.Selected += addSelectedResource;
            linkLabel.Selected += new EventHandler(augmentMoney);

            moneyNumber          = new Label();
            moneyNumber.Text     = moneyAmount.ToString();
            moneyNumber.Position = new Vector2(nextControlPosition.X + 500, nextControlPosition.Y);

            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 5f;

            ControlManager.Add(Money);
            ControlManager.Add(linkLabel);
            ControlManager.Add(moneyNumber);

            //Turns

            Label Turns = new Label();

            Turns.Text     = "Number of Turns";
            Turns.Position = nextControlPosition;

            LinkLabel linkLabelTurns = new LinkLabel();

            linkLabelTurns.TabStop  = true;
            linkLabelTurns.Text     = "+";
            linkLabelTurns.Position = new Vector2(nextControlPosition.X + 350, nextControlPosition.Y);

            linkLabelTurns.Selected += addSelectedResource;

            linkLabelTurns.Selected += new EventHandler(augmentTurns);

            turnNumber          = new Label();
            turnNumber.Text     = turnAmount.ToString();
            turnNumber.Position = new Vector2(nextControlPosition.X + 500, nextControlPosition.Y);

            ControlManager.Add(Turns);
            ControlManager.Add(linkLabelTurns);
            ControlManager.Add(turnNumber);

            //

            resourceLabel1.Add(new ResourceLabelSet(Money, linkLabel));

            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 5f;

            /*
             * Ships
             * */

            Label shipLabel = new Label();

            shipLabel.Text     = "Ships.";
            shipLabel.Position = nextControlPosition;

            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 5f;

            ControlManager.Add(shipLabel);

            //Ammo
            Label Ammo = new Label();

            Ammo.Text     = "Ammo Ammount";
            Ammo.Position = nextControlPosition;

            ControlManager.Add(Ammo);

            LinkLabel AmmoLabel = new LinkLabel();

            AmmoLabel.TabStop  = true;
            AmmoLabel.Text     = "+";
            AmmoLabel.Position = new Vector2(nextControlPosition.X + 350, nextControlPosition.Y);

            AmmoLabel.Selected += addSelectedResource;
            AmmoLabel.Selected += new EventHandler(augmentAmmo);

            ammoNumber          = new Label();
            ammoNumber.Text     = ammoAmount.ToString();
            ammoNumber.Position = new Vector2(nextControlPosition.X + 500, nextControlPosition.Y);

            ControlManager.Add(AmmoLabel);
            ControlManager.Add(ammoNumber);

            resourceLabel1.Add(new ResourceLabelSet(Ammo, AmmoLabel));
            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 5f;
            //

            //Health

            Label Health = new Label();

            Health.Text     = "Maximum Health";
            Health.Position = nextControlPosition;

            ControlManager.Add(Health);

            LinkLabel HealthLabel = new LinkLabel();

            HealthLabel.TabStop  = true;
            HealthLabel.Text     = "+";
            HealthLabel.Position = new Vector2(nextControlPosition.X + 350, nextControlPosition.Y);

            HealthLabel.Selected += addSelectedResource;
            HealthLabel.Selected += new EventHandler(augmentHealth);

            healthNumber          = new Label();
            healthNumber.Text     = healthAmount.ToString();
            healthNumber.Position = new Vector2(nextControlPosition.X + 500, nextControlPosition.Y);

            ControlManager.Add(HealthLabel);
            ControlManager.Add(healthNumber);

            resourceLabel1.Add(new ResourceLabelSet(Health, HealthLabel));
            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 5f;
            //

            //Fuel

            Label Fuel = new Label();

            Fuel.Text     = "Fuel Capacity";
            Fuel.Position = nextControlPosition;

            ControlManager.Add(Fuel);

            LinkLabel FuelLabel = new LinkLabel();

            FuelLabel.TabStop  = true;
            FuelLabel.Text     = "+";
            FuelLabel.Position = new Vector2(nextControlPosition.X + 350, nextControlPosition.Y);

            FuelLabel.Selected += addSelectedResource;
            FuelLabel.Selected += new EventHandler(augmentFuel);

            fuelNumber          = new Label();
            fuelNumber.Text     = fuelAmount.ToString();
            fuelNumber.Position = new Vector2(nextControlPosition.X + 500, nextControlPosition.Y);

            ControlManager.Add(FuelLabel);
            ControlManager.Add(fuelNumber);

            resourceLabel1.Add(new ResourceLabelSet(Fuel, FuelLabel));
            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 5f;
            //

            //Cargo Capacity

            Label CargoCapacity = new Label();

            CargoCapacity.Text     = "Cargo Capacity";
            CargoCapacity.Position = nextControlPosition;

            ControlManager.Add(CargoCapacity);

            LinkLabel CargoCapacityLabel = new LinkLabel();

            CargoCapacityLabel.TabStop  = true;
            CargoCapacityLabel.Text     = "+";
            CargoCapacityLabel.Position = new Vector2(nextControlPosition.X + 350, nextControlPosition.Y);

            CargoCapacityLabel.Selected += addSelectedResource;
            CargoCapacityLabel.Selected += new EventHandler(augmentCargo);

            cargoNumber          = new Label();
            cargoNumber.Text     = cargoAmount.ToString();
            cargoNumber.Position = new Vector2(nextControlPosition.X + 500, nextControlPosition.Y);

            ControlManager.Add(CargoCapacityLabel);
            ControlManager.Add(cargoNumber);

            resourceLabel1.Add(new ResourceLabelSet(CargoCapacity, CargoCapacityLabel));
            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 20f;
            //


            //Undo Label
            LinkLabel undoLabel = new LinkLabel();

            undoLabel.Text         = "Reset Values";
            undoLabel.Position     = nextControlPosition;
            undoLabel.TabStop      = true;
            undoLabel.Selected    += new EventHandler(undoLabel_Selected);
            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f;

            ControlManager.Add(undoLabel);

            //Accept Label
            LinkLabel acceptLabel = new LinkLabel();

            acceptLabel.Text       = "Accept Changes";
            acceptLabel.Position   = nextControlPosition;
            acceptLabel.TabStop    = true;
            acceptLabel.Selected  += new EventHandler(acceptLabel_Selected);
            nextControlPosition.Y += ControlManager.SpriteFont.LineSpacing + 10f;

            ControlManager.Add(acceptLabel);
            ControlManager.NextControl();

            //Back Button
            LinkLabel backLabel = new LinkLabel();

            backLabel.Text      = "Go Back";
            backLabel.Position  = nextControlPosition;
            backLabel.Selected += new EventHandler(goBack);

            ControlManager.Add(backLabel);
            ControlManager.NextControl();
        }
        private void CreateControls()
        {
            Texture2D leftTexture  = Game.Content.Load <Texture2D>(@"GUI\leftarrowUp");
            Texture2D rightTexture = Game.Content.Load <Texture2D>(@"GUI\rightarrowUp");
            Texture2D stopTexture  = Game.Content.Load <Texture2D>(@"GUI\StopBar");

            backgroundImage = new PictureBox(
                Game.Content.Load <Texture2D>(@"Backgrounds\titlescreen"),
                GameRef.ScreenRectangle);

            ControlManager.Add(backgroundImage);

            Label label1 = new Label
            {
                Text = "Who will search for the Eyes of the Dragon?"
            };

            label1.Size     = label1.SpriteFont.MeasureString(label1.Text);
            label1.Position = new Vector2(
                (GameRef.Window.ClientBounds.Width - label1.Size.X) / 2, 150);

            ControlManager.Add(label1);

            nameSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture);
            nameSelector.SetItems(maleName, 125);
            nameSelector.Position = new Vector2(label1.Position.X, 200);

            ControlManager.Add(nameSelector);

            genderSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture);
            genderSelector.SetItems(genderItems, 125);
            genderSelector.Position          = new Vector2(label1.Position.X, 250);
            genderSelector.SelectionChanged += GenderSelector_SelectionChanged;

            ControlManager.Add(genderSelector);

            classSelector = new LeftRightSelector(leftTexture, rightTexture, stopTexture);
            classSelector.SetItems(classItems, 125);
            classSelector.Position          = new Vector2(label1.Position.X, 300);
            classSelector.SelectionChanged += ClassSelector_SelectionChanged;

            ControlManager.Add(classSelector);

            LinkLabel linkLabel1 = new LinkLabel
            {
                Text     = "Accept this character.",
                Position = new Vector2(label1.Position.X, 350)
            };

            linkLabel1.Selected += new EventHandler(LinkLabel1_Selected);

            ControlManager.Add(linkLabel1);

            characterImage = new PictureBox(
                characterImages[0, 0],
                new Rectangle(600, 200, 96, 96),
                new Rectangle(0, 0, 32, 32));

            ControlManager.Add(characterImage);

            ControlManager.NextControl();
        }
Esempio n. 37
0
 public virtual void Dispose()
 {
     ControlManager.Dispose();
 }
Esempio n. 38
0
        protected override void LoadContent()
        {
            base.LoadContent();

            ContentManager Content = Game.Content;

            backgroundImage = new PictureBox(
                Content.Load <Texture2D>("Box"),
                GameRef.ScreenRectangle);
            ControlManager.Add(backgroundImage);

            Texture2D arrowTexture = Content.Load <Texture2D>(@"GUI\leftarrowUp");

            arrowImage = new PictureBox(
                arrowTexture,
                new Rectangle(
                    0,
                    0,
                    arrowTexture.Width,
                    arrowTexture.Height));
            ControlManager.Add(arrowImage);

            newGame           = new LinkLabel();
            newGame.Text      = "New Game";
            newGame.Size      = newGame.SpriteFont.MeasureString(newGame.Text);
            newGame.Selected += new EventHandler(menuItem_Selected);

            ControlManager.Add(newGame);
            ControlManager.Add(newGame);

            continueGame           = new LinkLabel();
            continueGame.Text      = "Continue Game";
            continueGame.Size      = continueGame.SpriteFont.MeasureString(continueGame.Text);
            continueGame.Selected += menuItem_Selected;

            ControlManager.Add(continueGame);

            exitGame           = new LinkLabel();
            exitGame.Text      = "Exit";
            exitGame.Size      = exitGame.SpriteFont.MeasureString(exitGame.Text);
            exitGame.Selected += menuItem_Selected;

            ControlManager.Add(exitGame);

            ControlManager.NextControl();

            ControlManager.FocusChanged += new EventHandler(ControlManager_FocusChanged);

            Vector2 position = new Vector2(350, 200);

            foreach (Control c in ControlManager)
            {
                if (c is LinkLabel)
                {
                    if (c.Size.X > maxItemWidth)
                    {
                        maxItemWidth = c.Size.X;
                    }

                    c.Position  = position;
                    position.Y += c.Size.Y + 5f;
                }
            }

            ControlManager_FocusChanged(newGame, null);
        }
Esempio n. 39
0
 public void OnPointerEnter(PointerEventData eventData)
 {
     ControlManager.GetInstantiate().mouseover = this;
     InterfaceManager.GetInstantiate().detectiveRollover.Show(this);
 }
Esempio n. 40
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShiftOS.WinForms.WindowBorder"/> class.
        /// </summary>
        /// <param name="win">Window.</param>
        public WindowBorder(UserControl win)
        {
            InitializeComponent();
            IsFocused       = true;
            this.Activated += (o, a) =>
            {
                IsFocused = true;
                SetupSkin();
            };
            this.Deactivate += (o, a) =>
            {
                IsFocused = false;
                SetupSkin();
            };
            this._parentWindow    = win;
            Shiftorium.Installed += () =>
            {
                try
                {
                    this.ParentForm.Invoke(new Action(() =>
                    {
                        Setup();
                    }));
                }
                catch { }
            };
            SkinEngine.SkinLoaded += () =>
            {
                try
                {
                    Setup();
                    (ParentWindow as IShiftOSWindow).OnSkinLoad();
                    ControlManager.SetupControls(this.pnlcontents);
                }
                catch
                {
                }
            };

            this.Width  = (LoadedSkin.LeftBorderWidth * 2) + _parentWindow.Width + LoadedSkin.RightBorderWidth;
            this.Height = (LoadedSkin.TitlebarHeight * 2) + _parentWindow.Height + LoadedSkin.BottomBorderWidth;

            this.pnlcontents.Controls.Add(this._parentWindow);
            this._parentWindow.Dock = DockStyle.Fill;
            this._parentWindow.Show();
            SetupControls(this);
            ControlManager.SetupControls(this._parentWindow);

            Shiftorium.Installed += () =>
            {
                Setup();
                ParentWindow.OnUpgrade();
            };
            Setup();
            this._parentWindow.TextChanged += (o, a) =>
            {
                Setup();
                Desktop.ResetPanelButtons();
            };


            if (!this.IsDialog)
            {
                Engine.AppearanceManager.OpenForms.Add(this);
            }

            SaveSystem.GameReady += () =>
            {
                if (Shiftorium.UpgradeInstalled("wm_free_placement"))
                {
                    AppearanceManager.Invoke(new Action(() =>
                    {
                        this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
                        this.Top  = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
                    }));
                }
                AppearanceManager.Invoke(new Action(() =>
                {
                    Setup();
                }));
            };
        }
        public override void Draw(GameTime gameTime)
        {
            _bloom.BeginDraw();

            ControlManager.Draw(GameRef.SpriteBatch);

            GameRef.SpriteBatch.Begin(0, BlendState.Opaque);

            /*
             * GameRef.SpriteBatch.Draw(_background, new Rectangle(
             *  (int)(Config.Resolution.X / 2f), (int)(Config.Resolution.Y / 2f),
             *  Config.Resolution.X * 2, Config.Resolution.Y * 2),
             *  null, Color.White, _counter, new Vector2(_background.Width / 2f, _background.Height / 2f), SpriteEffects.None, 0f);
             */

            GameRef.SpriteBatch.End();

            GameRef.GraphicsDevice.DepthStencilState = DepthStencilState.Default;

            Color backgroundColor = new Color(5, 5, 5);

            GraphicsDevice.Clear(backgroundColor);

            if (_singlePlayer)
            {
                GameRef.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Players[0].Camera.GetTransformation());

                Color randomColor = Color.White;//new Color(Rand.Next(255), Rand.Next(255), Rand.Next(255));
                GameRef.SpriteBatch.Draw(_backgroundImage, _backgroundMainRectangle, randomColor);

                foreach (var bullet in Players[0].GetBullets())
                {
                    bullet.Draw(gameTime);
                }

                Players[0].Draw(gameTime);

                /*
                 * if (_enemy.IsAlive)
                 * {
                 *  _enemy.Draw(gameTime);
                 * }
                 */

                GameRef.SpriteBatch.End();
            }
            else
            {
                if (Players[1].IsInvincible)
                {
                    // Player 2
                    GraphicsDevice.Viewport = rightView;
                    DrawPlayerCamera(gameTime, Players[1]);

                    // Player 1
                    GraphicsDevice.Viewport = leftView;
                    DrawPlayerCamera(gameTime, Players[0]);
                }
                else
                {
                    // Player 1
                    GraphicsDevice.Viewport = leftView;
                    DrawPlayerCamera(gameTime, Players[0]);

                    // Player 2
                    GraphicsDevice.Viewport = rightView;
                    DrawPlayerCamera(gameTime, Players[1]);
                }

                GraphicsDevice.Viewport = defaultView;
            }

            base.Draw(gameTime);

            GameRef.SpriteBatch.Begin();

            _timer.Draw(gameTime);

            if (!_singlePlayer)
            {
                GameRef.SpriteBatch.Draw(_pixel, new Rectangle((int)(Config.Resolution.X / 2 - 2), 0, 2, Config.Resolution.Y), Color.Black);
            }

            foreach (Player p in Players)
            {
                if (p.IsAlive)
                {
                    p.DrawString(gameTime);
                }
            }

            // Text
            if (Config.Debug)
            {
                GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont,
                                               "Boss bullets: " +
                                               _enemy.MoverManager.movers.Count.ToString(CultureInfo.InvariantCulture),
                                               new Vector2(1, 21), Color.Black);
                GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont,
                                               "Boss bullets: " +
                                               _enemy.MoverManager.movers.Count.ToString(CultureInfo.InvariantCulture),
                                               new Vector2(0, 20), Color.White);
            }

            // Wave number
            string waveNumber = "Wave #" + _waveNumber.ToString(CultureInfo.InvariantCulture);

            GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, waveNumber,
                                           new Vector2(Config.Resolution.X / 2f - ControlManager.SpriteFont.MeasureString(waveNumber).X / 2f + 1, Config.Resolution.Y - 49), Color.Black);
            GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, waveNumber,
                                           new Vector2(Config.Resolution.X / 2f - ControlManager.SpriteFont.MeasureString(waveNumber).X / 2f, Config.Resolution.Y - 50), Color.White);

            // Boss current pattern

            /*
             * if (Config.Debug)
             * {
             *  GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _enemy.GetCurrentPatternName(),
             *                                 new Vector2(
             *                                     Config.Resolution.X / 2f -
             *                                     ControlManager.SpriteFont.MeasureString(
             *                                         _enemy.GetCurrentPatternName()).X / 2,
             *                                     Config.Resolution.Y - 25),
             *                                 Color.Black);
             *  GameRef.SpriteBatch.DrawString(ControlManager.SpriteFont, _enemy.GetCurrentPatternName(),
             *                                 new Vector2(
             *                                     Config.Resolution.X / 2f -
             *                                     ControlManager.SpriteFont.MeasureString(
             *                                         _enemy.GetCurrentPatternName()).X / 2 + 1,
             *                                     Config.Resolution.Y - 26),
             *                                 Color.White);
             * }
             */
            GameRef.SpriteBatch.End();
        }
Esempio n. 42
0
 public void OnSizeChange(EventArgs e)
 {
     ControlManager.ParentWidth  = Width;
     ControlManager.ParentHeight = Height;
     ControlManager.OnParentSizeChange(null);
 }
Esempio n. 43
0
 public void OnPositionChange(EventArgs e)
 {
     ControlManager.ParentPositionOnScreen = PositionOnScreen;
     ControlManager.OnParentPositionChange(null);
 }
Esempio n. 44
0
        protected override void LoadContent()
        {
            base.LoadContent();

            _background = GameRef.Content.Load <Texture2D>("GUI/character-gui");

            int yOffset = 110;
            int xOffset = 630;

            Label label = new Label()
            {
                Position = new Vector2(xOffset, yOffset),
                Text     = "Strength: ",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _str = new Label()
            {
                Position = new Vector2(xOffset + 160, yOffset),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Strength}",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(_str);

            label = new Label()
            {
                Position = new Vector2(xOffset, 40 + yOffset),
                Text     = "Dexterity: ",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _dex = new Label()
            {
                Position = new Vector2(xOffset + 160, 40 + yOffset),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Dexterity}",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(_dex);

            label = new Label()
            {
                Position = new Vector2(xOffset, 80 + yOffset),
                Text     = "Cunning: ",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _cun = new Label()
            {
                Position = new Vector2(xOffset + 160, 80 + yOffset),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Cunning}",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(_cun);

            label = new Label()
            {
                Position = new Vector2(xOffset, 120 + yOffset),
                Text     = "Magic: ",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _mag = new Label()
            {
                Position = new Vector2(xOffset + 120, 120 + yOffset),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Magic}",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(_mag);

            label = new Label()
            {
                Position = new Vector2(xOffset, 160 + yOffset),
                Text     = "Will Power: ",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _wil = new Label()
            {
                Position = new Vector2(xOffset + 160, 160 + yOffset),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Willpower}",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(_wil);
            label = new Label()
            {
                Position = new Vector2(xOffset, 200 + yOffset),
                Text     = "Constitution: ",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _con = new Label()
            {
                Position = new Vector2(xOffset + 160, 200 + yOffset),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Constitution}",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(_con);

            label = new Label()
            {
                Position = new Vector2(xOffset + 250, yOffset),
                Text     = "Level:",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _lvl = new Label
            {
                Position = new Vector2(xOffset + 250 + 80, yOffset),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Level}",
                Color    = Color.Yellow,
                TabStop  = false
            };

            ControlManager.Add(_lvl);

            label = new Label()
            {
                Position = new Vector2(xOffset + 250, yOffset + 40),
                Text     = "XP:",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _xp = new Label
            {
                Position = new Vector2(xOffset + 250 + 80, yOffset + 40),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Experience}",
                Color    = Color.Yellow,
                TabStop  = false
            };

            ControlManager.Add(_xp);

            label = new Label()
            {
                Position = new Vector2(xOffset + 250, yOffset + 80),
                Text     = "HP:",
                Color    = Color.White,
                TabStop  = false
            };

            ControlManager.Add(label);

            _hp = new Label
            {
                Position = new Vector2(xOffset + 250 + 80, yOffset + 80),
                Text     = $"{GamePlayScreen.Player.Character.Entity.Health.CurrentValue} / {GamePlayScreen.Player.Character.Entity.Health.MaximumValue}",
                Color    = Color.Yellow,
                TabStop  = false
            };

            ControlManager.Add(_hp);

            _resName = new Label
            {
                Position = new Vector2(xOffset + 250, yOffset + 120),
                Color    = Color.White,
                TabStop  = false
            };

            _resName.Text = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ? "MP:" : "SP:";

            ControlManager.Add(_resName);

            _res = new Label
            {
                Position = new Vector2(xOffset + 250 + 80, yOffset + 120),
                Color    = Color.Yellow,
                TabStop  = false
            };

            _res.Color = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ? Color.Yellow : Color.Blue;

            _res.Text = GamePlayScreen.Player.Character.Entity.Mana.MaximumValue > 0 ?
                        $"{GamePlayScreen.Player.Character.Entity.Mana.CurrentValue} / " +
                        $"{GamePlayScreen.Player.Character.Entity.Mana.MaximumValue}" :
                        $"{GamePlayScreen.Player.Character.Entity.Stamina.CurrentValue} / " +
                        $"{GamePlayScreen.Player.Character.Entity.Stamina.MaximumValue}";

            _headGear   = new Rectangle(55, 157, 101, 73);
            _bodyGear   = new Rectangle(55, 247, 101, 73);
            _handGear   = new Rectangle(55, 337, 101, 73);
            _footGear   = new Rectangle(55, 427, 101, 73);
            _neckGear   = new Rectangle(500, 157, 101, 73);
            _mainGear   = new Rectangle(500, 247, 101, 73);
            _offGear    = new Rectangle(500, 337, 101, 73);
            _fingerGear = new Rectangle(500, 427, 101, 73);
        }
Esempio n. 45
0
 public void SetActive(Boolean newActive)
 {
     IsActive = newActive;
     ControlManager.SetChildren(newActive);
 }
Esempio n. 46
0
        public static void MakeWidget(Controls.TerminalBox txt)
        {
            AppearanceManager.StartConsoleOut();
            txt.GotFocus += (o, a) =>
            {
                AppearanceManager.ConsoleOut = txt;
            };
            txt.KeyDown += (o, a) =>
            {
                if (a.Control == true || a.Alt == true)
                {
                    a.SuppressKeyPress = true;
                    return;
                }

                if (a.KeyCode == Keys.Enter)
                {
                    try
                    {
                        if (!TerminalBackend.InStory)
                        {
                            a.SuppressKeyPress = false;
                        }
                        if (!TerminalBackend.PrefixEnabled)
                        {
                            string textraw = txt.Lines[txt.Lines.Length - 1];
                            TextSent?.Invoke(textraw);
                            TerminalBackend.SendText(textraw);
                            return;
                        }
                        var text  = txt.Lines.ToArray();
                        var text2 = text[text.Length - 1];
                        var text3 = "";
                        txt.AppendText(Environment.NewLine);
                        var text4 = Regex.Replace(text2, @"\t|\n|\r", "");

                        if (IsInRemoteSystem == true)
                        {
                            ServerManager.SendMessage("trm_invcmd", JsonConvert.SerializeObject(new
                            {
                                guid    = RemoteGuid,
                                command = text4
                            }));
                        }
                        else
                        {
                            if (TerminalBackend.PrefixEnabled)
                            {
                                text3 = text4.Remove(0, $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length);
                            }
                            TerminalBackend.LastCommand = text3;
                            TextSent?.Invoke(text4);
                            TerminalBackend.SendText(text4);
                            if (TerminalBackend.InStory == false)
                            {
                                if (text3 == "stop theme")
                                {
                                    CurrentCommandParser.parser = null;
                                }
                                else
                                {
                                    var result = SkinEngine.LoadedSkin.CurrentParser.ParseCommand(text3);

                                    if (result.Equals(default(KeyValuePair <string, Dictionary <string, string> >)))
                                    {
                                        Console.WriteLine("{ERR_SYNTAXERROR}");
                                    }
                                    else
                                    {
                                        TerminalBackend.InvokeCommand(result.Key, result.Value);
                                    }
                                }
                            }
                            if (TerminalBackend.PrefixEnabled)
                            {
                                TerminalBackend.PrintPrompt();
                            }
                        }
                    }
                    catch
                    {
                    }
                }
                else if (a.KeyCode == Keys.Back)
                {
                    try
                    {
                        var tostring3   = txt.Lines[txt.Lines.Length - 1];
                        var tostringlen = tostring3.Length + 1;
                        var workaround  = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                        var derp        = workaround.Length + 1;
                        if (tostringlen != derp)
                        {
                            AppearanceManager.CurrentPosition--;
                        }
                        else
                        {
                            a.SuppressKeyPress = true;
                        }
                    }
                    catch
                    {
                        Debug.WriteLine("Drunky alert in terminal.");
                    }
                }
                else if (a.KeyCode == Keys.Left)
                {
                    if (SaveSystem.CurrentSave != null)
                    {
                        var getstring = txt.Lines[txt.Lines.Length - 1];
                        var stringlen = getstring.Length + 1;
                        var header    = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ";
                        var headerlen = header.Length + 1;
                        var selstart  = txt.SelectionStart;
                        var remstrlen = txt.TextLength - stringlen;
                        var finalnum  = selstart - remstrlen;

                        if (finalnum != headerlen)
                        {
                            AppearanceManager.CurrentPosition--;
                        }
                        else
                        {
                            a.SuppressKeyPress = true;
                        }
                    }
                }
                else if (a.KeyCode == Keys.Up)
                {
                    var tostring3 = txt.Lines[txt.Lines.Length - 1];
                    if (tostring3 == $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ")
                    {
                        Console.Write(TerminalBackend.LastCommand);
                    }
                    ConsoleEx.OnFlush?.Invoke();
                    a.SuppressKeyPress = true;
                }
                else
                {
                    if (TerminalBackend.InStory)
                    {
                        a.SuppressKeyPress = true;
                    }
                    AppearanceManager.CurrentPosition++;
                }
            };

            AppearanceManager.ConsoleOut = txt;

            txt.Focus();

            txt.Font      = LoadedSkin.TerminalFont;
            txt.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC);
            txt.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC);
        }
Esempio n. 47
0
 public void RecalculatePosition()
 {
     ControlManager.RecalculatePosition();
 }
Esempio n. 48
0
 void End()
 {
     ControlManager.Reset();
     UnityEngine.SceneManagement.SceneManager.LoadScene("Startup");
 }
        public override void Update(GameTime gameTime)
        {
            ControlManager.Update(gameTime, PlayerIndex.One);

            base.Update(gameTime);
        }
Esempio n. 50
0
 private void btnClear_Click(object sender, EventArgs e)
 {
     ControlManager.ClearAll(this.tabPage);
 }
 public void Start()
 {
     _controlManager = ControlManager.Instance;
     //_pauseController = PauseController.Instance;
     _dialogueGUI = GetComponentInChildren <DialoguePresenter>();
 }
Esempio n. 52
0
        internal static void Load(MachineInfo machineInfo)
        {
            try
            {
                AxisManager.MachineAxes.Clear();
                ControlManager.Blocks.Clear();

                // read mod version
                if (!machineInfo.MachineData.HasKey("ac-version"))
                {
                    return;
                }
                var version = new Version(machineInfo.MachineData.ReadString("ac-version").TrimStart('v'));

                // version alert
                if (version < Assembly.GetExecutingAssembly().GetName().Version)
                {
                    Debug.Log("[ACM]: " + machineInfo.Name + " was saved with mod version " + version + ".\n\tIt may not be compatible with some newer features.");
                }

                // return if no input axes are present
                if (!machineInfo.MachineData.HasKey("ac-axislist"))
                {
                    return;
                }
                var axes = machineInfo.MachineData.ReadStringArray("ac-axislist");

                // load all axes
                foreach (var name in axes)
                {
                    InputAxis axis = null;
                    if (!machineInfo.MachineData.HasKey("axis-" + name + "-type"))
                    {
                        continue;
                    }
                    var type = machineInfo.MachineData.ReadString("axis-" + name + "-type");
                    if (type == AxisType.Chain.ToString())
                    {
                        axis = new ChainAxis(name);
                    }
                    if (type == AxisType.Controller.ToString())
                    {
                        axis = new ControllerAxis(name);
                    }
                    if (type == AxisType.Custom.ToString())
                    {
                        axis = new CustomAxis(name);
                    }
                    if (type == AxisType.Standard.ToString() || // backwards compatibility
                        type == AxisType.Inertial.ToString() || // backwards compatibility
                        type == AxisType.Key.ToString())
                    {
                        axis = new KeyAxis(name);
                    }
                    if (type == AxisType.Mouse.ToString())
                    {
                        axis = new MouseAxis(name);
                    }
                    if (axis != null)
                    {
                        axis?.Load(machineInfo);
                        AxisManager.AddMachineAxis(axis);
                    }
                }

                // refresh chain axis links
                foreach (var entry in AxisManager.MachineAxes)
                {
                    if (entry.Value.Type == AxisType.Chain)
                    {
                        (entry.Value as ChainAxis).RefreshLinks();
                    }
                }

                // resolve from foreign controllers
                AxisManager.ResolveMachineAxes();

                // load all controls
                foreach (BlockInfo blockInfo in machineInfo.Blocks)
                {
                    if (!blockInfo.BlockData.HasKey("ac-controllist"))
                    {
                        continue;
                    }
                    var control_list  = ControlManager.GetBlockControls(blockInfo.ID, blockInfo.Guid);
                    var control_names = blockInfo.BlockData.ReadStringArray("ac-controllist");
                    foreach (string name in control_names)
                    {
                        foreach (Control c in control_list)
                        {
                            if (name == c.Name)
                            {
                                c.Load(blockInfo);
                            }
                        }
                    }
                }

                ACM.Instance.LoadedMachine = true;
            }
            catch (Exception e)
            {
                Debug.Log("[ACM]: Error loading machine's controls:");
                Debug.LogException(e);
            }
        }
Esempio n. 53
0
 public virtual void Start()
 {
     _control   = ControlManager.Instance;
     _movement  = GetComponent <SidescrollingMovement>();
     _animation = GetComponent <SidescrollingAnimationController>();
 }
Esempio n. 54
0
 public void Add(TSControl control)
 {
     ControlManager.Add(control);
 }
Esempio n. 55
0
 public static void provide(ControlManager control)
 {
     control_ = control;
 }
Esempio n. 56
0
 private int JudgeDateStatus(DateTime startDate, DateTime endDate)
 {
     if ((endDate - DateTime.Now).Days < 0)
     {
         return(Statuses.Expired);
     }
     else if ((startDate - DateTime.Now).Days >= 0)
     {
         return(Statuses.Pending);
     }
     else if ((startDate - DateTime.Now).Days <= 0 && (int)Math.Ceiling((endDate - DateTime.Now).TotalDays) <= ControlManager.GetSettingInfo().WillExpireTime)
     {
         return(Statuses.WillExpire);
     }
     else
     {
         return(Statuses.Active);
     }
 }
Esempio n. 57
0
        internal static void Save(MachineInfo machineInfo)
        {
            try
            {
                var axisStack = new Stack <string>();
                var axisList  = new List <string>();

                // save all controls and collect all bound axes
                foreach (BlockInfo blockInfo in machineInfo.Blocks)
                {
                    if (ControlManager.Blocks.ContainsKey(blockInfo.Guid))
                    {
                        var controls = ControlManager.GetActiveBlockControls(blockInfo.Guid);
                        if (controls.Count == 0)
                        {
                            continue;
                        }
                        var control_names = new List <string>();
                        foreach (Control c in controls)
                        {
                            if (!axisStack.Contains(c.Axis))
                            {
                                axisStack.Push(c.Axis);
                            }
                            control_names.Add(c.Name);
                            c.Save(blockInfo);
                        }
                        blockInfo.BlockData.Write("ac-controllist", control_names.ToArray());
                    }
                }

                // go through stack and save all axes and chained axes
                while (axisStack.Count > 0)
                {
                    var a = AxisManager.Get(axisStack.Pop());
                    if (a == null || axisList.Contains(a.Name))
                    {
                        continue;
                    }
                    axisList.Add(a.Name);
                    if (a.Type == AxisType.Chain)
                    {
                        var chain = a as ChainAxis;
                        axisStack.Push(chain.SubAxis1);
                        axisStack.Push(chain.SubAxis2);
                    }
                    if (a.Type == AxisType.Custom)
                    {
                        var custom = a as CustomAxis;
                        foreach (var linked in custom.LinkedAxes)
                        {
                            axisStack.Push(linked);
                        }
                    }
                    a.Save(machineInfo);
                }

                // save axis list and metadata
                if (axisList.Count != 0)
                {
                    machineInfo.MachineData.Write("ac-version", Assembly.GetExecutingAssembly().GetName().Version.ToString());
                    machineInfo.MachineData.Write("ac-axislist", axisList.ToArray());
                }
            }
            catch (Exception e)
            {
                Debug.Log("[ACM]: Error saving machine's controls.");
                Debug.LogException(e);
            }
        }
Esempio n. 58
0
            /// <summary>
            /// 根据合同状态编号获取查询该状态合同的sql
            /// </summary>
            /// <param name="statusId">合同状态编号</param>
            /// <returns>查询该状态合同的sql</returns>
            public static string GetSqlFilter(int statusId)
            {
                switch (statusId)
                {
                case Expired:
                    return(" AND DATEDIFF(DAY,c.EndDate, GETDATE()) > 0");

                case WillExpire:
                    return(" AND DATEDIFF(DAY,c.StartDate, GETDATE()) >= 0 AND DATEDIFF(DAY, c.EndDate, GETDATE()) >= -" + ControlManager.GetSettingInfo().WillExpireTime + " AND DATEDIFF(DAY,c.EndDate, GETDATE()) <= 0 ");

                case Active:
                    return(" AND DATEDIFF(DAY,c.StartDate, GETDATE()) >= 0 AND DATEDIFF(DAY,c.EndDate, GETDATE()) <= 0");

                case Pending:
                    return(" AND (DATEDIFF(DAY,c.StartDate, GETDATE()) < 0 OR DATEDIFF(SECOND,c.StartDate, GETDATE()) < 0 )");

                default:
                    return("");
                }
            }
Esempio n. 59
0
 public override void OnParentSizeChange(EventArgs e)
 {
     base.OnParentSizeChange(e);
     ControlManager.ParentPositionOnScreen = this.PositionOnScreen;
     ControlManager.OnParentSizeChange(e);
 }
Esempio n. 60
0
 private void Start()
 {
     rig        = GetComponent <CameraRig>();
     controller = GameObject.Find("ControlManager").GetComponent <ControlManager>();
 }