Example #1
0
 public void Init()
 {
     if (m_GraphicsSettings == null)
     {
         m_GraphicsSettings = Methods.GetObjectOf <IGraphicsSettings>(m_PostOffice.GetMessageObjects(m_ModuleID, Constant.enumMessage.GET_GRAPHICS_SETTINGS));
         if (m_GraphicsSettings == null)
         {
             m_GraphicsSettings = new GraphicsSettings2D();
         }
         m_GraphicsSettings.Initialise(new Vector2(800, 600), false, true, true);
     }
     UpdateGraphicsSettings(m_GraphicsSettings);
 }
        public void Init()
        {
            IGameObject[]     objects = new IGameObject[31];
            SpriteComponent[] sprites = new SpriteComponent[31];
            m_CurrGraphicsSettings.Initialise(new Vector2(1314, 1018), false, true, true, new Vector3(0, 0, 0));

            m_GameCommand.SendData(Constant.enumMessage.LOAD_TEXTURES, new string[][] { m_spritePaths, m_texIDs });

            for (int i = 0; i < 3; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    objects[((i * 3) + j)] = new GameObject(m_TblObjTable[i, j], m_BoardGrid[i, j]);
                    sprites[((i * 3) + j)] = new SpriteComponent(m_texIDs[2]);
                    sprites[((i * 3) + j)].SwitchDrawState();
                    objects[((i * 3) + j) + 9]  = new GameObject(m_XObjTable[i, j], m_BoardGrid[i, j]);
                    sprites[((i * 3) + j) + 9]  = new SpriteComponent(m_texIDs[1]);
                    objects[((i * 3) + j) + 18] = new GameObject(m_OObjTable[i, j], m_BoardGrid[i, j]);
                    sprites[((i * 3) + j) + 18] = new SpriteComponent(m_texIDs[0]);
                }
            }
            Vector3 midScreen = new Vector3(m_CurrGraphicsSettings.m_ScreenSize.x / 2, m_CurrGraphicsSettings.m_ScreenSize.y / 2, 0.0f);

            objects[27] = new GameObject("StartScreen", midScreen);
            sprites[27] = new SpriteComponent(m_texIDs[3]);
            sprites[27].SwitchDrawState();
            objects[28] = new GameObject("WinScreen", midScreen);
            sprites[28] = new SpriteComponent(m_texIDs[4]);
            objects[29] = new GameObject("DrawScreen", midScreen);
            sprites[29] = new SpriteComponent(m_texIDs[5]);
            objects[30] = new GameObject("LoseScreen", midScreen);
            sprites[30] = new SpriteComponent(m_texIDs[6]);

            m_GameCommand.SendData(Constant.enumMessage.CREATE_OBJECTS, objects);

            for (int i = 0; i < sprites.Length; i++)
            {
                m_GameCommand.SendDataForObject <IComponent>(Constant.enumMessage.ADD_COMPONENTS_TO_OBJECT, objects[i].m_GameObjectKey, sprites[i]);
            }
            m_GameCommand.SendData(Constant.enumMessage.UPDATE_GRAPHICS_SETTINGS, new IGraphicsSettings[] { m_CurrGraphicsSettings });
        }