// 스테이지 변경 이벤트 public void OnStagePanelChanged() { int stageNumber = ScrollSnapMapView.GetComponent <SimpleScrollSnap>().TargetPanel + 1; currentMapId = MapSystem.GetCurrentMapId(stageNumber); // 현재 패널의 스테이지가 자신의 스테이지 보다 같거나 작을때 if (stageNumber <= MapSystem.GetMap(currentMapId).stageNumber) { mapNameText.text = string.Format("{0} <size='40'>{1}</size>", MapSystem.GetStageName(stageNumber - 1), MapSystem.GetMap(currentMapId).name); mapDescriptionText.text = MapSystem.GetStageDescription(stageNumber - 1); } else { mapNameText.text = MapSystem.GetStageName(stageNumber - 1); mapDescriptionText.text = string.Format("<color='red'>{0}</color>", LocalizationManager.GetText("MapWarningMessage")); } foreach (var node in mapNodeList) { if (node.Key == currentMapId) { mapNodeImage = node.Value.GetComponent <Image>(); break; } } mapInfoPanel.GetComponent <AiryUIAnimatedElement>().ShowElement(); ShowHero(); }
private void Start() { isStartGame = false; stageModeType = Common.stageModeType; MonsterCount = 0; isEndGame = false; kPoint = 0; dPoint = 0; userInfo = new UserInfo(); userInfo.initUserInfo(); stageInfo = GameManagement.instance.GetStageInfo(); stageInfo.initStage(); if (stageModeType == Common.StageModeType.Main) { Map map = MapSystem.GetMap(stageInfo.mapNumber); SoundManager.instance.BgmSourceChange(AudioClipManager.instance.StageBgm); switch (map.stageType) { case 0: UI_Manager.instance.Title.GetComponentInChildren <Text>().text = LocalizationManager.GetText("stageTitleMainType1"); InitCastle(); break; case 1: UI_Manager.instance.Title.GetComponentInChildren <Text>().text = LocalizationManager.GetText("stageTitleMainType2"); break; case 2: UI_Manager.instance.Title.GetComponentInChildren <Text>().text = LocalizationManager.GetText("stageTitleMainType3"); InitBoss(); break; } mapnameText.text = map.name; if (Map != null) { MapSystem.SetMapSprite(stageInfo.stageNumber, ref Map); } } else if (stageModeType == Common.StageModeType.Infinite) { SoundManager.instance.BgmSourceChange(AudioClipManager.instance.StageBgm); UI_Manager.instance.Title.GetComponentInChildren <Text>().text = LocalizationManager.GetText("stageTitleInfinity"); } CharactersManager.instance.SetStagePositionHeros(); StartCoroutine("StageStartEffect"); }
public static void AddMapClear(int clearId, int openId) { string path = Application.persistentDataPath + "/Xml/Map.Xml"; XmlDocument xmlDoc = new XmlDocument(); if (System.IO.File.Exists(path)) { xmlDoc.LoadXml(System.IO.File.ReadAllText(path)); } //복호화//// XmlElement elmRoot = xmlDoc.DocumentElement; var decrpytData = DataSecurityManager.DecryptData(elmRoot.InnerText); elmRoot.InnerXml = decrpytData; ////////// ChangeNode(MapSystem.GetUserMap(clearId), xmlDoc); CreateNode(MapSystem.GetMap(openId), xmlDoc, path); }
void Start() { if (mapSlotNodePrefab != null) { int stageCount = (int)((MapSystem.maps.Count - 1) / 10) + 1; int currentStageIndex = 0; // 스테이지 변경이벤트 추가 ScrollSnapMapView.GetComponent <SimpleScrollSnap>().onPanelChanged.RemoveAllListeners(); ScrollSnapMapView.GetComponent <SimpleScrollSnap>().onPanelChanged.AddListener(delegate { OnStagePanelChanged(); }); // Stage 카운트만큼 스크롤스냅뷰 추가 ScrollSnapMapView.GetComponent <DynamicContentController>().AddToBack(stageCount); // 추가된 스테이지 슬롯을 담을 리스트 추가 mapSlotList = new List <GameObject>(); // 맵 노드의 아이디와 슬롯을 담을 리스트 추가 mapNodeList = new Dictionary <int, GameObject>(); // 추가된 스테이지 슬롯에맞는 맵 노드 추가 for (var j = 0; j < ContentView.transform.childCount; j++) { ContentView.transform.GetChild(j).GetChild(1).GetChild(0).GetComponent <Image>().sprite = MapSystem.GetStageThumbnailImage(j + 1); mapSlotList.Add(ContentView.transform.GetChild(j).gameObject); foreach (var mapNode in MapSystem.GetMapNode(j + 1)) { if (mapNode != null) { GameObject mapNodePrefab = Instantiate(mapSlotNodePrefab, mapSlotList[j].transform.GetChild(0).transform); // 맵노드 버튼 이벤트 추가 mapNodePrefab.GetComponent <Button>().onClick.AddListener(delegate { OnMapNodeClick(mapNode.id); }); mapNodePrefab.SetActive(true); // 맵노드리스트에 아이디와 슬롯프리팹을 추가 mapNodeList.Add(mapNode.id, mapNodePrefab); // 아직 갈 수 없는 맵노드에 잠금 아이콘 추가 if (!MapSystem.isAbleMap(mapNode.id)) { mapNodePrefab.transform.GetChild(0).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("UI/ui_lock_transparent"); mapNodePrefab.transform.GetChild(1).gameObject.SetActive(false); } else { if (mapNode.clearPoint > 2) { mapNodePrefab.transform.GetChild(0).gameObject.SetActive(true); mapNodePrefab.transform.GetChild(1).gameObject.SetActive(true); } else if (mapNode.clearPoint == 2) { mapNodePrefab.transform.GetChild(0).gameObject.SetActive(true); mapNodePrefab.transform.GetChild(1).gameObject.SetActive(false); } else { mapNodePrefab.transform.GetChild(0).gameObject.SetActive(false); mapNodePrefab.transform.GetChild(1).gameObject.SetActive(false); } } } } } // 현재 유저가 갈 수있는 최상단 스테이지를 찾음 currentMapId = MapSystem.GetCurrentMapId(); // 현재 스테이지 넘버인덱스 currentStageIndex = MapSystem.GetMap(currentMapId).stageNumber - 1; for (var i = 0; i < mapSlotList.Count; i++) { if (i > currentStageIndex) { mapSlotList[i].transform.GetChild(1).GetChild(1).gameObject.SetActive(true); } else { mapSlotList[i].transform.GetChild(1).GetChild(1).gameObject.SetActive(false); } } // 찾은 스테이지 정보를 뷰로 보여줌 mapNameText.text = string.Format("{0} <size='40'>{1}</size>", MapSystem.GetStageName(currentStageIndex), MapSystem.GetMap(currentMapId).name); mapDescriptionText.text = MapSystem.GetStageDescription(currentStageIndex); foreach (var node in mapNodeList) { if (node.Key == currentMapId) { mapNodeImage = node.Value.GetComponent <Image>(); break; } } //mapNodeImage.overrideSprite = Resources.Load<Sprite>("UI/ui_container2"); ScrollSnapMapView.GetComponent <SimpleScrollSnap>().GoToPanel(currentStageIndex); if (hero == null) { hero = Instantiate(PrefabsDatabaseManager.instance.GetHeroPrefab(101), mapNodeImage.transform); if (hero.GetComponent <Hero>() != null) { Destroy(hero.GetComponent <Hero>()); } if (hero.GetComponent <Rigidbody2D>() != null) { Destroy(hero.GetComponent <Rigidbody2D>()); } foreach (var sp in hero.GetComponentsInChildren <SpriteRenderer>()) { sp.sortingLayerName = "ShowObject"; sp.gameObject.layer = 16; } hero.transform.localRotation = Quaternion.Euler(0, 180, 0); hero.GetComponent <Animator>().SetBool("isMoving", true); hero.GetComponent <Animator>().SetBool("isRun", true); } ShowHero(); } }
// 맵노드 클릭 이벤트 public void OnMapNodeClick(int mapId) { SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default); if (MapSystem.isAbleMap(mapId)) { currentMapId = mapId; mapNameText.text = string.Format("{0} <size='40'>{1}</size>", MapSystem.GetStageName(MapSystem.GetMap(currentMapId).stageNumber - 1), MapSystem.GetMap(currentMapId).name); foreach (var node in mapNodeList) { if (node.Key == mapId) { mapNodeImage = node.Value.GetComponent <Image>(); break; } } mapInfoPanel.GetComponent <AiryUIAnimatedElement>().ShowElement(); ShowHero(); } else { Debugging.Log(mapId + " 의 맵은 아직 열리지 않은 맵입니다."); } }
public IEnumerator ShowSelectMap() { while (ContentView.transform.childCount < MapSystem.GetMapCount()) { Debugging.Log("로딩........"); yield return(null); } currentMapId = MapSystem.GetCurrentAllMapId(); currentMapIndex = GetMapIndex(currentMapId); Debugging.Log(currentMapIndex + "번째 인덱스가 현재 맵입니다."); for (int i = 0; i < ContentView.transform.childCount; i++) { int tempEventIndex = i; if (i == currentMapIndex) { mapNodeImage = ContentView.transform.GetChild(i).GetComponent <Image>(); ShowMapInfo(GetMapId(i)); if (hero == null) { hero = Instantiate(PrefabsDatabaseManager.instance.GetHeroPrefab(101), mapNodeImage.transform); if (hero.GetComponent <Hero>() != null) { DestroyImmediate(hero.GetComponent <Hero>()); } if (hero.GetComponent <Rigidbody2D>() != null) { DestroyImmediate(hero.GetComponent <Rigidbody2D>()); } foreach (var sp in hero.GetComponentsInChildren <SpriteRenderer>()) { sp.sortingLayerName = "ShowObject"; sp.gameObject.layer = 16; } hero.transform.localRotation = Quaternion.Euler(0, 180, 0); hero.GetComponent <Animator>().SetBool("isMoving", true); hero.GetComponent <Animator>().SetBool("isRun", true); } this.GetComponentInChildren <SimpleScrollSnap>().GoToPanel(tempEventIndex); ShowHero(); } ContentView.transform.GetChild(i).GetComponent <Button>().onClick.RemoveAllListeners(); ContentView.transform.GetChild(i).GetComponent <Button>().onClick.AddListener(delegate { OnMapNodeClick(MapSystem.GetMap(GetMapId(tempEventIndex)).id, tempEventIndex); }); if (!MapSystem.isAbleMap(MapSystem.GetMap(GetMapId(i)).id)) { ContentView.transform.GetChild(i).transform.GetChild(0).GetComponent <Image>().overrideSprite = Resources.Load <Sprite>("UI/ui_lock_transparent"); } else { if (MapSystem.GetMap(GetMapId(i)).clearPoint < 1) { ContentView.transform.GetChild(i).transform.GetChild(0).GetComponent <Image>().color = new Color(1, 1, 1, 0); } else { ContentView.transform.GetChild(i).transform.GetChild(0).GetComponent <Image>().color = new Color(1, 1, 1, 1); } } } }
public StageInfo(int mapId) { this.mapNumber = mapId; this.stageNumber = MapSystem.GetMap(mapId).stageNumber; }