コード例 #1
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public void Initialize()
        {
            //RenderTarget = RenderTargetUtils.CreateRenderTarget(game.GraphicsDevice, 1, SurfaceFormat.Color, 800, 600);

            /** Load the terrain effect **/
            if (zoomedIn)
            {
                effect = GameFacade.Game.Content.Load <Effect>("Effects/TerrainSplat");
            }
            else
            {
                effect = GameFacade.Game.Content.Load <Effect>("Effects/TerrainSplat2");
            }

            /** Setup **/
            //SetCity("0020");
            SetCity("0001");

            //transX = -(City.Width * Geom.CellWidth / 2);
            //transY = +(City.Height / 2 * Geom.CellHeight / 2);

            /**
             * Setup terrain texture
             */

            var device = GameFacade.GraphicsDevice;

            var textureBase = GameFacade.GameFilePath("gamedata/terrain/newformat/");

            var grass = Texture2D.FromFile(device, Path.Combine(textureBase, "gr.tga"));
            var rock  = Texture2D.FromFile(device, Path.Combine(textureBase, "rk.tga"));
            var snow  = Texture2D.FromFile(device, Path.Combine(textureBase, "sn.tga"));
            var sand  = Texture2D.FromFile(device, Path.Combine(textureBase, "sd.tga"));
            var water = Texture2D.FromFile(device, Path.Combine(textureBase, "wt.tga"));

            TextureTerrain = TextureUtils.MergeHorizontal(device, grass, snow, sand, rock, water);

            TextureGrass = grass;
            TextureSand  = sand;
            TextureSnow  = snow;
            TextureRock  = rock;
            TextureWater = water;

            /** Dont need these anymore **/
            //grass.Dispose();
            //rock.Dispose();
            //snow.Dispose();
            //sand.Dispose();
            //water.Dispose();

            /**
             * Setup alpha map texture
             */
            /** Construct a single texture out of the alpha maps **/
            Texture2D[] alphaMaps = new Texture2D[15];
            for (var t = 0; t < 15; t++)
            {
                var index = t.ToString();
                if (t < 10)
                {
                    index = "0" + index;
                }
                alphaMaps[t] = Texture2D.FromFile(device, Path.Combine(textureBase, "transb" + index + "b.tga"));
            }

            /** We add an extra 64px so that the last slot in the sheet is a solid color aka no blending **/
            TextureBlend = TextureUtils.MergeHorizontal(device, 64, alphaMaps);
            alphaMaps.ToList().ForEach(x => x.Dispose());

            //TextureBlend.Save(@"C:\Users\Admin\Desktop\blendBB.jpg", ImageFileFormat.Jpg);
        }
コード例 #2
0
ファイル: UIManager.cs プロジェクト: SuperIOyht/OverAcher
 public UIManager(GameFacade facade) : base(facade)
 {
     ParseUIPanelTypeJson();
 }
コード例 #3
0
 public AudioManager(GameFacade facade) : base(facade)
 {
 }
コード例 #4
0
 public virtual void Init()
 {
     mFacade = GameFacade.Instance;
 }
コード例 #5
0
        static void Main(string[] args)
        {
            GameFacade gameFacade = new GameFacade();

            gameFacade.StartGame();
        }
コード例 #6
0
ファイル: CameraManager.cs プロジェクト: fctony/ForestWar
 private Vector3 originRotation;    //用于保存摄像机的初始角度
 public CameraManager(GameFacade facade) : base(facade)
 {
 }
コード例 #7
0
        /// <summary>
        /// Display an avatar
        /// </summary>
        /// <param name="avatar"></param>
        public void DisplayAvatar(AvatarData avatar)
        {
            this.Avatar = avatar;
            var isUsed = avatar != null;

            SetSlotAvailable(!isUsed);

            if (avatar == null)
            {
                return;
            }

            PersonNameText.Caption = avatar.Name;
            //PersonDescriptionText.CurrentText = avatar.Description;
            AvatarButton.Texture = Screen.SimSelectButtonImage;

            var shard = Screen.LoginRegulator.Shards.All.First(x => x.Name == avatar.ShardName);

            CityNameText.Caption = shard.Name;

            if (avatar.LotId.HasValue && avatar.LotName != null)
            {
                HouseNameText.Caption = avatar.LotName;
                Screen.AsyncAPILotThumbnail((uint)shard.Id, avatar.LotLocation.Value, (tex) =>
                {
                    HouseThumb.Texture = tex;
                    HouseThumb.Y      += HouseThumb.Size.Y / 2;
                    HouseThumb.SetSize(HouseThumb.Size.X, (int)(HouseThumb.Size.X * ((double)HouseThumb.Texture.Height / HouseThumb.Texture.Width)));
                    HouseThumb.Y -= HouseThumb.Size.Y / 2;
                });

                /*
                 * HouseThumb.Texture = Screen.GetLotThumbnail(avatar.ShardName, avatar.LotLocation.Value);
                 * HouseThumb.Y += HouseThumb.Size.Y / 2;
                 * HouseThumb.SetSize(HouseThumb.Size.X, (int)(HouseThumb.Size.X * ((double)HouseThumb.Texture.Height / HouseThumb.Texture.Width)));
                 * HouseThumb.Y -= HouseThumb.Size.Y / 2;
                 */
            }

            var cityThumb = (int.Parse(shard.Map) >= 100)?
                            Path.Combine(FSOEnvironment.ContentDir, "Cities/city_" + shard.Map + "/thumbnail.png")
                : GameFacade.GameFilePath("cities/city_" + shard.Map + "/thumbnail.bmp");

            Texture2D cityThumbTex =
                TextureUtils.Resize(
                    GameFacade.GraphicsDevice,
                    TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, cityThumb),
                    78,
                    58);

            TextureUtils.CopyAlpha(ref cityThumbTex, Screen.CityHouseButtonAlpha);
            CityThumb.Texture = cityThumbTex;

            SetTab(PersonSlotTab.EnterTab);

            Sim.Avatar.Appearance   = (AppearanceType)Enum.Parse(typeof(AppearanceType), avatar.AppearanceType.ToString());
            Sim.Avatar.BodyOutfitId = avatar.BodyOutfitID;
            Sim.Avatar.HeadOutfitId = avatar.HeadOutfitID;

            Sim.Visible = true;

            PersonDescriptionText.CurrentText = avatar.Description;
        }
コード例 #8
0
 public static void Main()
 {
     GameFacade.Start();
 }
コード例 #9
0
 private void Init()
 {
     //  GameFacade.GetInstance().stageDataController.
     playerController   = gameObject.GetComponent <PlayerController>();
     obstacleController = GameFacade.GetInstance().obstacleController;
 }
コード例 #10
0
 private void OnInitManagers()
 {
     this.mGameFacade = new GameFacade();
     Singleton <LuaManager> .GetInstance().StartUp(this.mGameFacade);
 }
コード例 #11
0
 public void Awake()
 {
     Input.multiTouchEnabled = true;
     enemyController         = GameFacade.GetInstance().EnemyController;
     gameStateData           = GameFacade.GetInstance().gameStateData;
 }
コード例 #12
0
 public static void RegisterObserver(this GameFacade facade
                                     , GameEventType _type, params AbsGameEventObserver[] _server)
 {
     facade.GameEventSystem.RegisterObserver(_type, _server);
 }
コード例 #13
0
 public static void TriggerEvent(this GameFacade facade
                                 , GameEventType _type)
 {
     facade.GameEventSystem.TriggerEvent(_type);
 }
コード例 #14
0
ファイル: Model.cs プロジェクト: AugSu/TetrisGame
 public void Init(GameFacade gameFacade)
 {
     this.gameFacade = gameFacade;
 }
コード例 #15
0
 public static bool UseEnergy(this GameFacade facade, int value)
 {
     return(facade.EnergySystem.UseEnergy(value));
 }
コード例 #16
0
    public void SyncMyCityFlagPos()
    {
        Coord c = GameFacade.GetProxy <CityProxy>().myCityCoord;

        MyCityFlag.transform.position = Layout.HexCenter(c);
    }
コード例 #17
0
 public DataManager(GameFacade facade) : base(facade)
 {
 }
コード例 #18
0
 protected BaseManager(GameFacade facade)
 {
     mFacade = facade;
 }
コード例 #19
0
        public Texture2D GetLotThumbnail(string shardName, uint lotId)
        {
            //might reintroduce the cache at some point, though with the thumbnails behind cloudflare it's likely not an issue for now.
            var shard    = LoginRegulator.Shards.GetByName(shardName);
            var shardKey = CacheKey.For("shards", shard.Id);
            var thumbKey = CacheKey.Combine(shardKey, "lot_thumbs", lotId);

            if (Cache.ContainsKey(thumbKey))
            {
                try {
                    var thumbData = Cache.Get <byte[]>(thumbKey).Result;
                    var thumb     = ImageLoader.FromStream(GameFacade.GraphicsDevice, new MemoryStream(thumbData));
                    return(thumb);
                }catch (Exception ex)
                {
                    //Handles cases where the cache file got corrupted
                    var thumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp"));
                    TextureUtils.ManualTextureMask(ref thumb, new uint[] { 0xFF000000 });
                    return(thumb);
                }
            }
            else
            {
                var thumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp"));
                TextureUtils.ManualTextureMask(ref thumb, new uint[] { 0xFF000000 });
                return(thumb);
            }
        }
コード例 #20
0
 public UIManager(GameFacade gameFacade) : base(gameFacade)
 {
     Debug.Log("UIManager构造函数执行了");
 }
コード例 #21
0
ファイル: UIExitDialog.cs プロジェクト: simscolony/FreeSims
 private void ExitButton_OnButtonClick(UIElement button)
 {
     GameFacade.Kill();
 }
コード例 #22
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public PoolManager(GameFacade facade) : base(facade)
 {
 }
コード例 #23
0
 public BaseManager(GameFacade facade)
 {
     this.facade = facade;
 }
コード例 #24
0
ファイル: PlayerManager.cs プロジェクト: BINPAN2/ForestWar
 public PlayerManager(GameFacade facade) : base(facade)
 {
 }
コード例 #25
0
 void Start()
 {
     mediator             = GameFacade.GetMediator <CityUIMediator> ();
     mediator.selectType += ShowBtns;
 }
コード例 #26
0
ファイル: DoorManager.cs プロジェクト: nikoong/gamedemo
 public DoorManager(GameFacade facade) : base(facade)
 {
 }
コード例 #27
0
//    public override void OnInit()
//    {
//        base.OnInit();
//        //todo,最好在此处添加所有的Request
//        //两种注入方式的对比
//        //BaseRequest自动添加到RequestManger中
//        //RequestMange来创建BaseRequest
//    }

    public RequestManger(GameFacade facade) : base(facade)
    {
    }
コード例 #28
0
 public static void RecycleEnergy(this GameFacade facade, int value)
 {
     facade.EnergySystem.RecycleEnergy(value);
 }
コード例 #29
0
 public ClientManager(GameFacade facade) : base(facade)
 {
 }
コード例 #30
0
 public void SetCity(string code)
 {
     //currentCity = code;
     City = CityData.Load(GameFacade.GraphicsDevice, GameFacade.GameFilePath("cities/city_" + code + "/"));
     RecalculateGeometry();
 }