public UIMain(string savePath) { UITranslator.filePath = savePath + @"\Translation.json"; UITranslator.LoadCurrent(); string[] tabNames = typeof(Tabs).GetEnumNames(); for (int i = 0, iend = tabNames.Length; i < iend; i++) { tabNames[i] = UITranslator.TranslateCurrent(tabNames[i]); } TabSelector = new UITabSelector(tabNames); TabSelector.OnSelectionChange += OnTabSelectionChange; currentTab = TabSelector.CurrentSelection; Desks = new UICardDesk[3]; Desks[(int)Tabs.Calculator] = NewCalculatorDesk(out calculatorInputCard, out calculatorOutputCard); Desks[(int)Tabs.Calculator].onEndEditCard += OnEndEditCalulatorInputCard; databaseSavePath = savePath + @"\Database.json"; Database currentDatabase = DatapackSerializer.Deserialize(databaseSavePath); Desks[(int)Tabs.Database] = NewDatabaseDesk(currentDatabase, out databaseCard); Desks[(int)Tabs.Database].onEndEditCard += OnEndEditDatabaseCard; DatabaseReferenceAttribute.CurrentDatabase = currentDatabase; calculator = new Calculator(); }
public static void SaveCurrent() { if (currentTranslator == null) { currentTranslator = new UITranslator(); } currentTranslator.Save(); }
public static string TranslateCurrent(string word) { if (currentTranslator == null) { currentTranslator = new UITranslator(); } return(currentTranslator.Translate(word)); }
// Start is called before the first frame update void Start() { // initialize popups dictionary for (int i = 0; i < popupsList.Count; i++) { popups.Add((PopUp)i, popupsList[i]); } translator = DBConnector.MainCanvas.GetComponent <UITranslator>(); ConfirmLogIn(); }
public static UIField NewField(FieldInfo info, int arrayLevel, bool makeReadOnly) { if (info == null) { return(null); } Type fieldType = GetElementType(info.FieldType, arrayLevel); if (fieldType == null) { return(null); } UIField newField; bool isArray = fieldType.IsArray; DatabaseReferenceAttribute databaseReference = GetDatabaseReferenceAttribute(info); if (databaseReference != null) { fieldType = databaseReference.dataType; } if (isArray == false) { InputType inputType = GetInputType(fieldType); switch (inputType) { case InputType.Value: newField = new UIValueField(); break; case InputType.Data: newField = new UIDataPackField(); break; default: return(null); } } else { Type arrayType = isArray ? fieldType.GetElementType() : null; InputType inputType = GetInputType(arrayType); switch (inputType) { case InputType.Value: newField = new UIValueArrayField(); break; case InputType.Data: newField = new UIDataPackArrayField(); break; default: return(null); } } newField.Info = info; newField.ArrayLevel = arrayLevel; newField.label = UITranslator.TranslateCurrent(info.Name); newField.DatabaseID = null; newField.ReadOnly = makeReadOnly;// || databaseReference != null; return(newField); }
private void Start() { // initialize panel handler panelHandler = MainCanvas.GetComponent <PanelHandler>(); translator = MainCanvas.GetComponent <UITranslator>(); ErrorBufferGO = GameObject.Find("ErrorBuffer"); // initialize static list of all students within class Student.Students = new List <object>(); Scenario.Scenarios = new List <object>(); translator.LoadFigureList(); }
public static void LoadCurrent() { if (File.Exists(filePath) && filePath.EndsWith(".json")) { string jsonString = File.ReadAllText(filePath, Encoding.GetEncoding(28591)); currentTranslator = JsonUtility.FromJson <UITranslator>(jsonString); if (currentTranslator == null) { currentTranslator = new UITranslator(); } } else { SaveCurrent(); } }
private void Awake() { translator = DBConnector.MainCanvas.GetComponent <UITranslator>(); }
private void Start() { translator = gameObject.GetComponent<UITranslator>(); arTap = gameObject.GetComponent<ARTapToPlaceObject>(); panelHandler = DatabaseHandler.MainCanvas.GetComponent<PanelHandler>(); }
private void Start() { figurePanel = DBConnector.MainCanvas.GetComponent <FigurePanel>(); translator = DBConnector.MainCanvas.GetComponent <UITranslator>(); }
private void Start() { panelHandler = DBConnector.MainCanvas.GetComponent <PanelHandler>(); translator = DBConnector.MainCanvas.GetComponent <UITranslator>(); }