public static ResourcesManager getInstance() { if(_instance == null) _instance = new ResourcesManager(); return _instance; }
void Awake() { if (instance == null) instance = this; else Destroy(gameObject); }
void Start() { mining = false; elapsed = 0f; miningTime = BalanceProvider.Instance().goldMining.MiningTime; resourcesManager = GameObject.Find("RTS_EntityCreator").GetComponent<ResourcesManager>(); }
public static ResourcesManager getInstance () { if ( _meInstance == null ) { _meInstance = GameObject.Find ( "_ResourcesManager" ).GetComponent < ResourcesManager > (); } return _meInstance; }
void Update() { if (manager == null) { manager = ResourcesManager.instance; } prisoners.maxValue = manager.GetResourcePrisoners().TotalAmount; population.maxValue = manager.GetResourcePopulation().TotalAmount; }
/// <summary> /// Constructor /// </summary> /// <param name="velocity">Velocidad del líder</param> /// <param name="lowL">X inferior del movimiento del líder</param> /// <param name="highL">X superior del movimiento del líder</param> /// <param name="color">Color con que se representa</param> public PlatoonLeader(float velocity, float lowL, float highL, SFML.Graphics.Color color, ResourcesManager resManager) : base(new Vector2f(velocity,0)) { _shape.FillColor = color; _lowL = lowL; _highL = highL; _animation = new Animation((SFML.Graphics.Texture)resManager["Naves:DummyLeader"], new Vector2u(1, 1), SFML.System.Time.FromSeconds(1f)); _animation.Run(); }
/// <summary> /// Constructor /// </summary> /// <param name="resManager">Gestor de recursos</param> /// <param name="worldBounds">Dimensiones de area de movimiento del PlayerShip</param> /// <param name="shootPool">Piscina que gestiona el reciclaje de las balas</param> public PlayerShip(ResourcesManager resManager, FloatRect worldBounds,ShootPlayerPool shootPool) : base() { _sprite = new Sprite((Texture)resManager["Naves:NaveJugador"]); _worldBounds = worldBounds; // ubico el origen del sprite en el centro en vez de en la esquina superior derecha FloatRect bounds = _sprite.GetLocalBounds(); _sprite.Origin = new SFML.System.Vector2f(bounds.Width / 2f, bounds.Height / 2f); _shootPool = shootPool; }
void Awake() { //Check if instance already exists if (instance == null) //if not, set instance to this instance = this; //If instance already exists and it's not this: else if (instance != this) //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. Destroy(gameObject); //DontDestroyOnLoad(gameObject); }
void Awake() { if (instance == null) { instance = this; Init(); } else { Debug.LogError("There is more than one ResourcesManager in the scene!"); } }
public void SetUp() { this.Manager = new ResourcesManager(); this.Resource1 = new Mock<MockResource>(); this.Resource1.Setup(r => r.Load()); this.Resource1.Setup(r => r.Free()); this.Manager.Load("resource 1", this.Resource1.Object); this.Resource2 = new Mock<MockResource>(); this.Resource2.Setup(r => r.Load()); this.Resource2.Setup(r => r.Free()); this.Manager.Load("resource 2", this.Resource2.Object); }
// Use this for initialization void Start() { _UIManager = GameObject.Find("UIManager").GetComponent<UIManager>(); _resourcesManager = GameObject.Find("ResourcesManager").GetComponent<ResourcesManager>(); _parser = GameObject.Find("Parser").GetComponent<Parser>(); _UIManager.Initialize(); _resourcesManager.Initialize(); _parser.Initialize(); //_parser.ParseUIData(); // 그래픽 리소스 아직 없음 _currentGameStatus = GameStatus.Start; _currentTurn = 0; }
public static void Main(string[] args) { // Print welcome message. UCSControl.WelcomeMessage(); // Check directories and files. DirectoryChecker.CheckDirectories(); DirectoryChecker.CheckFiles(); // Initialize our stuff. CSVManager.Initialize(); ResourcesManager.Initialize(); ObjectManager.Initialize(); Logger.Initialize(); ExceptionLogger.Initialize(); WebApi.Initialize(); Gateway.Initialize(); // Start listening since we're done initializing. Gateway.Listen(); while (true) { const int SLEEP_TIME = 5000; var numDisc = 0; var clients = ResourcesManager.GetConnectedClients(); for (int i = 0; i < clients.Count; i++) { var client = clients[i]; if (DateTime.Now > client.NextKeepAlive) { ResourcesManager.DropClient(client.GetSocketHandle()); numDisc++; } } if (numDisc > 0) { Logger.Say($"Dropped {numDisc} clients due to keep alive timeouts."); } Thread.Sleep(SLEEP_TIME); } }
internal override async void Process() { try { ClientAvatar player = this.Device.Player.Avatar; player.TroopRequestMessage = this.Message; Alliance all = ObjectManager.GetAlliance(player.AllianceId); TroopRequestStreamEntry cm = new TroopRequestStreamEntry(); cm.SetSender(player); cm.Message = this.Message; cm.ID = all.m_vChatMessages.Count + 1; cm.SetMaxTroop(player.GetAllianceCastleTotalCapacity()); cm.m_vDonatedTroop = player.GetAllianceCastleUsedCapacity(); StreamEntry s = all.m_vChatMessages.Find(c => c.SenderID == this.Device.Player.Avatar.UserId && c.GetStreamEntryType() == 1); if (s != null) { all.m_vChatMessages.RemoveAll(t => t == s); all.AddChatMessage(cm); } else { all.AddChatMessage(cm); } foreach (AllianceMemberEntry op in all.GetAllianceMembers()) { Level aplayer = await ResourcesManager.GetPlayer(op.AvatarId); if (aplayer.Client != null) { new AllianceStreamEntryMessage(aplayer.Client) { StreamEntry = cm }.Send(); if (s != null) { new AllianceStreamEntryRemovedMessage(aplayer.Client, s.ID).Send(); } } } } catch (Exception) { } }
private async void CheckClient() { try { if (UserID == 0 || string.IsNullOrEmpty(UserToken)) { NewUser(); return; } level = await ResourcesManager.GetPlayer(UserID); if (level != null) { if (level.Avatar.AccountBanned) { new LoginFailedMessage(Device) { ErrorCode = 11 }.Send(); return; } if (string.Equals(level.Avatar.UserToken, UserToken, StringComparison.Ordinal)) { LogUser(); } else { new LoginFailedMessage(Device) { ErrorCode = 11, Reason = "We have some Problems with your Account. Please clean your App Data." }.Send(); return; } } else { new LoginFailedMessage(Device) { ErrorCode = 11, Reason = "We have some Problems with your Account. Please clean your App Data." }.Send(); return; } } catch (Exception) { } }
public override void Encode() { var packet = new List <byte>(); var data = new List <byte>(); var i = 1; foreach (var player in ResourcesManager.GetInMemoryLevels().OrderByDescending(t => t.GetPlayerAvatar().GetScore())) { var pl = player.GetPlayerAvatar(); var id = pl.GetAllianceId(); if (i >= 100) { break; } data.AddInt64(pl.GetId()); data.AddString(pl.GetAvatarName()); data.AddInt32(i); data.AddInt32(pl.GetScore()); data.AddInt32(i); data.AddInt32(pl.GetAvatarLevel()); data.AddInt32(100); data.AddInt32(1); data.AddInt32(100); data.AddInt32(1); data.AddInt32(pl.GetLeagueId()); data.AddString(pl.GetUserRegion().ToUpper()); data.AddInt64(pl.GetAllianceId()); data.AddInt32(1); data.AddInt32(1); if (pl.GetAllianceId() > 0) { data.Add(1); // 1 = Have an alliance | 0 = No alliance data.AddInt64(pl.GetAllianceId()); data.AddString(ObjectManager.GetAlliance(id).GetAllianceName()); data.AddInt32(ObjectManager.GetAlliance(id).GetAllianceBadgeData()); } else { data.Add(0); } i++; } packet.AddInt32(i - 1); packet.AddRange(data.ToArray()); Encrypt(packet.ToArray()); }
public static void BuildAllAssetBundles() { string assetbundlePath = ResourcesManager.AssetBundlesResDirInStreamingAssetsPath; //先删除所有旧文件 string rootDir = MyFileUtil.GetParentDir(assetbundlePath); MyFileUtil.DeleteDir(rootDir); MyFileUtil.CreateDir(assetbundlePath); //获取文件列表 List <string> fileList = ResourcesManager.GenerateFileList(ResourcesManager.DirForAssetBundlesBuildFrom); //-------------------------------------------------------------// List <AssetBundleBuild> bundleList = new List <AssetBundleBuild>(); for (int i = 0; i < fileList.Count; ++i) { string filePath = fileList[i]; if (filePath.EndsWith(".meta")) { continue; } List <string> assetList = new List <string>(); string assetPath = filePath.Substring(filePath.IndexOf("Assets")); assetList.Add(assetPath); string dirNameForAssetBundlesBuildFrom = "/" + ResourcesManager.DirNameForAssetBundlesBuildFrom + "/"; int startPos = assetPath.IndexOf(dirNameForAssetBundlesBuildFrom) + dirNameForAssetBundlesBuildFrom.Length; //int endPos = assetPath.LastIndexOf("."); //string assetBundleName = assetPath.Substring(startPos, endPos - startPos); string assetBundleName = assetPath.Substring(startPos); AssetBundleBuild assetBundleBuild = new AssetBundleBuild(); assetBundleBuild.assetBundleName = assetBundleName + ResourcesManager.mAssetBundleSuffix; //assetBundleBuild.assetBundleVariant = ResourcesManager.mAssetBundleSuffix.Replace(".", ""); assetBundleBuild.assetNames = assetList.ToArray(); bundleList.Add(assetBundleBuild); } BuildPipeline.BuildAssetBundles(assetbundlePath, bundleList.ToArray(), BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget); Debug.Log("BuildAssetBundles Over"); }
public override void Execute(Level level) { if (level.GetAccountPrivileges() >= GetRequiredAccountPrivileges()) { /* Starting saving of players */ var pm = new GlobalChatLineMessage(level.GetClient()); pm.SetChatMessage("Starting saving process of every player!"); pm.SetPlayerId(0); pm.SetLeagueId(22); pm.SetPlayerName("UCS Bot"); pm.Send(); var levels = DatabaseManager.Single().Save(ResourcesManager.GetInMemoryLevels()); levels.Wait(); var p = new GlobalChatLineMessage(level.GetClient()); /* Confirmation */ p.SetChatMessage("All Players are saved!"); p.SetPlayerId(0); p.SetLeagueId(22); p.SetPlayerName("UCS Bot"); p.Send(); /* Starting saving of Clans */ var pmm = new GlobalChatLineMessage(level.GetClient()); pmm.SetPlayerId(0); pmm.SetLeagueId(22); pmm.SetPlayerName("UCS Bot"); pmm.SetChatMessage("Starting with saving of every Clan!"); pmm.Send(); /* Confirmation */ var clans = DatabaseManager.Single().Save(ResourcesManager.GetInMemoryAlliances()); clans.Wait(); var pmp = new GlobalChatLineMessage(level.GetClient()); pmp.SetPlayerId(0); pmp.SetLeagueId(22); pmp.SetPlayerName("UCS Bot"); pmp.SetChatMessage("All Clans are saved!"); pmp.Send(); } else { var p = new GlobalChatLineMessage(level.GetClient()); p.SetChatMessage("GameOp command failed. Access to Admin GameOP is prohibited."); p.SetPlayerId(0); p.SetLeagueId(22); p.SetPlayerName("UCS Bot"); p.Send(); } }
//设置高斯模糊 public static GameObject setBlurBackground(float picAllW, float picAllH) { if (picAllW > picAllH) { picAllH = picAllW; } else { picAllW = picAllH; } GameObject blurBackgroundObj = GameObject.Instantiate(ResourcesManager.LoadData <GameObject>("Prefab/Game/BlurBackgroundGameObj")); blurBackgroundObj.name = "GameBlurBackground"; blurBackgroundObj.transform.position = blurGroundVector; blurBackgroundObj.transform.localScale = new Vector3(picAllW * backgroundScale, picAllH * backgroundScale, 1); return(blurBackgroundObj); }
private void Compare(CompareResultDto dto) { transform.DOScale(Vector3.one, 0.3f).OnComplete(() => { StartCoroutine(Delay()); }); // 显示牌 for (int i = 0; i < dto.winDto.cardLidt.Count; i++) { win.imgCardArr[i].sprite = ResourcesManager.LoadCardSprite(dto.winDto.cardLidt[i].Name); } win.txtName.text = dto.winDto.name; for (int i = 0; i < dto.loseDto.cardLidt.Count; i++) { lose.imgCardArr[i].sprite = ResourcesManager.LoadCardSprite(dto.loseDto.cardLidt[i].Name); } lose.txtName.text = dto.loseDto.name; }
static void OnReceive(SocketRead read, byte[] data) { try { long socketHandle = read.Socket.Handle.ToInt64(); var c = ResourcesManager.GetClient(socketHandle); c.DataStream.AddRange(data); Message p; while (c.TryGetPacket(out p)) { PacketManager.ProcessIncomingPacket(p); } } catch (Exception) { } }
void Start() { resourcesManager = GameObject.FindObjectOfType<ResourcesManager>(); CalculateDifferenceInTimeSinceLastQuit(); double differenceInSeconds = difference.TotalSeconds; int dwarfsRegeneratedWhenOut = (int)(differenceInSeconds / 3); resourcesManager.Dwarfs(dwarfsRegeneratedWhenOut); double restFromDifference = differenceInSeconds % 3; actualRegenerateTimer = (int) restFromDifference; StartCoroutine(addDwarf()); }
private static void ProcessAccept(SocketAsyncEventArgs e, bool startNew) { var acceptSocket = e.AcceptSocket; if (e.SocketError != SocketError.Success) { Logger.Error($"Failed to accept new socket: {e.SocketError}."); Drop(e); // Get a new args from pool, since we dropped the previous one. e = GetArgs(); } else { try { if (Constants.Verbosity > 3) { Logger.Say($"Accepted connection at {acceptSocket.RemoteEndPoint}."); } var client = new Device(acceptSocket); // Register the client in the ResourceManager. ResourcesManager.AddClient(client); var args = GetArgs(); var buffer = GetBuffer(); args.UserToken = client; args.SetBuffer(buffer, 0, buffer.Length); StartReceive(args); } catch (Exception ex) { ExceptionLogger.Log(ex, "Exception while processing accept"); } } // Clean up for reuse. e.AcceptSocket = null; if (startNew) { StartAccept(e); } }
// Use this for initialization void Start() { stage = GameObject.Find("Stage"); ss = stage.GetComponent <StageScript> (); turns = GameObject.Find("Turns"); ts = turns.GetComponent <TurnsScript> (); resources = GameObject.Find("Resources"); rm = resources.GetComponent <ResourcesManager> (); P1ResultLog = transform.Find("P1Result").GetComponent <Text> (); P2ResultLog = transform.Find("P2Result").GetComponent <Text> (); eventLog = transform.Find("EventLog").GetComponent <Text> (); P1ResultLog.color = new Color(0, 0, 1, 1); P2ResultLog.color = new Color(1, 0, 0, 1); eventLog.color = new Color(0, 1, 0, 1); }
/// <summary> /// 获取怪物数据配置信息 /// </summary> private void GetMonsterValue() { string fileName = "InitialData"; JsonData MonsterData = ResourcesManager.GetJsonData(fileName, "Monster"); for (int i = 0; i < MonsterData.Count; i++) { if (MonsterName == MonsterData[i]["Name"].ToString()) { HP = (int)MonsterData[i]["HP"]; Atk = (int)MonsterData[i]["Atk"]; Def = (int)MonsterData[i]["Def"]; Golds = (int)MonsterData[i]["Gold"]; Exp = (int)MonsterData[i]["Exp"]; } } }
public static void Clean() { try { foreach (Level _Player in ResourcesManager.GetInMemoryLevels()) { if (!_Player.GetClient().IsClientSocketConnected()) { _Player.GetClient().Socket.Close(); ResourcesManager.DropClient(_Player.GetClient().GetSocketHandle()); } } GC.Collect(GC.MaxGeneration); GC.WaitForPendingFinalizers(); } catch (Exception) { } }
void Start() { resourcesManager = GameObject.FindObjectOfType <ResourcesManager>(); CalculateDifferenceInTimeSinceLastQuit(); double differenceInSeconds = difference.TotalSeconds; int dwarfsRegeneratedWhenOut = (int)(differenceInSeconds / 3); resourcesManager.Dwarfs(dwarfsRegeneratedWhenOut); double restFromDifference = differenceInSeconds % 3; actualRegenerateTimer = (int)restFromDifference; StartCoroutine(addDwarf()); }
private void UCSUI_Load(object sender, EventArgs e) { materialLabel5.Text = Convert.ToString(Dns.GetHostByName(Dns.GetHostName()).AddressList[0]); materialLabel6.Text = ConfigurationManager.AppSettings["ServerPort"]; materialLabel7.Text = Convert.ToString(ResourcesManager.GetOnlinePlayers().Count); materialLabel8.Text = Convert.ToString(ResourcesManager.GetConnectedClients().Count); materialLabel13.Text = Convert.ToString(ResourcesManager.GetInMemoryLevels().Count); //materialLabel14.Text = Convert.ToString(ResourcesManager.GetAllPlayerIds()) + Convert.ToString(ResourcesManager.); //materialLabel16.Text = Convert.ToString(ResourcesManager.GetAllPlayersFromDB()); /* SETTINGS */ textBox1.Text = ConfigurationManager.AppSettings["startingGems"]; textBox2.Text = ConfigurationManager.AppSettings["startingGold"]; textBox3.Text = ConfigurationManager.AppSettings["startingElixir"]; textBox4.Text = ConfigurationManager.AppSettings["startingDarkElixir"]; textBox5.Text = ConfigurationManager.AppSettings["startingTrophies"]; textBox6.Text = ConfigurationManager.AppSettings["startingLevel"]; textBox7.Text = ConfigurationManager.AppSettings["UpdateUrl"]; textBox10.Text = ConfigurationManager.AppSettings["useCustomPatch"]; textBox8.Text = ConfigurationManager.AppSettings["patchingServer"]; textBox9.Text = ConfigurationManager.AppSettings["maintenanceTimeleft"]; textBox11.Text = ConfigurationManager.AppSettings["databaseConnectionName"]; textBox13.Text = ConfigurationManager.AppSettings["ServerPort"]; textBox12.Text = ConfigurationManager.AppSettings["AdminMessage"]; textBox14.Text = ConfigurationManager.AppSettings["LogLevel"]; /* SETTINGS */ /* PLAYER EDITOR */ textBox15.Enabled = false; textBox16.Enabled = false; textBox17.Enabled = false; textBox18.Enabled = false; textBox19.Enabled = false; /* PLAYER EDITOR */ listView1.Items.Clear(); foreach (var acc in ResourcesManager.GetOnlinePlayers()) { ListViewItem item = new ListViewItem(acc.GetPlayerAvatar().GetAvatarName()); item.SubItems.Add(Convert.ToString(acc.GetPlayerAvatar().GetId())); item.SubItems.Add(Convert.ToString(acc.GetPlayerAvatar().GetAvatarLevel())); item.SubItems.Add(Convert.ToString(acc.GetPlayerAvatar().GetScore())); item.SubItems.Add(Convert.ToString(acc.GetAccountPrivileges())); listView1.Items.Add(item); } }
public void SetData(GarbageVo garbage) { model = GarbageModel.Instance; view = GetComponent <GarbageItemView>(); model.updateNum += UpdateNum;//添加事件触发函数 view.Btn_Choose.gameObject.SetActive(false); UIEventListener.Get(view.Img_Icon).OnClickHandler += OnChooseGarge; UIEventListener.Get(view.Img_Icon).OnBeginDragHandler += OnBeginDrag; UIEventListener.Get(view.Img_Icon).OnDragHandler += OnDrag; UIEventListener.Get(view.Img_Icon).OnEndDragHandler += OnEndDrag; this.garbage = garbage; view.Img_Icon.sprite = ResourcesManager.Load <Sprite>("Garbages/" + garbage.Id); view.Txt_Num.text = garbage.Num.ToString(); }
public void Show(string viewName) { UIAsset asset = GetUIAsset(viewName); if (asset == null) { return; } Object viewdata = ResourcesManager.GetInstance().LoadLocalAsset("UIPrefabs/" + asset.uiRecord.prefabName); GameObject viewObj = GameObject.Instantiate(viewdata) as GameObject; viewObj.transform.parent = mUIRoot; viewObj.transform.localScale = Vector3.one; viewObj.transform.localPosition = Vector3.zero; asset.viewObject = viewObj; asset.view = asset.viewObject.GetComponent <ViewBase>(); }
// Use this for initialization void Start() { resources = GameObject.Find("Resources"); rm = resources.GetComponent <ResourcesManager> (); stageScript = GameObject.Find("Stage"); ss = stageScript.GetComponent <StageScript> (); SPHealthOJ = GameObject.Find("SpawnPointFab"); sh = SPHealthOJ.GetComponent <SpawnPointHealthScript> (); gasText = transform.Find("GasTip").GetComponent <Text>(); nuclearText = transform.Find("NuclearTip").GetComponent <Text>(); coalText = transform.Find("CoalTip").GetComponent <Text>(); windText = transform.Find("WindTip").GetComponent <Text>(); oilText = transform.Find("OilTip").GetComponent <Text>(); solarText = transform.Find("SolarTip").GetComponent <Text>(); }
private static void OnReceive(SocketRead read, byte[] data) { try { Client c = ResourcesManager.GetClient(read.Socket.Handle.ToInt64()); c.DataStream.AddRange(data); Message p; while (c.TryGetPacket(out p)) { PacketManager.ProcessIncomingPacket(p); } } catch (Exception ex) { Debugger.WriteLine("[UCS] Exception thrown when processing incoming packet : ", ex); } }
//Save Button private async void materialRaisedButton7_Click(object sender, EventArgs e) { /* SAVE PLAYER */ Level l = await ResourcesManager.GetPlayer(long.Parse(txtPlayerID.Text)); l.Avatar.SetName(txtPlayerName.Text); l.Avatar.SetScore(Convert.ToInt32(txtPlayerScore.Text)); l.Avatar.m_vCurrentGems = Convert.ToInt32(txtPlayerGems.Text); l.Avatar.SetTownHallLevel(Convert.ToInt32(txtTownHallLevel.Text)); l.Avatar.AllianceId = Convert.ToInt32(txtAllianceID.Text); l.Avatar.m_vAvatarLevel = Convert.ToInt32(txtPlayerLevel.Text); var title = "Finished!"; MessageBox.Show("Player has been saved!", title, MessageBoxButtons.OK, MessageBoxIcon.Information); /* SAVE PLAYER */ }
public override void Encode() { var data = new List <byte>(); var packet1 = new List <byte>(); var i = 1; foreach (var player in ResourcesManager.GetOnlinePlayers().OrderByDescending(t => t.GetPlayerAvatar().GetScore())) { var pl = player.GetPlayerAvatar(); packet1.AddInt64(pl.GetId()); packet1.AddString(pl.GetAvatarName()); packet1.AddInt32(i); packet1.AddInt32(pl.GetScore()); packet1.AddInt32(i); packet1.AddInt32(pl.GetAvatarLevel()); packet1.AddInt32(100); packet1.AddInt32(i); packet1.AddInt32(100); packet1.AddInt32(1); packet1.AddInt64(pl.GetAllianceId()); packet1.AddInt32(1); packet1.AddInt32(1); if (pl.GetAllianceId() > 0) { packet1.Add(1); // 1 = Have an alliance | 0 = No alliance packet1.AddInt64(pl.GetAllianceId()); packet1.AddString(ObjectManager.GetAlliance(pl.GetAllianceId()).GetAllianceName()); packet1.AddInt32(ObjectManager.GetAlliance(pl.GetAllianceId()).GetAllianceBadgeData()); packet1.AddInt64(i); } else { packet1.Add(0); } if (i >= 200) { break; } i++; } data.AddInt32(90000); //Season End data.AddInt32(i - 1); data.AddRange(packet1); Encrypt(data.ToArray()); }
/// <summary> /// 播放BGM /// </summary> /// <param name="position"></param> public void playBGMClip(int position) { if (audioSource == null) { return; } if (listBGMInfo != null && listBGMInfo.Count > 0 && position <= listBGMInfo.Count - 1) { BGMInfoBean data = listBGMInfo[position]; string audioPath = data.FilePath; aduioClip = ResourcesManager.LoadData <AudioClip>(audioPath); audioSource.clip = aduioClip; audioSource.loop = false; audioSource.volume = CommonConfigure.BGMVolume; audioSource.Play(); } }
private void ProcessPacket(Reader read, byte[] data) { try { long socketHandle = read.Socket.Handle.ToInt64(); Client c = ResourcesManager.GetClient(socketHandle); c.DataStream.AddRange(data); Message p; while (c.TryGetPacket(out p)) { p.Receive(); } } catch { } }
static int GetUIInstanceSync(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); ResourcesManager obj = (ResourcesManager)ToLua.CheckObject <ResourcesManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); UnityEngine.GameObject o = obj.GetUIInstanceSync(arg0, arg1); ToLua.PushSealed(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_ResourcesRoot(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); ResourcesManager obj = (ResourcesManager)o; UnityEngine.Transform ret = obj.ResourcesRoot; ToLua.Push(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index ResourcesRoot on a nil value")); } }
static int GetUIInstance(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); ResourcesManager obj = (ResourcesManager)ToLua.CheckObject <ResourcesManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); System.Action <UnityEngine.Object> arg2 = (System.Action <UnityEngine.Object>)ToLua.CheckDelegate <System.Action <UnityEngine.Object> >(L, 4); obj.GetUIInstance(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int LoadAssetBundleSync(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); ResourcesManager obj = (ResourcesManager)ToLua.CheckObject <ResourcesManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); string arg1 = ToLua.CheckString(L, 3); UnityEngine.Object o = obj.LoadAssetBundleSync(arg0, arg1); ToLua.Push(L, o); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/// <summary>Deserialize a internal theme from resources.</summary> /// <param name="themes">The internal themes.</param> /// <returns>The <see cref="Theme" />.</returns> public static Theme Deserialize(Themes themes) { Theme _theme = null; try { string rawThemeResource = ResourcesManager.ReadResource(Assembly.GetExecutingAssembly().Location, $"{SettingConstants.ThemeResourceLocation}{themes.ToString()}.xml"); XDocument resourceDocumentTheme = XDocument.Parse(rawThemeResource); _theme = Deserialize(resourceDocumentTheme); } catch (Exception e) { ConsoleEx.WriteDebug(e); } return(_theme); }
static int Create(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { ResourcesManager obj = new ResourcesManager(); LuaScriptMgr.PushObject(L, obj); return(1); } else { LuaDLL.luaL_error(L, "invalid arguments to method: ResourcesManager.New"); } return(0); }
public DialogController ShowDialog(string _name) { var screenParent = parent; if (screens.Count > 0) { screenParent = screens[screens.Count - 1].GetComponent <Transform>(); } var dialog = Instantiate(ResourcesManager.LoadPrefab(ConstantsResourcesPath.DIALOGS, _name), screenParent).GetComponent <DialogController>(); dialog.transform.SetAsLastSibling(); dialogs.Add(dialog); return(dialog); }
public void HandleBuildCommand(Control control, ResourcesManager resourcesManager) { switch (control.Name) { case "BuildAirfield": if (resourcesManager.Money >= Settings.AirfieldCost) { IsAirfieldBuilt = true; resourcesManager.Money -= Settings.AirfieldCost; control.IsEnabled = false; } control.IsSelected = false; break; case "BuildControlTower": if (resourcesManager.Money >= Settings.ControlTowerCost) { IsControlTowerBuilt = true; resourcesManager.Money -= Settings.ControlTowerCost; control.IsEnabled = false; } control.IsSelected = false; break; } }
private void Start() { hudPositionX = hudIndentation; hudPositionY = Screen.height - workerTexture.height - hudIndentation - underButtonHeight; workerButtonClickCount = 0; warriorGreenButtonClickCount = 0; warriorYellowButtonClickCount = 0; warriorRedButtonClickCount = 0; towerButtonClickCount = 0; entityCreateOn = 0.0f; entityCreateSpeed = 2.0f; gameManagerScript = GameObject.Find("GameManager").GetComponent<GameManager>(); resourcesManagerScript = GameObject.Find("RTS_EntityCreator").GetComponent<ResourcesManager>(); workerPrice = BalanceProvider.Instance().resourcesPrice.WorkerPrice; warriorGreenPrice = BalanceProvider.Instance().resourcesPrice.WarriorPriceGreen; warriorYellowPrice = BalanceProvider.Instance().resourcesPrice.WarriorPriceYellow; warriorRedPrice = BalanceProvider.Instance().resourcesPrice.WarriorPriceRed; towerPrice = BalanceProvider.Instance().resourcesPrice.TowerPrice; }
// Use this for initialization void Start() { nwm = gameObject.GetComponent<NetworkManager>(); rm = gameObject.GetComponent<ResourcesManager>(); spr_rend = not_spr.GetComponent<SpriteRenderer>(); scale = gameObject.GetComponent<Manager>().getScale(); spr_rend.enabled = false; }
/// <summary> /// Constructor /// </summary> /// <param name="velocity">Velocidad del lider (dirección X)</param> /// <param name="lowL">X inferior del movimiento del líder</param> /// <param name="highL">X superior del movimiento del líder</param> public PlatoonLeader(float velocity, float lowL, float highL, ResourcesManager resManager) : this(velocity, lowL, highL, new SFML.Graphics.Color(100,80,250), resManager) { }
void Start() { resourceManager = FindObjectOfType<ResourcesManager>(); coinSound = GameObject.Find("CoinSound").GetComponent<AudioSource>(); coinSound.volume = 0.4f; }
public static void InitializeShootTypeConfiguration(ResourcesManager resManager) { ShootTypeConf = new ShootTypeData[(int)Type.TYPECOUNT]; // tipo Player ShootTypeConf[(int)Type.PLAYER]._textureKey = "Misiles:Jugador"; ShootTypeConf[(int)Type.PLAYER]._maxSpeed = -400; // px/s // tipo Enemies ShootTypeConf[(int)Type.ENEMIES]._textureKey = "Misiles:Enemigos"; ShootTypeConf[(int)Type.ENEMIES]._maxSpeed = 350; // px/s for (int type = 0; type < (int)Type.TYPECOUNT; type++) { ShootTypeConf[type]._resManager = resManager; } }
//////////////////////// // Métodos //////////////////////// public void Init() { _logger.Log(LogLevel.Info, " > Configurando aplicación."); // buffer 32 bits de colors ContextSettings contextSettings = new ContextSettings(); contextSettings.DepthBits = 32; // Creamos la ventana principal _logger.Log(LogLevel.Info, " >> Creando ventana principal."); // ventana no redimensionable _window = new RenderWindow(new VideoMode(800, 600), "Galaga ", Styles.Close, contextSettings); // gestor de escenas _logger.Log(LogLevel.Info, " >> Creando gestor de escenas."); _scnManager = new SceneManager(); // Se crea el gestor de recursos y se leen los elementos _logger.Log(LogLevel.Info, " >> Creando gestor de recursos."); _resManager = new ResourcesManager( this.GetType().Assembly.GetManifestResourceStream("Galaga.main.resxml")); _resManager.RegisterLoadFunction("texture", SFMLResourcesManager.LoadTexture); _resManager.RegisterLoadFunction("font", SFMLResourcesManager.LoadFont); // creación del contexto _context = new Scene.Context(_window, _resManager); _timePerFrame = SFML.System.Time.FromSeconds(1f / 40f); // como mínimo 40 frames por segundo _isPaused = false; RegisterDelegates(); RegisterScenes(); // pongo la primera escena en la pila _logger.Log(LogLevel.Info, " >> Push escena principal."); _scnManager.Push((int)SceneID.TITLE); }
void Awake() { Instance = this; }
void Start() { InitializeNetwork(); resourcesManager = GetComponent<ResourcesManager>(); resourcesPrices = GetComponent<ResourcesPrices>(); towerSelector = GetComponent<TowerSelector>(); }
public static void setResourcesManager(ResourcesManager RM) { Resources = RM; }
void Start() { dwarfShooter = GameObject.FindObjectOfType<DwarfShooter>(); resourcesManager = GameObject.FindObjectOfType<ResourcesManager>(); resourcesOnLevelCounter = GameObject.FindObjectOfType<ResourcesOnLevelCounter>(); }
void OnLevelWasLoaded() { resourcesManager = GameObject.FindObjectOfType<ResourcesManager>(); }