示例#1
0
    public void UpdateTeamName(TeamIdEnum teamIdEnum, string teamName)
    {
        int    teamId = (int)teamIdEnum;
        string teamsInformationsPanelTag = TagsConstants.TEAMS_INFORMATIONS_PANEL_TAG;
        string nameTextTag;

        switch (teamIdEnum)
        {
        case TeamIdEnum.TEAM_1:
            nameTextTag = TagsConstants.TEAM_1_NAME_TAG;
            break;

        case TeamIdEnum.TEAM_2:
            nameTextTag = TagsConstants.TEAM_2_NAME_TAG;
            break;

        default:
            nameTextTag = "";
            break;
        }

        Canvas          scoreCanvas = ScoreGameObject.GetComponentInChildren <Canvas>();
        GameObject      informationsPanelGameObject = scoreCanvas.gameObject.GetComponentsInChildren <RectTransform>().Where(panelGameObjectRectTransform => panelGameObjectRectTransform.CompareTag(teamsInformationsPanelTag)).First().gameObject;
        TextMeshProUGUI teamNameText = informationsPanelGameObject.GetComponentsInChildren <TextMeshProUGUI>().Where(teamNameTextComponent => teamNameTextComponent.gameObject.CompareTag(nameTextTag)).First();

        teamNameText.text = teamName;
    }
    public JewelJamGameWorld(JewelJam game)
    {
        // store a reference to the game
        this.game = game;

        // add the background
        SpriteGameObject background = new SpriteGameObject("spr_background");

        Size = new Point(background.Width, background.Height);
        AddChild(background);

        // add a "playing field" parent object for the grid and all related objects
        GameObjectList playingField = new GameObjectList();

        playingField.LocalPosition = new Vector2(85, 150);
        AddChild(playingField);

        // add the grid to the playing field
        JewelGrid grid = new JewelGrid(GridWidth, GridHeight, CellSize);

        playingField.AddChild(grid);

        // add the row selector to the playing field
        playingField.AddChild(new RowSelector(grid));

        // add a background sprite for the score object
        SpriteGameObject scoreFrame = new SpriteGameObject("spr_scoreframe");

        scoreFrame.LocalPosition = new Vector2(20, 20);
        AddChild(scoreFrame);

        // add the object that displays the score
        ScoreGameObject scoreObject = new ScoreGameObject();

        scoreObject.LocalPosition = new Vector2(270, 30);
        AddChild(scoreObject);

        // add the moving jewel cart
        jewelCart = new JewelCart(new Vector2(410, 230));
        AddChild(jewelCart);

        // add the help button
        helpButton = new SpriteGameObject("spr_button_help");
        helpButton.LocalPosition = new Vector2(1270, 20);
        AddChild(helpButton);

        // add combo images with visibility timers attached to them
        timer_double = AddComboImageWithTimer("spr_double");
        timer_triple = AddComboImageWithTimer("spr_triple");

        // add the various overlays
        titleScreen    = AddOverlay("spr_title");
        gameOverScreen = AddOverlay("spr_gameover");
        helpScreen     = AddOverlay("spr_frame_help");

        // start at the title screen
        GoToState(GameState.TitleScreen);
    }
    public JewelJamGameWorld()
    {
        // add the background
        SpriteGameObject background = new SpriteGameObject("spr_background");

        worldSize = new Point(background.Width, background.Height);
        AddChild(background);

        // add a "playing field" parent object for the grid and all related objects
        GameObjectList playingField = new GameObjectList();

        playingField.LocalPosition = new Vector2(85, 150);
        AddChild(playingField);

        // add the grid to the playing field
        JewelGrid grid = new JewelGrid(GridWidth, GridHeight, CellSize);

        playingField.AddChild(grid);

        // add the row selector to the playing field
        playingField.AddChild(new RowSelector(grid));

        // add a background sprite for the score object
        SpriteGameObject scoreFrame = new SpriteGameObject("spr_scoreframe");

        scoreFrame.LocalPosition = new Vector2(20, 20);
        AddChild(scoreFrame);

        // add the object that displays the score
        ScoreGameObject scoreObject = new ScoreGameObject();

        scoreObject.LocalPosition = new Vector2(270, 30);
        AddChild(scoreObject);

        // add the moving jewel cart
        jewelCart = new JewelCart(new Vector2(410, 230));
        AddChild(jewelCart);

        // reset some game parameters
        Reset();
    }
示例#4
0
 public void ToggleScoreUiDisplay()
 {
     ScoreGameObject.SetActive(!ScoreGameObject.activeInHierarchy);
 }