public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); var tmp = GameDataManager.GetColor((Rarity)property.FindPropertyRelative("dataRarity").enumValueIndex); var rectPosition = position; position = EditorGUI.PrefixLabel(position, label); var index = EditorGUI.indentLevel; EditorGUI.indentLevel = 0; rectPosition.width -= position.width; rectPosition.y += rectPosition.height / 2; rectPosition.height /= 2; EditorGUI.DrawRect(rectPosition, tmp); position.height /= 2; var enemyName = new Rect(position.x, position.y, 130, position.height); var enemyRarity = new Rect(position.x + 135, position.y, position.width - 135, position.height); var enemyPrefab = new Rect(position.x, position.y + position.height, position.width, position.height); //绘制属性 EditorGUI.PropertyField(enemyName, property.FindPropertyRelative("dataName"), GUIContent.none); EditorGUI.PropertyField(enemyRarity, property.FindPropertyRelative("dataRarity"), GUIContent.none); EditorGUI.PropertyField(enemyPrefab, property.FindPropertyRelative("dataPrefab"), GUIContent.none); //重新设置为原来的层级 EditorGUI.indentLevel = index; EditorGUI.EndProperty(); }
void OnItemPurchased(int index) { Character character = characterDB.GetCharacter(index); CharacterItemUI uiItem = GetItemUI(index); if (GameDataManager.CanSpendCoins(character.price)) { //Proceed with the purchase operation GameDataManager.SpendCoins(character.price); //Play purchase FX purchaseFx.Play(); //Update Coins UI text GameSharedUI.Instance.UpdateCoinsUIText(); //Update DB's Data characterDB.PurchaseCharacter(index); uiItem.SetCharacterAsPurchased(); uiItem.OnItemSelect(index, OnItemSelected); //Add purchased item to Shop Data GameDataManager.AddPurchasedCharacter(index); } else { //No enough coins.. AnimateNoMoreCoinsText(); uiItem.AnimateShakeItem(); } }
public void Plant(Crop crop) { SoundManager.Play(plantingSoundLabel); status.plantedCrop = true; status.currentCrop = new Crop(crop); status.currentGrowingPeriod = 0; if (GameDataManager.GameValues[GameValueType.Fertiliser] > 0f) { MessageBox.DisplayMessage( "", "Do you want to skip the minigame by using one fertiliser?", () => { GameDataManager.GameValues[GameValueType.Fertiliser]--; GameDataManager.UpdateValues(); WaitForPloughingMinigame(1); }, () => FieldManager.Instance.StartPlantMinigame(crop.index, WaitForPloughingMinigame) ); } else { FieldManager.Instance.StartPlantMinigame(crop.index, WaitForPloughingMinigame); } }
// Use this for initialization void Start() { myRigidbody.gravityScale = 0; myRigidbody.constraints = RigidbodyConstraints2D.FreezeRotation; management = GameObject.FindGameObjectWithTag("Management").GetComponent <Management>(); gameDataManager = GameObject.FindGameObjectWithTag("GameData").GetComponent <GameDataManager>(); database = GameObject.FindGameObjectWithTag("Item Pool").GetComponent <Database>(); if (gameDataManager.hasSavedGame) { playerStats = gameDataManager.LoadGame().player.playerDetails; } else { playerStats = gameDataManager.createdPlayer; playerStats.level = gameDataManager.lvl; //playerStats.attack = 100f; //playerStats.currentHealth = 100.0f; //playerStats.defense = 15.0f; //Cosas de testeo //playerStats.inventory.Add(new GenericItem(9, "ItemPrueba1", "weapon", "DescripcionPrueba1", 50.0f, 30.0f, 0, 5.0f, 4.5f, 100.0f, 0.0f, "Items/stunWhip")); //playerStats.inventory.Add(new GenericItem(1, "ItemPrueba2", "armor", "DescripcionPrueba2", 40.0f, 20.0f, 0, 6.0f, 7.5f, 200.0f, 0.0f, "Items/heavyKevlarArmor")); //playerStats.inventory.Add(new GenericItem(2, "ItemPrueba3", "potion", "DescripcionPrueba3", 30.0f, 15.0f, 0, 3.0f, 6.5f, 300.0f, 0.0f, "Items/potion")); //playerStats.inventory.Add(new GenericItem(2, "ItemPrueba3", "potion", "DescripcionPrueba3", 30.0f, 15.0f, 0, 3.0f, 6.5f, 300.0f, 50.0f, "Items/mana potion")); //playerStats.inventory.Add(new GenericItem(3, "ItemPrueba4", "weapon", "DescripcionPrueba4", 20.0f, 10.0f, 0, 2.0f, 4.5f, 50.0f, 0.0f, "Items/longSword")); //playerStats.inventory.Add(new GenericItem(4, "ItemPrueba5", "potion", "DescripcionPrueba5", 10.0f, 5.0f, 12, 1.0f, 3.5f, 2000.0f, 0.0f, "Items/potion")); //playerStats.inventory.Add(new GenericItem(5, "ItemPrueba6", "potion", "DescripcionPrueba6", 0.0f, 0.0f, 0, 0.0f, 0.0f, 300.0f, 0.0f, "Items/ration")); //playerStats.weapon = new GenericItem(6, "armaEquipadaPrueba1", "weapon", "DescripcionPrueba7", 0.0f, 0.0f, 0, 100.0f, 0.0f, 700.0f, 0.0f, "Items/assaultRifle"); //playerStats.armor = new GenericItem(7, "armaduraEquipadaPrueba1", "armor", "DescripcionPrueba8", 0.0f, 0.0f, 0, 0.0f, 123.0f, 1200.0f, 0.0f, "Items/greatShield"); //playerStats.currentHealth = 50.0f; //playerStats.currentMana = 70.0f; } }
public ShipDesignerMap(GameDataManager dataManager) { DataManager = dataManager; Modules = new ModuleData[dataManager.Modules.Count]; dataManager.Modules.Values.CopyTo(Modules, 0); Ship = new BattleShip(); }
public void RemoveCreature() { GameDataManager mng = GameRoot.GetInstance().gameDataManager; mng.ChangeRoomSubData(currRoomId, currIndex, -1); RefreshInfo(); }
public Game() { _packetManager = new PacketManager(); _clientManager = new GameClientManager(); _moderationManager = new ModerationManager(); _moderationManager.Init(); _itemDataManager = new ItemDataManager(); _itemDataManager.Init(); _catalogManager = new CatalogManager(); _catalogManager.Init(_itemDataManager); _televisionManager = new TelevisionManager(); _navigatorManager = new NavigatorManager(); _roomManager = new RoomManager(); _chatManager = new ChatManager(); _groupManager = new GroupManager(); _groupManager.Init(); _questManager = new QuestManager(); _achievementManager = new AchievementManager(); _talentTrackManager = new TalentTrackManager(); _landingViewManager = new LandingViewManager(); _gameDataManager = new GameDataManager(); _globalUpdater = new ServerStatusUpdater(); _globalUpdater.Init(); _botManager = new BotManager(); _botManager.Init(); _cacheManager = new CacheManager(); _rewardManager = new RewardManager(); _badgeManager = new BadgeManager(); _badgeManager.Init(); _permissionManager = new PermissionManager(); _permissionManager.Init(); _subscriptionManager = new SubscriptionManager(); _subscriptionManager.Init(); }
void ChangePlayerSkin() { Character character = GameDataManager.GetSelectedCharacter(); if (character.image != null) { /*[old code] * playerImage.sprite = character.image ; */ // Get selected character's index: int selectedSkin = GameDataManager.GetSelectedCharacterIndex(); // show selected skin's gameobject: skins [selectedSkin].SetActive(true); // hide other skins (except selectedSkin) : for (int i = 0; i < skins.Length; i++) { if (i != selectedSkin) { skins [i].SetActive(false); } } playerNameText.text = character.name; } }
public void RemoveStructure() { GameDataManager mng = GameRoot.GetInstance().gameDataManager; mng.ChangeRoomConstructure(currRoomId, -1); RefreshInfo(); }
private void Awake() { instance = this; Player.instance = player; PokemonMenu.instance = pokemonMenu; Bag.instance = bag; Options.instance = options; Title.instance = title; MainMenu.instance = mainMenu; CreditsHandler.instance = creditsHandler; BeginHandler.instance = beginHandler; Pokedex.instance = pokedex; PC.instance = pc; //VersionManager executes before GameDataManager, so the version is set in GameData beforehand VersionInit(); GameData.instance.Init(); GameData.instance.Save(); GameData.instance.money = 3000; GameData.instance.coins = 300; postRender = new RenderTexture(160, 144, 1); postRender.filterMode = FilterMode.Point; templateRenderTexture = new RenderTexture(mainRender); GameData.instance.inGame = startInGame; Camera.main.targetTexture = mainRender; if (!startInGame) { BootGame(GameData.instance.version); } }
public static void InstantiateItemInWorld(this string itemName, Vector3 spawnPosition, int amnt = 1) { Collectable collect = GameDataManager.InstantiateItem(spawnPosition).GetComponent <Collectable>(); collect.SetItemName(itemName); collect.amount = amnt; }
void Awake() { startTime = Time.time; // Singleton setup; if (instance != null) { Destroy(gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); var reader = new Reader(); var items = reader.read(); AllItems = items; AllItemsWeight = AllItems.Aggregate(0, (acc, next) => acc + next.Weight); AllItemsValue = AllItems.Aggregate(0, (acc, next) => acc + next.Value); Player = new Player(); Debug.Log("Loaded items:"); items.ForEach(Debug.Log); PopulatePlayerInventory(); Debug.Log(string.Format("Populated Player: {0}", Player)); Debug.Log($"inventory weight = {Player.InventoryWeight.Value}"); }
private void Awake() { if (GameManager._instance != null) { gdManager = GameManager._instance.GetComponent <GameDataManager>(); } }
public JsonResult Select(string server, Guid allcards, Guid allrunes, Guid allskills, Guid allmapstage, Guid allmaphardstage, Guid keywords) { try { var version = GameDataManager.Load(allcards, allrunes, allskills, allmapstage, allmaphardstage, keywords); var gdm = GameDataManager.Get(version); Response.Cookies.Append("server", server, new CookieOptions { Expires = DateTime.MaxValue }); Response.Cookies.Append("version", version.ToString()); Response.Cookies.Append("allcards", gdm.allcards.ToString()); Response.Cookies.Append("allrunes", gdm.allrunes.ToString()); Response.Cookies.Append("allskills", gdm.allskills.ToString()); Response.Cookies.Append("allmapstage", gdm.allmapstage.ToString()); Response.Cookies.Append("allmaphardstage", gdm.allmaphardstage.ToString()); Response.Cookies.Append("keywords", gdm.keywords.ToString()); return(new JsonResult(new { success = true, })); } catch (Exception ex) { return(new JsonResult(new { success = false, message = ex.Message, })); } }
void PressSpace() { if (Input.GetKeyDown(KeyCode.Space)) { GameDataManager.AddWater(10000); } }
public GameWorld(KoM game) : base() { this.game = game; data = game.dataManager; parameters = new WorldParameters(0); }
public void TestInitialize() { var gameDataManager = new GameDataManager(); var worldRepository = new GameDataRepository <XIVData.Model.World>(gameDataManager.World); _worldService = new WorldService(worldRepository); }
public override void OnInit() { MapRating = 0; beforeGameOverMapID = 0; isTest = false; loadedComponentNum = 0; curGameGoldValue = 0; curGameProgressValue = 0; GameGoldValue = GameDataManager.getGoldNum(); GameProgressValue = GameDataManager.getGameProgress(); GoldMulitipleLevel = GameDataManager.getGoldMultipleLevel(); aiBallReduceSpeedLevel = GameDataManager.getAiBallReduceSpeedLevel(); iReviveNum = GameDataManager.getReviveNum(); iLoginDayNum = GameDataManager.getLoginDayNum(); gameState = GAMESTATE.start; mapComponentsNum = GameDataManager._instance.getMapComponentNum(); curChooseBallSkinId = GameDataManager.getCurChooseBallSkinId(); sound = GameDataManager.getSoundState(); vibrate = GameDataManager.getVibrateState(); ballMoveSpeed = 3.5f; }
void SetSelectedTheme() { int index = GameDataManager.GetSelectedThemeIndex(); GameDataManager.SetSelectedThemeIndex(index); GameDataManager.SetSelectedTheme(themeDB.GetTheme(index), index); }
public JsonResult CardRank(int cardid) { var dm = GameDataManager.Get(Request); var cardList = dm.CardList; var card = cardList.FirstOrDefault(m => m.CardId == cardid); var HpArray = cardList.Select(m => m.HpArray).ToList(); var AttackArray = cardList.Select(m => m.AttackArray).ToList(); var HpRank = new int[levels]; var AttackRank = new int[levels]; for (var i = 0; i < levels; i++) { HpRank[i] = HpArray.Select(m => m[i]).OrderByDescending(m => m).ToList().IndexOf(card.HpArray[i]) + 1; AttackRank[i] = AttackArray.Select(m => m[i]).OrderByDescending(m => m).ToList().IndexOf(card.AttackArray[i]) + 1; } return(new JsonResult(new { CardsCount = cardList.Length, HpRank, AttackRank })); }
public void UpdateCoinsUIText() { for (int i = 0; i < coinsUIText.Length; i++) { SetCoinsText(coinsUIText [i], GameDataManager.GetCoins()); } }
/* public static void HandleShowResult (ShowResult result) { switch (result) { case ShowResult.Finished: unityAdsResult = PlayAdsState.FINISHED; break; case ShowResult.Skipped: unityAdsResult = PlayAdsState.SKIPPED; break; case ShowResult.Failed: unityAdsResult = PlayAdsState.FAILED; break; } } */ void OnDestroy() { if (instance == this) instance = null; GemuAPI.OnGetUserResponse -= OnGetUserResponse; GemuAPI.OnPlayResultResponse -= OnPlayResultResponse; }
public JsonResult CardBenchmark(int CardId) { var dm = GameDataManager.Get(Request); var card = dm.CardList.First(m => m.CardId == CardId); return(new JsonResult(DataBenchmark.CardBenchmark(card))); }
public void UpdateWaterUIText() { for (int i = 0; i < waterUIText.Length; i++) { SetCoinsText(waterUIText[i], GameDataManager.GetWater()); } }
void Start() { SoundManager.Instance.PlayMusic("BackGroundMusic"); mGameDataManager = gameObject.GetComponent<GameDataManager>(); GameObject.Instantiate(UIPrefab); UIManager.Instance.Show(UIType.MainUI); }
public void GoToMenu() { GameDataManager.ResetDatas(); ScoringManager.ResetScore(); PlayerManager.ClearPlayer(); SceneHandler.ChangeScene("MainScreen"); }
private void Awake() { prefabManager = GetComponent <PrefabManager>(); menuManager = GetComponent <MenuManager>(); sceneLoader = GetComponent <SceneLoader>(); charactersCommon = GetComponent <CharactersCommon>(); spawnCharacter = GetComponent <SpawnCharacter>(); pauseManager = GetComponent <PauseManager>(); levelMessageManager = GetComponent <LevelMessageManager>(); tutorialMessageManager = GetComponent <TutorialMessageManager>(); menuMessageManager = GetComponent <MenuMessageManager>(); threatManager = GetComponent <ThreatManager>(); timeEventManager = GetComponent <TimeEventManager>(); timeManager = GetComponent <TimeManager>(); cameraManager = GetComponent <CameraManager>(); notebookManager = GetComponent <NotebookManager>(); dialogBoxManager = GetComponent <DialogBoxManager>(); tutorialDialogBoxManager = GetComponent <TutorialDialogBoxManager>(); idCardManager = GetComponent <IdCardManager>(); gameDataManager = GetComponent <GameDataManager>(); threatChartManager = GetComponent <ThreatChartManager>(); logManager = GetComponent <LogManager>(); userActionManager = GetComponent <UserActionManager>(); if (SceneManager.GetActiveScene().buildIndex == StaticDb.menuSceneIndex || SceneManager.GetActiveScene().buildIndex == StaticDb.loginSceneIndex) { return; } regularPathfinder = GameObject.Find("PathFinderRegular").GetComponent <Pathfinding>(); strictedPathfinder = GameObject.Find("PathFinderRestricted").GetComponent <Pathfinding>(); }
private void DrawGlobal() { GameDataManager mytarget = (GameDataManager)target; //Draw Globals mytarget.GlobalConfig.DrawEditor(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save Global Data")) { string savePath; if (Utils.SaveFileDialog(GameDataManager.m_globalExtension, "Load Global Data", out savePath)) { Utils.Save(mytarget.GlobalConfig, savePath); } } if (GUILayout.Button("Load Global Data")) { string path; if (Utils.OpenFileDialog(GameDataManager.m_globalExtension, "Load Global Data", out path)) { GlobalConfig config = Utils.Load <GlobalConfig>(path); mytarget.GlobalConfig = config; } } EditorGUILayout.EndHorizontal(); }
protected override void OnOpen(IUIData uiData = null) { Button.onClick.AddListener(() => { FadeClose(); UIKit.OpenPanel <UISelectStage>(); }); ButtonClr.onClick.AddListener(() => { GameDataManager.Clear(); }); ButtonSetting.onClick.AddListener(() => { FadeClose(); UIKit.OpenPanel <UISettings>(); }); ButtonSTAFF.onClick.AddListener(() => { FadeClose(); UIKit.OpenPanel <UISTAFF>(); }); ButtonQuit.onClick.AddListener(() => { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif }); }
public static string Draw(int imageId, GameDataManager gameData, int width, int height, int offsetY) { var crmin = ImGui.GetWindowContentRegionMin() + new Vector2(0, offsetY); if (imageId != -1) { var wpos = ImGui.GetWindowPos() + new Vector2(0, offsetY); var a = wpos + ImGui.GetWindowContentRegionMin(); var b = wpos + ImGui.GetWindowContentRegionMax(); var drawList = ImGui.GetWindowDrawList(); drawList.AddImage((IntPtr)imageId, a, b, new Vector2(0, 1), new Vector2(1, 0)); } float margin = 0.15f; var min = crmin + (new Vector2(width, height) * margin); var factor = (new Vector2(width, height) * (1 - 2 * margin)) / 16f; string retVal = null; foreach (var sys in gameData.AllSystems) { ImGui.SetCursorPos(min + (sys.UniversePosition * factor) - new Vector2(8, 8)); if (ImGui.Button($"x##{sys.Nickname}")) { retVal = sys.Nickname; } if (ImGui.IsItemHovered()) { ImGui.SetTooltip($"{sys.Name} ({sys.Nickname})"); } } return(retVal); }
/// <summary> /// 处理 读取的方块 /// </summary> public void HandleForLoadBlock() { GameDataManager gameDataManager = GameDataHandler.Instance.manager; //获取数据中的chunk UserDataBean userData = gameDataManager.GetUserData(); ChunkSaveBean chunkSaveData = gameDataManager.GetChunkSaveData(userData.userId, WorldCreateHandler.Instance.manager.worldType, chunkData.positionForWorld); //如果没有世界数据 则创建一个 if (chunkSaveData == null) { chunkSaveData = new ChunkSaveBean(); chunkSaveData.workdType = (int)WorldCreateHandler.Instance.manager.worldType; chunkSaveData.userId = userData.userId; chunkSaveData.position = chunkData.positionForWorld; } chunkSaveData.InitData(); Dictionary <int, BlockBean> dicBlockData = chunkSaveData.dicBlockData; foreach (var itemData in dicBlockData) { BlockBean blockData = itemData.Value; Vector3Int positionBlock = blockData.localPosition; //添加方块 如果已经有该方块 则先删除,优先使用存档的方块 //chunkData.GetBlockForLocal(positionBlock, out Block block, out DirectionEnum direction); Block block = BlockHandler.Instance.manager.GetRegisterBlock(blockData.blockId); chunkData.SetBlockForLocal(positionBlock, block, blockData.direction); } SetChunkSaveData(chunkSaveData); }
void Awake() { _instance = this; // Update the path once the persistent path exists. saveFile = Application.persistentDataPath + "/gamedata.json"; }
void Awake () { dataManager = GameDataManager.Instance; packageName = PlayerPrefs.GetString (NameManager.PREF_PLAY_PACKAGE, NameManager.PREF_PLAY_PACKAGE_DEFAULT); PackageListManager.Instance.onLoadXml += Instance_onLoadXml; }
public static GameDataManager Instance() { if (!instance) { container = new GameObject(); container.name = "GameDataManager"; instance = container.AddComponent(typeof(GameDataManager)) as GameDataManager; } return instance; }
void Awake() { if (instance == null) { instance = this; } else { Debug.LogError("Duplicate GameMain"); } DontDestroyOnLoad(this); }
public KoM() : base() { horizontalZoom = 3; verticalZoom = 3; Resolution.Init(ref graphics, 256, 240); Resolution.SetVirtualResolution(256, 240); Resolution.SetResolution(256*3, 240*3, false); Content.RootDirectory = "Content"; dataManager = new GameDataManager(); }
public void Awake() { Instance = this; DataTableManager = new DataTableManager(); DataTableManager.LoadTownTable(TestData.TownInfoTable); DataTableManager.FleetInfo = TestData.Fleet; DataTableManager.LoadCommodityTable(TestData.CommodityTable); var save = TestData.Saves; EntityList = new List<Entity>(); //创建城镇 GameDataManager = new GameObject("GameDataManager").AddComponent<GameDataManager>(); GameDataManager.TownList = new List<Town>(); foreach (var townInfo in DataTableManager.TownTable.Values) { var town = new Town(); town.Info = townInfo; var townSave = save.TownList.Find(x => x.ID == townInfo.ID); if (null != townSave) { town.LoadSave(townSave); } GameDataManager.TownList.Add(town); EntityList.Add(town); town.Reset(); } Map.Setup(GameDataManager.TownList); //创建舰队 var fleet = new Fleet(); fleet.Info = DataTableManager.FleetInfo; fleet.Position = new Vector2(0, 0); fleet.Actor = Map.transform.Find("Fleet").GetComponent<FleetActor>(); fleet.Actor.Model = fleet; fleet.Reset(); EntityList.Add(fleet); FocusedFleet = fleet; WorldTime = 0; TickCountDownRemaining = 0; //CurrentTownSettleSeconds = -1; }
// Use this for initialization void Awake() { instance = this; //Total Score = PlayerPrefs.GetInt("totalScore", 0); Jump = PlayerPrefs.GetInt("totalJump", 0); Clear = PlayerPrefs.GetInt("totalClear", 0); Save = PlayerPrefs.GetInt("totalSave", 0); //Collection Point = PlayerPrefs.GetInt("collectPoint", 0); Aqua = PlayerPrefs.GetInt("collectAqua", 0); Magnet = PlayerPrefs.GetInt("collectMagnet", 0); PlusJump = PlayerPrefs.GetInt("collectPlusJump", 0); //Enemy Kill = PlayerPrefs.GetInt("enemyKill", 0); Dead = PlayerPrefs.GetInt("enemyDead", 0); //Secret SecretBlock = PlayerPrefs.GetInt("secretBlock", 0); SecretRoute = PlayerPrefs.GetInt("secretRoute", 0); //Store balanceScore = PlayerPrefs.GetInt("balanceScore", -1); expenseScore = PlayerPrefs.GetInt("expenseScore", 0); if (balanceScore == -1) InitWalletScore(); }