private void reinitVars() { _code = null; _texture = null; _next = null; _cancel = null; _info = null; }
private void reinitVars() { _code = null; _texture = null; _next = null; _cancel = null; _info = null; }
private static bool fillInFieldsFromCode(string code) { StandardInfoWindowInfo info = retrieveFromDico(code); if (null != info) { string generic = _genericPrefix + code.ToUpper(); _instance.titleLabel.key = generic + _genericTitle; _instance.subtitleLabel.key = generic + _genericSubtitle; _instance.infoSprite.spriteName = info._texture; _instance.explanationLabel.key = generic + _genericExplanation; _instance.bottomLabel.key = generic + _genericBottom; _instance.nextAction = getFromString(info._next); return(true); } else { return(false); } // TODO manage onNext }
public LinkedList<StandardInfoWindowInfo> loadInfoFromFile(string filePath) { Logger.Log("InfoWindowLoader::loadInfoFromFile("+filePath+")", Logger.Level.INFO); LinkedList<StandardInfoWindowInfo> resultInfo = new LinkedList<StandardInfoWindowInfo>(); XmlDocument xmlDoc = Tools.getXmlDocument(filePath); XmlNodeList infoList = xmlDoc.GetElementsByTagName(InfoWindowXMLTags.INFO); foreach (XmlNode infoNode in infoList) { reinitVars(); //common info attributes try { _code = infoNode.Attributes[InfoWindowXMLTags.CODE].Value; } catch (NullReferenceException exc) { Logger.Log("InfoWindowLoader::loadInfoFromFile bad xml, missing field\n"+exc, Logger.Level.WARN); continue; } catch (Exception exc) { Logger.Log("InfoWindowLoader::loadInfoFromFile failed, got exc="+exc, Logger.Level.WARN); continue; } if (checkString(_code)) { foreach (XmlNode attr in infoNode){ switch (attr.Name){ case InfoWindowXMLTags.TEXTURE: _texture = attr.InnerText; break; case InfoWindowXMLTags.NEXT: _next = attr.InnerText; break; case InfoWindowXMLTags.CANCEL: _cancel = attr.InnerText; break; default: Logger.Log("InfoWindowLoader::loadInfoFromFile unknown attr "+attr.Name+" for info node", Logger.Level.WARN); break; } } if( checkString(_texture) && checkString(_next) //_cancel is optional, therefore no need to check it ) { _info = new StandardInfoWindowInfo(_code, _texture, _next, _cancel); } if(null != _info) { resultInfo.AddLast(_info); } } else { Logger.Log("InfoWindowLoader::loadInfoFromFile Error : missing attribute code in info node", Logger.Level.WARN); } } return resultInfo; }
public LinkedList <StandardInfoWindowInfo> loadInfoFromFile(string filePath) { Logger.Log("InfoWindowLoader::loadInfoFromFile(" + filePath + ")", Logger.Level.INFO); LinkedList <StandardInfoWindowInfo> resultInfo = new LinkedList <StandardInfoWindowInfo>(); XmlDocument xmlDoc = Tools.getXmlDocument(filePath); XmlNodeList infoList = xmlDoc.GetElementsByTagName(InfoWindowXMLTags.INFO); foreach (XmlNode infoNode in infoList) { reinitVars(); //common info attributes try { _code = infoNode.Attributes[InfoWindowXMLTags.CODE].Value; } catch (NullReferenceException exc) { Logger.Log("InfoWindowLoader::loadInfoFromFile bad xml, missing field\n" + exc, Logger.Level.WARN); continue; } catch (Exception exc) { Logger.Log("InfoWindowLoader::loadInfoFromFile failed, got exc=" + exc, Logger.Level.WARN); continue; } if (checkString(_code)) { foreach (XmlNode attr in infoNode) { switch (attr.Name) { case InfoWindowXMLTags.TEXTURE: _texture = attr.InnerText; break; case InfoWindowXMLTags.NEXT: _next = attr.InnerText; break; case InfoWindowXMLTags.CANCEL: _cancel = attr.InnerText; break; default: Logger.Log("InfoWindowLoader::loadInfoFromFile unknown attr " + attr.Name + " for info node", Logger.Level.WARN); break; } } if ( checkString(_texture) && checkString(_next) //_cancel is optional, therefore no need to check it ) { _info = new StandardInfoWindowInfo(_code, _texture, _next, _cancel); } if (null != _info) { resultInfo.AddLast(_info); } } else { Logger.Log("InfoWindowLoader::loadInfoFromFile Error : missing attribute code in info node", Logger.Level.WARN); } } return(resultInfo); }
private static bool fillInFieldsFromCode(string code) { Logger.Log("ModalManager::fillInFieldsFromCode(" + code + ")", Logger.Level.INFO); StandardInfoWindowInfo info = retrieveFromDico(code); if (null != info) { string generic = _genericPrefix + code.ToUpper(); _instance.titleLabel.key = generic + _genericTitle; _instance.infoSprite.spriteName = info._texture; _instance.explanationLabel.key = generic + _genericExplanation; if (!string.IsNullOrEmpty(info._next)) { if (needsCancelButton(info._next)) { //affect class of action after validation _instance._validateButtonClass = info._next; //choose validation button _instance._validateButton = _instance.genericValidateButton; //set active buttons according to 'validate/cancel' pattern _instance.genericValidateButton.gameObject.SetActive(true); _instance.genericCenteredValidateButton.gameObject.SetActive(false); _instance.genericCancelButton.gameObject.SetActive(true); //update cancel button component if necessary prepareGenericCancelButton(info._cancel); } else { //affect class of action after validation _instance._validateButtonClass = info._next; //choose validation button button _instance._validateButton = _instance.genericCenteredValidateButton; //set active buttons according to 'validate' pattern _instance.genericValidateButton.gameObject.SetActive(false); _instance.genericCenteredValidateButton.gameObject.SetActive(true); _instance.genericCancelButton.gameObject.SetActive(false); //reset cancel button - isActive is used to test whether the button should respond to keys or not resetGenericCancelButton(); } //add class for action after validation safeAddComponent(_instance._validateButton, _instance._validateButtonClass); } else { return(false); } return(true); } else { Logger.Log("ModalManager::fillInFieldsFromCode(" + code + ") - no info", Logger.Level.WARN); return(false); } }