private void PersonLeaveAnimation() { stage = CaptureStage.Idle; Button1Label.Text = "Empezar"; Button1Label.Visibility = Visibility.Collapsed; Button1.Visibility = Visibility.Collapsed; Button2Label.Text = "No"; Button2Label.Visibility = Visibility.Collapsed; Button2.Visibility = Visibility.Collapsed; BottomPanel.Visibility = Visibility.Collapsed; BottomPanelText.Visibility = Visibility.Collapsed; BottomPanelText.Text = "Ubícate para que tu cabeza se alinee con la imagen. Presiona continuar cuando hayas terminado."; SmallLabel.Text = "Levanta tu mano y presiona el boton para empezar."; SmallLabel.Visibility = Visibility.Collapsed; MainLabel.Text = "Hola!\n¿Ya me conoces?"; MainLabel.Visibility = Visibility.Visible; VideoCapture.Visibility = Visibility.Collapsed; TemplateImage.Visibility = Visibility.Collapsed; IdentityImage.Visibility = Visibility.Collapsed; ImgReference.Visibility = Visibility.Collapsed; ImgReferenceBG.Visibility = Visibility.Collapsed; BottomPanel.SetValue(Grid.RowProperty, 3); BottomPanelText.SetValue(Grid.RowProperty, 3); Button1Label.SetValue(Grid.RowProperty, 3); Button1.SetValue(Grid.RowProperty, 3); Button2Label.SetValue(Grid.RowProperty, 3); Button2.SetValue(Grid.RowProperty, 3); string[] fromGradient = { "#ffd52941", "#ffe45f42", "#ffee894c", "#fff6b061", "#fffcd581" }; string[] toGradient = { "#ff1f719b", "#ff238aad", "#ff33a3bc", "#ff4cbcc9", "#ff6bd5d3" }; UIAnimations.GradientAnimation(1.0, fromGradient, toGradient, BGCanvas); }
private void PersonLeaveAnimation() { ButtonLabel.Text = "Empezar"; ButtonLabel.SetValue(Grid.RowProperty, 3); ButtonLabel.Visibility = Visibility.Collapsed; StartButton.SetValue(Grid.RowProperty, 3); StartButton.Visibility = Visibility.Collapsed; BottomPanel.Visibility = Visibility.Collapsed; BottomPanelText.Visibility = Visibility.Collapsed; BottomPanelText.Text = "Ubícate para que tu cabeza se alinee con la imagen. Presiona continuar cuando hayas terminado."; SmallLabel.Text = "Levanta tu mano y presiona el boton para empezar."; SmallLabel.Visibility = Visibility.Collapsed; MainLabel.Text = "¿Quieres ayudar a crear un algoritmo de identificación facial?"; MainLabel.Visibility = Visibility.Visible; VideoCapture.Visibility = Visibility.Collapsed; ImgReference.Visibility = Visibility.Collapsed; ImgReferenceBG.Visibility = Visibility.Collapsed; Timer.Visibility = Visibility.Collapsed; TimerBG.Visibility = Visibility.Collapsed; TemplateImage.Visibility = Visibility.Visible; string[] fromGradient = { "#ffd52941", "#ffe45f42", "#ffee894c", "#fff6b061", "#fffcd581" }; string[] toGradient = { "#ff1f719b", "#ff238aad", "#ff33a3bc", "#ff4cbcc9", "#ff6bd5d3" }; UIAnimations.GradientAnimation(1.0, fromGradient, toGradient, BGCanvas); }
private void Awake() { instance = this; healthDepleteBar = UIManager.instance.healthFillFlash; cpDepleteBar = UIManager.instance.cpFillFlash; healthBar = UIManager.instance.healthFill; cpBar = UIManager.instance.cpFill; }
private void PersonEnterAnimation() { SmallLabel.Visibility = Visibility.Visible; Button1.Visibility = Visibility.Visible; Button1Label.Visibility = Visibility.Visible; string[] fromGradient = { "#ff1f719b", "#ff238aad", "#ff33a3bc", "#ff4cbcc9", "#ff6bd5d3" }; string[] toGradient = { "#ffd52941", "#ffe45f42", "#ffee894c", "#fff6b061", "#fffcd581" }; UIAnimations.GradientAnimation(1.0, fromGradient, toGradient, BGCanvas); UIAnimations.FadeInAnimation(1.0, new FrameworkElement[] { Button1, Button1Label, SmallLabel }); }
public void StartAnimation(int index) { UIAnimations animation = (UIAnimations)m_animations[index]; for (int i = 0; i < animation.control_data.Count; ++i) { UIAnimations.ControlData data = (UIAnimations.ControlData)animation.control_data[i]; int control_id = data.control_id; string type = m_control_table[control_id].GetType().ToString(); if ("UIClickButton" == type) { UIClickButton button = ((UIClickButton)m_control_table[control_id]); data.pos.x = button.Rect.x; data.pos.y = button.Rect.y; data.angle = button.GetRotate(); } else if ("UIPushButton" == type) { UIPushButton button = ((UIPushButton)m_control_table[control_id]); data.pos.x = button.Rect.x; data.pos.y = button.Rect.y; data.angle = button.GetRotate(); } else if ("UISelectButton" == type) { UISelectButton button = ((UISelectButton)m_control_table[control_id]); data.pos.x = button.Rect.x; data.pos.y = button.Rect.y; data.angle = button.GetRotate(); } else if ("UIImage" == type) { UIImage image = ((UIImage)m_control_table[control_id]); data.pos.x = image.Rect.x; data.pos.y = image.Rect.y; data.angle = image.GetRotation(); } else if ("UIText" == type) { UIText text = ((UIText)m_control_table[control_id]); data.pos.x = text.Rect.x; data.pos.y = text.Rect.y; } } animation.Reset(); animation.Start(); //动作开始前存储当前该动作控件的初始数据 }
protected virtual void Start() { finishedAnimation = true; topPos.x = panel.transform.position.x; topPos.y = panel.transform.position.y; offset = scale ? new Vector2(0, offset.y / 1920 * Screen.height) : offset; //scrollTime = scale ? Screen.height / 1920 * Constants.ScreenScrollTime : Constants.ScreenScrollTime; scrollTime = Constants.ScreenScrollTime; fadeTime = Constants.ScreenTintFadeTime; if (button != null) { buttonAnim = button.GetComponent <UIAnimations> (); } }
public IngameMenus(SpriteBatch spriteBatch, Dictionary <string, Texture2D> texturesDictionary, Dictionary <string, Texture2D> playerSpriteSheets) { this.spriteBatch = spriteBatch; this.texturesDictionary = texturesDictionary; saveAnimation = new UIAnimations(texturesDictionary, playerSpriteSheets); rightTutPlayer = new UIAnimations(texturesDictionary, playerSpriteSheets); rightTutPlayer.nextAnimation = UIAnimations.uiAnimations.Reggie_Move_Right; leftTutPlayer = new UIAnimations(texturesDictionary, playerSpriteSheets); leftTutPlayer.nextAnimation = UIAnimations.uiAnimations.Reggie_Move_Left; jumpTutPlayer = new UIAnimations(texturesDictionary, playerSpriteSheets); jumpTutPlayer.nextAnimation = UIAnimations.uiAnimations.Reggie_Jump; floatingTutPlayer = new UIAnimations(texturesDictionary, playerSpriteSheets); floatingTutPlayer.currentAnimation = UIAnimations.uiAnimations.Reggie_Float; attackTutPlayer = new UIAnimations(texturesDictionary, playerSpriteSheets); attackTutPlayer.nextAnimation = UIAnimations.uiAnimations.Reggie_Attack; }
public static bool DrawAnimationPreset(SerializedObject serializedObject, SerializedProperty loadSelectedPresetAtRuntime, SerializedProperty presetCategory, SerializedProperty presetName, UIAnimationsDatabase databases, UIAnimation animation, ColorName colorName, out UIAnimation outAnimation) { bool presetUpdated = false; UIAnimationDatabase database = databases.Get(presetCategory.stringValue); if (database == null || !database.Contains(presetName.stringValue)) { presetCategory.stringValue = UIAnimations.DEFAULT_DATABASE_NAME; presetName.stringValue = UIAnimations.DEFAULT_PRESET_NAME; serializedObject.ApplyModifiedProperties(); presetUpdated = true; } if (database == null) { database = databases.Get(presetCategory.stringValue); } float buttonHeight = DGUI.Properties.SingleLineHeight + DGUI.Properties.Space(2); float lineHeight = DGUI.Properties.SingleLineHeight; float backgroundHeight = lineHeight * 2 + DGUI.Properties.Space(2); GUILayoutOption backgroundHeightOption = GUILayout.Height(backgroundHeight); bool loadAtRuntime = loadSelectedPresetAtRuntime.boolValue; float labelAlpha = DGUI.Properties.TextIconAlphaValue(loadAtRuntime); Color initialColor = GUI.color; bool isBeingEdited = s_behaviorPropertyBeingEdited == loadSelectedPresetAtRuntime; if (isBeingEdited && Event.current.keyCode == KeyCode.Escape && Event.current.type == EventType.KeyUp) { ResetPresetSettings(); } UIAnimation returnAnimation = animation; DGUI.Line.Draw(false, colorName, false, buttonHeight, () => { GUILayout.Space(DGUI.Properties.Space()); if (isBeingEdited) { GUILayout.Space(DGUI.Properties.Space()); EditorGUI.BeginChangeCheck(); s_createNewPresetCategory = DGUI.Toggle.Checkbox.Draw(s_createNewPresetCategory, colorName, buttonHeight - DGUI.Properties.Space(), serializedObject.isEditingMultipleObjects); if (EditorGUI.EndChangeCheck()) { if (s_createNewPresetCategory) { s_selectPresetCategoryTextField = true; } } GUILayout.Space(DGUI.Properties.Space()); DGUI.Label.Draw(DGUI.Properties.Labels.CreateNewCategory, Size.M, colorName, buttonHeight); GUILayout.FlexibleSpace(); if ((Event.current.type == EventType.KeyUp && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter) && GUI.GetNameOfFocusedControl().Equals(DGUI.Properties.Labels.PresetName)) | DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconSave), DGUI.Properties.Labels.SavePreset, Size.S, TextAlign.Left, ColorName.Green, ColorName.Green, buttonHeight, false)) { if (s_createNewPresetCategory) { if (s_newPresetCategory == null) { s_newPresetCategory = string.Empty; } s_newPresetCategory = s_newPresetCategory.Trim(); if (string.IsNullOrEmpty(s_newPresetCategory)) { EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewCategory, DGUI.Properties.Labels.NewCategoryNameCannotBeEmpty, DGUI.Properties.Labels.Ok); } else if (databases.DatabaseNames.Contains(s_newPresetCategory)) { EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewCategory, DGUI.Properties.Labels.AnotherEntryExists, DGUI.Properties.Labels.Ok); } else { UIAnimationDatabase targetDatabase = UIAnimations.Instance.CreateDatabase(databases.DatabaseType, s_newPresetCategory, true); if (string.IsNullOrEmpty(s_newPresetName)) { EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewPreset, DGUI.Properties.Labels.NewPresetNameCannotBeEmpty, DGUI.Properties.Labels.Ok); } else if (targetDatabase.Contains(s_newPresetName)) { EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewPreset, DGUI.Properties.Labels.AnotherEntryExists, DGUI.Properties.Labels.Ok); } else { targetDatabase.CreatePreset(s_newPresetName, animation); targetDatabase.RefreshDatabase(true); databases.Update(); presetCategory.stringValue = s_newPresetCategory; presetName.stringValue = s_newPresetName; serializedObject.ApplyModifiedProperties(); ResetPresetSettings(); presetUpdated = true; } } } else { if (s_newPresetName == null) { s_newPresetName = string.Empty; } s_newPresetName = s_newPresetName.Trim(); if (string.IsNullOrEmpty(s_newPresetName)) { EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewPreset, DGUI.Properties.Labels.NewPresetNameCannotBeEmpty, DGUI.Properties.Labels.Ok); } else if (database.Contains(s_newPresetName)) { EditorUtility.DisplayDialog(DGUI.Properties.Labels.NewPreset, DGUI.Properties.Labels.AnotherEntryExists, DGUI.Properties.Labels.Ok); } else { database.CreatePreset(s_newPresetName, animation); database.RefreshDatabase(true); databases.Update(); presetName.stringValue = s_newPresetName; serializedObject.ApplyModifiedProperties(); ResetPresetSettings(); } } } GUILayout.Space(DGUI.Properties.Space()); if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconClose), DGUI.Properties.Labels.Cancel, Size.S, TextAlign.Left, ColorName.Red, ColorName.Red, buttonHeight, false)) { ResetPresetSettings(); } } else { if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconFaBinoculars), colorName, colorName, buttonHeight)) { UIAnimations.Instance.SearchForUnregisteredDatabases(true); } GUILayout.Space(DGUI.Properties.Space(2)); if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconNew), DGUI.Properties.Labels.NewPreset, Size.S, TextAlign.Left, colorName, colorName, buttonHeight, false)) { s_behaviorPropertyBeingEdited = loadSelectedPresetAtRuntime; s_createNewPresetName = true; s_newPresetCategory = presetCategory.stringValue; s_selectPresetNameTextField = true; } GUILayout.FlexibleSpace(); if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconLoad), DGUI.Properties.Labels.LoadPreset, Size.S, TextAlign.Left, colorName, colorName, buttonHeight, false)) { UIAnimation presetAnimation = UIAnimations.LoadPreset(animation.AnimationType, presetCategory.stringValue, presetName.stringValue); if (presetAnimation != null) { Undo.RecordObjects(serializedObject.targetObjects, DGUI.Properties.Labels.LoadPreset); returnAnimation = presetAnimation; presetUpdated = true; } } GUILayout.Space(DGUI.Properties.Space(2)); if (DGUI.Button.Dynamic.DrawIconButton(Styles.GetStyle(Styles.StyleName.IconClose), DGUI.Properties.Labels.DeletePreset, Size.S, TextAlign.Left, colorName, colorName, buttonHeight, false)) { if (presetCategory.stringValue.Equals(UIAnimations.DEFAULT_DATABASE_NAME) && presetName.stringValue.Equals(UIAnimations.DEFAULT_PRESET_NAME)) { return; } if (EditorUtility.DisplayDialog(DGUI.Properties.Labels.DeletePreset, DGUI.Properties.Labels.PresetCategory + ": " + presetCategory.stringValue + "\n" + DGUI.Properties.Labels.PresetName + ": " + presetName.stringValue, DGUI.Properties.Labels.Yes, DGUI.Properties.Labels.No)) { database.Delete(presetName.stringValue, true); if (database != null && database.Database.Count > 0) { presetName.stringValue = database.AnimationNames[0]; } else { UIAnimations.Instance.Initialize(); presetCategory.stringValue = UIAnimations.DEFAULT_DATABASE_NAME; presetName.stringValue = UIAnimations.DEFAULT_PRESET_NAME; presetUpdated = true; } serializedObject.ApplyModifiedProperties(); } } } // GUILayout.Space(DGUI.Properties.Space()); }); GUILayout.Space(DGUI.Properties.Space()); GUILayout.BeginHorizontal(backgroundHeightOption, GUILayout.ExpandWidth(true)); { GUILayout.BeginVertical(backgroundHeightOption, GUILayout.ExpandWidth(true)); { DGUI.Background.Draw(colorName, backgroundHeight); GUILayout.Space(-backgroundHeight); GUILayout.Space(DGUI.Properties.Space()); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); { GUILayout.Space(DGUI.Properties.Space(2)); GUI.color = GUI.color.WithAlpha(labelAlpha); DGUI.Label.Draw(DGUI.Properties.Labels.PresetCategory, Size.S, colorName); GUI.color = initialColor; } GUILayout.EndHorizontal(); GUI.color = DGUI.Colors.PropertyColor(colorName); if (isBeingEdited && s_createNewPresetCategory) { GUI.SetNextControlName(DGUI.Properties.Labels.PresetCategory); s_newPresetCategory = EditorGUILayout.TextField(GUIContent.none, s_newPresetCategory, GUILayout.ExpandWidth(true)); if (s_selectPresetCategoryTextField) { EditorGUI.FocusTextInControl(DGUI.Properties.Labels.PresetCategory); s_selectPresetCategoryTextField = false; } } else { int presetCategoryIndex = databases.DatabaseNames.IndexOf(presetCategory.stringValue); EditorGUI.BeginChangeCheck(); presetCategoryIndex = EditorGUILayout.Popup(presetCategoryIndex, databases.DatabaseNames.ToArray(), GUILayout.ExpandWidth(true)); if (EditorGUI.EndChangeCheck()) { presetCategory.stringValue = databases.DatabaseNames[presetCategoryIndex]; database = databases.Get(databases.DatabaseNames[presetCategoryIndex]); database.RefreshDatabase(false); presetName.stringValue = database.AnimationNames[0]; DGUI.Properties.ResetKeyboardFocus(); presetUpdated = true; } } GUI.color = initialColor; } GUILayout.EndVertical(); GUILayout.Space(DGUI.Properties.Space()); GUILayout.BeginVertical(backgroundHeightOption, GUILayout.ExpandWidth(true)); { DGUI.Background.Draw(colorName, backgroundHeight); GUILayout.Space(-backgroundHeight); GUILayout.Space(DGUI.Properties.Space()); GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); { GUILayout.Space(DGUI.Properties.Space(2)); GUI.color = GUI.color.WithAlpha(labelAlpha); DGUI.Label.Draw(DGUI.Properties.Labels.PresetName, Size.S, colorName); GUI.color = initialColor; } GUILayout.EndHorizontal(); GUI.color = DGUI.Colors.PropertyColor(colorName); if (isBeingEdited && s_createNewPresetName) { GUI.SetNextControlName(DGUI.Properties.Labels.PresetName); s_newPresetName = EditorGUILayout.TextField(GUIContent.none, s_newPresetName, GUILayout.ExpandWidth(true)); if (s_selectPresetNameTextField) { EditorGUI.FocusTextInControl(DGUI.Properties.Labels.PresetName); s_selectPresetNameTextField = false; } } else { int presetNameIndex = database.AnimationNames.IndexOf(presetName.stringValue); EditorGUI.BeginChangeCheck(); presetNameIndex = EditorGUILayout.Popup(presetNameIndex, database.AnimationNames.ToArray(), GUILayout.ExpandWidth(true)); if (EditorGUI.EndChangeCheck()) { presetName.stringValue = database.AnimationNames[presetNameIndex]; presetUpdated = true; } } GUI.color = initialColor; } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); GUILayout.Space(DGUI.Properties.Space()); DGUI.Toggle.Checkbox.Draw(loadSelectedPresetAtRuntime, DGUI.Properties.Labels.LoadSelectedPresetAtRuntime, colorName, true, true, DGUI.Properties.SingleLineHeight); GUILayout.Space(DGUI.Properties.Space(2)); outAnimation = returnAnimation; return(presetUpdated); }
// Use this for initialization public void Start() { m_control_table = new Hashtable(); m_animations = new Hashtable(); XmlElement tempElem = null; string value = ""; TextAsset xml = Resources.Load(m_ui_cfgxml) as TextAsset; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xml.text); XmlNode root = xmlDoc.DocumentElement; foreach (XmlNode node1 in root.ChildNodes) { if ("UIElem" == node1.Name) { foreach (XmlNode xmlNode in node1.ChildNodes) { tempElem = (XmlElement)xmlNode; if ("UIButton" == xmlNode.Name) { UIButtonBase button = null; value = tempElem.GetAttribute("rect").Trim(); string[] digital = value.Split(','); value = tempElem.GetAttribute("type").Trim(); if ("click" == value) { button = new UIClickButton(); ((UIClickButton)button).Rect = new Rect(int.Parse(digital[0].Trim()), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim())); } else if ("push" == value) { button = new UIPushButton(); ((UIPushButton)button).Rect = new Rect(int.Parse(digital[0].Trim()), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim())); } else if ("select" == value) { button = new UISelectButton(); ((UISelectButton)button).Rect = new Rect(int.Parse(digital[0].Trim()), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim())); } if (null == button) { continue; } value = tempElem.GetAttribute("id").Trim(); button.Id = int.Parse(value); value = tempElem.GetAttribute("enable").Trim(); if (value.Length > 1) { button.Enable = ("true" == value); } value = tempElem.GetAttribute("visible").Trim(); if (value.Length > 1) { button.Visible = ("true" == value); } tempElem = (XmlElement)xmlNode.SelectSingleNode("Normal"); if (null != tempElem) { value = tempElem.GetAttribute("rect").Trim(); digital = value.Split(','); value = tempElem.GetAttribute("material").Trim(); button.SetTexture(UIButtonBase.State.Normal, LoadUIMaterial(value), new Rect(int.Parse(digital[0].Trim()), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim()))); } tempElem = (XmlElement)xmlNode.SelectSingleNode("Press"); if (null != tempElem) { value = tempElem.GetAttribute("rect").Trim(); digital = value.Split(','); value = tempElem.GetAttribute("material").Trim(); button.SetTexture(UIButtonBase.State.Pressed, LoadUIMaterial(value), new Rect(int.Parse(digital[0].Trim()), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim()))); } tempElem = (XmlElement)xmlNode.SelectSingleNode("Disable"); if (null != tempElem) { value = tempElem.GetAttribute("rect").Trim(); digital = value.Split(','); value = tempElem.GetAttribute("material").Trim(); button.SetTexture(UIButtonBase.State.Disabled, LoadUIMaterial(value), new Rect(int.Parse(digital[0].Trim()), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim()))); } tempElem = (XmlElement)xmlNode.SelectSingleNode("Hover"); if (null != tempElem) { value = tempElem.GetAttribute("rect").Trim(); digital = value.Split(','); value = tempElem.GetAttribute("material").Trim(); button.SetHoverSprite(LoadUIMaterial(value), new Rect(int.Parse(digital[0].Trim()), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim()))); } m_UIManagerRef.Add(button); m_control_table.Add(button.Id, button); } else if ("UIImage" == xmlNode.Name) { UIImage image = new UIImage(); value = tempElem.GetAttribute("id").Trim(); image.Id = int.Parse(value); value = tempElem.GetAttribute("rect").Trim(); string[] digital = value.Split(','); image.Rect = new Rect(int.Parse(digital[0]), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim())); value = tempElem.GetAttribute("enable").Trim(); if (value.Length > 1) { image.Enable = ("true" == value); } value = tempElem.GetAttribute("visible").Trim(); if (value.Length > 1) { image.Visible = ("true" == value); } tempElem = (XmlElement)xmlNode.SelectSingleNode("Texture"); if (null != tempElem) { value = tempElem.GetAttribute("rect").Trim(); digital = value.Split(','); value = tempElem.GetAttribute("material").Trim(); image.SetTexture(LoadUIMaterial(value), new Rect(int.Parse(digital[0].Trim()), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim()))); } m_UIManagerRef.Add(image); m_control_table.Add(image.Id, image); } else if ("UIText" == xmlNode.Name) { UIText text = new UIText(); value = tempElem.GetAttribute("id").Trim(); text.Id = int.Parse(value); value = tempElem.GetAttribute("rect").Trim(); string[] digital = value.Split(','); text.Rect = new Rect(int.Parse(digital[0]), int.Parse(digital[1].Trim()), int.Parse(digital[2].Trim()), int.Parse(digital[3].Trim())); value = tempElem.GetAttribute("chargap").Trim(); if (value.Length > 1) { text.CharacterSpacing = int.Parse(value); } value = tempElem.GetAttribute("linegap").Trim(); if (value.Length > 1) { text.LineSpacing = int.Parse(value); } value = tempElem.GetAttribute("autoline").Trim(); if (value.Length > 1) { text.AutoLine = ("true" == value); } value = tempElem.GetAttribute("align").Trim(); if (value.Length > 1) { text.AlignStyle = (UIText.enAlignStyle)Enum.Parse(typeof(UIText.enAlignStyle), value); } value = tempElem.GetAttribute("enable").Trim(); if (value.Length > 1) { text.Enable = ("true" == value); } value = tempElem.GetAttribute("visible").Trim(); if (value.Length > 1) { text.Visible = ("true" == value); } value = tempElem.GetAttribute("font").Trim(); text.SetFont(m_font_path + value); value = tempElem.GetAttribute("color").Trim(); if (value.Length > 1) { digital = value.Split(','); text.SetColor(new Color(int.Parse(digital[0].Trim()) / 255.0f, int.Parse(digital[1].Trim()) / 255.0f, int.Parse(digital[2].Trim()) / 255.0f, int.Parse(digital[3].Trim()) / 255.0f)); } text.SetText(xmlNode.InnerText.Trim(new char[] { ' ', '\t', '\r', '\n' })); m_UIManagerRef.Add(text); m_control_table.Add(text.Id, text); } //UIText } // for } else if ("UIAnimation" == node1.Name) { foreach (XmlNode xmlNode in node1.ChildNodes) { tempElem = (XmlElement)xmlNode; if ("Animation" != xmlNode.Name) { continue; } UIAnimations animation = new UIAnimations(); value = tempElem.GetAttribute("id").Trim(); animation.animation_id = int.Parse(value); Debug.Log(value); value = tempElem.GetAttribute("control_id").Trim(); Debug.Log(value); string[] digital = value.Split(','); for (int i = 0; i < digital.Length; ++i) { UIAnimations.ControlData data = new UIAnimations.ControlData(); data.control_id = int.Parse(digital[i].Trim()); animation.control_data.Add(data); } tempElem = (XmlElement)xmlNode.SelectSingleNode("Translate"); if (null != tempElem) { animation.translate_have = true; value = tempElem.GetAttribute("time").Trim(); animation.translate_time = float.Parse(value); value = tempElem.GetAttribute("offset").Trim(); if (value.Length > 0) { digital = value.Split(','); animation.translate_offset.x = int.Parse(digital[0].Trim()); animation.translate_offset.y = int.Parse(digital[1].Trim()); } value = tempElem.GetAttribute("restore").Trim(); if (value.Length > 0) { animation.translate_restore = ("true" == value); } value = tempElem.GetAttribute("loop").Trim(); if (value.Length > 0) { animation.translate_loop = ("true" == value); } value = tempElem.GetAttribute("reverse").Trim(); if (value.Length > 0) { animation.translate_reverse = ("true" == value); } } tempElem = (XmlElement)xmlNode.SelectSingleNode("Rotate"); if (null != tempElem) { animation.rotate_have = true; value = tempElem.GetAttribute("time").Trim(); animation.rotate_time = float.Parse(value); value = tempElem.GetAttribute("angle").Trim(); animation.rotate_angle = Mathf.Deg2Rad * float.Parse(value); value = tempElem.GetAttribute("restore").Trim(); if (value.Length > 0) { animation.rotate_restore = ("true" == value); } value = tempElem.GetAttribute("loop").Trim(); if (value.Length > 0) { animation.rotate_loop = ("true" == value); } value = tempElem.GetAttribute("reverse").Trim(); if (value.Length > 0) { animation.rotate_reverse = ("true" == value); } } m_animations.Add(animation.animation_id, animation); } // for } //if ("UIAnimation" == node1.Name) } //for root }