Exemple #1
0
    // needs color and radius
    private void addToGrid(string id, string relationship_name, string partner_name)
    {
        GameObject o       = Instantiate(cellPrefab.gameObject, container.transform);
        UIGridCell newCell = o.GetComponent <UIGridCell>();

        float relationship_time_percentage = 1f;

        float relationship_time = DataBridge.instance.time_by_relationship(id);
        float allTime           = DataBridge.instance.all_time();

        relationship_time_percentage = relationship_time / allTime;

        newCell.id = id;
        newCell.relationship_name            = relationship_name;
        newCell.partner_name                 = partner_name;
        newCell.relationship_time_percentage = relationship_time_percentage;

        newCell.UpdateCell();

        cells.Add(newCell);
    }
Exemple #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            /*
             *  Load content for the "game" state
             */
            //Load the background
            UIBox background = new UIBox(GameBoard.game, 0, 0, this.gameWidth, this.gameHeight);

            background.thisSprite  = Content.Load <Texture2D>(@"Images/background");
            background.layer       = 100;
            background.visible     = true;
            background.mouseEvents = false;

            //Create a new UIGrid
            this.UIGrid = new UIGrid(Grid.mainGrid);
            //Pass that grid to the UnitManager object
            UnitManager.Manager.UIGrid = this.UIGrid;
            //Load grid textures
            UIGridCell.Load(Content);
            //Load health bar textures
            UIHealthBar.Load(Content);
            //Load moves left textures
            UIMovesLeft.Load(Content);
            //Load the active unit UI textures
            UIStatBackground.Load(Content);
            UITextBox.Load(Content);
            UISkillButton.Load(Content);
            UIDefaultActionButton.Load(Content);
            //Load UIUnit textures
            for (int p = 0; p < playList.Count; p++)
            {
                for (int i = 0; i < playList[p].Units.Count; i++)
                {
                    playList[p].Units[i].sprite.Load(Content);
                }
            }

            //rock.sprite.Load(Content);

            /*
             *  Load content for the "teamSelect" state
             */


            /*
             *  Load content for the "startMenu" state
             */
            //Load the background
            UIBox startMenuBackground = new UIBox(GameBoard.startMenu, 0, 0, this.windowWidth, this.windowHeight);

            startMenuBackground.thisSprite  = Content.Load <Texture2D>(@"Images/TitleScreen/titleScreenBackground");
            startMenuBackground.layer       = 100;
            startMenuBackground.visible     = true;
            startMenuBackground.mouseEvents = false;
            startMenuBackground.viewMove    = false;
            //Load the start button
            UIStartButton startButton = new UIStartButton(GameBoard.startMenu, (this.windowWidth - 672) / 2, (this.windowHeight - 217) / 2, 672, 217);

            UIStartButton.Load(Content);
            startButton.layer    = 99;
            startButton.visible  = true;
            startButton.viewMove = false;

            /*
             *  Load content for the 'endMenu' state
             */
            UIBox endMenuBackground = new UIBox(GameBoard.endMenu, 0, 0, this.windowWidth, this.windowHeight);

            endMenuBackground.thisSprite  = Content.Load <Texture2D>(@"Images/EndScreen/endScreenBackground");
            endMenuBackground.layer       = 100;
            endMenuBackground.visible     = true;
            endMenuBackground.mouseEvents = false;
            endMenuBackground.viewMove    = false;
            //Load the exit button
            UIExitButton exitButton = new UIExitButton(GameBoard.endMenu, (this.windowWidth - 672) / 2, ((this.windowHeight - 217) / 2) + 150, 672, 217);

            UIExitButton.Load(Content);
            exitButton.layer    = 99;
            exitButton.visible  = true;
            exitButton.viewMove = false;

            //Load other content here
            //Load fonts
            GameBoard.font = Content.Load <SpriteFont>("Fonts/dosis");
        }