コード例 #1
0
ファイル: TileButton.cs プロジェクト: Tmbao/WordBattle
        public TileButton(float left, float top, string iconPath)
        {
            this.left = left;
            this.top = top;

            icon = new Sprite2D(0, 0, Utils.LoadTextures(iconPath));
            iconHighlighter = new Sprite2D(0, 0, Utils.LoadTextures(Utils.GetImageFileName(Consts.LIGHT)));
        }
コード例 #2
0
 private TileSpriteContainer()
 {
     allTiles = new Dictionary<char, Sprite2D>();
     allTiles[Consts.SPACE] = new Sprite2D(Consts.TILE_WIDTH, Consts.TILE_HEIGHT, Utils.LoadTextures(Utilities.Utils.GetCharacterFileName(Consts.SPACE)));
     allTiles[Consts.BLANK] = new Sprite2D(Consts.TILE_WIDTH, Consts.TILE_HEIGHT, Utils.LoadTextures(Utilities.Utils.GetCharacterFileName(Consts.BLANK)));
     allTiles[Consts.OBSTACLE] = new Sprite2D(Consts.TILE_WIDTH, Consts.TILE_HEIGHT, Utils.LoadTextures(Utilities.Utils.GetCharacterFileName(Consts.OBSTACLE)));
     allTiles[Consts.LIGHT] = new Sprite2D(Consts.TILE_WIDTH, Consts.TILE_HEIGHT, Utils.LoadTextures(Utilities.Utils.GetCharacterFileName(Consts.LIGHT)));
     allTiles[Consts.LIGHT_BLUE] = new Sprite2D(Consts.TILE_WIDTH, Consts.TILE_HEIGHT, Utils.LoadTextures(Utilities.Utils.GetCharacterFileName(Consts.LIGHT_BLUE)));
     for (char c = 'A'; c <= 'Z'; c++)
         allTiles[c] = new Sprite2D(Consts.TILE_WIDTH, Consts.TILE_HEIGHT, Utils.LoadTextures(Utilities.Utils.GetCharacterFileName(c)));
     for (char c = '0'; c <= '9'; c++)
         allTiles[c] = new Sprite2D(Consts.TILE_WIDTH, Consts.TILE_HEIGHT, Utils.LoadTextures(Utilities.Utils.GetCharacterFileName(c)));
 }
コード例 #3
0
ファイル: MenuOption.cs プロジェクト: Tmbao/WordBattle
        public MenuOption(float left, float top, string text, string iconPath)
        {
            this.left = left;
            this.top = top;

            this.text = text;
            entityPhase = Phase.MENU;

            this.iconSprite = new Sprite2D(0, 0, Utils.LoadTextures(iconPath));
            iconSpriteHighlighter = new Sprite2D(0, 0, Utils.LoadTextures(Utils.GetImageFileName(Consts.LIGHT)));

            intensity = 0;
        }
コード例 #4
0
ファイル: LogoPanel.cs プロジェクト: Tmbao/WordBattle
        private LogoPanel()
        {
            // Load background
            backgroundSprite = new Sprite2D(0, 0, Utils.LoadTextures(Utils.GetImageFileName("B")));

            //
            center_left = (Consts.SCREEN_WIDTH - GetWidth()) / 2f;
            center_top = 2 * Consts.LOGO_TOP;

            dx = (center_left - Consts.LOGO_LEFT) / Consts.LOGO_TRANSLATION_TIME;
            dy = (center_top - Consts.LOGO_TOP) / Consts.LOGO_TRANSLATION_TIME;

            left = center_left;
            top = center_top;
        }
コード例 #5
0
ファイル: PlayerEntity.cs プロジェクト: Tmbao/WordBattle
        public PlayerEntity(float left, float top, int width, int height, string playerName, string playerImage)
        {
            this.left = left;
            this.top = top;
            this.width = width;
            this.height = height;
            this.increasingScore = 0;

            this.entityPhase = Phase.IN_GAME_ACHIEVING_FINISHED;

            this.playerRecord = new PlayerRecord();
            this.playerRecord.PlayerName = playerName;
            this.playerRecord.PlayerScore = 0;

            this.playerImage = new Sprite2D(0, 0, Utils.LoadTextures(Utils.GetImageFileName(playerImage)));
            this.playerImageHighlighter = new Sprite2D(0, 0, Utils.LoadTextures(Utils.GetImageFileName(Consts.LIGHT)));

            intensity = new float[Consts.MAX_NAME_LENGTH];
            InitializeAnimating();
        }
コード例 #6
0
ファイル: WordBattleGame.cs プロジェクト: Tmbao/WordBattle
        /// <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);

            // TODO: use this.Content to load your game content here
            Global.Content = Content;

            // Allow mouse
            //IsMouseVisible = true;
            cursor = CustomCusor.GetInstance();

            // Initialize map
            gridMap = WordGrid.GetInstance();
            //gridMap.Load(Content.Load<GridData>(Utils.GetMapFileName(Consts.DEFALT_MAP_NAME)));

            // Initialize dictionary
            dictionary = TrieDictionary.GetInstance();
            dictionary.Load(Content.Load<string[]>(Utils.GetDictionaryFileName(Consts.DEFAULT_DICTIONARY_NAME)));

            // Initialize logo panel
            logoPanel = LogoPanel.GetInstance();

            // Initialize menu
            menuContainer = MenuContainer.GetInstance();

            // Initialize background
            background = new Sprite2D(0, 0, Utils.LoadTextures(Utils.GetImageFileName("Background")));

            // Initialize notification
            notification = GameNotification.GetInstance();

            // Initialize controller
            mouseController = MouseController.GetInstance();
            keyboardController = KeyboardController.GetInstance();

            // Initialize button
            backButton = new TileButton(25, 620, Utils.GetImageFileName("Back"));
            soundButton = new TileButton(70, 620, Utils.GetImageFileName("Sound"));

            // Load sound effects
            Global.clickSound = Content.Load<SoundEffect>(@"Sound\click");
            Global.achieveSound = Content.Load<SoundEffect>(@"Sound\achieve");
            Global.themeSong = Content.Load<Song>(@"Sound\theme");

            Global.UpdatePhase(Phase.MENU_LOADING);
        }
コード例 #7
0
ファイル: CustomCusor.cs プロジェクト: Tmbao/WordBattle
 private CustomCusor()
 {
     icon = new Sprite2D(0, 0, Utils.LoadTextures(@"Cursor\cursor_hand"));
 }