void Awake() { if (inst == null) { inst = this; } }
public void OnMissionUpdate(Mission mission) { if (mission.Complete) { active.Remove(mission); _gameProgress++; audioSource.clip = completeClip; audioSource.Play(); var m = _unlocked.Find(e => e.GetComponent <MissionUI>().mission == mission); _unlocked.Remove(m); Destroy(m); if (_gameProgress == missions.Length) { UIController.Instance.Victory(); } UpdateUnlocked(); } else { active.Add(mission); var missionUi = Instantiate(missionPrefab, missionWindow).GetComponent <MissionUI>(); missionUi.mission = mission; _unlocked.Add(missionUi.gameObject); } MapUI.UpdateTasks(); _waitingForUiShow.Enqueue(mission); }
void Start() { mapUI = GameObject.Find("PlayerShip").GetComponent <MapUI>(); mapSpawn = GameObject.Find("TileBorders").GetComponent <MapSpawn>(); roomMemory = GameObject.Find("RoomMemory").GetComponent <RoomMemory>(); templates = GameObject.Find("MapTemplates").GetComponent <MapTemplates>(); missionManager = FindObjectOfType <MissionManager>(); //0 - no room //1 - top open room //2 - bottom open room //3 - right open room //4 - left open room //5 - top and bottom open //6 - left and right open //7 - left and top open //8 - right and top open //9 - left and bottom open //10 - right and bottom open //11 - bottom, top, right open //12 - bottom, top, left open //13 - bottom, left, right open //14 - top, left, right open //15 - all open }
/// <summary> /// Borra el objeto que este seleccionado. /// </summary> /// <param name="Selected">Selected.</param> static void DeleteSelectedObject(GameObject Selected) { if (Selected.tag == "MainCamera") { return; } MapUI.DestroyImmediate(Selected, true); }
public void register_capacity_change(int ID, int sum, int capacity) { if (TurnPhaser.I.active_disc_ID != ID) { return; } MapUI.update_capacity_text(city_capacityT, sum, capacity); }
public void PlacePlayerInRoom(Room aRoom) { Room myStartingRoom = aRoom; myPlayerMovement.transform.position = myStartingRoom.GetMidTile().transform.position + Vector3.forward * -0.05f; MapUI mapUI = myPlayerMovement.GetComponentInChildren <MapUI>(); mapUI.Init(); mapUI.SetRoomVisited(myStartingRoom.myRoomData.myX, myStartingRoom.myRoomData.myY); myPlayerMovement.SetCurrentRoom(myStartingRoom); }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
public void SaveWorld() { PlayerPrefs.SetInt("Seed", myWorldGeneration.GetSeed()); Biome[] biomes = myWorldGeneration.GetBiomes(); List <ResourceUsable> resourceToSave = new List <ResourceUsable>(); for (int i = 0; i < biomes.Length; ++i) { List <ResourceUsable> newResouces = biomes[i].GetResourceUsablesToSave(); for (int j = 0; j < newResouces.Count; ++j) { resourceToSave.Add(newResouces[j]); } } PlayerPrefs.SetInt("PlayerRoomX", myWorldGeneration.GetPlayerMovement().GetCurrentRoom().myRoomData.myX); PlayerPrefs.SetInt("PlayerRoomY", myWorldGeneration.GetPlayerMovement().GetCurrentRoom().myRoomData.myY); PlayerPrefs.SetInt("PlayerBiomeX", myWorldGeneration.GetPlayerMovement().GetCurrentRoom().GetBiome().myX); PlayerPrefs.SetInt("PlayerBiomeY", myWorldGeneration.GetPlayerMovement().GetCurrentRoom().GetBiome().myY); PlayerPrefs.SetFloat("PlayerX", myWorldGeneration.GetPlayerMovement().transform.position.x); PlayerPrefs.SetFloat("PlayerY", myWorldGeneration.GetPlayerMovement().transform.position.y); PlayerPrefs.SetInt("PlayerSouls", myWorldGeneration.GetPlayerMovement().GetComponent <PlayerData>().GetSoulsCollected()); PlayerPrefs.SetInt("ResourceNum", resourceToSave.Count); for (int i = 0; i < resourceToSave.Count; ++i) { PlayerPrefs.SetInt("Resource" + i + "Life", resourceToSave[i].GetCurrentLife()); PlayerPrefs.SetFloat("Resource" + i + "Time", resourceToSave[i].GetCurrentTimeToRefill()); PlayerPrefs.SetInt("Resource" + i + "X", resourceToSave[i].GetTile().myTileData.myX); PlayerPrefs.SetInt("Resource" + i + "Y", resourceToSave[i].GetTile().myTileData.myY); PlayerPrefs.SetInt("Resource" + i + "BiomeX", resourceToSave[i].GetTile().myParentRoom.GetBiome().myX); PlayerPrefs.SetInt("Resource" + i + "BiomeY", resourceToSave[i].GetTile().myParentRoom.GetBiome().myY); } MapUI mapUI = FindObjectOfType <MapUI>(); List <Room> rooms = mapUI.GetVisitedRooms(); PlayerPrefs.SetInt("RoomsVisited", rooms.Count); for (int i = 0; i < rooms.Count; ++i) { PlayerPrefs.SetInt("Visited" + i + "BiomeX", rooms[i].GetBiome().myX); PlayerPrefs.SetInt("Visited" + i + "BiomeY", rooms[i].GetBiome().myY); PlayerPrefs.SetInt("Visited" + i + "RoomX", rooms[i].myRoomData.myX); PlayerPrefs.SetInt("Visited" + i + "RoomY", rooms[i].myRoomData.myY); } PlayerPrefs.Save(); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
private IEnumerator LoadSave() { //Debug.Log("Seed:" + PlayerPrefs.GetInt("Seed")); myWorldGeneration.myUseSeed = true; GameInstance.GetInstance().SetSeed(PlayerPrefs.GetInt("Seed")); myWorldGeneration.GenerateWorld(); //Debug.Log("PlayerRoomX:" + PlayerPrefs.GetInt("PlayerRoomX")); //Debug.Log("PlayerRoomY:" + PlayerPrefs.GetInt("PlayerRoomY")); //Debug.Log("PlayerBiomeX:" + PlayerPrefs.GetInt("PlayerBiomeX")); //Debug.Log("PlayerBiomeY:" + PlayerPrefs.GetInt("PlayerBiomeY")); while (!myWorldGeneration.myGenerationFinished) { yield return(null); } myWorldGeneration.ActivateBiome(PlayerPrefs.GetInt("PlayerBiomeX"), PlayerPrefs.GetInt("PlayerBiomeY")); Room theRoom = myWorldGeneration.ActivateRoom(PlayerPrefs.GetInt("PlayerRoomX"), PlayerPrefs.GetInt("PlayerRoomY")); myWorldGeneration.PlacePlayerInRoom(theRoom); myWorldGeneration.PlacePlayerAt(PlayerPrefs.GetFloat("PlayerX"), PlayerPrefs.GetFloat("PlayerY")); MapUI mapUI = FindObjectOfType <MapUI>(); int roomVisited = PlayerPrefs.GetInt("RoomsVisited"); for (int i = 0; i < roomVisited; ++i) { Biome biome = myWorldGeneration.GetBiome(PlayerPrefs.GetInt("Visited" + i + "BiomeX"), PlayerPrefs.GetInt("Visited" + i + "BiomeY")); mapUI.SetRoomVisited(PlayerPrefs.GetInt("Visited" + i + "RoomX"), PlayerPrefs.GetInt("Visited" + i + "RoomY"), biome); } myWorldGeneration.GetPlayerMovement().GetComponent <PlayerData>().SetSoulsCollected(PlayerPrefs.GetInt("PlayerSouls")); /* * PlayerPrefs.SetInt("ResourceNum", resourceToSave.Count); * * for (int i = 0; i < resourceToSave.Count; ++i) * { * PlayerPrefs.SetInt("Resource" + i + "Life", resourceToSave[i].GetCurrentLife()); * PlayerPrefs.SetFloat("Resource" + i + "Time", resourceToSave[i].GetCurrentTimeToRefill()); * PlayerPrefs.SetInt("Resource" + i + "X", resourceToSave[i].GetTile().myTileData.myX); * PlayerPrefs.SetInt("Resource" + i + "Y", resourceToSave[i].GetTile().myTileData.myY); * PlayerPrefs.SetInt("Resource" + i + "BiomeX", resourceToSave[i].GetTile().myParentRoom.GetBiome().myX); * PlayerPrefs.SetInt("Resource" + i + "BiomeY", resourceToSave[i].GetTile().myParentRoom.GetBiome().myY); * } */ }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == returnButton || control == okButton) { MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); //gameObject.SetActiveRecursively(false); this.Hide(); //if (ui != null) { MapUI.GetInstance().GetOptionsMenuUI().Show(); } } }
internal Map(Game game) { _game = game; _countTimer = 0; _sec = DateTime.Now.Second; _UI = new MapUI(_game.Sprites, _game.GetWindow.Render); CreateMap(); _village = new Village(this); _barbarians = new List <Unit>(); _buildings = new List <Building>(); _projectiles = new List <Projectiles>(); _projectiles = new List <Projectiles>(); _waves = new Waves(this); }
void Start() { playerShip = GameObject.Find("PlayerShip"); mapUI = GameObject.Find("PlayerShip").GetComponent <MapUI>(); missionManager = FindObjectOfType <MissionManager>(); roomTemplates = FindObjectOfType <RoomTemplates>(); if (roomTemplates == null) { hubCamera = true; } if (FindObjectOfType <RoomMemory>()) { roomMemory = GameObject.Find("RoomMemory").GetComponent <RoomMemory>(); mapSpawn = GameObject.Find("TileBorders").GetComponent <MapSpawn>(); } }
// ---Hire units UI--- public void update_stat_text(int calling_class, string field, int val, int sum, int capacity) { TextMeshProUGUI t = null; if (calling_class == City.CITY) { city_inv.TryGetValue(field, out t); MapUI.update_capacity_text(city_capacityT, sum, capacity); } else if (calling_class == TurnPhaser.I.active_disc_ID) { disc_inv.TryGetValue(field, out t); MapUI.update_capacity_text(bat_capacityT, sum, capacity); } if (t != null) { t.text = val.ToString(); } }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (control == musicButtonOff) { musicButtonOn.Set(false); AudioListener.volume = 0; gameState.MusicOn = false; } else if (control == musicButtonOn) { musicButtonOff.Set(false); AudioListener.volume = 100; gameState.MusicOn = true; MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); } else if (control == creditsButton) { MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); creditsPanel.Show(); } else if (control == returnButton) { MapUI.GetInstance().GetAudioPlayer().PlayAudio("Button"); this.Hide(); ui.GetMapUI().Show(); } else if (control == shareButton) { string htm = GameApp.GetInstance().GetResourceConfig().shareHtm.text; Utils.ToSendMail("", "Call Of Mini: Zombies", htm); } else if (control == reviewButton) { Application.OpenURL("http://www.trinitigame.com/callofminizombies/review/"); } else if (control == supportButton) { Utils.ToSendMail("*****@*****.**", "Call Of Mini: Zombies", ""); } }
private ColorGlyph GetLastSeenColorGlyph(Point p, bool useOutOfSightColor) { ColorGlyph cg = DetermineVisibleColorGlyph(MapUI.LastKnownTile(p), MapUI.LastKnownFeatures(p), MapUI.LastKnownItem(p), Map.CurrentDepthSeed, p); if (useOutOfSightColor) { if (cg.BackgroundColor != Color.Black) { return(new ColorGlyph(cg.GlyphIndex, Color.Black, Color.OutOfSight)); } else { return(new ColorGlyph(cg.GlyphIndex, Color.OutOfSight, Color.Black)); } } else { return(cg); } }
// Start is called before the first frame update private void Start() { //PlayerPrefs.DeleteAll(); // Map Declaration. listImages.Add(map1Star); listImages.Add(map2Star); listImages.Add(map3Star); PlayerPrefs.SetInt(string.Format("is{0}Complete", Maps[0].name), 1); // for map1 alway unlock. for (int index = 0; index < mapUIs.Length; index++) { mapUIs[index] = new MapUI(mapLocks[index], maps[index]); } mapInfo = new MapInfo(mapInfoStars, newScore, highScore, score, scoreMore); // Scence Controller Declaration. sceneController = SceneController.instance; sceneController.gameState = SceneController.GameState.Pause; }
/// <summary> /// Borra los objeto seleccionados. /// </summary> static void DeleteObject() { GameObject MapObj = GameObject.Find("Map"); foreach (GameObject i in Selection.gameObjects) { if (i == null) { continue; } if (i.name.Contains("Main Camera")) { var camera = i; GameObject.Instantiate(camera); continue; } SpriteRenderer si = i.GetComponent <SpriteRenderer>(); if (si.sortingLayerName == Constant.LAYER_TILE) { GameObject temp = new GameObject(); if ((i.transform.position.x + i.transform.position.y) % 2 == 0) { temp = (GameObject)DarkFloor; } else { temp = (GameObject)LightFloor; } Sprite aux = temp.GetComponent <SpriteRenderer>().sprite; temp.transform.position = i.transform.position; temp.transform.localScale = new Vector3(ProjectSettings.pixelPerUnit / aux.rect.width, ProjectSettings.pixelPerUnit / aux.rect.height); var ins = MapUI.Instantiate(temp, temp.transform.position, Quaternion.identity) as GameObject; ins.transform.parent = MapObj.transform; MapUI.DestroyImmediate(GameObject.Find("New Game Object"), true); } MapUI.DestroyImmediate(i, true); } }
// Use this for initialization void Start() { //获取路径配置表 GetPathConfig(); state = MoveState.Stay; playerPoints.Nowpoint = startpoint; //获取价格文本,确定和取消按钮 priceText = priceBoard.Find("price/pricetext").GetComponent <Text>(); btn_priceOK = priceBoard.Find("ok").GetComponent <RectTransform>(); btn_priceCancle = priceBoard.Find("cancle").GetComponent <RectTransform>(); btn_okMask = priceBoard.Find("okMask").GetComponent <RectTransform>(); //获取采集文本和采集按钮 MineText = mineActionBoard.Find("Text").GetComponent <Text>(); btn_mine = mineActionBoard.Find("mine").GetComponent <RectTransform>(); btn_mineMask = mineActionBoard.Find("mineMask").GetComponent <RectTransform>(); //获取回家文版 homeText = homeBoard.Find("Text").GetComponent <Text>(); //读取角色配置表 charaModle = GameObject.Find("/CollectionTools/CharacterModle").GetComponent <CharacterModle>(); //获取地图的ui _mapUI = GameObject.Find("/CollectionTools/Colection").GetComponent <MapUI>(); //读取采集控制脚本 collectAction = GameObject.Find("/CollectionTools/Colection").GetComponent <CollectAction>(); //获取事件控制器 eventmanager = transform.Find("/ToolsKit/EventManager").GetComponent <ChatEventManager>(); questManager = transform.Find("/ToolsKit/QuestManager").GetComponent <QuestManager>(); InstPlayer(playerPoints.Nowpoint); AddPathPointListener(); eventmanager.PreCheckEventList(1); questManager.PreCheckQuest(1); questManager.IsArriveWaitingCheckPoint(1); }
void Start() { PlayerD = PlayerData.Get(1); MapU = MapUI.Instance; MapU.Init(); }
public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager content) { base.Initialize(content); FarWorld world = new FarWorld(); scene = new GameScene(world, Content); locationText.Initialize(Content); locationText.Text = "NONE"; ArrowScroll a = new ArrowScroll(); a.Initialize(Content); a.Right = false; scene.AddNode(a); a = new ArrowScroll(); a.Initialize(Content); scene.AddNode(a); map = new MapUI(); map.Initialize(Content); scene.AddNode(map); Components.Add(scene); for (int i = 0; i < ChicksnVixensGame.Get.locationOrder.Count; i++) { worldLocations.Add(ChicksnVixensGame.Get.locationOrder[i]); } BlankNess faderInner = new BlankNess(); faderInner.Initialize(Content); faderInner.fullBlankity = 1.0f; faderInner.fadeInTimer = 1.0f; faderInner.fadeSpeed = 2.0f; faderInner.RaiseFlag(Flags.FADE_OUT); Components.Add(faderInner); locked = new MenuObj("ui/ui"); locked.Initialize(content); locked.CreateFramesFromXML("ui/ui_frames"); locked.CurrentFrame = "lock"; locked.ResetDimensions(); locked.UniformScale = ScaleFactor * 2.0f; locked.Position = Vector2.Zero; locked.Colour = new Color(0, 0, 0, 0); Components.Add(locked); EventManager.Get.SendImmediateEvent(new NewLocationSelected()); string location = worldLocations[curLocation]; Cam.TargetPos = map.GetLocation(location); Cam.targetScale = 2; Cam.LevelSelect = false; }
public void HandleEvent(UIControl control, int command, float wparam, float lparam) { if (buttonPressed) { return; } if (control == mapButtons[0]) { GameObject.Destroy(GameObject.Find("Music")); MapUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "0"; fadeTimer.SetTimer(2f, false); GameApp.GetInstance().Save(); buttonPressed = true; } else if (control == mapButtons[1]) { GameObject.Destroy(GameObject.Find("Music")); MapUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "1"; fadeTimer.SetTimer(2f, false); GameApp.GetInstance().Save(); buttonPressed = true; } else if (control == mapButtons[2]) { GameObject.Destroy(GameObject.Find("Music")); MapUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "2"; fadeTimer.SetTimer(2f, false); GameApp.GetInstance().Save(); buttonPressed = true; } else if (control == mapButtons[3]) { GameObject.Destroy(GameObject.Find("Music")); MapUI.GetInstance().GetAudioPlayer().PlayAudio("Battle"); FadeAnimationScript.GetInstance().FadeInBlack(); fadeTimer.Name = "3"; fadeTimer.SetTimer(2f, false); GameApp.GetInstance().Save(); buttonPressed = true; } else if (control == shopButton) { FadeAnimationScript.GetInstance().FadeInBlack(0.5f); fadeTimer.Name = "shop"; fadeTimer.SetTimer(0.5f, false); buttonPressed = true; } else if (control == returnButton) { FadeAnimationScript.GetInstance().FadeInBlack(1); fadeTimer.Name = "return"; fadeTimer.SetTimer(1f, false); buttonPressed = true; } else if (control == optionsButton) { this.Hide(); MapUI.GetInstance().GetOptionsMenuUI().Show(); } }
public static void DisplayUI(float width) { MapUI.Display(width); }
//public Sprite roomsprite; public void Awake() { instance = this; }
private void upgrade(int ID) { if (is_purchased(FORGE2)) { if (is_purchased(STABLE, BARRACKS2)) { unlock_unit_purchase(PlayerUnit.DRAGOON); } if (is_purchased(CRAFT_SHOP, BARRACKS2)) { unlock_unit_purchase(PlayerUnit.GUARDIAN); } if (ID == BARRACKS2) { unlock_unit_purchase(PlayerUnit.SCOUT); } } else if (is_purchased(FORGE)) { if (ID == BARRACKS) { unlock_unit_purchase(PlayerUnit.GUARDIAN); unlock_unit_purchase(PlayerUnit.ARBALEST); unlock_unit_purchase(PlayerUnit.SKIRMISHER); } else if (ID == BARRACKS2) { unlock_unit_purchase(PlayerUnit.PALADIN); } else if (ID == TEMPLE2) { unlock_unit_purchase(PlayerUnit.MENDER); } else if (ID == STABLE) { unlock_unit_purchase(PlayerUnit.CARTER); } if (is_purchased(CRAFT_SHOP2, TEMPLE)) { unlock_unit_purchase(PlayerUnit.DRUMMER); } } if (ID == TEMPLE) { unlock_unit_purchase(PlayerUnit.SEEKER); } if (ID == RUNE_PORT) { Map.I.city_cell.has_rune_gate = true; Map.I.city_cell.restored_rune_gate = true; } else if (ID == SHARED_WISDOM) { Controller.I.astra.change_var(Storeable.UNITY, 10); Controller.I.endura.change_var(Storeable.UNITY, 10); Controller.I.martial.change_var(Storeable.UNITY, 10); } else if (ID == STOREHOUSE) { Controller.I.city.capacity += 36; MapUI.update_capacity_text(city_capacityT, Controller.I.city.get_sum_storeable_resources(), 108); MapUI.update_capacity_text(MapUI.I.city_capacityT, Controller.I.city.get_sum_storeable_resources(), 108); } else if (ID == STOREHOUSE2) { Controller.I.city.capacity += 36; MapUI.update_capacity_text(city_capacityT, Controller.I.city.get_sum_storeable_resources(), 144); MapUI.update_capacity_text(MapUI.I.city_capacityT, Controller.I.city.get_sum_storeable_resources(), 144); } else if (ID == FAITHFUL) { Controller.I.astra.change_var(Storeable.UNITY, 10); Controller.I.endura.change_var(Storeable.UNITY, 10); Controller.I.martial.change_var(Storeable.UNITY, 10); } else if (ID == REFINED_STARDUST) { Controller.I.astra.light_refresh_amount = 5; Controller.I.endura.light_refresh_amount = 5; Controller.I.martial.light_refresh_amount = 5; } else if (ID == STABLE) { equimare_transferB.interactable = true; equimare_transferB2.interactable = true; } else if (ID == RESTORE_GREAT_TORCH) { Controller.I.city.light_refresh_amount = 11; } else if (ID == REFINED) { } }
void Awake() { mapUI = GameObject.Find("PlayerShip").GetComponent <MapUI>(); templates = GameObject.Find("MapTemplates").GetComponent <MapTemplates>(); roomMemory = GameObject.Find("RoomMemory").GetComponent <RoomMemory>(); }
void Awake() { if (I == null) { I = this; } else { Destroy(gameObject); } cell_light_colors = new Dictionary <int, Color>() { { MapCell.STAR_ID, star_light_color }, { MapCell.TITRUM_ID, titrum_light_color }, { MapCell.RUNE_GATE_ID, rune_gate_light_color }, { MapCell.FOREST_ID, forest_light_color }, { MapCell.LUSH_LAND_ID, lush_land_color }, { MapCell.CAVE_ID, cave_color }, { MapCell.MOUNTAIN_ID, mountain_color }, { MapCell.PLAINS_ID, plains_color }, //{MapCell.SETTLEMENT_ID, settlement_color}, { MapCell.RUINS_ID, ruins_color }, }; // Populate city dictionary city_inv.Add(Storeable.LIGHT, c_light); city_inv.Add(Storeable.STAR_CRYSTALS, c_star_crystals); city_inv.Add(Storeable.MINERALS, c_minerals); city_inv.Add(Storeable.ARELICS, c_arelics); city_inv.Add(Storeable.MRELICS, c_mrelics); city_inv.Add(Storeable.ERELICS, c_erelics); city_inv.Add(Storeable.EQUIMARES, c_equimares); // Populate batallion dictionary disc_inv.Add(Storeable.LIGHT, b_light); disc_inv.Add(Storeable.UNITY, b_unity); disc_inv.Add(Discipline.EXPERIENCE, b_experience); disc_inv.Add(Storeable.STAR_CRYSTALS, b_star_crystals); disc_inv.Add(Storeable.MINERALS, b_minerals); disc_inv.Add(Storeable.ARELICS, b_arelics); disc_inv.Add(Storeable.MRELICS, b_mrelics); disc_inv.Add(Storeable.ERELICS, b_erelics); disc_inv.Add(Storeable.EQUIMARES, b_equimares); unit_countsT.Add(PlayerUnit.WARRIOR, warrior_count); unit_countsT.Add(PlayerUnit.SPEARMAN, spearman_count); unit_countsT.Add(PlayerUnit.ARCHER, archer_count); unit_countsT.Add(PlayerUnit.MINER, miner_count); unit_countsT.Add(PlayerUnit.INSPIRATOR, inspirator_count); unit_countsT.Add(PlayerUnit.SEEKER, seeker_count); unit_countsT.Add(PlayerUnit.GUARDIAN, guardian_count); unit_countsT.Add(PlayerUnit.ARBALEST, arbalest_count); unit_countsT.Add(PlayerUnit.SKIRMISHER, skirmisher_count); unit_countsT.Add(PlayerUnit.PALADIN, paladin_count); unit_countsT.Add(PlayerUnit.MENDER, mender_count); unit_countsT.Add(PlayerUnit.CARTER, carter_count); unit_countsT.Add(PlayerUnit.DRAGOON, dragoon_count); unit_countsT.Add(PlayerUnit.SCOUT, scout_count); unit_countsT.Add(PlayerUnit.DRUMMER, drummer_count); unit_countsT.Add(PlayerUnit.SHIELD_MAIDEN, shield_maiden_count); unit_countsT.Add(PlayerUnit.PIKEMAN, pikeman_count); }
private void DrawModeInfo(SerializedProperty modeInfo, bool mini) { MapUI UI = this.UI.objectReferenceValue as MapUI; if (UI) { SerializedProperty defaultSizeOfCam = modeInfo.FindPropertyRelative("defaultSizeOfCam"); SerializedProperty currentSizeOfCam = modeInfo.FindPropertyRelative("currentSizeOfCam"); SerializedProperty minZoomOfCam = modeInfo.FindPropertyRelative("minZoomOfCam"); SerializedProperty maxZoomOfCam = modeInfo.FindPropertyRelative("maxZoomOfCam"); SerializedProperty windowAnchoreMin = modeInfo.FindPropertyRelative("windowAnchoreMin"); SerializedProperty windowAnchoreMax = modeInfo.FindPropertyRelative("windowAnchoreMax"); SerializedProperty mapAnchoreMin = modeInfo.FindPropertyRelative("mapAnchoreMin"); SerializedProperty mapAnchoreMax = modeInfo.FindPropertyRelative("mapAnchoreMax"); SerializedProperty anchoredPosition = modeInfo.FindPropertyRelative("anchoredPosition"); SerializedProperty sizeOfWindow = modeInfo.FindPropertyRelative("sizeOfWindow"); SerializedProperty sizeOfMap = modeInfo.FindPropertyRelative("sizeOfMap"); EditorGUILayout.BeginVertical("Box"); EditorGUILayout.BeginHorizontal(); if (Application.isPlaying || mini && isViewingWorldMap.boolValue || !mini && !isViewingWorldMap.boolValue) { GUI.enabled = false; } if (GUILayout.Button("以当前状态作为" + (mini ? "小地图" : "大地图"))) { if (!(mini && isViewingWorldMap.boolValue)) { if (mapCamera.objectReferenceValue) { defaultSizeOfCam.floatValue = (mapCamera.objectReferenceValue as MapCamera).Camera.orthographicSize; currentSizeOfCam.floatValue = (mapCamera.objectReferenceValue as MapCamera).Camera.orthographicSize; } windowAnchoreMin.vector2Value = UI.mapWindowRect.anchorMin; windowAnchoreMax.vector2Value = UI.mapWindowRect.anchorMax; mapAnchoreMin.vector2Value = UI.mapRect.anchorMin; mapAnchoreMax.vector2Value = UI.mapRect.anchorMax; anchoredPosition.vector2Value = UI.mapWindowRect.anchoredPosition; sizeOfWindow.vector2Value = UI.mapWindowRect.sizeDelta; sizeOfMap.vector2Value = UI.mapRect.sizeDelta; if (mini) { isViewingWorldMap.boolValue = false; } else { isViewingWorldMap.boolValue = true; } } } if (Application.isPlaying || mini && isViewingWorldMap.boolValue || !mini && !isViewingWorldMap.boolValue) { GUI.enabled = true; } if (mini && !isViewingWorldMap.boolValue || !mini && isViewingWorldMap.boolValue) { GUI.enabled = false; } if (GUILayout.Button("切换至" + (mini ? "小地图" : "大地图") + "模式")) { if (mini) { manager.ToMiniMap(); } else { manager.ToWorldMap(); } } if (mini && !isViewingWorldMap.boolValue || !mini && isViewingWorldMap.boolValue) { GUI.enabled = true; } EditorGUILayout.EndHorizontal(); EditorGUILayout.PropertyField(modeInfo, new GUIContent(mini ? "小地图模式信息" : "大地图模式信息"), false); if (modeInfo.isExpanded) { EditorGUILayout.PropertyField(defaultSizeOfCam, new GUIContent("默认相机视野大小")); EditorGUILayout.LabelField("当前相机视野大小", currentSizeOfCam.floatValue.ToString()); EditorGUILayout.Slider(minZoomOfCam, mini ? 1 : miniModeInfo.FindPropertyRelative("defaultSizeOfCam").floatValue, defaultSizeOfCam.floatValue, new GUIContent("相机视野大小下限")); EditorGUILayout.Slider(maxZoomOfCam, defaultSizeOfCam.floatValue, mini ? worldModeInfo.FindPropertyRelative("defaultSizeOfCam").floatValue : 255, new GUIContent("相机视野大小上限")); EditorGUILayout.PropertyField(windowAnchoreMin, new GUIContent("窗口锚点最小值")); EditorGUILayout.PropertyField(windowAnchoreMax, new GUIContent("窗口锚点最大值")); EditorGUILayout.PropertyField(mapAnchoreMin, new GUIContent("地图锚点最小值")); EditorGUILayout.PropertyField(mapAnchoreMax, new GUIContent("地图锚点最大值")); EditorGUILayout.PropertyField(anchoredPosition, new GUIContent("窗口修正位置")); EditorGUILayout.PropertyField(sizeOfWindow, new GUIContent("窗口矩形大小")); EditorGUILayout.PropertyField(sizeOfMap, new GUIContent("地图矩形大小")); } EditorGUILayout.EndVertical(); } }
/// <summary> /// Pinta el objeto seleccionado en la scene. /// </summary> static void DropObject() { GameObject temp = RPGInspectorUI.ObjectBrowser; SpriteRenderer selectSprite = temp.GetComponent <SpriteRenderer>(); foreach (GameObject i in Selection.gameObjects) { if (i == null) { continue; } SpriteRenderer iSprite = i.GetComponent <SpriteRenderer>(); if (i.name == "Main Camera" || iSprite.sprite.name == selectSprite.sprite.name || i.name == "Map") { continue; } if (selectSprite.sortingLayerName == Constant.LAYER_TILE) { if (i.transform.parent.name == "Map" && i.tag != "RPG-PLAYER") { temp.transform.position = i.transform.position; } else if (i.tag != "RPG-PLAYER") { temp.transform.position = i.transform.parent.gameObject.transform.position; } temp.transform.localScale = new Vector3(ProjectSettings.pixelPerUnit / selectSprite.sprite.rect.width, ProjectSettings.pixelPerUnit / selectSprite.sprite.rect.height); GameObject son = MapUI.Instantiate(temp, temp.transform.position, Quaternion.identity) as GameObject; son.transform.parent = i.transform.parent; MapUI.DestroyImmediate(i, true); } else if (temp.tag == "RPG-PLAYER") { if (GameObject.Find("PLAYER(Clone)") != null) { continue; } temp.name = "PLAYER"; temp.transform.position = i.transform.position; temp.transform.localScale = new Vector3(ProjectSettings.pixelPerUnit / selectSprite.sprite.rect.width, ProjectSettings.pixelPerUnit / selectSprite.sprite.rect.height); var son = MapUI.Instantiate(temp, temp.transform.position, Quaternion.identity) as GameObject; } else { GameObject aux = null; if (i.transform.parent.gameObject.transform.parent != null && i.transform.parent.childCount != 0) { if (i.transform.parent.gameObject.transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>().sprite.name == selectSprite.sprite.name) { continue; } aux = i.transform.parent.gameObject; MapUI.DestroyImmediate(i.transform.parent.gameObject.transform.GetChild(0).gameObject); } else if (i.transform.parent.gameObject.transform.parent != null) { aux = i.transform.parent.gameObject.transform.parent.gameObject; MapUI.DestroyImmediate(i); } else { aux = i; } var inst = MapUI.Instantiate(temp, new Vector3(0, 0), Quaternion.identity); temp = inst as GameObject; temp.transform.parent = aux.transform; temp.transform.localPosition = new Vector3(0, 0); var sprite = aux.GetComponent <SpriteRenderer>().sprite; var sprite2 = temp.GetComponent <SpriteRenderer>().sprite; temp.transform.localScale = new Vector3(sprite.rect.width / sprite2.rect.width, sprite.rect.height / sprite2.rect.height); } MapUI.DestroyImmediate(GameObject.Find("New Game Object"), true); } Selection.activeGameObject = null; }
// Use this for initialization void Start() { combat = GameObject.FindObjectOfType <Combat>(); screenBounds = GameObject.FindObjectOfType <Main>().screenBounds; mapUI = GameObject.FindObjectOfType <MapUI>(); }