public void Setup(ByteBuffer buffer) { int beginPos = buffer.position; buffer.Seek(beginPos, 0); name = buffer.ReadS(); autoRadioGroupDepth = buffer.ReadBool(); buffer.Seek(beginPos, 1); int cnt = buffer.ReadShort(); _pageIds.Capacity = cnt; _pageNames.Capacity = cnt; for (int i = 0; i < cnt; i++) { _pageIds.Add(buffer.ReadS()); _pageNames.Add(buffer.ReadS()); } buffer.Seek(beginPos, 2); cnt = buffer.ReadShort(); if (cnt > 0) { if (_actions == null) { _actions = new List <ControllerAction>(cnt); } for (int i = 0; i < cnt; i++) { int nextPos = buffer.ReadShort(); nextPos += buffer.position; ControllerAction action = ControllerAction.CreateAction((ControllerAction.ActionType)buffer.ReadByte()); action.Setup(buffer); _actions.Add(action); buffer.position = nextPos; } } if (parent != null && _pageIds.Count > 0) { if (UIConfig.uiLanguageCtr > 0 && name == "UILanguageCtr" && UIConfig.uiLanguageCtr < _pageIds.Count) { _selectedIndex = UIConfig.uiLanguageCtr; } else { _selectedIndex = 0; } } else { _selectedIndex = -1; } }
public void Setup(XML xml) { string[] arr; name = xml.GetAttribute("name"); autoRadioGroupDepth = xml.GetAttributeBool("autoRadioGroupDepth"); arr = xml.GetAttributeArray("pages"); if (arr != null) { int cnt = arr.Length; for (int i = 0; i < cnt; i += 2) { _pageIds.Add(arr[i]); _pageNames.Add(arr[i + 1]); } } XMLList.Enumerator et = xml.GetEnumerator("action"); while (et.MoveNext()) { if (_actions == null) { _actions = new List <ControllerAction>(); } XML cxml = et.Current; ControllerAction action = ControllerAction.CreateAction(cxml.GetAttribute("type")); action.Setup(cxml); _actions.Add(action); } arr = xml.GetAttributeArray("transitions"); if (arr != null) { if (_actions == null) { _actions = new List <ControllerAction>(); } int cnt = arr.Length; for (int i = 0; i < cnt; i++) { string str = arr[i]; PlayTransitionAction taction = new PlayTransitionAction(); int k = str.IndexOf("="); taction.transitionName = str.Substring(k + 1); str = str.Substring(0, k); k = str.IndexOf("-"); int ii = int.Parse(str.Substring(k + 1)); if (ii < _pageIds.Count) { taction.toPage = new string[] { _pageIds[ii] } } ; str = str.Substring(0, k); if (str != "*") { ii = int.Parse(str); if (ii < _pageIds.Count) { taction.fromPage = new string[] { _pageIds[ii] } } ; } taction.stopOnExit = true; _actions.Add(taction); } } if (parent != null && _pageIds.Count > 0) { _selectedIndex = 0; } else { _selectedIndex = -1; } } } }
public void Setup(ByteBuffer buffer) { int beginPos = buffer.position; buffer.Seek(beginPos, 0); name = buffer.ReadS(); autoRadioGroupDepth = buffer.ReadBool(); buffer.Seek(beginPos, 1); int cnt = buffer.ReadShort(); _pageIds.Capacity = cnt; _pageNames.Capacity = cnt; for (int i = 0; i < cnt; i++) { _pageIds.Add(buffer.ReadS()); _pageNames.Add(buffer.ReadS()); } int homePageIndex = 0; if (buffer.version >= 2) { int homePageType = buffer.ReadByte(); switch (homePageType) { case 1: homePageIndex = buffer.ReadShort(); break; case 2: homePageIndex = _pageNames.IndexOf(UIPackage.branch); if (homePageIndex == -1) { homePageIndex = 0; } break; case 3: homePageIndex = _pageNames.IndexOf(UIPackage.GetVar(buffer.ReadS())); if (homePageIndex == -1) { homePageIndex = 0; } break; } } buffer.Seek(beginPos, 2); cnt = buffer.ReadShort(); if (cnt > 0) { if (_actions == null) { _actions = new List <ControllerAction>(cnt); } for (int i = 0; i < cnt; i++) { int nextPos = buffer.ReadShort(); nextPos += buffer.position; ControllerAction action = ControllerAction.CreateAction((ControllerAction.ActionType)buffer.ReadByte()); action.Setup(buffer); _actions.Add(action); buffer.position = nextPos; } } if (parent != null && _pageIds.Count > 0) { _selectedIndex = homePageIndex; } else { _selectedIndex = -1; } }