//---------------------------------------------------------------------------- public StageLayer() { m_stageLoad = new StageLoad(null); m_EntryCtrl = new CopyEntryCtrl(); m_EntryCtrl.Initialize(); m_copyFactory = new CopyFactory(); Messenger.AddListener(DgMsgID.DgMsg_UnloadAssetFalse, OnUnloadAssetFalse); }
//---------------------------------------------------------------------------- public override void Finalized() { base.Finalized(); if (m_EntryCtrl != null) { m_EntryCtrl.Finalized(); m_EntryCtrl = null; } m_copyFactory = null; Messenger.RemoveListener(DgMsgID.DgMsg_UnloadAssetFalse, OnUnloadAssetFalse); }
//---------------------------------------------------------------------------- public bool Create(XmlNode node, ref string strCopyName, eSceneType type) { XmlElement mainElm = node as XmlElement; if (mainElm == null) { return(false); } if (m_sceneDict == null) { m_sceneDict = new Dictionary <int, Scene>(); } m_strSceneName = mainElm.GetAttribute("Name"); if (mainElm.HasAttribute("UIName")) { m_strUIName = mainElm.GetAttribute("UIName"); } string strBGM = mainElm.GetAttribute("BGM"); if (!string.IsNullOrEmpty(strBGM)) { m_nBGM = int.Parse(strBGM); } const string strStage = "Stage"; const string strPart = "Part"; const string strName = "Name"; int sceneIndex = 0; XmlElement startElm = mainElm.SelectSingleNode(strStage) as XmlElement; while (startElm != null) { int nStageID = int.Parse(startElm.GetAttribute("ID")); if (startElm.HasAttribute("TypeID")) { int nType = int.Parse(startElm.GetAttribute("TypeID")); type = (eSceneType)nType; } float nBackSpeed = 0f; float nMedSpeed = 0f; if (startElm.HasAttribute("BackSpeed")) { nBackSpeed = float.Parse(startElm.GetAttribute("BackSpeed")); } if (startElm.HasAttribute("MedSpeed")) { nMedSpeed = float.Parse(startElm.GetAttribute("MedSpeed")); } Scene newScene = null; newScene = CopyFactory.CreateScene(type, this); newScene.SetType(type); newScene.SetStageID(nStageID); newScene.SetStageBackSpeed(nBackSpeed); newScene.SetStageMedSpeed(nMedSpeed); newScene.SetFirstSceneFlag(sceneIndex == 0 ? true : false); XmlElement parElm = startElm.SelectSingleNode(strPart) as XmlElement; while (parElm != null) { newScene.AddToDict(int.Parse(parElm.GetAttribute("ID")), parElm.GetAttribute(strName)); parElm = parElm.NextSibling as XmlElement; } m_sceneDict.Add(nStageID, newScene); startElm = startElm.NextSibling as XmlElement; ++sceneIndex; } PlugInMsgPipe(m_CurScene); return(true); }