/// <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); }
public UIManager(GameFacade facade) : base(facade) { ParseUIPanelTypeJson(); }
public AudioManager(GameFacade facade) : base(facade) { }
public virtual void Init() { mFacade = GameFacade.Instance; }
static void Main(string[] args) { GameFacade gameFacade = new GameFacade(); gameFacade.StartGame(); }
private Vector3 originRotation; //用于保存摄像机的初始角度 public CameraManager(GameFacade facade) : base(facade) { }
/// <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; }
public static void Main() { GameFacade.Start(); }
private void Init() { // GameFacade.GetInstance().stageDataController. playerController = gameObject.GetComponent <PlayerController>(); obstacleController = GameFacade.GetInstance().obstacleController; }
private void OnInitManagers() { this.mGameFacade = new GameFacade(); Singleton <LuaManager> .GetInstance().StartUp(this.mGameFacade); }
public void Awake() { Input.multiTouchEnabled = true; enemyController = GameFacade.GetInstance().EnemyController; gameStateData = GameFacade.GetInstance().gameStateData; }
public static void RegisterObserver(this GameFacade facade , GameEventType _type, params AbsGameEventObserver[] _server) { facade.GameEventSystem.RegisterObserver(_type, _server); }
public static void TriggerEvent(this GameFacade facade , GameEventType _type) { facade.GameEventSystem.TriggerEvent(_type); }
public void Init(GameFacade gameFacade) { this.gameFacade = gameFacade; }
public static bool UseEnergy(this GameFacade facade, int value) { return(facade.EnergySystem.UseEnergy(value)); }
public void SyncMyCityFlagPos() { Coord c = GameFacade.GetProxy <CityProxy>().myCityCoord; MyCityFlag.transform.position = Layout.HexCenter(c); }
public DataManager(GameFacade facade) : base(facade) { }
protected BaseManager(GameFacade facade) { mFacade = facade; }
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); } }
public UIManager(GameFacade gameFacade) : base(gameFacade) { Debug.Log("UIManager构造函数执行了"); }
private void ExitButton_OnButtonClick(UIElement button) { GameFacade.Kill(); }
/// <summary> /// 构造函数 /// </summary> public PoolManager(GameFacade facade) : base(facade) { }
public BaseManager(GameFacade facade) { this.facade = facade; }
public PlayerManager(GameFacade facade) : base(facade) { }
void Start() { mediator = GameFacade.GetMediator <CityUIMediator> (); mediator.selectType += ShowBtns; }
public DoorManager(GameFacade facade) : base(facade) { }
// public override void OnInit() // { // base.OnInit(); // //todo,最好在此处添加所有的Request // //两种注入方式的对比 // //BaseRequest自动添加到RequestManger中 // //RequestMange来创建BaseRequest // } public RequestManger(GameFacade facade) : base(facade) { }
public static void RecycleEnergy(this GameFacade facade, int value) { facade.EnergySystem.RecycleEnergy(value); }
public ClientManager(GameFacade facade) : base(facade) { }
public void SetCity(string code) { //currentCity = code; City = CityData.Load(GameFacade.GraphicsDevice, GameFacade.GameFilePath("cities/city_" + code + "/")); RecalculateGeometry(); }