/// <summary> /// Creates a new gradient meter using the specified meter texture and colors. /// </summary> /// <param name="statName">The name of the meter's stat, used for object naming.</param> /// <param name="gradientTexture">The texture to used for the meter's gradient.</param> /// <param name="colorA">The color to render on the left side of the meter.</param> /// <param name="colorB">The color to render on the right side of the meter.</param> /// <returns>The created gradient meter.</returns> private UISlider CreateGradientMeter(string statName, UITextureSprite gradientTexture, Color colorA, Color colorB) { // Create the slider GameObject sliderObject = new GameObject(statName + "Meter"); sliderObject.transform.parent = this.infoPanel.transform; UISlider slider = sliderObject.AddComponent <UISlider>(); slider.width = MeterWidth; slider.height = MeterHeight; // Create the indicator GameObject indicatorObject = new GameObject(statName + "Indicator"); indicatorObject.transform.parent = slider.transform; UISprite indicator = indicatorObject.AddComponent <UISprite>(); indicator.spriteName = "MeterIndicator"; indicator.width = MeterIndicatorSize; indicator.height = MeterIndicatorSize; slider.thumbObject = indicator; // Create the gradient texture and setup how its material is rendered UITextureSprite gradient = GameObject.Instantiate <UITextureSprite>(gradientTexture); gradient.name = statName + "Gradient"; gradient.transform.parent = slider.transform; gradient.transform.localPosition = Vector3.zero; gradient.width = slider.width; gradient.height = slider.height; gradient.renderMaterial.SetColor("_ColorA", colorA); gradient.renderMaterial.SetColor("_ColorB", colorB); return(slider); }
private void setPreviewWindow(UIHelperExtension assetSelectionTabContainer) { UIPanel uIPanel = assetSelectionTabContainer.self.AddUIComponent <UIPanel>(); uIPanel.backgroundSprite = "GenericPanel"; uIPanel.width = 900f; uIPanel.height = 250f; uIPanel.relativePosition = new Vector3(0f, 350); this.m_preview = uIPanel.AddUIComponent <UITextureSprite>(); this.m_preview.size = uIPanel.size; this.m_preview.relativePosition = Vector3.zero; this.m_previewRenderer = assetSelectionTabContainer.self.gameObject.AddComponent <AVOPreviewRenderer>(); this.m_previewRenderer.size = this.m_preview.size * 2f; this.m_preview.texture = this.m_previewRenderer.texture; uIPanel.eventMouseDown += delegate(UIComponent c, UIMouseEventParameter p) { assetSelectionTabContainer.self.eventMouseMove += new MouseEventHandler(RotateCamera); redrawModel(); }; uIPanel.eventMouseUp += delegate(UIComponent c, UIMouseEventParameter p) { assetSelectionTabContainer.self.eventMouseMove -= new MouseEventHandler(RotateCamera); redrawModel(); }; uIPanel.eventMouseWheel += delegate(UIComponent c, UIMouseEventParameter p) { this.m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f; redrawModel(); }; }
protected void OnDestroy() { HookEvents(false); instance = null; CancelInvoke(); desaturationTarget = null; assets = null; PloppableAsset.ClearCache(); }
public UITextureSprite AddNamedTexture(string name) { UIPanel uIPanel = this.m_Root.AttachUIComponent(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate)) as UIPanel; uIPanel.Find <UILabel>("Label").text = name; UnityEngine.Object.Destroy(uIPanel.Find <UIDropDown>("Dropdown").gameObject); UITextureSprite uITextureSprite = uIPanel.AddUIComponent <UITextureSprite>(); uITextureSprite.isVisible = true; uITextureSprite.name = "TextureSprite"; return(uITextureSprite); }
protected void Awake() { this.m_SaveList = transform.Find("SaveList").GetComponent <UIListBox>(); var asd = new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnListingSelectionChanged); m_SaveList.ClearEventInvocations("eventSelectedIndexChanged"); //m_LoadButton.ClearEventInvocations("eventButtonStateChanged"); this.m_SaveList.eventSelectedIndexChanged += new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnListingSelectionChanged); this.m_LoadButton = transform.Find("Load").GetComponent <UIButton>(); this.m_CityName = transform.Find("CityInfo").Find("CityName").GetComponent <UILabel>(); this.m_SnapShotSprite = transform.Find("SnapShot").GetComponent <UITextureSprite>(); //this.m_AchNope = transform.Find("Ach").Find("AchNope").GetComponent<UISprite>(); var hostInfoPanel = transform.Find("CityInfo").GetComponent <UIPanel>(); m_serverNameTextbox = hostInfoPanel.AddUIComponent <UITextField>(); var serverNameLabel = hostInfoPanel.AddUIComponent <UILabel>(); SetLabel(serverNameLabel, "Server Name: ", 0, 115); SetTextBox(m_serverNameTextbox, "Unnamed Server", 85, 115, 300, 20); m_serverPortTextbox = hostInfoPanel.AddUIComponent <UITextField>(); var serverPortLabel = hostInfoPanel.AddUIComponent <UILabel>(); SetLabel(serverPortLabel, "Port: ", 0, 140); SetTextBox(m_serverPortTextbox, "27015", 85, 140, 100, 20); m_serverPrivateCheckbox = hostInfoPanel.AddUIComponent <UICheckBox>(); var serverPrivateLabel = hostInfoPanel.AddUIComponent <UILabel>(); SetLabel(serverPrivateLabel, "Private Server: ", 0, 165); SetCheckBox(m_serverPrivateCheckbox, 35, 166); transform.Find("CityInfo").Find("MapThemeLabel").gameObject.SetActive(false); transform.Find("CityInfo").Find("MapTheme").gameObject.SetActive(false); transform.Find("CityInfo").Find("PopulationLabel").gameObject.SetActive(false); transform.Find("CityInfo").Find("Population").gameObject.SetActive(false); transform.Find("CityInfo").Find("MoneyLabel").gameObject.SetActive(false); transform.Find("CityInfo").Find("Money").gameObject.SetActive(false); transform.Find("AchGroup").gameObject.SetActive(false); this.ClearInfo(); UIView v = UIView.GetAView(); m_hostGameHelpPanel = v.AddUIComponent(typeof(HostGameHelpPanel)) as HostGameHelpPanel; }
private void CreateThumbnail() { thumbnailPanel = AddUIComponent <UIPanel>(); thumbnailPanel.size = new Vector2(33.0f, 30.0f); thumbnailPanel.backgroundSprite = "WhiteRect"; thumbnailPanel.color = thumbnailBackgroundColor; thumbnailPanel.atlas = Resources.DefaultAtlas; thumbnailSprite = thumbnailPanel.AddUIComponent <UISprite>(); thumbnailSprite.size = new Vector2(31.0f, 28.0f); thumbnailSprite.relativePosition = new Vector2(1.0f, 1.0f); thumbnailSprite2 = thumbnailPanel.AddUIComponent <UITextureSprite>(); thumbnailSprite2.size = new Vector2(31.0f, 28.0f); thumbnailSprite2.relativePosition = new Vector2(1.0f, 1.0f); }
// runs only once, do internal init here public override void Awake() { base.Awake(); // Note - parent may not be set yet Snapshot = AddUIComponent <UITextureSprite>(); TrophySprite = AddUIComponent <UISprite>(); AchSprite = AddUIComponent <UISprite>(); LoadButton = AddUIComponent <UIButton>(); CancelButton = AddUIComponent <UIButton>(); //// some defaults //this.height = 40; //this.width = 400; }
/// <summary> /// Create the panel; we no longer use Start() as that's not sufficiently reliable (race conditions), and is no longer needed, with the new create/destroy process. /// </summary> public void Setup() { // Set background and sprites. backgroundSprite = "GenericPanel"; previewSprite = AddUIComponent <UITextureSprite>(); previewSprite.size = size; previewSprite.relativePosition = Vector3.zero; noPreviewSprite = AddUIComponent <UISprite>(); noPreviewSprite.size = size; noPreviewSprite.relativePosition = Vector3.zero; // Initialise renderer; use double size for anti-aliasing. previewRender = gameObject.AddComponent <UIPreviewRenderer>(); previewRender.Size = previewSprite.size * 2; // Click-and-drag rotation. eventMouseDown += (c, p) => { eventMouseMove += RotateCamera; }; eventMouseUp += (c, p) => { eventMouseMove -= RotateCamera; }; // Zoom with mouse wheel. eventMouseWheel += (c, p) => { previewRender.Zoom -= Mathf.Sign(p.wheelDelta) * 0.25f; RenderPreview(); }; // Display building name. buildingName = AddUIComponent <UILabel>(); buildingName.textScale = 0.9f; buildingName.useDropShadow = true; buildingName.dropShadowColor = new Color32(80, 80, 80, 255); buildingName.dropShadowOffset = new Vector2(2, -2); buildingName.text = "Name"; buildingName.isVisible = false; buildingName.relativePosition = new Vector3(5, 10); }
/// <summary> /// Obtain the <see cref="desaturationTarget"/> for the /// <see cref="LateUpdate()"/> loop. /// </summary> private static void CacheDesaturationControl() { var desaturationControl = FindObjectOfType <DesaturationControl>(); if (desaturationControl is null) { return; } desaturationTarget = desaturationControl.GetComponent <UITextureSprite>(); if (desaturationTarget is null) { return; } cacheDesaturationOpacity = desaturationTarget.opacity; }
static void Postfix(string[] extensions, AssetImporterAssetImport __instance, UIListBox ___m_FileList, UITextureSprite ___m_SmallPreview ) { try { // increase panel size: __instance.component.width = 1115; ___m_FileList.width = 550; ___m_FileList.relativePosition = ___m_FileList.relativePosition.SetI(0, 0); ___m_SmallPreview.relativePosition = ___m_SmallPreview.relativePosition.SetI(600, 0); AddSubfolders(___m_FileList, extensions); } catch (Exception ex) { Log.Exception(ex); } }
/// <summary> /// Creates a new gradient meter using the specified meter texture and colors. /// </summary> /// <param name="statName">The name of the meter's stat, used for object naming.</param> /// <param name="gradientTexture">The texture to used for the meter's gradient.</param> /// <param name="colorA">The color to render on the left side of the meter.</param> /// <param name="colorB">The color to render on the right side of the meter.</param> /// <returns>The created gradient meter.</returns> private UISlider CreateGradientMeter(string statName, UITextureSprite gradientTexture, Color colorA, Color colorB) { // Create the slider GameObject sliderObject = new GameObject(statName + "Meter"); sliderObject.transform.parent = this.infoPanel.transform; UISlider slider = sliderObject.AddComponent<UISlider>(); slider.width = MeterWidth; slider.height = MeterHeight; // Create the indicator GameObject indicatorObject = new GameObject(statName + "Indicator"); indicatorObject.transform.parent = slider.transform; UISprite indicator = indicatorObject.AddComponent<UISprite>(); indicator.spriteName = "MeterIndicator"; indicator.width = MeterIndicatorSize; indicator.height = MeterIndicatorSize; slider.thumbObject = indicator; // Create the gradient texture and setup how its material is rendered UITextureSprite gradient = GameObject.Instantiate<UITextureSprite>(gradientTexture); gradient.name = statName + "Gradient"; gradient.transform.parent = slider.transform; gradient.transform.localPosition = Vector3.zero; gradient.width = slider.width; gradient.height = slider.height; gradient.renderMaterial.SetColor("_ColorA", colorA); gradient.renderMaterial.SetColor("_ColorB", colorB); return slider; }
public override void Start() { try { uint citizen = this.MyInstanceID.Citizen; citizenINT = (int)((UIntPtr)citizen); this.CitizenName = this.MyInstance.GetName (this.MyInstanceID); if(this.MyInstancedName == null) { this.MyInstancedName = this.CitizenName; } if (citizenINT != 0 && !FavCimsCore.RowID.ContainsKey (citizenINT) && this.CitizenName != null && this.CitizenName.Length > 0) { FavCimsCore.InsertIdIntoArray (citizenINT); /////////////////////// //Row Background Panel ////////////////////// this.width = 1134; this.height = 41; this.autoLayoutDirection = LayoutDirection.Vertical; this.autoLayout = true; this.autoLayoutPadding = new RectOffset (0, 0, 1, 0); this.FavCimsCitizenSingleRowPanel = this.AddUIComponent<UIPanel> (); this.FavCimsCitizenSingleRowPanel.width = this.width; this.FavCimsCitizenSingleRowPanel.height = 40; this.FavCimsCitizenSingleRowBGSprite = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UITextureSprite> (); this.FavCimsCitizenSingleRowBGSprite.name = "FavCimsCitizenSingleRowBGSprite"; this.FavCimsCitizenSingleRowBGSprite.width = this.FavCimsCitizenSingleRowPanel.width; this.FavCimsCitizenSingleRowBGSprite.height = this.FavCimsCitizenSingleRowPanel.height; this.FavCimsCitizenSingleRowBGSprite.AlignTo (this.FavCimsCitizenSingleRowPanel, UIAlignAnchor.TopLeft); //Background Color if (!FavoriteCimsMainPanel.RowAlternateBackground) { this.FavDot = ResourceLoader.loadTexture ((int)this.width, 40, "UIMainPanel.Rows.bgrow_1.png"); this.FavDot.name = "FavDot_1"; this.FavCimsCitizenSingleRowBGSprite.texture = this.FavDot; FavoriteCimsMainPanel.RowAlternateBackground = true; } else { this.FavDot = ResourceLoader.loadTexture ((int)this.width, 40, "UIMainPanel.Rows.bgrow_2.png"); this.FavDot.name = "FavDot_2"; this.FavCimsCitizenSingleRowBGSprite.texture = this.FavDot; FavoriteCimsMainPanel.RowAlternateBackground = false; } this.FavDot_hover = ResourceLoader.loadTexture ((int)this.width, 40, "UIMainPanel.Rows.bgrow_hover.png"); //this.FavCimsCitizenSingleRowBGSprite.opacity = 0.60f; this.FavCimsCitizenSingleRowPanel.eventMouseEnter += (UIComponent component, UIMouseEventParameter eventParam) => this.FavCimsCitizenSingleRowBGSprite.texture = this.FavDot_hover; this.FavCimsCitizenSingleRowPanel.eventMouseLeave += (UIComponent component, UIMouseEventParameter eventParam) => this.FavCimsCitizenSingleRowBGSprite.texture = this.FavDot; //////////////////////// //Happiness Column Panel //////////////////////// this.FavCimsCitizenHappinessPanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsCitizenHappinessPanel.name = "FavCimsCitizenHappinessPanel"; this.FavCimsCitizenHappinessPanel.width = FavoriteCimsMainPanel.FavCimsHappinesColText.width; this.FavCimsCitizenHappinessPanel.height = 40; //Printing this.FavCimsCitizenHappinessPanel.relativePosition = new Vector3 (0, 0); //Happiness Icon this.FavCimsHappyIcon = this.FavCimsCitizenHappinessPanel.AddUIComponent<UIButton> (); this.FavCimsHappyIcon.width = 30; this.FavCimsHappyIcon.height = 30; this.FavCimsHappyIcon.isEnabled = false; this.FavCimsHappyIcon.playAudioEvents = false; this.FavCimsHappyIcon.tooltipBox = UIView.GetAView().defaultTooltipBox; //Printing this.FavCimsHappyIcon.relativePosition = new Vector3 (15, 5); //Happiness Icon Override (if citizen is gone away) this.FavCimsHappyOverride = this.FavCimsHappyIcon.AddUIComponent<UITextureSprite> (); this.FavCimsHappyOverride.width = 30; this.FavCimsHappyOverride.height = 30; this.FavCimsHappyOverride.tooltipBox = UIView.GetAView().defaultTooltipBox; /////////////////// //Name Column Panel /////////////////// this.FavCimsCitizenNamePanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsCitizenNamePanel.name = "FavCimsCitizenNamePanel"; this.FavCimsCitizenNamePanel.width = FavoriteCimsMainPanel.FavCimsNameColText.width; this.FavCimsCitizenNamePanel.height = 40; //Printing this.FavCimsCitizenNamePanel.relativePosition = new Vector3 (this.FavCimsCitizenHappinessPanel.relativePosition.x + this.FavCimsCitizenHappinessPanel.width, 0); //Name Button this.FavCimsCitizenName = this.FavCimsCitizenNamePanel.AddUIComponent<UIButton> (); this.FavCimsCitizenName.name = "FavCimsCitizenName"; this.FavCimsCitizenName.width = this.FavCimsCitizenNamePanel.width; this.FavCimsCitizenName.height = this.FavCimsCitizenNamePanel.height; this.FavCimsCitizenName.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsCitizenName.textHorizontalAlignment = UIHorizontalAlignment.Left; this.FavCimsCitizenName.playAudioEvents = true; this.FavCimsCitizenName.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsCitizenName.font.size = 15; this.FavCimsCitizenName.textScale = 1f; this.FavCimsCitizenName.wordWrap = true; this.FavCimsCitizenName.textPadding.left = 40; this.FavCimsCitizenName.textPadding.right = 5; this.FavCimsCitizenName.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.FavCimsCitizenName.hoveredTextColor = new Color32 (204, 102, 0, 20); this.FavCimsCitizenName.pressedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsCitizenName.focusedTextColor = new Color32 (153, 0, 0, 0); this.FavCimsCitizenName.useDropShadow = true; this.FavCimsCitizenName.dropShadowOffset = new Vector2 (1, -1); this.FavCimsCitizenName.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsCitizenName.maximumSize = new Vector2 (this.FavCimsCitizenNamePanel.width, this.FavCimsCitizenNamePanel.height); this.FavCimsCitizenName.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsCitizenName.eventMouseDown += (component, eventParam) => this.GoToCitizen(MyInstanceID); this.FavCimsNameColText_EmptySprite = this.FavCimsCitizenNamePanel.AddUIComponent<UITextureSprite> (); this.FavCimsNameColText_EmptySprite.width = this.FavCimsCitizenName.width; this.FavCimsNameColText_EmptySprite.height = this.FavCimsCitizenName.height; this.FavCimsNameColText_EmptySprite.relativePosition = new Vector3 (0, 0); if(FavoriteCimsMainPanel.ColumnSpecialBackground == true) { this.FavCimsNameColText_EmptySprite.texture = ResourceLoader.loadTexture ((int)this.FavCimsNameColText_EmptySprite.width, (int)this.FavCimsNameColText_EmptySprite.height, "UIMainPanel.submenubar.png"); this.FavCimsNameColText_EmptySprite.opacity = 0.7f; } FavoriteCimsMainPanel.FavCimsNameColText.eventClick += delegate { if (this.FavCimsNameColText_EmptySprite.texture == null) { this.FavCimsNameColText_EmptySprite.texture = ResourceLoader.loadTexture ((int)this.FavCimsNameColText_EmptySprite.width, (int)this.FavCimsNameColText_EmptySprite.height, "UIMainPanel.submenubar.png"); this.FavCimsNameColText_EmptySprite.opacity = 0.7f; FavoriteCimsMainPanel.ColumnSpecialBackground = true; } else { this.FavCimsNameColText_EmptySprite.texture = null; FavoriteCimsMainPanel.ColumnSpecialBackground = false; } }; //Printing this.FavCimsCitizenName.BringToFront (); this.FavCimsCitizenName.relativePosition = new Vector3 (0, 0); //Citizen Info Panel Button Toggle this.OtherInfoButton = this.FavCimsCitizenNamePanel.AddUIComponent<UIButton> (); this.OtherInfoButton.name = "FavCimsOtherInfoButton"; this.OtherInfoButton.width = 20; this.OtherInfoButton.height = 20; this.OtherInfoButton.playAudioEvents = true; this.OtherInfoButton.normalBgSprite = "CityInfo"; this.OtherInfoButton.hoveredBgSprite = "CityInfoHovered"; this.OtherInfoButton.pressedBgSprite = "CityInfoPressed"; //this.OtherInfoButton.focusedBgSprite = "CityInfoFocused"; this.OtherInfoButton.disabledBgSprite = "CityInfoDisabled"; this.OtherInfoButton.tooltipBox = UIView.GetAView().defaultTooltipBox; //Printing this.OtherInfoButton.relativePosition = new Vector3(10,10); //Family Panel Toggle this.OtherInfoButton.eventClick += delegate { try { if(this.MyFamily == null && GetTemplate() >= 0) { this.MyFamily = FavCimsMainClass.Templates[GetTemplate()]; this.MyFamily.MyInstanceID = this.MyInstanceID; this.MyFamily.Show(); this.MyFamily.BringToFront (); this.OtherInfoButton.normalBgSprite = "CityInfoFocused"; }else if (this.MyFamily != null && !this.MyFamily.isVisible) { this.MyFamily.MyInstanceID = this.MyInstanceID; this.MyFamily.Show(); this.MyFamily.BringToFront (); this.OtherInfoButton.normalBgSprite = "CityInfoFocused"; }else{ if(this.MyFamily != null) { this.MyFamily.Hide(); this.MyFamily.MyInstanceID = InstanceID.Empty; this.MyFamily = null; this.OtherInfoButton.normalBgSprite = "CityInfo"; } } }catch (Exception e) { Debug.Error("Error when loading the template : " + e.ToString()); } }; //Icon Separator_2 this.FavCimsSeparatorSprite2 = this.FavCimsCitizenNamePanel.AddUIComponent<UITextureSprite> (); this.FavCimsSeparatorSprite2.name = "FavCimsSeparatorSprite2"; this.FavCimsSeparatorSprite2.texture = TextureDB.FavCimsSeparator; this.FavCimsSeparatorSprite2.relativePosition = new Vector3 (0, 0); /////////////////// //Age Phase Column Panel /////////////////// this.FavCimsAgePhasePanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsAgePhasePanel.name = "FavCimsAgePhasePanel"; this.FavCimsAgePhasePanel.width = FavoriteCimsMainPanel.FavCimsAgePhaseColText.width; this.FavCimsAgePhasePanel.height = 40; //Printing this.FavCimsAgePhasePanel.relativePosition = new Vector3 (this.FavCimsCitizenNamePanel.relativePosition.x + this.FavCimsCitizenNamePanel.width, 0); //Age Phase Button this.FavCimsAgePhase = this.FavCimsAgePhasePanel.AddUIComponent<UIButton> (); this.FavCimsAgePhase.name = "FavCimsAgePhase"; this.FavCimsAgePhase.width = this.FavCimsAgePhasePanel.width; this.FavCimsAgePhase.height = this.FavCimsAgePhasePanel.height; this.FavCimsAgePhase.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsAgePhase.textHorizontalAlignment = UIHorizontalAlignment.Center; this.FavCimsAgePhase.playAudioEvents = true; this.FavCimsAgePhase.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsAgePhase.font.size = 15; this.FavCimsAgePhase.textScale = 1f; this.FavCimsAgePhase.wordWrap = true; this.FavCimsAgePhase.textPadding.left = 5; this.FavCimsAgePhase.textPadding.right = 5; this.FavCimsAgePhase.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsAgePhase.outlineSize = 1; this.FavCimsAgePhase.outlineColor = new Color32 (0, 0, 0, 0); this.FavCimsAgePhase.useDropShadow = true; this.FavCimsAgePhase.dropShadowOffset = new Vector2 (1, -1); this.FavCimsAgePhase.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsAgePhase.maximumSize = new Vector2 (this.FavCimsAgePhasePanel.width, this.FavCimsAgePhasePanel.height); this.FavCimsAgePhase.isInteractive = false; //Printing this.FavCimsAgePhase.relativePosition = new Vector3 (0, 0); //Icon Separator_3 this.FavCimsSeparatorSprite3 = this.FavCimsAgePhasePanel.AddUIComponent<UITextureSprite> (); this.FavCimsSeparatorSprite3.name = "FavCimsSeparatorSprite3"; this.FavCimsSeparatorSprite3.texture = TextureDB.FavCimsSeparator; this.FavCimsSeparatorSprite3.relativePosition = new Vector3 (0, 0); /////////////////// //Age Column Panel /////////////////// this.FavCimsRealAgePanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsRealAgePanel.name = "FavCimsRealAgePanel"; this.FavCimsRealAgePanel.width = FavoriteCimsMainPanel.FavCimsAgeColText.width; this.FavCimsRealAgePanel.height = 40; //Printing this.FavCimsRealAgePanel.relativePosition = new Vector3 (this.FavCimsAgePhasePanel.relativePosition.x + this.FavCimsAgePhasePanel.width, 0); //Real Age Button this.FavCimsRealAge = this.FavCimsRealAgePanel.AddUIComponent<UIButton> (); this.FavCimsRealAge.name = "FavCimsRealAge"; this.FavCimsRealAge.width = this.FavCimsRealAgePanel.width; this.FavCimsRealAge.height = this.FavCimsRealAgePanel.height; this.FavCimsRealAge.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsRealAge.textHorizontalAlignment = UIHorizontalAlignment.Center; this.FavCimsRealAge.playAudioEvents = true; this.FavCimsRealAge.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsRealAge.font.size = 15; this.FavCimsRealAge.textScale = 1f; this.FavCimsRealAge.wordWrap = true; this.FavCimsRealAge.textPadding.left = 5; this.FavCimsRealAge.textPadding.right = 5; this.FavCimsRealAge.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsRealAge.outlineSize = 1; this.FavCimsRealAge.outlineColor = new Color32 (0, 0, 0, 0); //this.FavCimsRealAge.hoveredTextColor = new Color32 (204, 102, 0, 20); //this.FavCimsRealAge.pressedTextColor = new Color32 (153, 0, 0, 0); //this.FavCimsRealAge.focusedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsRealAge.useDropShadow = true; this.FavCimsRealAge.dropShadowOffset = new Vector2 (1, -1); this.FavCimsRealAge.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsRealAge.maximumSize = new Vector2 (this.FavCimsRealAgePanel.width, this.FavCimsRealAgePanel.height); //this.FavCimsRealAge.isEnabled = false; this.FavCimsRealAge.isInteractive = false; //Printing this.FavCimsRealAge.relativePosition = new Vector3 (0, 0); //Icon Separator_4 this.FavCimsSeparatorSprite4 = this.FavCimsRealAgePanel.AddUIComponent<UITextureSprite> (); this.FavCimsSeparatorSprite4.name = "FavCimsSeparatorSprite4"; this.FavCimsSeparatorSprite4.texture = TextureDB.FavCimsSeparator; this.FavCimsSeparatorSprite4.relativePosition = new Vector3 (0, 0); /////////////////// //Education Column Panel /////////////////// this.FavCimsEducationPanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsEducationPanel.name = "FavCimsEducationPanel"; this.FavCimsEducationPanel.width = FavoriteCimsMainPanel.FavCimsEduColText.width; this.FavCimsEducationPanel.height = 40; //Printing this.FavCimsEducationPanel.relativePosition = new Vector3 (this.FavCimsRealAgePanel.relativePosition.x + this.FavCimsRealAgePanel.width, 0); //Education Button this.FavCimsEducation = this.FavCimsEducationPanel.AddUIComponent<UIButton> (); this.FavCimsEducation.name = "FavCimsEducation"; this.FavCimsEducation.width = this.FavCimsEducationPanel.width; this.FavCimsEducation.height = this.FavCimsEducationPanel.height; this.FavCimsEducation.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsEducation.textHorizontalAlignment = UIHorizontalAlignment.Center; this.FavCimsEducation.playAudioEvents = true; this.FavCimsEducation.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsEducation.font.size = 15; this.FavCimsEducation.textScale = 1f; this.FavCimsEducation.wordWrap = true; this.FavCimsEducation.textPadding.left = 5; this.FavCimsEducation.textPadding.right = 5; this.FavCimsEducation.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsEducation.outlineSize = 1; this.FavCimsEducation.outlineColor = new Color32 (0, 0, 0, 0); //this.FavCimsEducation.hoveredTextColor = new Color32 (204, 102, 0, 20); //this.FavCimsEducation.pressedTextColor = new Color32 (153, 0, 0, 0); //this.FavCimsEducation.focusedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsEducation.useDropShadow = true; this.FavCimsEducation.dropShadowOffset = new Vector2 (1, -1); this.FavCimsEducation.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsEducation.maximumSize = new Vector2 (this.FavCimsEducationPanel.width, this.FavCimsEducationPanel.height); //this.FavCimsEducation.isEnabled = false; this.FavCimsEducation.isInteractive = false; //Printing this.FavCimsEducation.relativePosition = new Vector3 (0, 0); //Icon Separator_5 this.FavCimsSeparatorSprite5 = this.FavCimsEducationPanel.AddUIComponent<UITextureSprite> (); this.FavCimsSeparatorSprite5.name = "FavCimsSeparatorSprite5"; this.FavCimsSeparatorSprite5.texture = TextureDB.FavCimsSeparator; this.FavCimsSeparatorSprite5.relativePosition = new Vector3 (0, 0); /////////////////// //Home Column Panel /////////////////// this.FavCimsCitizenHomePanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsCitizenHomePanel.name = "FavCimsCitizenHomePanel"; this.FavCimsCitizenHomePanel.width = FavoriteCimsMainPanel.FavCimsHomeColText.width; this.FavCimsCitizenHomePanel.height = 40; //Printing this.FavCimsCitizenHomePanel.relativePosition = new Vector3 (this.FavCimsEducationPanel.relativePosition.x + this.FavCimsEducationPanel.width, 0); //Home Building this.FavCimsCitizenHome = this.FavCimsCitizenHomePanel.AddUIComponent<UIButton> (); this.FavCimsCitizenHome.name = "FavCimsCitizenHome"; this.FavCimsCitizenHome.width = this.FavCimsCitizenHomePanel.width; this.FavCimsCitizenHome.height = this.FavCimsCitizenHomePanel.height; this.FavCimsCitizenHome.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsCitizenHome.textHorizontalAlignment = UIHorizontalAlignment.Left; //this.FavCimsCitizenHome.textPadding.left = 5; this.FavCimsCitizenHome.playAudioEvents = true; this.FavCimsCitizenHome.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsCitizenHome.font.size = 15; this.FavCimsCitizenHome.textScale = 0.85f; this.FavCimsCitizenHome.wordWrap = true; this.FavCimsCitizenHome.textPadding.left = 40; this.FavCimsCitizenHome.textPadding.right = 5; this.FavCimsCitizenHome.outlineColor = new Color32 (0, 0, 0, 0); this.FavCimsCitizenHome.outlineSize = 1; this.FavCimsCitizenHome.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.FavCimsCitizenHome.hoveredTextColor = new Color32 (204, 102, 0, 20); this.FavCimsCitizenHome.pressedTextColor = new Color32 (153, 0, 0, 0); this.FavCimsCitizenHome.focusedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsCitizenHome.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsCitizenHome.useDropShadow = true; this.FavCimsCitizenHome.dropShadowOffset = new Vector2 (1, -1); this.FavCimsCitizenHome.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsCitizenHome.maximumSize = new Vector2 (this.FavCimsCitizenHomePanel.width, this.FavCimsCitizenHomePanel.height); this.FavCimsCitizenHome.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsCitizenHome.eventMouseDown += new MouseEventHandler(this.GoToHome); //Printing this.FavCimsCitizenHome.relativePosition = new Vector3 (0, 0); //Home sprites this.FavCimsCitizenHomeSprite = this.FavCimsCitizenHomePanel.AddUIComponent<UITextureSprite> (); this.FavCimsCitizenHomeSprite.name = "FavCimsCitizenHomeSprite"; this.FavCimsCitizenHomeSprite.relativePosition = new Vector3 (10, 0); this.FavCimsCitizenHomeSprite.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsCitizenResidentialLevelSprite = this.FavCimsCitizenHomeSprite.AddUIComponent<UITextureSprite> (); this.FavCimsCitizenResidentialLevelSprite.name = "FavCimsCitizenResidentialLevelSprite"; this.FavCimsCitizenResidentialLevelSprite.relativePosition = new Vector3 (0, 0); //Icon Separator_6 this.FavCimsSeparatorSprite6 = this.FavCimsCitizenHomePanel.AddUIComponent<UITextureSprite> (); this.FavCimsSeparatorSprite6.name = "FavCimsSeparatorSprite6"; this.FavCimsSeparatorSprite6.texture = TextureDB.FavCimsSeparator; this.FavCimsSeparatorSprite6.relativePosition = new Vector3 (0, 0); /////////////////// //Work Column Panel /////////////////// this.FavCimsWorkingPlacePanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsWorkingPlacePanel.name = "FavCimsWorkingPlacePanel"; this.FavCimsWorkingPlacePanel.width = FavoriteCimsMainPanel.FavCimsWorkingPlaceColText.width; this.FavCimsWorkingPlacePanel.height = 40; //Printing this.FavCimsWorkingPlacePanel.relativePosition = new Vector3 (this.FavCimsCitizenHomePanel.relativePosition.x + this.FavCimsCitizenHomePanel.width, 0); //Work Building this.FavCimsWorkingPlace = this.FavCimsWorkingPlacePanel.AddUIComponent<UIButton> (); this.FavCimsWorkingPlace.name = "FavCimsWorkingPlace"; this.FavCimsWorkingPlace.width = this.FavCimsWorkingPlacePanel.width; this.FavCimsWorkingPlace.height = this.FavCimsWorkingPlacePanel.height; this.FavCimsWorkingPlace.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsWorkingPlace.textHorizontalAlignment = UIHorizontalAlignment.Left; this.FavCimsWorkingPlace.playAudioEvents = true; this.FavCimsWorkingPlace.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsWorkingPlace.font.size = 15; this.FavCimsWorkingPlace.textScale = 0.85f; this.FavCimsWorkingPlace.wordWrap = true; this.FavCimsWorkingPlace.textPadding.left = 40; this.FavCimsWorkingPlace.textPadding.right = 5; this.FavCimsWorkingPlace.outlineColor = new Color32 (0, 0, 0, 0); this.FavCimsWorkingPlace.outlineSize = 1; this.FavCimsWorkingPlace.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.FavCimsWorkingPlace.hoveredTextColor = new Color32 (204, 102, 0, 20); this.FavCimsWorkingPlace.pressedTextColor = new Color32 (153, 0, 0, 0); this.FavCimsWorkingPlace.focusedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsWorkingPlace.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsWorkingPlace.useDropShadow = true; this.FavCimsWorkingPlace.dropShadowOffset = new Vector2 (1, -1); this.FavCimsWorkingPlace.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsWorkingPlace.maximumSize = new Vector2 (this.FavCimsWorkingPlacePanel.width, this.FavCimsWorkingPlacePanel.height); this.FavCimsWorkingPlace.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsWorkingPlace.eventMouseDown += new MouseEventHandler(this.GoToWork); //Printing this.FavCimsWorkingPlace.relativePosition = new Vector3 (0, 0); //Work sprites this.FavCimsWorkingPlaceSprite = this.FavCimsWorkingPlacePanel.AddUIComponent<UITextureSprite> (); this.FavCimsWorkingPlaceSprite.name = "FavCimsWorkingPlaceSprite"; this.FavCimsWorkingPlaceSprite.width = 20; this.FavCimsWorkingPlaceSprite.height = 40; this.FavCimsWorkingPlaceSprite.relativePosition = new Vector3 (10, 0); this.FavCimsWorkingPlaceSprite.tooltipBox = UIView.GetAView().defaultTooltipBox; //I will put all icons inside the atlas soon. this.FavCimsWorkingPlaceButtonGamDefImg = this.FavCimsWorkingPlaceSprite.AddUIComponent<UIButton> (); this.FavCimsWorkingPlaceButtonGamDefImg.name = "FavCimsWorkingPlaceButtonGamDefImg"; this.FavCimsWorkingPlaceButtonGamDefImg.width = 20; this.FavCimsWorkingPlaceButtonGamDefImg.height = 20; this.FavCimsWorkingPlaceButtonGamDefImg.relativePosition = new Vector3 (0, 10); this.FavCimsWorkingPlaceButtonGamDefImg.isInteractive = false; this.FavCimsWorkingPlaceButtonGamDefImg.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsCitizenWorkPlaceLevelSprite = this.FavCimsWorkingPlaceSprite.AddUIComponent<UITextureSprite> (); this.FavCimsCitizenWorkPlaceLevelSprite.name = "FavCimsCitizenWorkPlaceLevelSprite"; this.FavCimsCitizenWorkPlaceLevelSprite.relativePosition = new Vector3 (0, 0); //Icon Separator_7 this.FavCimsSeparatorSprite7 = this.FavCimsWorkingPlacePanel.AddUIComponent<UITextureSprite> (); this.FavCimsSeparatorSprite7.name = "FavCimsSeparatorSprite7"; this.FavCimsSeparatorSprite7.texture = TextureDB.FavCimsSeparator; this.FavCimsSeparatorSprite7.relativePosition = new Vector3 (0, 0); /////////////////// //Last Activity Column Panel /////////////////// this.FavCimsLastActivityPanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsLastActivityPanel.name = "FavCimsLastActivityPanel"; this.FavCimsLastActivityPanel.width = FavoriteCimsMainPanel.FavCimsLastActColText.width; this.FavCimsLastActivityPanel.height = 40; //Printing this.FavCimsLastActivityPanel.relativePosition = new Vector3 (this.FavCimsWorkingPlacePanel.relativePosition.x + this.FavCimsWorkingPlacePanel.width, 0); //Last Activity this.FavCimsLastActivity = this.FavCimsLastActivityPanel.AddUIComponent<UIButton> (); this.FavCimsLastActivity.name = "FavCimsLastActivity"; this.FavCimsLastActivity.width = this.FavCimsLastActivityPanel.width-40; this.FavCimsLastActivity.height = this.FavCimsLastActivityPanel.height; this.FavCimsLastActivity.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsLastActivity.textHorizontalAlignment = UIHorizontalAlignment.Left; this.FavCimsLastActivity.playAudioEvents = true; this.FavCimsLastActivity.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsLastActivity.font.size = 15; this.FavCimsLastActivity.textScale = 0.85f; this.FavCimsLastActivity.wordWrap = true; this.FavCimsLastActivity.textPadding.left = 0; this.FavCimsLastActivity.textPadding.right = 5; this.FavCimsLastActivity.outlineColor = new Color32 (0, 0, 0, 0); this.FavCimsLastActivity.outlineSize = 1; this.FavCimsLastActivity.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.FavCimsLastActivity.hoveredTextColor = new Color32 (204, 102, 0, 20); this.FavCimsLastActivity.pressedTextColor = new Color32 (153, 0, 0, 0); this.FavCimsLastActivity.focusedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsLastActivity.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsLastActivity.useDropShadow = true; this.FavCimsLastActivity.dropShadowOffset = new Vector2 (1, -1); this.FavCimsLastActivity.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsLastActivity.maximumSize = new Vector2 (this.FavCimsLastActivityPanel.width-40, this.FavCimsLastActivityPanel.height); this.FavCimsLastActivity.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsLastActivity.eventMouseDown += new MouseEventHandler(this.GoToTarget); //Printing this.FavCimsLastActivity.relativePosition = new Vector3 (40, 0); //Last Activity Button this.FavCimsLastActivityVehicleButton = this.FavCimsLastActivityPanel.AddUIComponent<UIButton> (); this.FavCimsLastActivityVehicleButton.name = "FavCimsLastActivityVehicleButton"; this.FavCimsLastActivityVehicleButton.width = 26; this.FavCimsLastActivityVehicleButton.height = 26; this.FavCimsLastActivityVehicleButton.relativePosition = new Vector3 (5, 7); this.FavCimsLastActivityVehicleButton.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsLastActivityVehicleButton.eventMouseDown += new MouseEventHandler(this.GoToVehicle); //Icon Separator_8 this.FavCimsSeparatorSprite8 = this.FavCimsLastActivityPanel.AddUIComponent<UITextureSprite> (); this.FavCimsSeparatorSprite8.name = "FavCimsSeparatorSprite8"; this.FavCimsSeparatorSprite8.texture = TextureDB.FavCimsSeparator; this.FavCimsSeparatorSprite8.relativePosition = new Vector3 (0, 0); /////////////////// //Close Row Column Panel /////////////////// this.FavCimsCloseRowPanel = this.FavCimsCitizenSingleRowPanel.AddUIComponent<UIPanel> (); this.FavCimsCloseRowPanel.name = "FavCimsCloseRowPanel"; this.FavCimsCloseRowPanel.width = FavoriteCimsMainPanel.FavCimsCloseButtonCol.width; this.FavCimsCloseRowPanel.height = 40; //Printing this.FavCimsCloseRowPanel.relativePosition = new Vector3 (this.FavCimsLastActivityPanel.relativePosition.x + FavCimsLastActivityPanel.width, 0); //Close row & unfollow citizen Button this.FavCimsRowCloseButton = this.FavCimsCloseRowPanel.AddUIComponent<UIButton> (); this.FavCimsRowCloseButton.name = "FavCimsRowCloseButton"; this.FavCimsRowCloseButton.width = 26; this.FavCimsRowCloseButton.height = 26; this.FavCimsRowCloseButton.normalBgSprite = "buttonclose"; this.FavCimsRowCloseButton.hoveredBgSprite = "buttonclosehover"; this.FavCimsRowCloseButton.pressedBgSprite = "buttonclosepressed"; this.FavCimsRowCloseButton.opacity = 0.9f; //this.FavCimsRowCloseButton.useOutline = true; this.FavCimsRowCloseButton.playAudioEvents = true; this.FavCimsRowCloseButton.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsRowCloseButton.eventClick += delegate { try { FavCimsCore.RemoveRowAndRemoveFav(this.MyInstanceID, citizenINT); if(this.MyFamily != null) { this.MyFamily.Hide(); this.MyFamily.MyInstanceID = InstanceID.Empty; this.MyFamily = null; } if(UIView.Find<UILabel>("DefaultTooltip")) UIView.Find<UILabel>("DefaultTooltip").Hide(); GameObject.Destroy(this.gameObject); }catch(Exception e) { Debug.Error("Can't remove row " + e.ToString()); } }; //Printing this.FavCimsRowCloseButton.relativePosition = new Vector3 ((this.FavCimsCloseRowPanel.width / 2) - (this.FavCimsRowCloseButton.width / 2), 7); //Icon Separator_9 this.FavCimsSeparatorSprite9 = this.FavCimsCloseRowPanel.AddUIComponent<UITextureSprite> (); this.FavCimsSeparatorSprite9.name = "FavCimsSeparatorSprite9"; this.FavCimsSeparatorSprite9.texture = TextureDB.FavCimsSeparator; this.FavCimsSeparatorSprite9.relativePosition = new Vector3 (0, 0); //Row end// } } catch (Exception e) { Debug.Error ("CitizenRow Create Error : " + e.ToString ()); } }
private void Setup() { width = parent.width; height = 122f; autoLayout = true; autoLayoutDirection = LayoutDirection.Horizontal; padding = new RectOffset(10, 0, 0, 0); autoLayoutPadding = new RectOffset(0, 0, 0, 0); isInteractive = true; builtinKeyNavigation = true; relativePosition = new Vector2(410.0f, 0.0f); ScrollablePanel = AddUIComponent <UIScrollablePanel>(); ScrollablePanel.zOrder = 0; ScrollablePanel.width = 366f; ScrollablePanel.height = height; ScrollablePanel.autoLayout = true; ScrollablePanel.wrapLayout = true; ScrollablePanel.clipChildren = true; ScrollablePanel.backgroundSprite = "TextFieldPanel"; ScrollablePanel.autoLayoutDirection = LayoutDirection.Horizontal; ScrollablePanel.autoLayoutPadding = new RectOffset(2, 2, 2, 2); ScrollablePanel.color = new Color32(255, 255, 255, 255); ScrollablePanel.isInteractive = true; ScrollablePanel.builtinKeyNavigation = true; ScrollablePanel.scrollWheelDirection = UIOrientation.Vertical; ScrollablePanel.scrollWithArrowKeys = true; Dictionary <string, Texture2D> brushes = ForestBrush.Instance.GetBrushBitmaps(); foreach (KeyValuePair <string, Texture2D> brush in brushes) { UIButton button = ScrollablePanel.AddUIComponent <UIButton>(); button.atlas = ResourceLoader.Atlas; button.normalBgSprite = ResourceLoader.GenericPanel; if (UserMod.Settings.SelectedBrush != null && UserMod.Settings.SelectedBrush.Options != null && UserMod.Settings.SelectedBrush.Options.BitmapID == brush.Key) { button.normalBgSprite = string.Empty; } button.color = new Color32(170, 170, 170, 255); button.hoveredColor = new Color32(210, 210, 210, 255); button.focusedColor = Color.white; button.pressedColor = Color.white; button.size = new Vector2(57.0f, 57.0f); UITextureSprite sprite = button.AddUIComponent <UITextureSprite>(); sprite.size = button.size - new Vector2(4.0f, 4.0f); sprite.relativePosition = new Vector2(2.0f, 2.0f); sprite.texture = brush.Value; button.objectUserData = brush.Key; button.eventClicked += Button_eventClicked; BrushButtons.Add(brush.Key, button); } UIScrollbar scrollbar = AddUIComponent <UIScrollbar>(); scrollbar.zOrder = 1; scrollbar.width = 13f; scrollbar.height = ScrollablePanel.height; scrollbar.orientation = UIOrientation.Vertical; scrollbar.minValue = 0; scrollbar.value = 0; scrollbar.incrementAmount = 61; UISlicedSprite tracSprite = scrollbar.AddUIComponent <UISlicedSprite>(); tracSprite.atlas = ResourceLoader.Atlas; tracSprite.relativePosition = new Vector3(0, 0); tracSprite.autoSize = true; tracSprite.size = tracSprite.parent.size; tracSprite.fillDirection = UIFillDirection.Vertical; tracSprite.spriteName = ResourceLoader.LevelBarBackground; scrollbar.trackObject = tracSprite; UISlicedSprite thumbSprite = tracSprite.AddUIComponent <UISlicedSprite>(); thumbSprite.atlas = ResourceLoader.Atlas; thumbSprite.relativePosition = Vector2.zero; thumbSprite.fillDirection = UIFillDirection.Vertical; thumbSprite.autoSize = true; thumbSprite.width = 13f; thumbSprite.spriteName = ResourceLoader.LevelBarForeground; scrollbar.thumbObject = thumbSprite; ScrollablePanel.verticalScrollbar = scrollbar; owner = (ForestBrushPanel)parent; }
public override void Start() { base.Start(); backgroundSprite = "GenericPanel"; // Preview m_preview = AddUIComponent<UITextureSprite>(); m_preview.size = size; m_preview.relativePosition = Vector3.zero; m_noPreview = AddUIComponent<UISprite>(); m_noPreview.spriteName = "Niet"; m_noPreview.relativePosition = new Vector3((width - m_noPreview.spriteInfo.width) / 2, (height - m_noPreview.spriteInfo.height) / 2); m_previewRenderer = gameObject.AddComponent<PreviewRenderer>(); m_previewRenderer.size = m_preview.size * 2; // Twice the size for anti-aliasing eventMouseDown += (c, p) => { eventMouseMove += RotateCamera; }; eventMouseUp += (c, p) => { eventMouseMove -= RotateCamera; }; eventMouseWheel += (c, p) => { m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f; RenderPreview(); }; // Name m_buildingName = AddUIComponent<UILabel>(); m_buildingName.textScale = 0.9f; m_buildingName.useDropShadow = true; m_buildingName.dropShadowColor = new Color32(80, 80, 80, 255); m_buildingName.dropShadowOffset = new Vector2(2, -2); m_buildingName.text = "Name"; m_buildingName.isVisible = false; m_buildingName.relativePosition = new Vector3(5, 10); // Category icon m_categoryIcon = AddUIComponent<UISprite>(); m_categoryIcon.size = new Vector2(35, 35); m_categoryIcon.isVisible = false; m_categoryIcon.relativePosition = new Vector3(width - 37, 2); // Level m_level = AddUIComponent<UILabel>(); m_level.textScale = 0.9f; m_level.useDropShadow = true; m_level.dropShadowColor = new Color32(80, 80, 80, 255); m_level.dropShadowOffset = new Vector2(2, -2); m_level.text = "Level"; m_level.isVisible = false; m_level.relativePosition = new Vector3(5, height - 20); // Size m_size = AddUIComponent<UILabel>(); m_size.textScale = 0.9f; m_size.useDropShadow = true; m_size.dropShadowColor = new Color32(80, 80, 80, 255); m_size.dropShadowOffset = new Vector2(2, -2); m_size.text = "Size"; m_size.isVisible = false; m_size.relativePosition = new Vector3(width - 50, height - 20); }
internal void FamilyVehicle(uint m_citizen, UITextureSprite sPrite, out InstanceID MyCitVeh) { MyCitVeh = InstanceID.Empty; if (m_citizen == 0) return; try { ushort FamVehicle = this.MyCitizen.m_citizens.m_buffer [m_citizen].m_vehicle; ushort FamVehicleParked = this.MyCitizen.m_citizens.m_buffer [m_citizen].m_parkedVehicle; VehicleInfo VehInfo; VehicleParked VehParked; if (FamVehicle != 0) { MyCitVeh.Vehicle = FamVehicle; VehInfo = this.MyVehicle.m_vehicles.m_buffer [FamVehicle].Info; if (VehInfo.m_vehicleAI.GetOwnerID (FamVehicle, ref MyVehicle.m_vehicles.m_buffer [FamVehicle]).Citizen == m_citizen) { //sta usando la sua macchina //this.CarOwner = m_citizen; sPrite.texture = TextureDB.BubbleCar; sPrite.playAudioEvents = true; sPrite.tooltip = this.MyVehicle.GetVehicleName (FamVehicle) + " " + Locale.Get("VEHICLE_OWNER") + " - " + this.MyCitizen.GetCitizenName (m_citizen); } } else if (FamVehicleParked != 0) { MyCitVeh.ParkedVehicle = FamVehicleParked; //VehInfo = this.MyVehicle.m_parkedVehicles.m_buffer[FamVehicleParked].Info; VehParked = this.MyVehicle.m_parkedVehicles.m_buffer[FamVehicleParked]; if (VehParked.m_ownerCitizen == m_citizen) { //sta usando la sua macchina //this.CarOwner = m_citizen; sPrite.texture = TextureDB.BubbleCar; sPrite.playAudioEvents = true; sPrite.tooltip = this.MyVehicle.GetParkedVehicleName (FamVehicleParked) + " (" + Locale.Get("VEHICLE_STATUS_PARKED") + ")" + " - " + Locale.Get("VEHICLE_OWNER") + " " + this.MyCitizen.GetCitizenName (m_citizen); } } else { //this.CarOwner = 0; sPrite.texture = TextureDB.BubbleCarDisabled; sPrite.playAudioEvents = false; sPrite.tooltip = null; //this.FamilyVehicleID.Vehicle = 0; //this.FamilyVehicleID.ParkedVehicle = 0; } } catch /*(Exception e)*/ { //Debug.Error("Family Car Error - " + e.ToString()); } }
public override void Start() { //Atlas UITextureAtlas m_atlas = MyAtlas.FavCimsAtlas; //////////Main Family Panel//////////// this.width = 250; this.height = 500; this.clipChildren = true; //this.backgroundSprite = "CitizenBackground"; int RandXMin = 30; int RandXMax = Screen.width / 4; int RandYMin = 100; int RandYMax = Screen.height - (int)this.height - RandYMin; System.Random rnd = new System.Random (); //Family Panel Bg Sprite this.FavCimsOtherInfoSprite = this.AddUIComponent<UITextureSprite> (); this.FavCimsOtherInfoSprite.name = "FavCimsOtherInfoSprite"; this.FavCimsOtherInfoSprite.texture = TextureDB.FavCimsOtherInfoTexture; this.FavCimsOtherInfoSprite.width = this.width; this.FavCimsOtherInfoSprite.height = this.height; this.FavCimsOtherInfoSprite.relativePosition = Vector3.zero; //Header Panel this.BubbleHeaderPanel = this.AddUIComponent<UIPanel>(); this.BubbleHeaderPanel.name = "BubbleHeaderPanel"; this.BubbleHeaderPanel.width = 250; this.BubbleHeaderPanel.height = 41; this.BubbleHeaderPanel.relativePosition = new Vector3(0,0); //Icon Sprite this.BubbleHeaderIconSprite = this.BubbleHeaderPanel.AddUIComponent<UITextureSprite> (); this.BubbleHeaderIconSprite.name = "BubbleHeaderIconSprite"; this.BubbleHeaderIconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureMale; this.BubbleHeaderIconSprite.relativePosition = new Vector3 (9, this.BubbleHeaderPanel.relativePosition.y+9); //UIButton Name this.BubbleHeaderCitizenName = this.BubbleHeaderPanel.AddUIComponent<UIButton> (); this.BubbleHeaderCitizenName.name = "BubbleHeaderCitizenName"; this.BubbleHeaderCitizenName.width = this.BubbleHeaderPanel.width; this.BubbleHeaderCitizenName.height = this.BubbleHeaderPanel.height; this.BubbleHeaderCitizenName.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleHeaderCitizenName.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleHeaderCitizenName.playAudioEvents = false; this.BubbleHeaderCitizenName.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleHeaderCitizenName.font.size = 15; this.BubbleHeaderCitizenName.textScale = 1f; this.BubbleHeaderCitizenName.wordWrap = true; this.BubbleHeaderCitizenName.textPadding.left = 5; this.BubbleHeaderCitizenName.textPadding.right = 5; this.BubbleHeaderCitizenName.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleHeaderCitizenName.hoveredTextColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleHeaderCitizenName.pressedTextColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleHeaderCitizenName.focusedTextColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleHeaderCitizenName.useDropShadow = true; this.BubbleHeaderCitizenName.dropShadowOffset = new Vector2 (1, -1); this.BubbleHeaderCitizenName.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleHeaderCitizenName.relativePosition = Vector3.zero; //Panel Mover this.BubbleHeaderCitizenName.eventMouseDown += delegate { if(Input.GetMouseButton(0)) { if(this.GetComponentInChildren<WindowController>() != null) { this.PanelMover = this.GetComponentInChildren<WindowController>(); this.PanelMover.ComponentToMove = this; this.PanelMover.Stop = false; this.PanelMover.Start(); } else { this.PanelMover = this.AddUIComponent(typeof(WindowController)) as WindowController; this.PanelMover.ComponentToMove = this; } this.opacity = 0.5f; } }; //Panel Mover Close Event this.BubbleHeaderCitizenName.eventMouseUp += delegate { if(this.PanelMover != null) { this.PanelMover.Stop = true; this.PanelMover.ComponentToMove = null; this.PanelMover = null; } this.opacity = 1f; }; //Bubble Close Panel this.BubbleCloseButton = this.AddUIComponent<UIButton> (); this.BubbleCloseButton.name = "BubbleCloseButton"; this.BubbleCloseButton.width = 26; this.BubbleCloseButton.height = 26; this.BubbleCloseButton.normalBgSprite = "buttonclose"; this.BubbleCloseButton.hoveredBgSprite = "buttonclosehover"; this.BubbleCloseButton.pressedBgSprite = "buttonclosepressed"; this.BubbleCloseButton.opacity = 0.9f; //this.BubbleCloseButton.useOutline = true; this.BubbleCloseButton.playAudioEvents = true; this.BubbleCloseButton.tooltipBox = UIView.GetAView().defaultTooltipBox; this.BubbleCloseButton.eventClick += delegate { try { //GameObject.Destroy(this.gameObject); this.Hide(); this.MyInstanceID = InstanceID.Empty; }catch(Exception e) { Debug.Error("Can't remove family panel " + e.ToString()); } }; //Printing this.BubbleCloseButton.relativePosition = new Vector3 (this.BubbleHeaderPanel.width - 36, 7); //FamilyPortrait this.BubbleFamilyPortraitPanel = this.AddUIComponent<UIPanel>(); this.BubbleFamilyPortraitPanel.name = "BubbleFamilyPortraitPanel"; this.BubbleFamilyPortraitPanel.width = 242; this.BubbleFamilyPortraitPanel.height = 156; this.BubbleFamilyPortraitPanel.relativePosition = new Vector3(4,this.BubbleHeaderPanel.relativePosition.y+this.BubbleHeaderPanel.height); //Sprite CitizenDetail Background this.BubbleFamPortBgSpriteBack = this.BubbleFamilyPortraitPanel.AddUIComponent<UITextureSprite> (); this.BubbleFamPortBgSpriteBack.name = "BubbleFamPortBgSpriteBack"; this.BubbleFamPortBgSpriteBack.texture = TextureDB.BubbleFamPortBgSpriteBackTexture; this.BubbleFamPortBgSpriteBack.relativePosition = new Vector3 (4, 4); //Sprite CitizenDetail Foreground this.BubbleFamPortBgSprite = this.BubbleFamilyPortraitPanel.AddUIComponent<UITextureSprite> (); this.BubbleFamPortBgSprite.name = "BubbleFamPortBgSprite"; this.BubbleFamPortBgSprite.texture = TextureDB.BubbleFamPortBgSpriteTexture; this.BubbleFamPortBgSprite.relativePosition = Vector3.zero; //Panel (Happiness Icon + Age + Age Phase + Education (Label & Value)) this.BubbleRow1Panel = this.BubbleFamPortBgSprite.AddUIComponent<UIPanel> (); this.BubbleRow1Panel.name = "BubbleRow1Panel"; this.BubbleRow1Panel.width = 234; this.BubbleRow1Panel.height = 36; this.BubbleRow1Panel.relativePosition = new Vector3 (4, 4); //Happiness Container Panel this.BubbleRow1HappyPanel = this.BubbleRow1Panel.AddUIComponent<UIPanel> (); this.BubbleRow1HappyPanel.name = "BubbleRow1Panel"; this.BubbleRow1HappyPanel.width = 36; this.BubbleRow1HappyPanel.height = 36; this.BubbleRow1HappyPanel.relativePosition = Vector3.zero; //Happiness Icon this.BubbleRow1HappyIcon = this.BubbleRow1HappyPanel.AddUIComponent<UIButton> (); this.BubbleRow1HappyIcon.width = 26; this.BubbleRow1HappyIcon.height = 26; this.BubbleRow1HappyIcon.isEnabled = false; this.BubbleRow1HappyIcon.playAudioEvents = false; this.BubbleRow1HappyIcon.tooltipBox = UIView.GetAView().defaultTooltipBox; this.BubbleRow1HappyIcon.relativePosition = new Vector3 (4, 5); //Wellbeing Icon this.BubbleRow2WellbeingIcon = this.BubbleRow1HappyPanel.AddUIComponent<UIButton> (); this.BubbleRow2WellbeingIcon.width = 11; this.BubbleRow2WellbeingIcon.height = 11; this.BubbleRow2WellbeingIcon.isEnabled = false; this.BubbleRow2WellbeingIcon.playAudioEvents = false; this.BubbleRow2WellbeingIcon.tooltipBox = UIView.GetAView().defaultTooltipBox; this.BubbleRow2WellbeingIcon.relativePosition = new Vector3 (24, 5); //Labels & Values Container Panel this.BubbleRow1TextPanel = this.BubbleRow1Panel.AddUIComponent<UIPanel> (); this.BubbleRow1TextPanel.name = "BubbleRow1TextPanel"; this.BubbleRow1TextPanel.width = 198; this.BubbleRow1TextPanel.height = 37; this.BubbleRow1TextPanel.relativePosition = new Vector3 (36, 0); //Labels Container Sprite this.BubbleRow1LabelsSprite = this.BubbleRow1TextPanel.AddUIComponent<UITextureSprite> (); this.BubbleRow1LabelsSprite.name = "BubbleRow1LabelsSprite"; this.BubbleRow1LabelsSprite.width = 198; this.BubbleRow1LabelsSprite.height = 34; this.BubbleRow1LabelsSprite.texture = TextureDB.BubbleBgBar1Big; this.BubbleRow1LabelsSprite.relativePosition = new Vector3 (0, 3); //Age Label Panel this.BubbleRow1AgeLabelPanel = this.BubbleRow1LabelsSprite.AddUIComponent<UIPanel> (); this.BubbleRow1AgeLabelPanel.name = "BubbleRow1AgeLabelPanel"; this.BubbleRow1AgeLabelPanel.width = 32; this.BubbleRow1AgeLabelPanel.height = 17; this.BubbleRow1AgeLabelPanel.relativePosition = Vector3.zero; //Age Button (Label) Text this.BubbleCitizenAge = this.BubbleRow1AgeLabelPanel.AddUIComponent<UIButton> (); this.BubbleCitizenAge.name = "BubbleCitizenAge"; this.BubbleCitizenAge.width = this.BubbleRow1AgeLabelPanel.width; this.BubbleCitizenAge.height = this.BubbleRow1AgeLabelPanel.height; this.BubbleCitizenAge.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleCitizenAge.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleCitizenAge.font.size = 15; this.BubbleCitizenAge.textScale = 0.80f; this.BubbleCitizenAge.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenAge.outlineSize = 1; this.BubbleCitizenAge.textColor = new Color32 (0, 51, 102, 140); //r,g,b,a this.BubbleCitizenAge.isInteractive = false; this.BubbleCitizenAge.useDropShadow = true; this.BubbleCitizenAge.dropShadowOffset = new Vector2 (1, -1); this.BubbleCitizenAge.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenAge.relativePosition = new Vector3 (0, 1); //Age Phase Label Panel this.BubbleRow1AgePhaseLabelPanel = this.BubbleRow1LabelsSprite.AddUIComponent<UIPanel> (); this.BubbleRow1AgePhaseLabelPanel.name = "BubbleRow1AgePhaseLabelPanel"; this.BubbleRow1AgePhaseLabelPanel.width = 100; this.BubbleRow1AgePhaseLabelPanel.height = 17; this.BubbleRow1AgePhaseLabelPanel.relativePosition = new Vector3 (32, 0); //Age Phase Button (Label) Text this.BubbleCitizenAgePhase = this.BubbleRow1AgePhaseLabelPanel.AddUIComponent<UIButton> (); this.BubbleCitizenAgePhase.name = "BubbleCitizenAgePhase"; this.BubbleCitizenAgePhase.width = this.BubbleRow1AgePhaseLabelPanel.width; this.BubbleCitizenAgePhase.height = this.BubbleRow1AgePhaseLabelPanel.height; this.BubbleCitizenAgePhase.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleCitizenAgePhase.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleCitizenAgePhase.font.size = 15; this.BubbleCitizenAgePhase.textScale = 0.8f; this.BubbleCitizenAgePhase.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenAgePhase.outlineSize = 1; this.BubbleCitizenAgePhase.textColor = new Color32 (0, 51, 102, 140); //r,g,b,a this.BubbleCitizenAgePhase.isInteractive = false; this.BubbleCitizenAgePhase.useDropShadow = true; this.BubbleCitizenAgePhase.dropShadowOffset = new Vector2 (1, -1); this.BubbleCitizenAgePhase.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenAgePhase.relativePosition = new Vector3 (0, 1); //Education Label Panel this.BubbleRow1EducationLabelPanel = this.BubbleRow1LabelsSprite.AddUIComponent<UIPanel> (); this.BubbleRow1EducationLabelPanel.name = "BubbleRow1LabelsPanel"; this.BubbleRow1EducationLabelPanel.width = 66; this.BubbleRow1EducationLabelPanel.height = 17; this.BubbleRow1EducationLabelPanel.relativePosition = new Vector3 (132, 0); //Education Button (Label) Text this.BubbleCitizenEducation = this.BubbleRow1EducationLabelPanel.AddUIComponent<UIButton> (); this.BubbleCitizenEducation.name = "BubbleCitizenEducation"; this.BubbleCitizenEducation.width = this.BubbleRow1EducationLabelPanel.width; this.BubbleCitizenEducation.height = this.BubbleRow1EducationLabelPanel.height; //this.BubbleCitizenEducation.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleCitizenEducation.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleCitizenEducation.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleCitizenEducation.font.size = 15; this.BubbleCitizenEducation.textScale = 0.80f; //this.BubbleCitizenEducation.wordWrap = true; //this.BubbleCitizenEducation.textPadding.left = 2; //this.BubbleCitizenEducation.textPadding.right = 2; this.BubbleCitizenEducation.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenEducation.outlineSize = 1; this.BubbleCitizenEducation.textColor = new Color32 (0, 51, 102, 140); //r,g,b,a this.BubbleCitizenEducation.isInteractive = false; this.BubbleCitizenEducation.useDropShadow = true; this.BubbleCitizenEducation.dropShadowOffset = new Vector2 (1, -1); this.BubbleCitizenEducation.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenEducation.relativePosition = new Vector3 (0, 1); //Values Container Sprite this.BubbleRow1ValuesPanel = this.BubbleRow1LabelsSprite.AddUIComponent<UIPanel> (); this.BubbleRow1ValuesPanel.name = "BubbleRow1ValuesPanel"; this.BubbleRow1ValuesPanel.width = 198; this.BubbleRow1ValuesPanel.height = 17; //this.BubbleRow1ValuesPanel.texture = TextureDB.BubbleBgBar1Small; this.BubbleRow1ValuesPanel.relativePosition = new Vector3 (0, 17); //Age Value Panel this.BubbleRow1AgeValuePanel = this.BubbleRow1ValuesPanel.AddUIComponent<UIPanel> (); this.BubbleRow1AgeValuePanel.name = "BubbleRow1AgeValuePanel"; this.BubbleRow1AgeValuePanel.width = 32; this.BubbleRow1AgeValuePanel.height = 17; this.BubbleRow1AgeValuePanel.relativePosition = Vector3.zero; //Age Button (Value) Text this.BubbleCitizenAgeVal = this.BubbleRow1AgeValuePanel.AddUIComponent<UIButton> (); this.BubbleCitizenAgeVal.name = "BubbleCitizenAgeVal"; this.BubbleCitizenAgeVal.width = this.BubbleRow1AgeValuePanel.width; this.BubbleCitizenAgeVal.height = this.BubbleRow1AgeValuePanel.height; //this.BubbleCitizenAgeVal.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleCitizenAgeVal.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleCitizenAgeVal.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleCitizenAgeVal.font.size = 15; this.BubbleCitizenAgeVal.textScale = 0.85f; //this.BubbleCitizenAgeVal.wordWrap = true; //this.BubbleCitizenAgeVal.textPadding.left = 2; //this.BubbleCitizenAgeVal.textPadding.right = 2; this.BubbleCitizenAgeVal.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenAgeVal.outlineSize = 1; this.BubbleCitizenAgeVal.textColor = new Color32 (0, 51, 102, 140); //r,g,b,a this.BubbleCitizenAgeVal.isInteractive = false; this.BubbleCitizenAgeVal.useDropShadow = true; this.BubbleCitizenAgeVal.dropShadowOffset = new Vector2 (1, -1); this.BubbleCitizenAgeVal.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenAgeVal.relativePosition = new Vector3 (0, 0); //Age Phase Value Panel this.BubbleRow1AgePhaseValuePanel = this.BubbleRow1ValuesPanel.AddUIComponent<UIPanel> (); this.BubbleRow1AgePhaseValuePanel.name = "BubbleRow1AgePhaseValuePanel"; this.BubbleRow1AgePhaseValuePanel.width = 100; this.BubbleRow1AgePhaseValuePanel.height = 17; this.BubbleRow1AgePhaseValuePanel.relativePosition = new Vector3 (32, 0); //Age Phase Button (Value) Text this.BubbleCitizenAgePhaseVal = this.BubbleRow1AgePhaseValuePanel.AddUIComponent<UIButton> (); this.BubbleCitizenAgePhaseVal.name = "BubbleCitizenAgePhaseVal"; this.BubbleCitizenAgePhaseVal.width = this.BubbleRow1AgePhaseValuePanel.width; this.BubbleCitizenAgePhaseVal.height = this.BubbleRow1AgePhaseValuePanel.height; this.BubbleCitizenAgePhaseVal.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleCitizenAgePhaseVal.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleCitizenAgePhaseVal.font.size = 15; this.BubbleCitizenAgePhaseVal.textScale = 0.85f; this.BubbleCitizenAgePhaseVal.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenAgePhaseVal.outlineSize = 1; this.BubbleCitizenAgePhaseVal.textColor = new Color32 (0, 51, 102, 140); //r,g,b,a this.BubbleCitizenAgePhaseVal.isInteractive = false; this.BubbleCitizenAgePhaseVal.useDropShadow = true; this.BubbleCitizenAgePhaseVal.dropShadowOffset = new Vector2 (1, -1); this.BubbleCitizenAgePhaseVal.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleCitizenAgePhaseVal.relativePosition = new Vector3 (0, 0); //Education Value Panel this.BubbleRow1EducationValuePanel = this.BubbleRow1ValuesPanel.AddUIComponent<UIPanel> (); this.BubbleRow1EducationValuePanel.name = "BubbleRow1LabelsPanel"; this.BubbleRow1EducationValuePanel.width = 66; this.BubbleRow1EducationValuePanel.height = 17; //this.BubbleRow1EducationValuePanel.padding.top = 1; this.BubbleRow1EducationValuePanel.relativePosition = new Vector3 (132, 0); //Education Level 1 this.BubbleEduLevel1 = this.BubbleRow1EducationValuePanel.AddUIComponent<UIButton> (); this.BubbleEduLevel1.width = 18; this.BubbleEduLevel1.height = 17; this.BubbleEduLevel1.normalBgSprite = "InfoIconEducation"; this.BubbleEduLevel1.disabledBgSprite = "InfoIconEducationDisabled"; this.BubbleEduLevel1.isEnabled = false; this.BubbleEduLevel1.playAudioEvents = false; this.BubbleEduLevel1.relativePosition = new Vector3 (2, 0); //Education Level 2 this.BubbleEduLevel2 = this.BubbleRow1EducationValuePanel.AddUIComponent<UIButton> (); this.BubbleEduLevel2.width = this.BubbleEduLevel1.width; this.BubbleEduLevel2.height = this.BubbleEduLevel1.height; this.BubbleEduLevel2.normalBgSprite = "InfoIconEducation"; this.BubbleEduLevel2.disabledBgSprite = "InfoIconEducationDisabled"; this.BubbleEduLevel2.isEnabled = false; this.BubbleEduLevel2.playAudioEvents = false; this.BubbleEduLevel2.relativePosition = new Vector3 (24, 0); //Education Level 3 this.BubbleEduLevel3 = this.BubbleRow1EducationValuePanel.AddUIComponent<UIButton> (); this.BubbleEduLevel3.width = this.BubbleEduLevel1.width; this.BubbleEduLevel3.height = this.BubbleEduLevel1.height; this.BubbleEduLevel3.normalBgSprite = "InfoIconEducation"; this.BubbleEduLevel3.disabledBgSprite = "InfoIconEducationDisabled"; this.BubbleEduLevel3.isEnabled = false; this.BubbleEduLevel3.playAudioEvents = false; this.BubbleEduLevel3.relativePosition = new Vector3 (46, 0); //Education Tooltip Area this.BubbleRow1EducationTooltipArea = this.BubbleRow1ValuesPanel.AddUIComponent<UIPanel> (); this.BubbleRow1EducationTooltipArea.name = "BubbleRow1EducationTooltipArea"; this.BubbleRow1EducationTooltipArea.width = this.BubbleRow1EducationValuePanel.width; this.BubbleRow1EducationTooltipArea.height = this.BubbleRow1EducationValuePanel.height; this.BubbleRow1EducationTooltipArea.absolutePosition = BubbleRow1EducationValuePanel.absolutePosition; this.BubbleRow1EducationTooltipArea.tooltipBox = UIView.GetAView().defaultTooltipBox; //Target Panel this.BubbleTargetPanel = this.BubbleFamPortBgSprite.AddUIComponent<UIPanel> (); this.BubbleTargetPanel.name = "BubbleTargetPanel"; this.BubbleTargetPanel.width = 58; this.BubbleTargetPanel.height = 36; this.BubbleTargetPanel.relativePosition = new Vector3 (4, 35); //Target Button this.BubbleTargetIcon = this.BubbleTargetPanel.AddUIComponent<UIButton> (); this.BubbleTargetIcon.width = 28; this.BubbleTargetIcon.height = 28; this.BubbleTargetIcon.normalBgSprite = "LocationMarkerNormal"; this.BubbleTargetIcon.hoveredBgSprite = "LocationMarkerHovered"; this.BubbleTargetIcon.focusedBgSprite = "LocationMarkerFocused"; this.BubbleTargetIcon.pressedBgSprite = "LocationMarkerPressed"; this.BubbleTargetIcon.disabledBgSprite = "LocationMarkerDisabled"; this.BubbleTargetIcon.playAudioEvents = true; this.BubbleTargetIcon.relativePosition = new Vector3 (4, 0); this.BubbleTargetIcon.eventMouseDown += (component, eventParam) => GoToCitizen (MyInstanceID); //Wealth + Health Panel this.BubbleRow2Panel = this.BubbleFamPortBgSprite.AddUIComponent<UIPanel> (); this.BubbleRow2Panel.name = "BubbleRow2Panel"; this.BubbleRow2Panel.width = 198; this.BubbleRow2Panel.height = 34; this.BubbleRow2Panel.relativePosition = new Vector3 (40, 44); //Wealth + Health Bg Sprite this.BubbleWealthHealthSprite = this.BubbleRow2Panel.AddUIComponent<UITextureSprite> (); this.BubbleWealthHealthSprite.name = "BubbleWealthHealthSprite"; this.BubbleWealthHealthSprite.width = 198; this.BubbleWealthHealthSprite.height = 34; this.BubbleWealthHealthSprite.texture = TextureDB.BubbleBgBar1Big; this.BubbleWealthHealthSprite.relativePosition = Vector3.zero; //Wealth Sprite Panel this.BubbleWealthSpritePanel = this.BubbleWealthHealthSprite.AddUIComponent<UIPanel> (); this.BubbleWealthSpritePanel.name = "BubbleWealthSpritePanel"; this.BubbleWealthSpritePanel.width = 37; this.BubbleWealthSpritePanel.height = 34; this.BubbleWealthSpritePanel.relativePosition = new Vector3 (0, 0); //Wealth Button Sprite this.BubbleWealthSprite = this.BubbleWealthSpritePanel.AddUIComponent<UIButton> (); this.BubbleWealthSprite.name = "BubbleWealthSprite"; this.BubbleWealthSprite.width = 25; this.BubbleWealthSprite.height = 25; this.BubbleWealthSprite.normalBgSprite = "MoneyThumb"; this.BubbleWealthSprite.playAudioEvents = false; this.BubbleWealthSprite.tooltipBox = UIView.GetAView().defaultTooltipBox; this.BubbleWealthSprite.relativePosition = new Vector3(10,5); //Weatlh Button Value this.BubbleRow2WealthValueVal = this.BubbleWealthHealthSprite.AddUIComponent<UIButton> (); this.BubbleRow2WealthValueVal.name = "BubbleRow2WealthValueVal"; this.BubbleRow2WealthValueVal.width = 70; this.BubbleRow2WealthValueVal.height = 34; this.BubbleRow2WealthValueVal.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleRow2WealthValueVal.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleRow2WealthValueVal.font = UIDynamicFont.FindByName ("OpenSans-Regular"); //this.BubbleRow2WealthValueVal.textPadding.left = 2; //this.BubbleRow2WealthValueVal.textPadding.right = 2; this.BubbleRow2WealthValueVal.textPadding.top = 1; this.BubbleRow2WealthValueVal.font.size = 15; this.BubbleRow2WealthValueVal.textScale = 0.80f; this.BubbleRow2WealthValueVal.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleRow2WealthValueVal.outlineSize = 1; this.BubbleRow2WealthValueVal.textColor = new Color32 (0, 51, 102, 140); //r,g,b,a this.BubbleRow2WealthValueVal.isInteractive = false; this.BubbleRow2WealthValueVal.useDropShadow = true; this.BubbleRow2WealthValueVal.wordWrap = true; this.BubbleRow2WealthValueVal.dropShadowOffset = new Vector2 (1, -1); this.BubbleRow2WealthValueVal.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleRow2WealthValueVal.relativePosition = new Vector3(37,0); //Health Sprite Panel this.BubbleHealthSpritePanel = this.BubbleWealthHealthSprite.AddUIComponent<UIPanel> (); this.BubbleHealthSpritePanel.name = "BubbleHealthSpritePanel"; this.BubbleHealthSpritePanel.width = 26; this.BubbleHealthSpritePanel.height = 34; this.BubbleHealthSpritePanel.relativePosition = new Vector3 (107, 0); //Health Button Sprite this.BubbleHealthSprite = this.BubbleHealthSpritePanel.AddUIComponent<UIButton> (); this.BubbleHealthSprite.name = "BubbleWealthSprite"; this.BubbleHealthSprite.width = 26; this.BubbleHealthSprite.height = 26; this.BubbleHealthSprite.playAudioEvents = false; this.BubbleHealthSprite.tooltipBox = UIView.GetAView().defaultTooltipBox; this.BubbleHealthSprite.relativePosition = new Vector3(0,4); //Heatlh Button Value this.BubbleHealthValue = this.BubbleWealthHealthSprite.AddUIComponent<UIButton> (); this.BubbleHealthValue.name = "BubbleHealthValue"; this.BubbleHealthValue.width = 65; this.BubbleHealthValue.height = 34; this.BubbleHealthValue.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleHealthValue.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleHealthValue.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleHealthValue.textPadding.left = 5; this.BubbleHealthValue.textPadding.right = 5; this.BubbleHealthValue.textPadding.top = 1; this.BubbleHealthValue.font.size = 15; this.BubbleHealthValue.textScale = 0.85f; this.BubbleHealthValue.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleHealthValue.outlineSize = 1; this.BubbleHealthValue.textColor = new Color32 (0, 51, 102, 140); //r,g,b,a this.BubbleHealthValue.isInteractive = false; this.BubbleHealthValue.useDropShadow = true; this.BubbleHealthValue.wordWrap = true; this.BubbleHealthValue.dropShadowOffset = new Vector2 (1, -1); this.BubbleHealthValue.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleHealthValue.relativePosition = new Vector3(133,0); //Work Building Panel this.WorkBuildingPanel = this.BubbleFamPortBgSprite.AddUIComponent<UIPanel> (); this.WorkBuildingPanel.name = "WorkBuildingPanel"; this.WorkBuildingPanel.width = 234; this.WorkBuildingPanel.height = 25; this.WorkBuildingPanel.relativePosition = new Vector3 (4, 82); //Work Building Background this.BubbleWorkBuildingSprite = this.WorkBuildingPanel.AddUIComponent<UITextureSprite> (); this.BubbleWorkBuildingSprite.name = "BubbleWorkBuildingSprite"; this.BubbleWorkBuildingSprite.width = this.WorkBuildingPanel.width; this.BubbleWorkBuildingSprite.height = this.WorkBuildingPanel.height; this.BubbleWorkBuildingSprite.texture = TextureDB.BubbleBg1Special; this.BubbleWorkBuildingSprite.relativePosition = Vector3.zero; this.BubbleWorkBuildingSprite.clipChildren = true; this.FavCimsWorkingPlace = this.BubbleWorkBuildingSprite.AddUIComponent<UIButton> (); this.FavCimsWorkingPlace.name = "FavCimsWorkingPlace"; this.FavCimsWorkingPlace.width = this.BubbleWorkBuildingSprite.width; this.FavCimsWorkingPlace.height = this.BubbleWorkBuildingSprite.height; this.FavCimsWorkingPlace.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsWorkingPlace.textHorizontalAlignment = UIHorizontalAlignment.Left; this.FavCimsWorkingPlace.playAudioEvents = true; this.FavCimsWorkingPlace.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsWorkingPlace.font.size = 15; this.FavCimsWorkingPlace.textScale = 0.85f; //this.FavCimsWorkingPlace.wordWrap = true; this.FavCimsWorkingPlace.textPadding.left = 40; this.FavCimsWorkingPlace.textPadding.right = 5; this.FavCimsWorkingPlace.outlineColor = new Color32 (0, 0, 0, 0); this.FavCimsWorkingPlace.outlineSize = 1; this.FavCimsWorkingPlace.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.FavCimsWorkingPlace.hoveredTextColor = new Color32 (204, 102, 0, 20); this.FavCimsWorkingPlace.pressedTextColor = new Color32 (153, 0, 0, 0); this.FavCimsWorkingPlace.focusedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsWorkingPlace.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsWorkingPlace.useDropShadow = true; this.FavCimsWorkingPlace.dropShadowOffset = new Vector2 (1, -1); this.FavCimsWorkingPlace.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsWorkingPlace.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsWorkingPlace.eventMouseDown += (component, eventParam) => GoToInstance (WorkPlaceID); this.FavCimsWorkingPlace.relativePosition = new Vector3 (0, 1); //Work Panel this.BubbleWorkIconPanel = this.BubbleFamPortBgSprite.AddUIComponent<UIPanel> (); this.BubbleWorkIconPanel.name = "BubbleRow2Panel"; this.BubbleWorkIconPanel.width = 36; this.BubbleWorkIconPanel.height = 40; this.BubbleWorkIconPanel.absolutePosition = new Vector3 (BubbleFamPortBgSprite.absolutePosition.x + 4, BubbleFamPortBgSprite.absolutePosition.y + 71); //70 //Work sprites this.FavCimsWorkingPlaceSprite = this.BubbleWorkIconPanel.AddUIComponent<UITextureSprite> (); this.FavCimsWorkingPlaceSprite.name = "FavCimsWorkingPlaceSprite"; this.FavCimsWorkingPlaceSprite.width = 20; this.FavCimsWorkingPlaceSprite.height = 40; this.FavCimsWorkingPlaceSprite.relativePosition = new Vector3 (9, 3); this.FavCimsWorkingPlaceSprite.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsWorkingPlaceButtonGamDefImg = this.FavCimsWorkingPlaceSprite.AddUIComponent<UIButton> (); this.FavCimsWorkingPlaceButtonGamDefImg.name = "FavCimsWorkingPlaceButtonGamDefImg"; this.FavCimsWorkingPlaceButtonGamDefImg.width = 20; this.FavCimsWorkingPlaceButtonGamDefImg.height = 20; this.FavCimsWorkingPlaceButtonGamDefImg.relativePosition = new Vector3 (0, 10); this.FavCimsWorkingPlaceButtonGamDefImg.isInteractive = false; this.FavCimsWorkingPlaceButtonGamDefImg.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsCitizenWorkPlaceLevelSprite = this.FavCimsWorkingPlaceSprite.AddUIComponent<UITextureSprite> (); this.FavCimsCitizenWorkPlaceLevelSprite.name = "FavCimsCitizenWorkPlaceLevelSprite"; this.FavCimsCitizenWorkPlaceLevelSprite.relativePosition = new Vector3 (0, 0); //Citizen Personal Vehicle this.BubblePersonalCarButton = this.BubbleFamPortBgSprite.AddUIComponent<UITextureSprite> (); this.BubblePersonalCarButton.name = "BubblePersonalCarButton"; this.BubblePersonalCarButton.width = 30; this.BubblePersonalCarButton.height = 20; this.BubblePersonalCarButton.texture = TextureDB.BubbleCarDisabled; this.BubblePersonalCarButton.tooltipBox = UIView.GetAView().defaultTooltipBox; this.BubblePersonalCarButton.absolutePosition = new Vector3(BubbleTargetIcon.absolutePosition.x, this.BubbleTargetIcon.absolutePosition.y + this.BubbleTargetIcon.height); this.BubblePersonalCarButton.eventMouseDown += (component, eventParam) => this.GoToInstance(this.PersonalVehicleID); this.BubblePersonalCarButton.BringToFront (); //Activity Panel this.BubbleActivityPanel = this.BubbleFamPortBgSprite.AddUIComponent<UIPanel> (); this.BubbleActivityPanel.name = "BubbleActivityPanel"; this.BubbleActivityPanel.width = 234; this.BubbleActivityPanel.height = 18; //15 this.BubbleActivityPanel.relativePosition = new Vector3 (4, this.WorkBuildingPanel.relativePosition.y + 31); //34 //Activity Background this.BubbleActivitySprite = this.BubbleActivityPanel.AddUIComponent<UITextureSprite> (); this.BubbleActivitySprite.name = "BubbleActivitySprite"; this.BubbleActivitySprite.width = this.BubbleActivityPanel.width; this.BubbleActivitySprite.height = this.BubbleActivityPanel.height; this.BubbleActivitySprite.texture = TextureDB.BubbleBg1Special2; this.BubbleActivitySprite.relativePosition = Vector3.zero; //Citizen Vehicle Panel this.BubbleActivityVehiclePanel = this.BubbleActivitySprite.AddUIComponent<UIPanel> (); this.BubbleActivityVehiclePanel.name = "BubbleActivityVehiclePanel"; this.BubbleActivityVehiclePanel.width = 234; this.BubbleActivityVehiclePanel.height = 18; //15 this.BubbleActivityVehiclePanel.relativePosition = new Vector3 (4, 0); //Citizen Vehicle this.FavCimsLastActivityVehicleButton = this.BubbleActivityVehiclePanel.AddUIComponent<UIButton> (); this.FavCimsLastActivityVehicleButton.name = "FavCimsLastActivityVehicleButton"; this.FavCimsLastActivityVehicleButton.width = 18; this.FavCimsLastActivityVehicleButton.height = 17; this.FavCimsLastActivityVehicleButton.relativePosition = new Vector3 (0, 0); this.FavCimsLastActivityVehicleButton.eventMouseDown += (component, eventParam) => GoToInstance(this.MyVehicleID); //Last Activity this.FavCimsLastActivity = this.BubbleActivitySprite.AddUIComponent<UIButton> (); this.FavCimsLastActivity.name = "FavCimsLastActivity"; this.FavCimsLastActivity.width = this.BubbleActivitySprite.width-27; this.FavCimsLastActivity.height = this.BubbleActivitySprite.height; this.FavCimsLastActivity.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsLastActivity.textHorizontalAlignment = UIHorizontalAlignment.Left; this.FavCimsLastActivity.playAudioEvents = true; this.FavCimsLastActivity.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsLastActivity.font.size = 15; this.FavCimsLastActivity.textScale = 0.75f; //this.FavCimsLastActivity.wordWrap = true; this.FavCimsLastActivity.textPadding.left = 0; this.FavCimsLastActivity.textPadding.right = 5; //this.FavCimsLastActivity.textPadding.left = (int)this.FavCimsLastActivitySprite.width + (int)this.FavCimsLastActivitySprite.relativePosition.x + 10; this.FavCimsLastActivity.outlineColor = new Color32 (0, 0, 0, 0); this.FavCimsLastActivity.outlineSize = 1; this.FavCimsLastActivity.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.FavCimsLastActivity.hoveredTextColor = new Color32 (204, 102, 0, 20); this.FavCimsLastActivity.pressedTextColor = new Color32 (153, 0, 0, 0); this.FavCimsLastActivity.focusedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsLastActivity.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsLastActivity.useDropShadow = true; this.FavCimsLastActivity.dropShadowOffset = new Vector2 (1, -1); this.FavCimsLastActivity.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsLastActivity.maximumSize = new Vector2 (this.BubbleActivitySprite.width-40, this.BubbleActivitySprite.height); this.FavCimsLastActivity.tooltipBox = UIView.GetAView().defaultTooltipBox; this.FavCimsLastActivity.eventMouseDown += (component, eventParam) => GoToInstance(this.MyTargetID); this.FavCimsLastActivity.relativePosition = new Vector3 (27, 1); //District Panel this.BubbleDistrictPanel = this.BubbleFamPortBgSprite.AddUIComponent<UIPanel> (); this.BubbleDistrictPanel.name = "BubbleDistrictPanel"; this.BubbleDistrictPanel.width = 234; this.BubbleDistrictPanel.height = 15; this.BubbleDistrictPanel.relativePosition = new Vector3 (4, this.BubbleActivityPanel.relativePosition.y + 21); //District Background this.BubbleDistrictSprite = this.BubbleDistrictPanel.AddUIComponent<UITextureSprite> (); this.BubbleDistrictSprite.name = "BubbleDistrictSprite"; this.BubbleDistrictSprite.width = this.BubbleDistrictPanel.width; this.BubbleDistrictSprite.height = this.BubbleDistrictPanel.height; this.BubbleDistrictSprite.texture = TextureDB.BubbleBg1Special2; this.BubbleDistrictSprite.relativePosition = Vector3.zero; //District Label this.FavCimsDistrictLabel = this.BubbleDistrictSprite.AddUIComponent<UIButton> (); this.FavCimsDistrictLabel.name = "FavCimsDistrictLabel"; this.FavCimsDistrictLabel.width = 60; this.FavCimsDistrictLabel.height = 15; this.FavCimsDistrictLabel.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsDistrictLabel.textHorizontalAlignment = UIHorizontalAlignment.Center; this.FavCimsDistrictLabel.playAudioEvents = true; this.FavCimsDistrictLabel.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsDistrictLabel.font.size = 15; this.FavCimsDistrictLabel.textScale = 0.70f; //this.FavCimsDistrictLabel.wordWrap = true; this.FavCimsDistrictLabel.textPadding.left = 0; this.FavCimsDistrictLabel.textPadding.right = 5; this.FavCimsDistrictLabel.outlineColor = new Color32 (0, 0, 0, 0); this.FavCimsDistrictLabel.outlineSize = 1; this.FavCimsDistrictLabel.textColor = new Color32 (153, 0, 0, 0); this.FavCimsDistrictLabel.isInteractive = false; //this.FavCimsDistrictLabel.hoveredTextColor = new Color32 (204, 102, 0, 20); //this.FavCimsDistrictLabel.pressedTextColor = new Color32 (153, 0, 0, 0); //this.FavCimsDistrictLabel.focusedTextColor = new Color32 (102, 153, 255, 147); //this.FavCimsDistrictLabel.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsDistrictLabel.useDropShadow = true; this.FavCimsDistrictLabel.dropShadowOffset = new Vector2 (1, -1); this.FavCimsDistrictLabel.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsDistrictLabel.relativePosition = new Vector3 (4, 1); //Now in this District this.FavCimsDistrictValue = this.BubbleDistrictSprite.AddUIComponent<UIButton> (); this.FavCimsDistrictValue.name = "FavCimsDistrictValue"; this.FavCimsDistrictValue.width = this.BubbleDistrictPanel.width - 74; this.FavCimsDistrictValue.height = 15; this.FavCimsDistrictValue.textVerticalAlignment = UIVerticalAlignment.Middle; this.FavCimsDistrictValue.textHorizontalAlignment = UIHorizontalAlignment.Left; this.FavCimsDistrictValue.playAudioEvents = true; this.FavCimsDistrictValue.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.FavCimsDistrictValue.font.size = 15; this.FavCimsDistrictValue.textScale = 0.70f; //this.FavCimsDistrictValue.wordWrap = true; this.FavCimsDistrictValue.textPadding.left = 0; this.FavCimsDistrictValue.textPadding.right = 5; this.FavCimsDistrictValue.outlineColor = new Color32 (0, 0, 0, 0); this.FavCimsDistrictValue.outlineSize = 1; this.FavCimsDistrictValue.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a //this.FavCimsDistrictValue.isInteractive = false; //this.FavCimsDistrictValue.hoveredTextColor = new Color32 (204, 102, 0, 20); //this.FavCimsDistrictValue.pressedTextColor = new Color32 (153, 0, 0, 0); //this.FavCimsDistrictValue.focusedTextColor = new Color32 (102, 153, 255, 147); this.FavCimsDistrictValue.disabledTextColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.FavCimsDistrictValue.isEnabled = false; this.FavCimsDistrictValue.useDropShadow = true; this.FavCimsDistrictValue.dropShadowOffset = new Vector2 (1, -1); this.FavCimsDistrictValue.dropShadowColor = new Color32 (0, 0, 0, 0); this.FavCimsDistrictValue.relativePosition = new Vector3 (64, 1); //Details & Problems Panel this.BubbleDetailsPanel = this.AddUIComponent<UIPanel>(); this.BubbleDetailsPanel.name = "BubbleDetailsPanel"; this.BubbleDetailsPanel.width = 235; this.BubbleDetailsPanel.height = 60; this.BubbleDetailsPanel.relativePosition = new Vector3(7,this.BubbleFamilyPortraitPanel.relativePosition.y+this.BubbleFamilyPortraitPanel.height+1); //Details & Problems Background Sprite this.BubbleDetailsBgSprite = this.BubbleDetailsPanel.AddUIComponent<UITextureSprite> (); this.BubbleDetailsBgSprite.name = "BubbleFamPortBgSprite"; this.BubbleDetailsBgSprite.texture = TextureDB.BubbleDetailsBgSprite; this.BubbleDetailsBgSprite.relativePosition = Vector3.zero; //Home Icon this.BubbleHomeIcon = this.BubbleDetailsPanel.AddUIComponent<UITextureSprite> (); this.BubbleHomeIcon.name = "FavCimsCitizenHomeSprite"; this.BubbleHomeIcon.relativePosition = new Vector3 (10,10); this.BubbleHomeIcon.tooltipBox = UIView.GetAView().defaultTooltipBox; //Home Level this.BubbleHomeLevel = this.BubbleHomeIcon.AddUIComponent<UITextureSprite> (); this.BubbleHomeLevel.name = "FavCimsCitizenResidentialLevelSprite"; this.BubbleHomeLevel.relativePosition = Vector3.zero; //Home Name & Level this.BubbleHomePanel = this.BubbleDetailsPanel.AddUIComponent<UIPanel>(); this.BubbleHomePanel.name = "BubbleHomePanel"; this.BubbleHomePanel.width = 181; this.BubbleHomePanel.height = 30; this.BubbleHomePanel.maximumSize = new Vector2(181,40); this.BubbleHomePanel.autoLayoutDirection = LayoutDirection.Horizontal; this.BubbleHomePanel.autoLayout = true; this.BubbleHomePanel.relativePosition = new Vector3(40,4); //Home Name this.BubbleHomeName = this.BubbleHomePanel.AddUIComponent<UIButton> (); this.BubbleHomeName.name = "BubbleHomeName"; this.BubbleHomeName.width = this.BubbleHomePanel.width; this.BubbleHomeName.height = this.BubbleHomePanel.height; this.BubbleHomeName.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleHomeName.textHorizontalAlignment = UIHorizontalAlignment.Left; //this.BubbleHomeName.textPadding.left = 5; this.BubbleHomeName.playAudioEvents = true; this.BubbleHomeName.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleHomeName.font.size = 15; this.BubbleHomeName.textScale = 0.90f; this.BubbleHomeName.wordWrap = true; this.BubbleHomeName.textPadding.left = 2; this.BubbleHomeName.textPadding.right = 5; this.BubbleHomeName.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleHomeName.outlineSize = 1; this.BubbleHomeName.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.BubbleHomeName.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleHomeName.pressedTextColor = new Color32 (153, 0, 0, 0); this.BubbleHomeName.focusedTextColor = new Color32 (102, 153, 255, 147); this.BubbleHomeName.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleHomeName.useDropShadow = true; this.BubbleHomeName.dropShadowOffset = new Vector2 (1, -1); this.BubbleHomeName.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleHomeName.maximumSize = new Vector2 (this.BubbleHomePanel.width, this.BubbleHomePanel.height); this.BubbleHomeName.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleHomeName.text = "prova"; this.BubbleHomeName.eventMouseDown += (component, eventParam) => this.GoToInstance (this.CitizenHomeID); this.BubbleHomeName.relativePosition = Vector3.zero; //Details & Problems Icons Panel this.BubbleDetailsIconsPanel = this.BubbleDetailsPanel.AddUIComponent<UIPanel>(); this.BubbleDetailsIconsPanel.name = "BubbleDetailsIconsPanel"; this.BubbleDetailsIconsPanel.width = 181; this.BubbleDetailsIconsPanel.height = 20; //this.BubbleDetailsIconsPanel.padding.left = 7; //this.BubbleDetailsIconsPanel.padding.right = 7; this.BubbleDetailsIconsPanel.maximumSize = new Vector2(181,30); this.BubbleDetailsIconsPanel.autoLayoutDirection = LayoutDirection.Horizontal; this.BubbleDetailsIconsPanel.autoLayout = true; this.BubbleDetailsIconsPanel.relativePosition = new Vector3(this.BubbleHomePanel.relativePosition.x, 30); //Details & Problems Icons Buttons; this.BubbleDetailsElettricity = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsElettricity.name = "BubbleDetailsElettricity"; this.BubbleDetailsElettricity.normalBgSprite = "ToolbarIconElectricity"; this.BubbleDetailsElettricity.width = 20; this.BubbleDetailsElettricity.height = 20; this.BubbleDetailsElettricity.playAudioEvents = false; this.BubbleDetailsElettricity.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsElettricity.isInteractive = false; this.BubbleDetailsWater = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsWater.name = "BubbleDetailsWater"; this.BubbleDetailsWater.normalBgSprite = "IconPolicyWaterSaving"; this.BubbleDetailsWater.width = this.BubbleDetailsElettricity.width; this.BubbleDetailsWater.height = this.BubbleDetailsElettricity.height; this.BubbleDetailsWater.playAudioEvents = false; this.BubbleDetailsWater.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsWater.isInteractive = false; this.BubbleDetailsLandValue = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsLandValue.name = "BubbleDetailsLandValue"; this.BubbleDetailsLandValue.normalBgSprite = "InfoIconLandValue"; this.BubbleDetailsLandValue.width = BubbleDetailsElettricity.width; this.BubbleDetailsLandValue.height = BubbleDetailsElettricity.height; this.BubbleDetailsLandValue.playAudioEvents = false; this.BubbleDetailsLandValue.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsLandValue.isInteractive = false; this.BubbleDetailsCrime = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsCrime.name = "BubbleDetailsCrime"; this.BubbleDetailsCrime.normalBgSprite = "InfoIconCrime"; this.BubbleDetailsCrime.width = this.BubbleDetailsElettricity.width; this.BubbleDetailsCrime.height = this.BubbleDetailsElettricity.height; this.BubbleDetailsCrime.playAudioEvents = false; this.BubbleDetailsCrime.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsCrime.isInteractive = false; this.BubbleDetailsNoise = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsNoise.name = "BubbleDetailsNoise"; this.BubbleDetailsNoise.normalBgSprite = "InfoIconNoisePollution"; this.BubbleDetailsNoise.width = this.BubbleDetailsElettricity.width; this.BubbleDetailsNoise.height = this.BubbleDetailsElettricity.height; this.BubbleDetailsNoise.playAudioEvents = false; this.BubbleDetailsNoise.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsNoise.isInteractive = false; this.BubbleDetailsGarbage = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsGarbage.name = "BubbleDetailsGarbage"; this.BubbleDetailsGarbage.normalBgSprite = "InfoIconGarbage"; this.BubbleDetailsGarbage.width = this.BubbleDetailsElettricity.width; this.BubbleDetailsGarbage.height = this.BubbleDetailsElettricity.height; this.BubbleDetailsGarbage.playAudioEvents = false; this.BubbleDetailsGarbage.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsGarbage.isInteractive = false; this.BubbleDetailsDeath = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsDeath.name = "BubbleDetailsDeath"; this.BubbleDetailsDeath.normalBgSprite = "NotificationIconVerySick"; this.BubbleDetailsDeath.width = this.BubbleDetailsElettricity.width; this.BubbleDetailsDeath.height = this.BubbleDetailsElettricity.height; this.BubbleDetailsDeath.playAudioEvents = false; this.BubbleDetailsDeath.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsDeath.isInteractive = false; this.BubbleDetailsFire = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsFire.name = "BubbleDetailsFire"; this.BubbleDetailsFire.normalBgSprite = "ToolbarIconFireDepartment"; this.BubbleDetailsFire.width = this.BubbleDetailsElettricity.width; this.BubbleDetailsFire.height = this.BubbleDetailsElettricity.height; this.BubbleDetailsFire.playAudioEvents = false; this.BubbleDetailsFire.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsFire.isInteractive = false; this.BubbleDetailsPollution = this.BubbleDetailsIconsPanel.AddUIComponent<UIButton> (); this.BubbleDetailsPollution.name = "BubbleDetailsPollution"; this.BubbleDetailsPollution.normalBgSprite = "InfoIconPollution"; this.BubbleDetailsPollution.width = this.BubbleDetailsElettricity.width; this.BubbleDetailsPollution.height = this.BubbleDetailsElettricity.height; this.BubbleDetailsPollution.playAudioEvents = false; this.BubbleDetailsPollution.tooltipBox = UIView.GetAView().defaultTooltipBox; //this.BubbleDetailsPollution.isInteractive = false; //Header Family Bar Panel this.BubbleFamilyBarPanel = this.AddUIComponent<UIPanel>(); this.BubbleFamilyBarPanel.name = "BubbleFamilyBarPanel"; this.BubbleFamilyBarPanel.width = 236; this.BubbleFamilyBarPanel.height = 20; this.BubbleFamilyBarPanel.relativePosition = new Vector3(7,this.BubbleDetailsPanel.relativePosition.y + this.BubbleDetailsPanel.height + 2); //Header Family Bar Bg this.BubbleFamilyBarPanelBg = this.BubbleFamilyBarPanel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyBarPanelBg.name = "BubbleFamilyBarPanelBg"; this.BubbleFamilyBarPanelBg.width = this.BubbleFamilyBarPanel.width; this.BubbleFamilyBarPanelBg.height = this.BubbleFamilyBarPanel.height; this.BubbleFamilyBarPanelBg.texture = TextureDB.BubbleBgBarHover; this.BubbleFamilyBarPanelBg.relativePosition = Vector3.zero; //Header Family Label this.BubbleFamilyBarLabel = this.BubbleFamilyBarPanel.AddUIComponent<UILabel> (); this.BubbleFamilyBarLabel.name = "BubbleFamilyBarLabel"; this.BubbleFamilyBarLabel.height = this.BubbleFamilyBarPanel.height; this.BubbleFamilyBarLabel.width = 221; this.BubbleFamilyBarLabel.font.size = 11; this.BubbleFamilyBarLabel.textScale = 1f; this.BubbleFamilyBarLabel.textColor = new Color32 (102, 0, 51, 220); this.BubbleFamilyBarLabel.relativePosition = new Vector3(7,2); //Header Family Dog SpriteButton this.BubbleFamilyBarDogButton = this.BubbleFamilyBarPanel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyBarDogButton.name = "BubbleFamilyBarDogButton"; this.BubbleFamilyBarDogButton.texture = TextureDB.BubbleDogDisabled; this.BubbleFamilyBarDogButton.tooltipBox = UIView.GetAView().defaultTooltipBox; this.BubbleFamilyBarDogButton.relativePosition = new Vector3(175,0); this.BubbleFamilyBarDogButton.eventMouseDown += (component, eventParam) => this.GoToInstance(this.MyPetID); //Header Family Car SpriteButton this.BubbleFamilyBarCarButton = this.BubbleFamilyBarPanel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyBarCarButton.name = "BubbleFamilyBarCarButton"; this.BubbleFamilyBarCarButton.texture = TextureDB.BubbleCarDisabled; this.BubbleFamilyBarCarButton.tooltipBox = UIView.GetAView().defaultTooltipBox; this.BubbleFamilyBarCarButton.relativePosition = new Vector3(this.BubbleFamilyBarDogButton.relativePosition.x + this.BubbleFamilyBarDogButton.width + 10,0); this.BubbleFamilyBarCarButton.eventMouseDown += (component, eventParam) => this.GoToInstance(this.FamilyVehicleID); //Family Panel this.BubbleFamilyPanel = this.AddUIComponent<UIPanel>(); this.BubbleFamilyPanel.name = "BubbleFamilyPanel"; this.BubbleFamilyPanel.width = 236; this.BubbleFamilyPanel.height = 212; this.BubbleFamilyPanel.clipChildren = true; this.BubbleFamilyPanel.padding = new RectOffset(0,0,0,0); this.BubbleFamilyPanel.autoLayout = true; this.BubbleFamilyPanel.autoLayoutDirection = LayoutDirection.Vertical; this.BubbleFamilyPanel.relativePosition = new Vector3(7,this.BubbleFamilyBarPanel.relativePosition.y + this.BubbleFamilyBarPanel.height); //No partner panel this.NoPartnerPanel = this.BubbleFamilyPanel.AddUIComponent<UIPanel>(); this.NoPartnerPanel.name = "NoPartnerPanel"; this.NoPartnerPanel.width = this.BubbleFamilyPanel.width; this.NoPartnerPanel.height = 52; this.NoPartnerPanel.Hide (); //No partner button sprite this.NoPartnerBSprite = this.NoPartnerPanel.AddUIComponent<UIButton> (); this.NoPartnerBSprite.name = "NoPartnerBSprite"; this.NoPartnerBSprite.normalBgSprite = "InfoIconHealthDisabled"; this.NoPartnerBSprite.width = 36; this.NoPartnerBSprite.height = 36; this.NoPartnerBSprite.relativePosition = new Vector3 (7, 5); //No partner fake button this.NoPartnerFButton = this.NoPartnerPanel.AddUIComponent<UIButton> (); this.NoPartnerFButton.name = "NoPartnerFButton"; this.NoPartnerFButton.width = 155; this.NoPartnerFButton.height = this.NoPartnerBSprite.height; this.NoPartnerFButton.textVerticalAlignment = UIVerticalAlignment.Middle; this.NoPartnerFButton.textHorizontalAlignment = UIHorizontalAlignment.Left; this.NoPartnerFButton.playAudioEvents = false; this.NoPartnerFButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.NoPartnerFButton.font.size = 16; this.NoPartnerFButton.textScale = 0.9f; this.NoPartnerFButton.wordWrap = true; this.NoPartnerFButton.useDropShadow = true; this.NoPartnerFButton.dropShadowOffset = new Vector2 (1, -1); this.NoPartnerFButton.dropShadowColor = new Color32 (0, 0, 0, 0); this.NoPartnerFButton.textPadding.left = 5; this.NoPartnerFButton.textPadding.right = 5; this.NoPartnerFButton.isEnabled = false; this.NoPartnerFButton.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.NoPartnerFButton.relativePosition = new Vector3 (this.NoPartnerBSprite.relativePosition.x + this.NoPartnerBSprite.width, this.NoPartnerBSprite.relativePosition.y); //x 4 Rows //Partner Panel this.PartnerPanel = this.BubbleFamilyPanel.AddUIComponent<UIPanel>(); this.PartnerPanel.name = "PartnerPanel"; this.PartnerPanel.width = this.BubbleFamilyPanel.width; this.PartnerPanel.height = 52; this.PartnerPanel.clipChildren = true; this.PartnerPanel.padding = new RectOffset(0,0,0,0); this.PartnerPanel.autoLayout = true; this.PartnerPanel.autoLayoutDirection = LayoutDirection.Vertical; //Partner Background Bar this.BubblePartnerBgBar = this.PartnerPanel.AddUIComponent<UITextureSprite> (); this.BubblePartnerBgBar.name = "BubblePartnerBgBar"; this.BubblePartnerBgBar.width = this.PartnerPanel.width; this.BubblePartnerBgBar.height = 26; this.BubblePartnerBgBar.texture = TextureDB.BubbleBgBar1; //Partner Fake Button Hearth this.BubblePartnerLove = this.BubblePartnerBgBar.AddUIComponent<UIButton> (); this.BubblePartnerLove.name = "BubblePartnerLove"; this.BubblePartnerLove.normalBgSprite = "InfoIconHealth"; this.BubblePartnerLove.width = 22; this.BubblePartnerLove.height = 22; this.BubblePartnerLove.isInteractive = false; this.BubblePartnerLove.relativePosition = new Vector3 (7, 2); //Partner Name Button this.BubblePartnerName = this.BubblePartnerBgBar.AddUIComponent<UIButton> (); this.BubblePartnerName.name = "BubblePartnerName"; this.BubblePartnerName.width = 135; this.BubblePartnerName.height = this.BubblePartnerBgBar.height; this.BubblePartnerName.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubblePartnerName.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubblePartnerName.playAudioEvents = true; this.BubblePartnerName.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubblePartnerName.font.size = 15; this.BubblePartnerName.textScale = 0.80f; this.BubblePartnerName.wordWrap = true; this.BubblePartnerName.useDropShadow = true; this.BubblePartnerName.dropShadowOffset = new Vector2 (1, -1); this.BubblePartnerName.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubblePartnerName.textPadding.left = 5; this.BubblePartnerName.textPadding.right = 5; this.BubblePartnerName.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubblePartnerName.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubblePartnerName.pressedTextColor = new Color32 (102, 153, 255, 147); this.BubblePartnerName.focusedTextColor = new Color32 (153, 0, 0, 0); this.BubblePartnerName.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubblePartnerName.relativePosition = new Vector3 (this.BubblePartnerLove.relativePosition.x + this.BubblePartnerLove.width, 2); this.BubblePartnerName.eventMouseDown += (component, eventParam) => this.GoToCitizen(this.PartnerID); //Partner Real Age Button this.BubbleParnerAgeButton = this.BubblePartnerBgBar.AddUIComponent<UIButton> (); this.BubbleParnerAgeButton.name = "BubbleParnerAgeButton"; this.BubbleParnerAgeButton.width = 23; this.BubbleParnerAgeButton.height = 18; this.BubbleParnerAgeButton.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleParnerAgeButton.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleParnerAgeButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleParnerAgeButton.textScale = 0.90f; this.BubbleParnerAgeButton.font.size = 15; this.BubbleParnerAgeButton.dropShadowOffset = new Vector2 (1, -1); this.BubbleParnerAgeButton.dropShadowColor = new Color32 (0, 0, 0, 0); //this.BubbleParnerAgeButton.text = "99"; //Real Age test //this.BubbleParnerAgeButton.normalBgSprite = "GenericPanel"; this.BubbleParnerAgeButton.isInteractive = false; this.BubbleParnerAgeButton.relativePosition = new Vector3 (this.BubblePartnerName.relativePosition.x + this.BubblePartnerName.width + 6, 6); //Partner Follow Texture Sprite this.BubblePartnerFollowToggler = this.BubblePartnerBgBar.AddUIComponent<UIButton> (); this.BubblePartnerFollowToggler.name = "BubblePartnerFollowToggler"; this.BubblePartnerFollowToggler.atlas = m_atlas; this.BubblePartnerFollowToggler.size = new Vector2(18,18); this.BubblePartnerFollowToggler.playAudioEvents = true; this.BubblePartnerFollowToggler.relativePosition = new Vector3 (this.BubbleParnerAgeButton.relativePosition.x + this.BubbleParnerAgeButton.width + 12, 4); this.BubblePartnerFollowToggler.eventClick += (component, eventParam) => { FavCimsCore.AddToFavorites (this.PartnerID); }; //Partner Activity Background Bar this.BubblePartnerActivityBar = this.PartnerPanel.AddUIComponent<UITextureSprite> (); this.BubblePartnerActivityBar.name = "BubblePartnerActivityBar"; this.BubblePartnerActivityBar.width = this.PartnerPanel.width; this.BubblePartnerActivityBar.height = 26; this.BubblePartnerActivityBar.texture = TextureDB.BubbleBgBar2; //Partner Activity Vehicle Button this.BubblePartnerVehicleButton = this.BubblePartnerActivityBar.AddUIComponent<UIButton> (); this.BubblePartnerVehicleButton.name = "BubblePartnerVehicleButton"; this.BubblePartnerVehicleButton.width = 22; this.BubblePartnerVehicleButton.height = 22; this.BubblePartnerVehicleButton.relativePosition = new Vector3 (7, 2); this.BubblePartnerVehicleButton.eventMouseDown += (component, eventParam) => GoToInstance(this.PartnerVehID); //Partner Activity Destination this.BubblePartnerDestination = this.BubblePartnerActivityBar.AddUIComponent<UIButton> (); this.BubblePartnerDestination.name = "BubblePartnerDestination"; this.BubblePartnerDestination.width = this.BubblePartnerActivityBar.width-this.BubblePartnerVehicleButton.width; this.BubblePartnerDestination.height = this.BubblePartnerActivityBar.height; this.BubblePartnerDestination.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubblePartnerDestination.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubblePartnerDestination.playAudioEvents = true; this.BubblePartnerDestination.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubblePartnerDestination.font.size = 15; this.BubblePartnerDestination.textScale = 0.75f; this.BubblePartnerDestination.wordWrap = true; this.BubblePartnerDestination.textPadding.left = 0; this.BubblePartnerDestination.textPadding.right = 5; this.BubblePartnerDestination.outlineColor = new Color32 (0, 0, 0, 0); this.BubblePartnerDestination.outlineSize = 1; this.BubblePartnerDestination.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.BubblePartnerDestination.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubblePartnerDestination.pressedTextColor = new Color32 (153, 0, 0, 0); this.BubblePartnerDestination.focusedTextColor = new Color32 (102, 153, 255, 147); this.BubblePartnerDestination.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubblePartnerDestination.useDropShadow = true; this.BubblePartnerDestination.dropShadowOffset = new Vector2 (1, -1); this.BubblePartnerDestination.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubblePartnerDestination.maximumSize = new Vector2 (this.BubblePartnerDestination.width, this.BubblePartnerActivityBar.height); this.BubblePartnerDestination.relativePosition = new Vector3 (this.BubblePartnerVehicleButton.relativePosition.x + this.BubblePartnerVehicleButton.width +5, 2); this.BubblePartnerDestination.eventMouseDown += (component, eventParam) => GoToInstance(this.PartnerTarget); //Parent 1 Panel this.Parent1Panel = this.BubbleFamilyPanel.AddUIComponent<UIPanel>(); this.Parent1Panel.name = "PartnerPanel"; this.Parent1Panel.width = this.BubbleFamilyPanel.width; this.Parent1Panel.height = 52; this.Parent1Panel.clipChildren = true; this.Parent1Panel.padding = new RectOffset(0,0,0,0); this.Parent1Panel.autoLayout = true; this.Parent1Panel.autoLayoutDirection = LayoutDirection.Vertical; this.Parent1Panel.relativePosition = new Vector3(0,0); this.Parent1Panel.Hide (); //Parent1 Background Bar this.BubbleParent1BgBar = this.Parent1Panel.AddUIComponent<UITextureSprite> (); this.BubbleParent1BgBar.name = "BubbleParent1BgBar"; this.BubbleParent1BgBar.width = this.Parent1Panel.width; this.BubbleParent1BgBar.height = 26; this.BubbleParent1BgBar.texture = TextureDB.BubbleBgBar1; //Parent1 Fake Button Hearth this.BubbleParent1Love = this.BubbleParent1BgBar.AddUIComponent<UIButton> (); this.BubbleParent1Love.name = "BubbleParent1Love"; this.BubbleParent1Love.normalBgSprite = "InfoIconAge"; this.BubbleParent1Love.width = 22; this.BubbleParent1Love.height = 22; this.BubbleParent1Love.isInteractive = false; this.BubbleParent1Love.relativePosition = new Vector3 (7, 2); //Parent1 Name Button this.BubbleParent1Name = this.BubbleParent1BgBar.AddUIComponent<UIButton> (); this.BubbleParent1Name.name = "BubbleParent1Name"; this.BubbleParent1Name.width = 135; this.BubbleParent1Name.height = this.BubbleParent1BgBar.height; this.BubbleParent1Name.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleParent1Name.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubbleParent1Name.playAudioEvents = true; this.BubbleParent1Name.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleParent1Name.font.size = 15; this.BubbleParent1Name.textScale = 0.80f; this.BubbleParent1Name.wordWrap = true; this.BubbleParent1Name.useDropShadow = true; this.BubbleParent1Name.dropShadowOffset = new Vector2 (1, -1); this.BubbleParent1Name.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleParent1Name.textPadding.left = 5; this.BubbleParent1Name.textPadding.right = 5; this.BubbleParent1Name.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleParent1Name.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleParent1Name.pressedTextColor = new Color32 (102, 153, 255, 147); this.BubbleParent1Name.focusedTextColor = new Color32 (153, 0, 0, 0); this.BubbleParent1Name.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleParent1Name.relativePosition = new Vector3 (this.BubbleParent1Love.relativePosition.x + this.BubbleParent1Love.width, 2); this.BubbleParent1Name.eventMouseDown += (component, eventParam) => this.GoToCitizen(this.Parent1ID); //Parent1 Real Age Button this.BubbleParent1AgeButton = this.BubbleParent1BgBar.AddUIComponent<UIButton> (); this.BubbleParent1AgeButton.name = "BubbleParent1AgeButton"; this.BubbleParent1AgeButton.width = 23; this.BubbleParent1AgeButton.height = 18; this.BubbleParent1AgeButton.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleParent1AgeButton.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleParent1AgeButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleParent1AgeButton.textScale = 0.90f; this.BubbleParent1AgeButton.font.size = 15; this.BubbleParent1AgeButton.dropShadowOffset = new Vector2 (1, -1); this.BubbleParent1AgeButton.dropShadowColor = new Color32 (0, 0, 0, 0); //this.BubbleParent1AgeButton.text = "99"; //Real Age test //this.BubbleParent1AgeButton.normalBgSprite = "GenericPanel"; this.BubbleParent1AgeButton.isInteractive = false; this.BubbleParent1AgeButton.relativePosition = new Vector3 (this.BubbleParent1Name.relativePosition.x + this.BubbleParent1Name.width + 6, 6); //Parent1 Follow Texture Sprite this.BubbleParent1FollowToggler = this.BubbleParent1BgBar.AddUIComponent<UIButton> (); this.BubbleParent1FollowToggler.name = "BubbleParent1FollowToggler"; this.BubbleParent1FollowToggler.atlas = m_atlas; this.BubbleParent1FollowToggler.size = new Vector2 (18, 18); this.BubbleParent1FollowToggler.playAudioEvents = true; this.BubbleParent1FollowToggler.relativePosition = new Vector3 (this.BubbleParent1AgeButton.relativePosition.x + this.BubbleParent1AgeButton.width + 12, 4); this.BubbleParent1FollowToggler.eventClick += (component, eventParam) => { FavCimsCore.AddToFavorites (this.Parent1ID); }; //Parent1 Activity Background Bar this.BubbleParent1ActivityBar = this.Parent1Panel.AddUIComponent<UITextureSprite> (); this.BubbleParent1ActivityBar.name = "BubbleParent1ActivityBar"; this.BubbleParent1ActivityBar.width = this.Parent1Panel.width; this.BubbleParent1ActivityBar.height = 26; this.BubbleParent1ActivityBar.texture = TextureDB.BubbleBgBar2; //Parent1 Activity Vehicle Button this.BubbleParent1VehicleButton = this.BubbleParent1ActivityBar.AddUIComponent<UIButton> (); this.BubbleParent1VehicleButton.name = "BubbleParent1VehicleButton"; this.BubbleParent1VehicleButton.width = 22; this.BubbleParent1VehicleButton.height = 22; this.BubbleParent1VehicleButton.relativePosition = new Vector3 (7, 2); this.BubbleParent1VehicleButton.eventMouseDown += (component, eventParam) => GoToInstance(this.Parent1VehID); //Parent1 Activity Destination this.BubbleParent1Destination = this.BubbleParent1ActivityBar.AddUIComponent<UIButton> (); this.BubbleParent1Destination.name = "BubbleParent1Destination"; this.BubbleParent1Destination.width = this.BubbleParent1ActivityBar.width-this.BubbleParent1VehicleButton.width; this.BubbleParent1Destination.height = this.BubbleParent1ActivityBar.height; this.BubbleParent1Destination.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleParent1Destination.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubbleParent1Destination.playAudioEvents = true; this.BubbleParent1Destination.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleParent1Destination.font.size = 15; this.BubbleParent1Destination.textScale = 0.75f; this.BubbleParent1Destination.wordWrap = true; this.BubbleParent1Destination.textPadding.left = 0; this.BubbleParent1Destination.textPadding.right = 5; this.BubbleParent1Destination.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleParent1Destination.outlineSize = 1; this.BubbleParent1Destination.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.BubbleParent1Destination.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleParent1Destination.pressedTextColor = new Color32 (153, 0, 0, 0); this.BubbleParent1Destination.focusedTextColor = new Color32 (102, 153, 255, 147); this.BubbleParent1Destination.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleParent1Destination.useDropShadow = true; this.BubbleParent1Destination.dropShadowOffset = new Vector2 (1, -1); this.BubbleParent1Destination.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleParent1Destination.maximumSize = new Vector2 (this.BubbleParent1Destination.width, this.BubbleParent1ActivityBar.height); this.BubbleParent1Destination.relativePosition = new Vector3 (this.BubblePartnerDestination.relativePosition.x, 2); this.BubbleParent1Destination.eventMouseDown += (component, eventParam) => GoToInstance(this.Parent1Target); //No Child Panel this.NoChildsPanel = this.BubbleFamilyPanel.AddUIComponent<UIPanel>(); this.NoChildsPanel.name = "NoChildsPanel"; this.NoChildsPanel.width = this.BubbleFamilyPanel.width; this.NoChildsPanel.height = 52; this.NoChildsPanel.Hide (); //No Child button sprite this.NoChildsBSprite = this.NoChildsPanel.AddUIComponent<UIButton> (); this.NoChildsBSprite.name = "NoChildsBSprite"; this.NoChildsBSprite.normalBgSprite = "InfoIconHappinessDisabled"; this.NoChildsBSprite.width = 36; this.NoChildsBSprite.height = 36; this.NoChildsBSprite.relativePosition = new Vector3 (7, 5); //No Childs fake button this.NoChildsFButton = this.NoChildsPanel.AddUIComponent<UIButton> (); this.NoChildsFButton.name = "NoChildsFButton"; this.NoChildsFButton.width = 155; this.NoChildsFButton.height = this.NoChildsBSprite.height; this.NoChildsFButton.textVerticalAlignment = UIVerticalAlignment.Middle; this.NoChildsFButton.textHorizontalAlignment = UIHorizontalAlignment.Left; this.NoChildsFButton.playAudioEvents = false; this.NoChildsFButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.NoChildsFButton.font.size = 16; this.NoChildsFButton.textScale = 0.9f; this.NoChildsFButton.wordWrap = true; this.NoChildsFButton.useDropShadow = true; this.NoChildsFButton.dropShadowOffset = new Vector2 (1, -1); this.NoChildsFButton.dropShadowColor = new Color32 (0, 0, 0, 0); this.NoChildsFButton.textPadding.left = 5; this.NoChildsFButton.textPadding.right = 5; this.NoChildsFButton.isEnabled = false; this.NoChildsFButton.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.NoChildsFButton.relativePosition = new Vector3 (this.NoChildsBSprite.relativePosition.x + this.NoChildsBSprite.width, this.NoChildsBSprite.relativePosition.y); //Parent 2 Panel this.FamilyMember2Panel = this.BubbleFamilyPanel.AddUIComponent<UIPanel>(); this.FamilyMember2Panel.name = "FamilyMember2Panel"; this.FamilyMember2Panel.width = this.BubbleFamilyPanel.width; this.FamilyMember2Panel.height = 52; this.FamilyMember2Panel.clipChildren = true; this.FamilyMember2Panel.padding = new RectOffset(0,0,0,0); this.FamilyMember2Panel.autoLayout = true; this.FamilyMember2Panel.autoLayoutDirection = LayoutDirection.Vertical; this.FamilyMember2Panel.relativePosition = new Vector3(0,0); this.FamilyMember2Panel.Hide (); //Family 2 Background bar this.BubbleFamilyMember2BgBar = this.FamilyMember2Panel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember2BgBar.name = "BubbleFamilyMember2BgBar"; this.BubbleFamilyMember2BgBar.width = this.BubbleFamilyPanel.width; this.BubbleFamilyMember2BgBar.height = 26; this.BubbleFamilyMember2BgBar.texture = TextureDB.BubbleBgBar1; //Family 2 icon sprite this.BubbleFamilyMember2IconSprite = this.BubbleFamilyMember2BgBar.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember2IconSprite.name = "BubbleFamilyMember2IconSprite"; this.BubbleFamilyMember2IconSprite.width = 18; this.BubbleFamilyMember2IconSprite.height = 18; this.BubbleFamilyMember2IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureMale; this.BubbleFamilyMember2IconSprite.relativePosition = new Vector3(7,4); //Family 2 name button this.BubbleFamilyMember2Name = this.BubbleFamilyMember2BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember2Name.name = "BubbleFamilyMember2Name"; this.BubbleFamilyMember2Name.width = 135; this.BubbleFamilyMember2Name.height = this.BubbleFamilyMember2BgBar.height; this.BubbleFamilyMember2Name.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember2Name.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubbleFamilyMember2Name.playAudioEvents = true; this.BubbleFamilyMember2Name.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember2Name.font.size = 15; this.BubbleFamilyMember2Name.textScale = 0.80f; this.BubbleFamilyMember2Name.wordWrap = true; this.BubbleFamilyMember2Name.useDropShadow = true; this.BubbleFamilyMember2Name.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember2Name.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember2Name.textPadding.left = 5; this.BubbleFamilyMember2Name.textPadding.right = 5; this.BubbleFamilyMember2Name.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleFamilyMember2Name.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleFamilyMember2Name.pressedTextColor = new Color32 (102, 153, 255, 147); this.BubbleFamilyMember2Name.focusedTextColor = new Color32 (153, 0, 0, 0); this.BubbleFamilyMember2Name.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleFamilyMember2Name.relativePosition = new Vector3 (this.BubbleFamilyMember2IconSprite.relativePosition.x + this.BubbleFamilyMember2IconSprite.width+2, 2); this.BubbleFamilyMember2Name.eventMouseDown += (component, eventParam) => this.GoToCitizen(this.Parent2ID); //Family Member2 Real Age Button this.BubbleFamilyMember2AgeButton = this.BubbleFamilyMember2BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember2AgeButton.name = "BubbleFamilyMember2AgeButton"; this.BubbleFamilyMember2AgeButton.width = 23; this.BubbleFamilyMember2AgeButton.height = 18; this.BubbleFamilyMember2AgeButton.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleFamilyMember2AgeButton.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember2AgeButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember2AgeButton.textScale = 0.90f; this.BubbleFamilyMember2AgeButton.font.size = 15; this.BubbleFamilyMember2AgeButton.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember2AgeButton.dropShadowColor = new Color32 (0, 0, 0, 0); //this.BubbleFamilyMember2AgeButton.text = "99"; //Real Age test //this.BubbleFamilyMember2AgeButton.normalBgSprite = "GenericPanel"; this.BubbleFamilyMember2AgeButton.isInteractive = false; this.BubbleFamilyMember2AgeButton.relativePosition = new Vector3 (this.BubbleFamilyMember2Name.relativePosition.x + this.BubbleFamilyMember2Name.width + 6, 6); //Family 2 Follow Texture Sprite this.BubbleFamilyMember2FollowToggler = this.BubbleFamilyMember2BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember2FollowToggler.name = "BubbleFamilyMember2FollowToggler"; this.BubbleFamilyMember2FollowToggler.atlas = m_atlas; this.BubbleFamilyMember2FollowToggler.size = new Vector2 (18, 18); this.BubbleFamilyMember2FollowToggler.playAudioEvents = true; this.BubbleFamilyMember2FollowToggler.relativePosition = new Vector3 (this.BubbleFamilyMember2AgeButton.relativePosition.x + this.BubbleFamilyMember2AgeButton.width + 12, 4); this.BubbleFamilyMember2FollowToggler.eventClick += (component, eventParam) => { FavCimsCore.AddToFavorites (this.Parent2ID); }; //Family 2 Activity background this.BubbleFamilyMember2ActivityBgBar = this.FamilyMember2Panel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember2ActivityBgBar.name = "BubbleFamilyMember2ActivityBgBar"; this.BubbleFamilyMember2ActivityBgBar.width = this.BubbleFamilyPanel.width; this.BubbleFamilyMember2ActivityBgBar.height = 26; this.BubbleFamilyMember2ActivityBgBar.texture = TextureDB.BubbleBgBar2; //Family 2 Activity Vehicle Button this.BubbleFamilyMember2ActivityVehicleButton = this.BubbleFamilyMember2ActivityBgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember2ActivityVehicleButton.name = "BubbleFamilyMember2ActivityVehicleButton"; this.BubbleFamilyMember2ActivityVehicleButton.width = 22; this.BubbleFamilyMember2ActivityVehicleButton.height = 22; this.BubbleFamilyMember2ActivityVehicleButton.relativePosition = new Vector3 (7, 2); this.BubbleFamilyMember2ActivityVehicleButton.eventMouseDown += (component, eventParam) => GoToInstance(this.Parent2VehID); //Family 2 Activity Destination this.BubbleFamilyMember2ActivityDestination = this.BubbleFamilyMember2ActivityBgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember2ActivityDestination.name = "BubbleFamilyMember2ActivityDestination"; this.BubbleFamilyMember2ActivityDestination.width = this.BubbleFamilyMember2ActivityBgBar.width-this.BubbleFamilyMember2ActivityVehicleButton.width; this.BubbleFamilyMember2ActivityDestination.height = this.BubbleFamilyMember2ActivityBgBar.height; this.BubbleFamilyMember2ActivityDestination.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember2ActivityDestination.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubbleFamilyMember2ActivityDestination.playAudioEvents = true; this.BubbleFamilyMember2ActivityDestination.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember2ActivityDestination.font.size = 15; this.BubbleFamilyMember2ActivityDestination.textScale = 0.75f; this.BubbleFamilyMember2ActivityDestination.wordWrap = true; this.BubbleFamilyMember2ActivityDestination.textPadding.left = 0; this.BubbleFamilyMember2ActivityDestination.textPadding.right = 5; this.BubbleFamilyMember2ActivityDestination.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember2ActivityDestination.outlineSize = 1; this.BubbleFamilyMember2ActivityDestination.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.BubbleFamilyMember2ActivityDestination.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleFamilyMember2ActivityDestination.pressedTextColor = new Color32 (153, 0, 0, 0); this.BubbleFamilyMember2ActivityDestination.focusedTextColor = new Color32 (102, 153, 255, 147); this.BubbleFamilyMember2ActivityDestination.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleFamilyMember2ActivityDestination.useDropShadow = true; this.BubbleFamilyMember2ActivityDestination.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember2ActivityDestination.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember2ActivityDestination.maximumSize = new Vector2 (this.BubbleFamilyMember2ActivityDestination.width, this.BubbleFamilyMember2ActivityBgBar.height); this.BubbleFamilyMember2ActivityDestination.relativePosition = new Vector3 (this.BubblePartnerDestination.relativePosition.x, 2); this.BubbleFamilyMember2ActivityDestination.eventMouseDown += (component, eventParam) => GoToInstance(this.Parent2Target); //Parent 3 Panel this.FamilyMember3Panel = this.BubbleFamilyPanel.AddUIComponent<UIPanel>(); this.FamilyMember3Panel.name = "FamilyMember3Panel"; this.FamilyMember3Panel.width = this.BubbleFamilyPanel.width; this.FamilyMember3Panel.height = 52; this.FamilyMember3Panel.clipChildren = true; this.FamilyMember3Panel.padding = new RectOffset(0,0,0,0); this.FamilyMember3Panel.autoLayout = true; this.FamilyMember3Panel.autoLayoutDirection = LayoutDirection.Vertical; this.FamilyMember3Panel.relativePosition = new Vector3(0,0); this.FamilyMember3Panel.Hide (); //Family 3 Background bar this.BubbleFamilyMember3BgBar = this.FamilyMember3Panel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember3BgBar.name = "BubbleFamilyMember3BgBar"; this.BubbleFamilyMember3BgBar.width = this.BubbleFamilyPanel.width; this.BubbleFamilyMember3BgBar.height = 26; this.BubbleFamilyMember3BgBar.texture = TextureDB.BubbleBgBar1; //Family 3 icon sprite this.BubbleFamilyMember3IconSprite = this.BubbleFamilyMember3BgBar.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember3IconSprite.name = "BubbleFamilyMember3IconSprite"; this.BubbleFamilyMember3IconSprite.width = 18; this.BubbleFamilyMember3IconSprite.height = 18; this.BubbleFamilyMember3IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureMale; this.BubbleFamilyMember3IconSprite.relativePosition = new Vector3(7,4); //Family 3 name button this.BubbleFamilyMember3Name = this.BubbleFamilyMember3BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember3Name.name = "BubbleFamilyMember3Name"; this.BubbleFamilyMember3Name.width = 135; this.BubbleFamilyMember3Name.height = this.BubbleFamilyMember3BgBar.height; this.BubbleFamilyMember3Name.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember3Name.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubbleFamilyMember3Name.playAudioEvents = true; this.BubbleFamilyMember3Name.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember3Name.font.size = 15; this.BubbleFamilyMember3Name.textScale = 0.80f; this.BubbleFamilyMember3Name.wordWrap = true; this.BubbleFamilyMember3Name.useDropShadow = true; this.BubbleFamilyMember3Name.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember3Name.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember3Name.textPadding.left = 5; this.BubbleFamilyMember3Name.textPadding.right = 5; this.BubbleFamilyMember3Name.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleFamilyMember3Name.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleFamilyMember3Name.pressedTextColor = new Color32 (102, 153, 255, 147); this.BubbleFamilyMember3Name.focusedTextColor = new Color32 (153, 0, 0, 0); this.BubbleFamilyMember3Name.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleFamilyMember3Name.relativePosition = new Vector3 (this.BubbleFamilyMember3IconSprite.relativePosition.x + this.BubbleFamilyMember3IconSprite.width+2, 2); this.BubbleFamilyMember3Name.eventMouseDown += (component, eventParam) => this.GoToCitizen(this.Parent3ID); //Family Member3 Real Age Button this.BubbleFamilyMember3AgeButton = this.BubbleFamilyMember3BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember3AgeButton.name = "BubbleFamilyMember3AgeButton"; this.BubbleFamilyMember3AgeButton.width = 23; this.BubbleFamilyMember3AgeButton.height = 18; this.BubbleFamilyMember3AgeButton.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleFamilyMember3AgeButton.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember3AgeButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember3AgeButton.textScale = 0.90f; this.BubbleFamilyMember3AgeButton.font.size = 15; this.BubbleFamilyMember3AgeButton.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember3AgeButton.dropShadowColor = new Color32 (0, 0, 0, 0); //this.BubbleFamilyMember3AgeButton.text = "99"; //Real Age test //this.BubbleFamilyMember3AgeButton.normalBgSprite = "GenericPanel"; this.BubbleFamilyMember3AgeButton.isInteractive = false; this.BubbleFamilyMember3AgeButton.relativePosition = new Vector3 (this.BubbleFamilyMember3Name.relativePosition.x + this.BubbleFamilyMember3Name.width + 6, 6); //Family 3 Follow Texture Sprite this.BubbleFamilyMember3FollowToggler = this.BubbleFamilyMember3BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember3FollowToggler.name = "BubbleFamilyMember3FollowToggler"; this.BubbleFamilyMember3FollowToggler.atlas = m_atlas; this.BubbleFamilyMember3FollowToggler.size = new Vector2 (18, 18); this.BubbleFamilyMember3FollowToggler.playAudioEvents = true; this.BubbleFamilyMember3FollowToggler.relativePosition = new Vector3 (this.BubbleFamilyMember3AgeButton.relativePosition.x + this.BubbleFamilyMember3AgeButton.width + 12, 4); this.BubbleFamilyMember3FollowToggler.eventClick += (component, eventParam) => { FavCimsCore.AddToFavorites (this.Parent3ID); }; //Family 3 Activity background this.BubbleFamilyMember3ActivityBgBar = this.FamilyMember3Panel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember3ActivityBgBar.name = "BubbleFamilyMember3ActivityBgBar"; this.BubbleFamilyMember3ActivityBgBar.width = this.BubbleFamilyPanel.width; this.BubbleFamilyMember3ActivityBgBar.height = 26; this.BubbleFamilyMember3ActivityBgBar.texture = TextureDB.BubbleBgBar2; //Family 3 Activity Vehicle Button this.BubbleFamilyMember3ActivityVehicleButton = this.BubbleFamilyMember3ActivityBgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember3ActivityVehicleButton.name = "BubbleFamilyMember3ActivityVehicleButton"; this.BubbleFamilyMember3ActivityVehicleButton.width = 22; this.BubbleFamilyMember3ActivityVehicleButton.height = 22; this.BubbleFamilyMember3ActivityVehicleButton.relativePosition = new Vector3 (7, 2); this.BubbleFamilyMember3ActivityVehicleButton.eventMouseDown += (component, eventParam) => GoToInstance(this.Parent3VehID); //Family 3 Activity Destination this.BubbleFamilyMember3ActivityDestination = this.BubbleFamilyMember3ActivityBgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember3ActivityDestination.name = "BubbleFamilyMember3ActivityDestination"; this.BubbleFamilyMember3ActivityDestination.width = this.BubbleFamilyMember3ActivityBgBar.width-this.BubbleFamilyMember3ActivityVehicleButton.width; this.BubbleFamilyMember3ActivityDestination.height = this.BubbleFamilyMember3ActivityBgBar.height; this.BubbleFamilyMember3ActivityDestination.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember3ActivityDestination.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubbleFamilyMember3ActivityDestination.playAudioEvents = true; this.BubbleFamilyMember3ActivityDestination.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember3ActivityDestination.font.size = 15; this.BubbleFamilyMember3ActivityDestination.textScale = 0.75f; this.BubbleFamilyMember3ActivityDestination.wordWrap = true; this.BubbleFamilyMember3ActivityDestination.textPadding.left = 0; this.BubbleFamilyMember3ActivityDestination.textPadding.right = 5; this.BubbleFamilyMember3ActivityDestination.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember3ActivityDestination.outlineSize = 1; this.BubbleFamilyMember3ActivityDestination.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.BubbleFamilyMember3ActivityDestination.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleFamilyMember3ActivityDestination.pressedTextColor = new Color32 (153, 0, 0, 0); this.BubbleFamilyMember3ActivityDestination.focusedTextColor = new Color32 (102, 153, 255, 147); this.BubbleFamilyMember3ActivityDestination.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleFamilyMember3ActivityDestination.useDropShadow = true; this.BubbleFamilyMember3ActivityDestination.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember3ActivityDestination.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember3ActivityDestination.maximumSize = new Vector2 (this.BubbleFamilyMember3ActivityDestination.width, this.BubbleFamilyMember3ActivityBgBar.height); this.BubbleFamilyMember3ActivityDestination.relativePosition = new Vector3 (this.BubblePartnerDestination.relativePosition.x, 2); this.BubbleFamilyMember3ActivityDestination.eventMouseDown += (component, eventParam) => GoToInstance(this.Parent3Target); //Parent 4 Panel this.FamilyMember4Panel = this.BubbleFamilyPanel.AddUIComponent<UIPanel>(); this.FamilyMember4Panel.name = "FamilyMember4Panel"; this.FamilyMember4Panel.width = this.BubbleFamilyPanel.width; this.FamilyMember4Panel.height = 52; this.FamilyMember4Panel.clipChildren = true; this.FamilyMember4Panel.padding = new RectOffset(0,0,0,0); this.FamilyMember4Panel.autoLayout = true; this.FamilyMember4Panel.autoLayoutDirection = LayoutDirection.Vertical; this.FamilyMember4Panel.relativePosition = new Vector3(0,0); this.FamilyMember4Panel.Hide (); //Family 4 Background bar this.BubbleFamilyMember4BgBar = this.FamilyMember4Panel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember4BgBar.name = "BubbleFamilyMember4BgBar"; this.BubbleFamilyMember4BgBar.width = this.BubbleFamilyPanel.width; this.BubbleFamilyMember4BgBar.height = 26; this.BubbleFamilyMember4BgBar.texture = TextureDB.BubbleBgBar1; //Family 4 icon sprite this.BubbleFamilyMember4IconSprite = this.BubbleFamilyMember4BgBar.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember4IconSprite.name = "BubbleFamilyMember4IconSprite"; this.BubbleFamilyMember4IconSprite.width = 18; this.BubbleFamilyMember4IconSprite.height = 18; this.BubbleFamilyMember4IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureMale; this.BubbleFamilyMember4IconSprite.relativePosition = new Vector3(7,4); //Family 4 name button this.BubbleFamilyMember4Name = this.BubbleFamilyMember4BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember4Name.name = "BubbleFamilyMember4Name"; this.BubbleFamilyMember4Name.width = 135; this.BubbleFamilyMember4Name.height = this.BubbleFamilyMember4BgBar.height; this.BubbleFamilyMember4Name.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember4Name.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubbleFamilyMember4Name.playAudioEvents = true; this.BubbleFamilyMember4Name.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember4Name.font.size = 15; this.BubbleFamilyMember4Name.textScale = 0.80f; this.BubbleFamilyMember4Name.wordWrap = true; this.BubbleFamilyMember4Name.useDropShadow = true; this.BubbleFamilyMember4Name.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember4Name.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember4Name.textPadding.left = 5; this.BubbleFamilyMember4Name.textPadding.right = 5; this.BubbleFamilyMember4Name.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleFamilyMember4Name.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleFamilyMember4Name.pressedTextColor = new Color32 (102, 153, 255, 147); this.BubbleFamilyMember4Name.focusedTextColor = new Color32 (153, 0, 0, 0); this.BubbleFamilyMember4Name.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleFamilyMember4Name.relativePosition = new Vector3 (this.BubbleFamilyMember4IconSprite.relativePosition.x + this.BubbleFamilyMember4IconSprite.width+2, 2); this.BubbleFamilyMember4Name.eventMouseDown += (component, eventParam) => this.GoToCitizen(this.Parent4ID); //Family Member4 Real Age Button this.BubbleFamilyMember4AgeButton = this.BubbleFamilyMember4BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember4AgeButton.name = "BubbleFamilyMember4AgeButton"; this.BubbleFamilyMember4AgeButton.width = 23; this.BubbleFamilyMember4AgeButton.height = 18; this.BubbleFamilyMember4AgeButton.textHorizontalAlignment = UIHorizontalAlignment.Center; this.BubbleFamilyMember4AgeButton.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember4AgeButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember4AgeButton.textScale = 0.90f; this.BubbleFamilyMember4AgeButton.font.size = 15; this.BubbleFamilyMember4AgeButton.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember4AgeButton.dropShadowColor = new Color32 (0, 0, 0, 0); //this.BubbleFamilyMember4AgeButton.text = "99"; //Real Age test //this.BubbleFamilyMember4AgeButton.normalBgSprite = "GenericPanel"; this.BubbleFamilyMember4AgeButton.isInteractive = false; this.BubbleFamilyMember4AgeButton.relativePosition = new Vector3 (this.BubbleFamilyMember4Name.relativePosition.x + this.BubbleFamilyMember4Name.width + 6, 6); //Family 4 Follow Texture Sprite this.BubbleFamilyMember4FollowToggler = this.BubbleFamilyMember4BgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember4FollowToggler.name = "BubbleFamilyMember4FollowToggler"; this.BubbleFamilyMember4FollowToggler.atlas = m_atlas; this.BubbleFamilyMember4FollowToggler.width = 18; this.BubbleFamilyMember4FollowToggler.height = 18; this.BubbleFamilyMember4FollowToggler.playAudioEvents = true; this.BubbleFamilyMember4FollowToggler.relativePosition = new Vector3 (this.BubbleFamilyMember4AgeButton.relativePosition.x + this.BubbleFamilyMember4AgeButton.width + 12, 4); this.BubbleFamilyMember4FollowToggler.eventClick += (component, eventParam) => { FavCimsCore.AddToFavorites (this.Parent4ID); }; //Family 4 Activity background this.BubbleFamilyMember4ActivityBgBar = this.FamilyMember4Panel.AddUIComponent<UITextureSprite> (); this.BubbleFamilyMember4ActivityBgBar.name = "BubbleFamilyMember4ActivityBgBar"; this.BubbleFamilyMember4ActivityBgBar.width = this.BubbleFamilyPanel.width; this.BubbleFamilyMember4ActivityBgBar.height = 26; this.BubbleFamilyMember4ActivityBgBar.texture = TextureDB.BubbleBgBar2; //Family 4 Activity Vehicle Button this.BubbleFamilyMember4ActivityVehicleButton = this.BubbleFamilyMember4ActivityBgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember4ActivityVehicleButton.name = "BubbleFamilyMember4ActivityVehicleButton"; this.BubbleFamilyMember4ActivityVehicleButton.width = 22; this.BubbleFamilyMember4ActivityVehicleButton.height = 22; this.BubbleFamilyMember4ActivityVehicleButton.relativePosition = new Vector3 (7, 2); this.BubbleFamilyMember4ActivityVehicleButton.eventMouseDown += (component, eventParam) => GoToInstance(this.Parent4VehID); //Family 4 Activity Destination this.BubbleFamilyMember4ActivityDestination = this.BubbleFamilyMember4ActivityBgBar.AddUIComponent<UIButton> (); this.BubbleFamilyMember4ActivityDestination.name = "BubbleFamilyMember4ActivityDestination"; this.BubbleFamilyMember4ActivityDestination.width = this.BubbleFamilyMember4ActivityBgBar.width-this.BubbleFamilyMember4ActivityVehicleButton.width; this.BubbleFamilyMember4ActivityDestination.height = this.BubbleFamilyMember4ActivityBgBar.height; this.BubbleFamilyMember4ActivityDestination.textVerticalAlignment = UIVerticalAlignment.Middle; this.BubbleFamilyMember4ActivityDestination.textHorizontalAlignment = UIHorizontalAlignment.Left; this.BubbleFamilyMember4ActivityDestination.playAudioEvents = true; this.BubbleFamilyMember4ActivityDestination.font = UIDynamicFont.FindByName ("OpenSans-Regular"); this.BubbleFamilyMember4ActivityDestination.font.size = 15; this.BubbleFamilyMember4ActivityDestination.textScale = 0.75f; this.BubbleFamilyMember4ActivityDestination.wordWrap = true; this.BubbleFamilyMember4ActivityDestination.textPadding.left = 0; this.BubbleFamilyMember4ActivityDestination.textPadding.right = 5; this.BubbleFamilyMember4ActivityDestination.outlineColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember4ActivityDestination.outlineSize = 1; this.BubbleFamilyMember4ActivityDestination.textColor = new Color32 (21, 59, 96, 140); //r,g,b,a this.BubbleFamilyMember4ActivityDestination.hoveredTextColor = new Color32 (204, 102, 0, 20); this.BubbleFamilyMember4ActivityDestination.pressedTextColor = new Color32 (153, 0, 0, 0); this.BubbleFamilyMember4ActivityDestination.focusedTextColor = new Color32 (102, 153, 255, 147); this.BubbleFamilyMember4ActivityDestination.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.BubbleFamilyMember4ActivityDestination.useDropShadow = true; this.BubbleFamilyMember4ActivityDestination.dropShadowOffset = new Vector2 (1, -1); this.BubbleFamilyMember4ActivityDestination.dropShadowColor = new Color32 (0, 0, 0, 0); this.BubbleFamilyMember4ActivityDestination.maximumSize = new Vector2 (this.BubbleFamilyMember4ActivityDestination.width, this.BubbleFamilyMember4ActivityBgBar.height); this.BubbleFamilyMember4ActivityDestination.relativePosition = new Vector3 (this.BubblePartnerDestination.relativePosition.x, 2); this.BubbleFamilyMember4ActivityDestination.eventMouseDown += (component, eventParam) => GoToInstance(this.Parent4Target); this.absolutePosition = new Vector3 ((float)rnd.Next (RandXMin, RandXMax), (float)rnd.Next (RandYMin, RandYMax)); //this.absolutePosition = new Vector3 (FavCimsMainClass.FavCimsPanel.absolutePosition.x - this.width - 15, (FavCimsMainClass.FavCimsPanel.absolutePosition.y / 2) - (this.height / 2));//(MouseClickPos.y - Screen.height)*-1); //this.BringToFront (); ///////////////End Bubble/////////////// }
public override void Start() { base.Start(); backgroundSprite = "GenericPanel"; // Preview m_preview = AddUIComponent<UITextureSprite>(); m_preview.size = size; m_preview.relativePosition = Vector3.zero; m_noPreview = AddUIComponent<UISprite>(); m_noPreview.spriteName = "Niet"; m_noPreview.relativePosition = new Vector3((width - m_noPreview.spriteInfo.width) / 2, (height - m_noPreview.spriteInfo.height) / 2); m_previewRenderer = gameObject.AddComponent<PreviewRenderer>(); m_previewRenderer.size = m_preview.size * 2; // Twice the size for anti-aliasing eventMouseDown += (c, p) => { eventMouseMove += RotateCamera; }; eventMouseUp += (c, p) => { eventMouseMove -= RotateCamera; }; eventMouseWheel += (c, p) => { m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f; RenderPreview(); }; // Name m_buildingName = AddUIComponent<UILabel>(); m_buildingName.textScale = 0.9f; m_buildingName.useDropShadow = true; m_buildingName.dropShadowColor = new Color32(80, 80, 80, 255); m_buildingName.dropShadowOffset = new Vector2(2, -2); m_buildingName.text = "Name"; m_buildingName.isVisible = false; m_buildingName.relativePosition = new Vector3(5, 10); // Category icon m_categoryIcon = AddUIComponent<UISprite>(); m_categoryIcon.size = new Vector2(35, 35); m_categoryIcon.isVisible = false; m_categoryIcon.relativePosition = new Vector3(width - 37, 2); // Level m_level = AddUIComponent<UILabel>(); m_level.textScale = 0.9f; m_level.useDropShadow = true; m_level.dropShadowColor = new Color32(80, 80, 80, 255); m_level.dropShadowOffset = new Vector2(2, -2); m_level.text = "Level"; m_level.isVisible = false; m_level.relativePosition = new Vector3(5, height - 20); // Size m_size = AddUIComponent<UILabel>(); m_size.textScale = 0.9f; m_size.useDropShadow = true; m_size.dropShadowColor = new Color32(80, 80, 80, 255); m_size.dropShadowOffset = new Vector2(2, -2); m_size.text = "Size"; m_size.isVisible = false; m_size.relativePosition = new Vector3(width - 50, height - 20); }
private void SetupControls() { float offset = 40f; //Beta Testing Timestamp //DateTime now = DateTime.Now; //m_title.title = "Advanced Vehicle Options " + ModInfo.version + " " + now; // Title Bar m_title = AddUIComponent <UITitleBar>(); m_title.iconSprite = "InfoIconTrafficCongestion"; m_title.title = "Advanced Vehicle Options " + ModInfo.version; // Category DropDown UILabel label = AddUIComponent <UILabel>(); label.textScale = 0.8f; label.padding = new RectOffset(0, 0, 8, 0); label.relativePosition = new Vector3(10f, offset); label.text = "Category :"; m_category = UIUtils.CreateDropDown(this); m_category.width = 175; for (int i = 0; i < categoryList.Length; i++) { m_category.AddItem(categoryList[i]); } m_category.selectedIndex = 0; m_category.tooltip = "Select a category to display\nTip: Use the mouse wheel to switch between categories faster"; m_category.relativePosition = label.relativePosition + new Vector3(75f, 0f); m_category.eventSelectedIndexChanged += (c, t) => { m_category.enabled = false; PopulateList(); m_category.enabled = true; }; // Search m_search = UIUtils.CreateTextField(this); m_search.width = 145f; m_search.height = 30f; m_search.padding = new RectOffset(6, 6, 6, 6); m_search.tooltip = "Type the name of a vehicle type"; m_search.relativePosition = new Vector3(WIDTHLEFT - m_search.width, offset); m_search.eventTextChanged += (c, t) => PopulateList(); label = AddUIComponent <UILabel>(); label.textScale = 0.8f; label.padding = new RectOffset(0, 0, 8, 0); label.relativePosition = m_search.relativePosition - new Vector3(60f, 0f); label.text = "Search :"; // FastList m_fastList = UIFastList.Create <UIVehicleItem>(this); m_fastList.backgroundSprite = "UnlockingPanel"; m_fastList.width = WIDTHLEFT - 5; m_fastList.height = height - offset - 110; m_fastList.canSelect = true; m_fastList.relativePosition = new Vector3(5, offset + 35); // Configuration file buttons UILabel configLabel = this.AddUIComponent <UILabel>(); configLabel.text = "Actions for Vehicle Configuration:"; configLabel.textScale = 0.8f; configLabel.relativePosition = new Vector3(16, height - 65); m_import = UIUtils.CreateButton(this); m_import.text = "Import"; m_import.width = 80; m_import.tooltip = "Import the configuration"; m_import.relativePosition = new Vector3(10, height - 45); m_export = UIUtils.CreateButton(this); m_export.text = "Export"; m_export.width = 80; m_export.tooltip = "Export the configuration"; m_export.relativePosition = new Vector3(95, height - 45); m_resetall = UIUtils.CreateButton(this); m_resetall.text = "Reset all"; m_resetall.width = 80; m_resetall.tooltip = "Reset full configuration"; m_resetall.relativePosition = new Vector3(180, height - 45); // Preview UIPanel panel = AddUIComponent <UIPanel>(); panel.backgroundSprite = "GenericPanel"; panel.width = WIDTHRIGHT - 10; panel.height = HEIGHT - 420; panel.relativePosition = new Vector3(WIDTHLEFT + 5, offset); m_preview = panel.AddUIComponent <UITextureSprite>(); m_preview.size = panel.size; m_preview.relativePosition = Vector3.zero; m_previewRenderer = gameObject.AddComponent <PreviewRenderer>(); m_previewRenderer.size = m_preview.size * 2; // Twice the size for anti-aliasing m_preview.texture = m_previewRenderer.texture; // Follow a vehicle if (m_cameraController != null) { m_followVehicle = AddUIComponent <UISprite>(); m_followVehicle.spriteName = "LocationMarkerFocused"; m_followVehicle.width = m_followVehicle.spriteInfo.width; m_followVehicle.height = m_followVehicle.spriteInfo.height; m_followVehicle.tooltip = "Click here to cycle through the existing vehicles of that type.\nHold Shift Key down for zooming directly to vehicle."; m_followVehicle.relativePosition = new Vector3(panel.relativePosition.x + panel.width - m_followVehicle.width - 5, panel.relativePosition.y + 5); m_followVehicle.eventClick += (c, p) => FollowNextVehicle(); } //Remove the followed vehicle { m_removeVehicle = AddUIComponent <UISprite>(); m_removeVehicle.Hide(); m_removeVehicle.spriteName = "IconPolicyOldTown"; m_removeVehicle.width = m_removeVehicle.spriteInfo.width - 12; m_removeVehicle.height = m_removeVehicle.spriteInfo.height - 12; m_removeVehicle.tooltip = "Click here to remove the selected vehicle."; m_removeVehicle.relativePosition = new Vector3(panel.relativePosition.x + panel.width - m_removeVehicle.width - 33, panel.relativePosition.y + 7); m_removeVehicle.eventClick += (c, p) => RemoveThisVehicle(); } // Option panel m_optionPanel = AddUIComponent <UIOptionPanel>(); m_optionPanel.relativePosition = new Vector3(WIDTHLEFT, height - 370); // Event handlers m_fastList.eventSelectedIndexChanged += OnSelectedItemChanged; m_optionPanel.eventEnableCheckChanged += OnEnableStateChanged; m_import.eventClick += (c, t) => { DefaultOptions.RestoreAll(); AdvancedVehicleOptionsUID.ImportConfig(); optionList = AdvancedVehicleOptionsUID.config.options; }; m_export.eventClick += (c, t) => AdvancedVehicleOptionsUID.ExportConfig(); m_resetall.eventClick += (c, t) => { ConfirmPanel.ShowModal("Confirm Reset Configuration", "Customized settings for all vehicles will be reset.\n\n" + "Proceed with Configuration reset ?", (comp, ret) => { if (ret != 1) { return; } DefaultOptions.RestoreAll(); AdvancedVehicleOptionsUID.ResetConfig(); optionList = AdvancedVehicleOptionsUID.config.options; ExceptionPanel resetpanel = UIView.library.ShowModal <ExceptionPanel>("ExceptionPanel"); resetpanel.SetMessage("Advanced Vehicle Options", "All vehicle configuration and customized settings\n" + "have been reset to the Game Defaults.", false); }); }; panel.eventMouseDown += (c, p) => { eventMouseMove += RotateCamera; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; panel.eventMouseUp += (c, p) => { eventMouseMove -= RotateCamera; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; panel.eventMouseWheel += (c, p) => { m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; }
private void CreateComponents() { int headerHeight = 40; // Label UILabel label = AddUIComponent <UILabel>(); label.text = "Save Asset"; label.relativePosition = new Vector3(WIDTH / 2 - label.width / 2, 10); // Drag handle UIDragHandle handle = AddUIComponent <UIDragHandle>(); handle.target = this; handle.constrainToScreen = true; handle.width = WIDTH; handle.height = headerHeight; handle.relativePosition = Vector3.zero; // Fields label = AddUIComponent <UILabel>(); label.text = "Package name:"; label.relativePosition = new Vector3(10, headerHeight + 15); m_packageField = UIUtils.CreateTextField(this); m_packageField.width = 400; m_packageField.relativePosition = new Vector3(20 + label.width, headerHeight + 10); // Fields label = AddUIComponent <UILabel>(); label.text = "Asset name:"; label.relativePosition = new Vector3(10, headerHeight + 45); m_nameField = UIUtils.CreateTextField(this); m_nameField.width = 400; m_nameField.relativePosition = new Vector3(m_packageField.relativePosition.x, headerHeight + 40); // Naming dropdown menu label = AddUIComponent <UILabel>(); label.text = "Trailer naming:"; label.relativePosition = new Vector3(m_nameField.relativePosition.x + m_nameField.width + 20, headerHeight + 10); m_namingDropdown = UIUtils.CreateDropDown(this); m_namingDropdown.text = "Trailer naming convention"; m_namingDropdown.AddItem("Package name (TrailerPackageName0)"); //0 m_namingDropdown.AddItem("Default (Trailer0)"); //1 m_namingDropdown.selectedIndex = 0; m_namingDropdown.width = 300; m_namingDropdown.relativePosition = new Vector3(m_nameField.relativePosition.x + m_nameField.width + 20, headerHeight + 35); // Save button m_saveButton = UIUtils.CreateButton(this); m_saveButton.text = "Save"; m_saveButton.textScale = 1.3f; m_saveButton.width = 153f; m_saveButton.height = 47f; m_saveButton.eventClicked += (c, b) => { string assetName = m_nameField.text.Trim(); string packageName = m_packageField.text.Trim(); string file = GetSavePathName(packageName); if (!File.Exists(file)) { SaveAsset(assetName, packageName); } else { ConfirmPanel.ShowModal("CONFIRM_SAVEOVERRIDE", delegate(UIComponent comp, int ret) { if (ret == 1) { SaveAsset(assetName, packageName); } }); } }; m_saveButton.relativePosition = new Vector3(WIDTH / 2 - m_saveButton.width - 50, HEIGHT - m_saveButton.height - 10); // Cancel button m_cancelButton = UIUtils.CreateButton(this); m_cancelButton.text = "Cancel"; m_cancelButton.textScale = 1.3f; m_cancelButton.width = 153f; m_cancelButton.height = 47f; m_cancelButton.eventClicked += (c, b) => { m_info = null; isVisible = false; }; m_cancelButton.relativePosition = new Vector3(WIDTH / 2 + 50, HEIGHT - m_cancelButton.height - 10); // Snapshot container GameObject go = GameObject.Find("SnapshotContainer"); if (go != null) { m_snapshotContainer = GameObject.Instantiate <UIPanel>(go.GetComponent <UIPanel>()); m_snapshotContainer.transform.SetParent(transform); m_snapshotSprite = m_snapshotContainer.Find <UITextureSprite>("SnapShot"); m_snapshotLabel = m_snapshotContainer.Find <UILabel>("CurrentSnapShot"); m_snapshotPrev = m_snapshotContainer.Find <UIButton>("Previous"); m_snapshotPrev.eventClicked += (c, b) => { OnPreviousSnapshot(); }; m_snapshotNext = m_snapshotContainer.Find <UIButton>("Next"); m_snapshotNext.eventClicked += (c, b) => { OnNextSnapshot(); }; } }
/*public override void OnDestroy() * { * base.OnDestroy(); * * DebugUtils.Log("Destroying UIMainPanel"); * * if (m_button != null) GameObject.Destroy(m_button.gameObject); * GameObject.Destroy(m_optionPanel.gameObject); * }*/ private void SetupControls() { float offset = 40f; // Title Bar m_title = AddUIComponent <UITitleBar>(); m_title.iconSprite = "InfoIconTrafficCongestion"; m_title.title = "Advanced Vehicle Options " + ModInfo.version; // Category DropDown UILabel label = AddUIComponent <UILabel>(); label.textScale = 0.8f; label.padding = new RectOffset(0, 0, 8, 0); label.relativePosition = new Vector3(10f, offset); label.text = "Category :"; m_category = UIUtils.CreateDropDown(this); m_category.width = 150; for (int i = 0; i < categoryList.Length; i++) { m_category.AddItem(categoryList[i]); } m_category.selectedIndex = 0; m_category.tooltip = "Select a category to display\nTip: Use the mouse wheel to switch between categories faster"; m_category.relativePosition = label.relativePosition + new Vector3(75f, 0f); m_category.eventSelectedIndexChanged += (c, t) => { m_category.enabled = false; PopulateList(); m_category.enabled = true; }; // Search m_search = UIUtils.CreateTextField(this); m_search.width = 145f; m_search.height = 30f; m_search.padding = new RectOffset(6, 6, 6, 6); m_search.tooltip = "Type the name of a vehicle type"; m_search.relativePosition = new Vector3(WIDTHLEFT - m_search.width, offset); m_search.eventTextChanged += (c, t) => PopulateList(); label = AddUIComponent <UILabel>(); label.textScale = 0.8f; label.padding = new RectOffset(0, 0, 8, 0); label.relativePosition = m_search.relativePosition - new Vector3(60f, 0f); label.text = "Search :"; // FastList m_fastList = UIFastList.Create <UIVehicleItem>(this); m_fastList.backgroundSprite = "UnlockingPanel"; m_fastList.width = WIDTHLEFT - 5; m_fastList.height = height - offset - 110; m_fastList.canSelect = true; m_fastList.relativePosition = new Vector3(5, offset + 35); // Configuration file buttons UILabel configLabel = this.AddUIComponent <UILabel>(); configLabel.text = "Configuration file:"; configLabel.textScale = 0.8f; configLabel.relativePosition = new Vector3(10, height - 60); m_import = UIUtils.CreateButton(this); m_import.text = "Import"; m_import.tooltip = "Import the configuration"; m_import.relativePosition = new Vector3(10, height - 40); m_export = UIUtils.CreateButton(this); m_export.text = "Export"; m_export.tooltip = "Export the configuration"; m_export.relativePosition = new Vector3(105, height - 40); // Preview UIPanel panel = AddUIComponent <UIPanel>(); panel.backgroundSprite = "GenericPanel"; panel.width = WIDTHRIGHT - 10; panel.height = HEIGHT - 420; panel.relativePosition = new Vector3(WIDTHLEFT + 5, offset); m_preview = panel.AddUIComponent <UITextureSprite>(); m_preview.size = panel.size; m_preview.relativePosition = Vector3.zero; m_previewRenderer = gameObject.AddComponent <PreviewRenderer>(); m_previewRenderer.size = m_preview.size * 2; // Twice the size for anti-aliasing m_preview.texture = m_previewRenderer.texture; // Follow if (m_cameraController != null) { m_followVehicle = AddUIComponent <UISprite>(); m_followVehicle.spriteName = "LocationMarkerFocused"; m_followVehicle.width = m_followVehicle.spriteInfo.width; m_followVehicle.height = m_followVehicle.spriteInfo.height; m_followVehicle.tooltip = "Click here to cycle through the existing vehicles of that type"; m_followVehicle.relativePosition = new Vector3(panel.relativePosition.x + panel.width - m_followVehicle.width - 5, panel.relativePosition.y + 5); m_followVehicle.eventClick += (c, p) => FollowNextVehicle(); } // Option panel m_optionPanel = AddUIComponent <UIOptionPanel>(); m_optionPanel.relativePosition = new Vector3(WIDTHLEFT, height - 370); // Event handlers m_fastList.eventSelectedIndexChanged += OnSelectedItemChanged; m_optionPanel.eventEnableCheckChanged += OnEnableStateChanged; m_import.eventClick += (c, t) => { DefaultOptions.RestoreAll(); AdvancedVehicleOptions.ImportConfig(); optionList = AdvancedVehicleOptions.config.options; }; m_export.eventClick += (c, t) => AdvancedVehicleOptions.ExportConfig(); panel.eventMouseDown += (c, p) => { eventMouseMove += RotateCamera; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; panel.eventMouseUp += (c, p) => { eventMouseMove -= RotateCamera; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; panel.eventMouseWheel += (c, p) => { m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; }
//public void ButtonEnabler(UITextureSprite sPrite) { //if (sPrite == FavCimsCBMenuSprite) { //FavCimsCBMenuSprite.texture = FavCimsCBETexture; //FavCimsBBMenuSprite.texture = FavCimsBBDTexture; //FavCimsSBMenuSprite.texture = FavCimsSBDTexture; //} else if (sPrite == FavCimsBBMenuSprite) { //FavCimsCBMenuSprite.texture = FavCimsCBDTexture; //FavCimsBBMenuSprite.texture = FavCimsBBETexture; //FavCimsSBMenuSprite.texture = FavCimsSBDTexture; //} else if (sPrite == FavCimsSBMenuSprite) { //FavCimsCBMenuSprite.texture = FavCimsCBDTexture; //FavCimsBBMenuSprite.texture = FavCimsBBDTexture; //FavCimsSBMenuSprite.texture = FavCimsSBETexture; //} //return; //} public override void Start() { var uiView = UIView.GetAView(); this.name = "FavCimsPanel"; this.width = 1200; this.height = 700; this.opacity = 0.95f; this.eventVisibilityChanged += (component, value) => change_visibility_event(); //Main Panel BG Texture Texture FavCimsMainBGTexture = ResourceLoader.loadTexture((int)this.width, (int)this.height, "UIMainPanel.mainbg.png"); FavCimsMainBGTexture.wrapMode = TextureWrapMode.Clamp; FavCimsMainBGTexture.filterMode = FilterMode.Bilinear; //FavCimsMainBGTexture.anisoLevel = 9; Set 1 Bad to 9 Very God FavCimsMainBGTexture.name = "FavCimsMainBGTexture"; UITextureSprite FavCimsMainBGSprite; FavCimsMainBGSprite = this.AddUIComponent <UITextureSprite> (); FavCimsMainBGSprite.name = "FavCimsMainBGSprite"; FavCimsMainBGSprite.texture = FavCimsMainBGTexture; FavCimsMainBGSprite.relativePosition = new Vector3(0, 0); FavCimsMainBGSprite.eventMouseDown += delegate { if (Input.GetMouseButton(0)) { if (this.GetComponentInChildren <WindowController> () != null) { this.PanelMover = this.GetComponentInChildren <WindowController> (); this.PanelMover.ComponentToMove = this; this.PanelMover.Stop = false; this.PanelMover.Start(); } else { this.PanelMover = this.AddUIComponent(typeof(WindowController)) as WindowController; this.PanelMover.ComponentToMove = this; } this.opacity = 0.5f; } }; FavCimsMainBGSprite.eventMouseUp += delegate { if (this.PanelMover != null) { this.PanelMover.Stop = true; this.PanelMover.ComponentToMove = null; this.PanelMover = null; } this.opacity = 1f; }; //Main Panel Title Texture Texture FavCimsTitleTexture; FavCimsTitleTexture = ResourceLoader.loadTexture((int)this.width, 58, "UIMainPanel.favcimstitle.png"); FavCimsTitleTexture.wrapMode = TextureWrapMode.Clamp; FavCimsTitleTexture.filterMode = FilterMode.Bilinear; FavCimsTitleTexture.mipMapBias = -0.5f; //FavCimsTitleTexture.anisoLevel = 9; // Set 1 Bad to 9 Very God FavCimsTitleTexture.name = "FavCimsTitleTexture"; FavCimsTitleSprite = FavCimsMainBGSprite.AddUIComponent <UITextureSprite> (); FavCimsTitleSprite.name = "FavCimsTitleSprite"; FavCimsTitleSprite.texture = FavCimsTitleTexture; float FavCimsTitleSpriteRelPosX = ((this.width / 2) - (float)FavCimsTitleTexture.width / 2); FavCimsTitleSprite.relativePosition = new Vector3(FavCimsTitleSpriteRelPosX, 0); /////////////////////////////////////////////// //Game Default Close Button ////////////////////////////////////////////// UIButton FavCimsMenuCloseButton = this.AddUIComponent <UIButton> (); FavCimsMenuCloseButton.name = "FavCimsMenuCloseButton"; FavCimsMenuCloseButton.width = 32; FavCimsMenuCloseButton.height = 32; FavCimsMenuCloseButton.normalBgSprite = "buttonclose"; FavCimsMenuCloseButton.hoveredBgSprite = "buttonclosehover"; FavCimsMenuCloseButton.pressedBgSprite = "buttonclosepressed"; FavCimsMenuCloseButton.opacity = 1; FavCimsMenuCloseButton.useOutline = true; FavCimsMenuCloseButton.playAudioEvents = true; FavCimsMenuCloseButton.eventClick += (component, eventParam) => FavoritesCimsButton.FavCimsPanelToggle(); //Printing FavCimsMenuCloseButton.relativePosition = new Vector3(this.width - (FavCimsMenuCloseButton.width * 1.5f), ((float)FavCimsTitleTexture.height / 2) - FavCimsMenuCloseButton.height / 2); /////////////////////////////////////////////// //Main Panel Menu Background Texture /////////////////////////////////////////////// Texture FavCimsBGMenuTexture; FavCimsBGMenuTexture = ResourceLoader.loadTexture((int)this.width - 10, 70, "UIMainPanel.submenubar.png"); FavCimsBGMenuTexture.wrapMode = TextureWrapMode.Clamp; FavCimsBGMenuTexture.filterMode = FilterMode.Bilinear; FavCimsBGMenuTexture.name = "FavCimsBGMenuTexture"; UITextureSprite FavCimsBGMenuSprite = FavCimsMainBGSprite.AddUIComponent <UITextureSprite> (); FavCimsBGMenuSprite.name = "FavCimsBGMenuSprite"; FavCimsBGMenuSprite.texture = FavCimsBGMenuTexture; float FavCimsBGMenuSpriteRelPosX = ((this.width / 2) - (float)FavCimsBGMenuTexture.width / 2); FavCimsBGMenuSprite.relativePosition = new Vector3(FavCimsBGMenuSpriteRelPosX, 58); //Citizen Button Texture (Enabled & Disabled) FavCimsCBETexture = ResourceLoader.loadTexture(200, 59, "UIMainPanel.citizenbuttonenabled.png"); FavCimsCBDTexture = ResourceLoader.loadTexture(200, 59, "UIMainPanel.citizenbuttondisabled.png"); FavCimsCBETexture.wrapMode = TextureWrapMode.Clamp; FavCimsCBETexture.filterMode = FilterMode.Bilinear; FavCimsCBETexture.name = "FavCimsCBETexture"; FavCimsCBETexture.mipMapBias = -0.5f; FavCimsCBDTexture.wrapMode = TextureWrapMode.Clamp; FavCimsCBDTexture.filterMode = FilterMode.Bilinear; FavCimsCBDTexture.name = "FavCimsCBDTexture"; FavCimsCBDTexture.mipMapBias = -0.5f; FavCimsCBMenuSprite = FavCimsMainBGSprite.AddUIComponent <UITextureSprite> (); FavCimsCBMenuSprite.name = "FavCimsBGMenuSprite"; FavCimsCBMenuSprite.texture = FavCimsCBETexture; //Citizens Transparent Button (For Easy Text Change) FavCimsBCMenuButton = this.AddUIComponent <UIButton> (); FavCimsBCMenuButton.name = "FavCimsBCMenuButton"; FavCimsBCMenuButton.width = FavCimsCBMenuSprite.width; FavCimsBCMenuButton.height = FavCimsCBMenuSprite.height; FavCimsBCMenuButton.useOutline = true; FavCimsBCMenuButton.playAudioEvents = true; FavCimsBCMenuButton.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsBCMenuButton.textScale = 1.8f; FavCimsBCMenuButton.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsBCMenuButton.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsBCMenuButton.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsBCMenuButton.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsBCMenuButton.textPadding.left = 15; FavCimsBCMenuButton.useDropShadow = true; FavCimsBCMenuButton.tooltipBox = uiView.defaultTooltipBox; //Printing FavCimsCBMenuSprite.relativePosition = new Vector3(27, 69); FavCimsBCMenuButton.relativePosition = new Vector3(27, 69); /////////////////////////////////////////////// //Buildings Button Texture (Enabled & Disabled) ////////////////////////////////////////////// /* * FavCimsBBETexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.buildingsbuttonenabled.png"); * FavCimsBBDTexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.buildingsbuttondisabled.png"); * * FavCimsBBETexture.wrapMode = TextureWrapMode.Clamp; * FavCimsBBETexture.filterMode = FilterMode.Bilinear; * FavCimsBBETexture.name = "FavCimsBBETexture"; * FavCimsBBETexture.mipMapBias = -0.5f; * FavCimsBBDTexture.wrapMode = TextureWrapMode.Clamp; * FavCimsBBDTexture.filterMode = FilterMode.Bilinear; * FavCimsBBDTexture.name = "FavCimsBBETexture"; * FavCimsBBDTexture.mipMapBias = -0.5f; * FavCimsBBMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> (); * FavCimsBBMenuSprite.name = "FavCimsBBMenuSprite"; * FavCimsBBMenuSprite.texture = FavCimsBBDTexture; * * //Buildings Transparent Button (For Easy Text Change) * FavCimsBBMenuButton = this.AddUIComponent<UIButton> (); * FavCimsBBMenuButton.name = "FavCimsBBMenuButton"; * FavCimsBBMenuButton.width = FavCimsBBETexture.width; * FavCimsBBMenuButton.height = FavCimsBBETexture.height; * FavCimsBBMenuButton.useOutline = true; * FavCimsBBMenuButton.playAudioEvents = true; * FavCimsBBMenuButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); * FavCimsBBMenuButton.textScale = 1.8f; * FavCimsBBMenuButton.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a * FavCimsBBMenuButton.hoveredTextColor = new Color32 (204, 102, 0, 20); * FavCimsBBMenuButton.pressedTextColor = new Color32 (153, 0, 0, 0); * FavCimsBBMenuButton.focusedTextColor = new Color32 (102, 153, 255, 147); * FavCimsBBMenuButton.textPadding.left = 20; * FavCimsBBMenuButton.useDropShadow = true; * FavCimsBBMenuButton.tooltipBox = uiView.defaultTooltipBox; * * //Printing * //FavCimsBBMenuSprite.relativePosition = new Vector3 (FavCimsCBMenuSprite.position.x + FavCimsBBMenuSprite.width + 21, 69); //html => margin-left:21px; * //FavCimsBBMenuButton.relativePosition = new Vector3 (FavCimsBCMenuButton.position.x + FavCimsBBMenuButton.width + 35, 69); * * /////////////////////////////////////////////// * //Stats Button Texture (Enabled & Disabled) * ////////////////////////////////////////////// * * FavCimsSBETexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.statsbuttonenabled.png"); * FavCimsSBDTexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.statsbuttondisabled.png"); * * FavCimsSBETexture.wrapMode = TextureWrapMode.Clamp; * FavCimsSBETexture.filterMode = FilterMode.Bilinear; * FavCimsSBETexture.name = "FavCimsSBETexture"; * FavCimsSBETexture.mipMapBias = -0.5f; * FavCimsSBDTexture.wrapMode = TextureWrapMode.Clamp; * FavCimsSBDTexture.filterMode = FilterMode.Bilinear; * FavCimsSBDTexture.name = "FavCimsSBETexture"; * FavCimsSBDTexture.mipMapBias = -0.5f; * FavCimsSBMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> (); * FavCimsSBMenuSprite.name = "FavCimsSBMenuSprite"; * FavCimsSBMenuSprite.texture = FavCimsSBDTexture; * * //Stats Transparent Button (For Easy Text Change) * FavCimsBSMenuButton = this.AddUIComponent<UIButton> (); * FavCimsBSMenuButton.name = "FavCimsBSMenuButton"; * FavCimsBSMenuButton.width = FavCimsSBETexture.width; * FavCimsBSMenuButton.height = FavCimsSBETexture.height; * FavCimsBSMenuButton.useOutline = true; * FavCimsBSMenuButton.playAudioEvents = true; * FavCimsBSMenuButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); * FavCimsBSMenuButton.textScale = 1.8f; * FavCimsBSMenuButton.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a * FavCimsBSMenuButton.hoveredTextColor = new Color32 (204, 102, 0, 20); * FavCimsBSMenuButton.pressedTextColor = new Color32 (153, 0, 0, 0); * FavCimsBSMenuButton.focusedTextColor = new Color32 (102, 153, 255, 147); * FavCimsBSMenuButton.textPadding.left = 0; * FavCimsBSMenuButton.useDropShadow = true; * FavCimsBSMenuButton.tooltipBox = uiView.defaultTooltipBox; * * //Printing * //FavCimsSBMenuSprite.relativePosition = new Vector3 (FavCimsBBMenuSprite.position.x + FavCimsSBMenuSprite.width + 21, 69); //html => margin-left:21px; * //FavCimsBSMenuButton.relativePosition = new Vector3 (FavCimsBBMenuButton.position.x + FavCimsBSMenuButton.width + 21, 69); //html => margin-left:21px; * * /////////////////////////////////////////////// * //Click Operation for Main Buttons * ////////////////////////////////////////////// * * //FavCimsBCMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsCBMenuSprite); * //FavCimsBBMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsBBMenuSprite); * //FavCimsBSMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsSBMenuSprite); */ /////////////////////////////////////////////// //Citizens Panel ////////////////////////////////////////////// CitizensPanel = this.AddUIComponent <UIPanel> (); CitizensPanel.name = "CitizensPanel"; CitizensPanel.width = 1190; CitizensPanel.height = 558; CitizensPanel.relativePosition = new Vector3(((this.width / 2) - (float)CitizensPanel.width / 2), 128); /////////////////////////////////////////////// //Citizens Panel Body Background ////////////////////////////////////////////// FavCimsMainBodyTexture = ResourceLoader.loadTexture(1190, 558, "UIMainPanel.bodybg.png"); FavCimsMainBodyTexture.wrapMode = TextureWrapMode.Clamp; FavCimsMainBodyTexture.filterMode = FilterMode.Bilinear; FavCimsMainBodyTexture.name = "FavCimsMainBodyTexture"; FavCimsBodySprite = CitizensPanel.AddUIComponent <UITextureSprite> (); FavCimsBodySprite.name = "FavCimsCBGBodySprite"; FavCimsBodySprite.texture = FavCimsMainBodyTexture; //Printing FavCimsBodySprite.relativePosition = Vector3.zero; /////////////////////////////////////////////// //Index Column Background ////////////////////////////////////////////// Texture FavCimsIndexBgBar = ResourceLoader.loadTexture(1146, 26, "UIMainPanel.indexerbgbar.png"); FavCimsIndexBgBar.wrapMode = TextureWrapMode.Clamp; FavCimsIndexBgBar.filterMode = FilterMode.Bilinear; FavCimsIndexBgBar.name = "FavCimsIndexBgBar"; FavCimsIndexBgBar.mipMapBias = -0.5f; UITextureSprite FavCimsIndexBgBarSprite = CitizensPanel.AddUIComponent <UITextureSprite> (); FavCimsIndexBgBarSprite.name = "FavCimsIndexBgBarSprite"; FavCimsIndexBgBarSprite.texture = FavCimsIndexBgBar; //Printing FavCimsIndexBgBarSprite.relativePosition = new Vector3(21, 7); //////////////////////////////////////////////// //Index Columns (Button for future sort order...) //////////////////////////////////////////////// //Status FavCimsHappinesColText = CitizensPanel.AddUIComponent <UIButton> (); FavCimsHappinesColText.name = "FavCimsHappinesColText"; FavCimsHappinesColText.width = 60; FavCimsHappinesColText.height = FavCimsIndexBgBar.height; FavCimsHappinesColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsHappinesColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsHappinesColText.playAudioEvents = true; FavCimsHappinesColText.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsHappinesColText.textScale = 0.7f; FavCimsHappinesColText.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsHappinesColText.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsHappinesColText.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsHappinesColText.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsHappinesColText.textPadding.left = 0; FavCimsHappinesColText.tooltipBox = uiView.defaultTooltipBox; //Printing Status FavCimsHappinesColText.relativePosition = new Vector3(FavCimsIndexBgBarSprite.relativePosition.x + 6, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Name FavCimsNameColText = CitizensPanel.AddUIComponent <UIButton> (); FavCimsNameColText.name = "FavCimsNameColText"; FavCimsNameColText.width = 180; FavCimsNameColText.height = FavCimsIndexBgBar.height; FavCimsNameColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsNameColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsNameColText.playAudioEvents = true; FavCimsNameColText.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsNameColText.textScale = 0.7f; FavCimsNameColText.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsNameColText.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsNameColText.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsNameColText.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsNameColText.textPadding.left = 0; FavCimsNameColText.tooltipBox = uiView.defaultTooltipBox; //Printing Name FavCimsNameColText.relativePosition = new Vector3(FavCimsHappinesColText.relativePosition.x + FavCimsHappinesColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Age Phase FavCimsAgePhaseColText = CitizensPanel.AddUIComponent <UIButton> (); FavCimsAgePhaseColText.name = "FavCimsAgePhaseColText"; FavCimsAgePhaseColText.width = 120; FavCimsAgePhaseColText.height = FavCimsIndexBgBar.height; FavCimsAgePhaseColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsAgePhaseColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsAgePhaseColText.playAudioEvents = true; FavCimsAgePhaseColText.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsAgePhaseColText.textScale = 0.7f; FavCimsAgePhaseColText.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsAgePhaseColText.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsAgePhaseColText.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsAgePhaseColText.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsAgePhaseColText.textPadding.left = 0; FavCimsAgePhaseColText.tooltipBox = uiView.defaultTooltipBox; //Printing Age Phase FavCimsAgePhaseColText.relativePosition = new Vector3(FavCimsNameColText.relativePosition.x + FavCimsNameColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Age FavCimsAgeColText = CitizensPanel.AddUIComponent <UIButton> (); FavCimsAgeColText.name = "FavCimsAgeColText"; FavCimsAgeColText.width = 40; FavCimsAgeColText.height = FavCimsIndexBgBar.height; FavCimsAgeColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsAgeColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsAgeColText.playAudioEvents = true; FavCimsAgeColText.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsAgeColText.textScale = 0.7f; FavCimsAgeColText.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsAgeColText.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsAgeColText.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsAgeColText.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsAgeColText.textPadding.left = 0; FavCimsAgeColText.tooltipBox = uiView.defaultTooltipBox; //Printing Age FavCimsAgeColText.relativePosition = new Vector3(FavCimsAgePhaseColText.relativePosition.x + FavCimsAgePhaseColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Education FavCimsEduColText = CitizensPanel.AddUIComponent <UIButton> (); FavCimsEduColText.name = "FavCimsEduColText"; FavCimsEduColText.width = 140; FavCimsEduColText.height = FavCimsIndexBgBar.height; FavCimsEduColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsEduColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsEduColText.playAudioEvents = true; FavCimsEduColText.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsEduColText.textScale = 0.7f; FavCimsEduColText.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsEduColText.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsEduColText.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsEduColText.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsEduColText.textPadding.left = 0; FavCimsEduColText.tooltipBox = uiView.defaultTooltipBox; //Printing Education FavCimsEduColText.relativePosition = new Vector3(FavCimsAgeColText.relativePosition.x + FavCimsAgeColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Home FavCimsHomeColText = CitizensPanel.AddUIComponent <UIButton> (); FavCimsHomeColText.name = "FavCimsHomeColText"; FavCimsHomeColText.width = 184; FavCimsHomeColText.height = FavCimsIndexBgBar.height; FavCimsHomeColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsHomeColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsHomeColText.playAudioEvents = true; FavCimsHomeColText.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsHomeColText.textScale = 0.7f; FavCimsHomeColText.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsHomeColText.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsHomeColText.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsHomeColText.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsHomeColText.textPadding.left = 0; FavCimsHomeColText.tooltipBox = uiView.defaultTooltipBox; //Printing Home FavCimsHomeColText.relativePosition = new Vector3(FavCimsEduColText.relativePosition.x + FavCimsEduColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Working Place FavCimsWorkingPlaceColText = CitizensPanel.AddUIComponent <UIButton> (); FavCimsWorkingPlaceColText.name = "FavCimsWorkingPlaceColText"; FavCimsWorkingPlaceColText.width = 180; FavCimsWorkingPlaceColText.height = FavCimsIndexBgBar.height; FavCimsWorkingPlaceColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsWorkingPlaceColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsWorkingPlaceColText.playAudioEvents = true; FavCimsWorkingPlaceColText.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsWorkingPlaceColText.textScale = 0.7f; FavCimsWorkingPlaceColText.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsWorkingPlaceColText.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsWorkingPlaceColText.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsWorkingPlaceColText.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsWorkingPlaceColText.textPadding.left = 0; FavCimsWorkingPlaceColText.tooltipBox = uiView.defaultTooltipBox; //Printing Working Place FavCimsWorkingPlaceColText.relativePosition = new Vector3(FavCimsHomeColText.relativePosition.x + FavCimsHomeColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Last Activity FavCimsLastActColText = CitizensPanel.AddUIComponent <UIButton> (); FavCimsLastActColText.name = "FavCimsLastActColText"; FavCimsLastActColText.width = 180; FavCimsLastActColText.height = FavCimsIndexBgBar.height; FavCimsLastActColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsLastActColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsLastActColText.playAudioEvents = true; FavCimsLastActColText.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsLastActColText.textScale = 0.7f; FavCimsLastActColText.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsLastActColText.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsLastActColText.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsLastActColText.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsLastActColText.textPadding.left = 0; FavCimsLastActColText.tooltipBox = uiView.defaultTooltipBox; //Printing Last Activity FavCimsLastActColText.relativePosition = new Vector3(FavCimsWorkingPlaceColText.relativePosition.x + FavCimsWorkingPlaceColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Close Button FavCimsCloseButtonCol = CitizensPanel.AddUIComponent <UIButton> (); FavCimsCloseButtonCol.name = "FavCimsCloseButtonCol"; FavCimsCloseButtonCol.width = 50; FavCimsCloseButtonCol.height = FavCimsIndexBgBar.height; FavCimsCloseButtonCol.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsCloseButtonCol.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsCloseButtonCol.playAudioEvents = true; FavCimsCloseButtonCol.font = UIDynamicFont.FindByName("OpenSans-Regular"); FavCimsCloseButtonCol.textScale = 0.7f; FavCimsCloseButtonCol.textColor = new Color32(204, 204, 51, 40); //r,g,b,a FavCimsCloseButtonCol.hoveredTextColor = new Color32(204, 102, 0, 20); FavCimsCloseButtonCol.pressedTextColor = new Color32(153, 0, 0, 0); FavCimsCloseButtonCol.focusedTextColor = new Color32(102, 153, 255, 147); FavCimsCloseButtonCol.textPadding.right = 6; FavCimsCloseButtonCol.tooltipBox = uiView.defaultTooltipBox; //Printing Close Button FavCimsCloseButtonCol.relativePosition = new Vector3(FavCimsLastActColText.relativePosition.x + FavCimsLastActColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); /////////////////////////////////////////////// /////Rows Panel Body /////////////////////////////////////////////// FavCimsCitizenRowsPanel = CitizensPanel.AddUIComponent <UIScrollablePanel> (); FavCimsCitizenRowsPanel.name = "FavCimsCitizenRowsPanel"; FavCimsCitizenRowsPanel.width = FavCimsIndexBgBarSprite.width - 12; FavCimsCitizenRowsPanel.height = 500; FavCimsCitizenRowsPanel.autoLayoutDirection = LayoutDirection.Vertical; FavCimsCitizenRowsPanel.autoLayout = true; FavCimsCitizenRowsPanel.clipChildren = true; FavCimsCitizenRowsPanel.autoLayoutPadding = new RectOffset(0, 0, 0, 0); FavCimsCitizenRowsPanel.relativePosition = new Vector3(FavCimsIndexBgBarSprite.relativePosition.x + 6, FavCimsIndexBgBarSprite.relativePosition.y + FavCimsIndexBgBarSprite.height); //Damn ScrollBar UIScrollablePanel FavCimsCitizenRowsPanelScrollBar = CitizensPanel.AddUIComponent <UIScrollablePanel> (); FavCimsCitizenRowsPanelScrollBar.name = "FavCimsCitizenRowsPanelScrollBar"; FavCimsCitizenRowsPanelScrollBar.width = 10; FavCimsCitizenRowsPanelScrollBar.height = 500; FavCimsCitizenRowsPanelScrollBar.relativePosition = new Vector3(FavCimsIndexBgBarSprite.relativePosition.x + FavCimsIndexBgBarSprite.width, FavCimsCitizenRowsPanel.relativePosition.y); UIScrollbar FavCimsMainPanelScrollBar = FavCimsCitizenRowsPanelScrollBar.AddUIComponent <UIScrollbar> (); FavCimsMainPanelScrollBar.width = 10; FavCimsMainPanelScrollBar.height = FavCimsCitizenRowsPanel.height; FavCimsMainPanelScrollBar.orientation = UIOrientation.Vertical; FavCimsMainPanelScrollBar.pivot = UIPivotPoint.TopRight; FavCimsMainPanelScrollBar.AlignTo(FavCimsMainPanelScrollBar.parent, UIAlignAnchor.TopRight); FavCimsMainPanelScrollBar.minValue = 0; FavCimsMainPanelScrollBar.value = 0; FavCimsMainPanelScrollBar.incrementAmount = 40; UISlicedSprite FavCimsMainPanelTrackSprite = FavCimsMainPanelScrollBar.AddUIComponent <UISlicedSprite> (); FavCimsMainPanelTrackSprite.relativePosition = FavCimsMainPanelScrollBar.relativePosition; FavCimsMainPanelTrackSprite.autoSize = true; FavCimsMainPanelTrackSprite.size = FavCimsMainPanelTrackSprite.parent.size; FavCimsMainPanelTrackSprite.fillDirection = UIFillDirection.Vertical; FavCimsMainPanelTrackSprite.spriteName = "ScrollbarTrack"; FavCimsMainPanelScrollBar.trackObject = FavCimsMainPanelTrackSprite; UISlicedSprite thumbSprite = FavCimsMainPanelScrollBar.AddUIComponent <UISlicedSprite> (); thumbSprite.relativePosition = FavCimsMainPanelScrollBar.relativePosition; thumbSprite.autoSize = true; thumbSprite.width = thumbSprite.parent.width; thumbSprite.fillDirection = UIFillDirection.Vertical; thumbSprite.spriteName = "ScrollbarThumb"; FavCimsMainPanelScrollBar.thumbObject = thumbSprite; FavCimsCitizenRowsPanel.verticalScrollbar = FavCimsMainPanelScrollBar; /* Thx to CNightwing for this piece of code */ FavCimsCitizenRowsPanel.eventMouseWheel += (component, eventParam) => { var sign = Math.Sign(eventParam.wheelDelta); FavCimsCitizenRowsPanel.scrollPosition += new Vector2(0, sign * (-1) * FavCimsMainPanelScrollBar.incrementAmount); }; /* End */ FavCimsCitizenRowsPanel.eventComponentAdded += (component, eventParam) => ReorderRowsBackgrounds(); FavCimsCitizenRowsPanel.eventComponentRemoved += (component, eventParam) => ReorderRowsBackgrounds(); /////////////////////////////////////////////// /////Rows Panel Footer /////////////////////////////////////////////// UITextureSprite FavCimsFooterBgBarSprite = CitizensPanel.AddUIComponent <UITextureSprite> (); FavCimsFooterBgBarSprite.name = "FavCimsFooterBgBarSprite"; FavCimsFooterBgBarSprite.width = FavCimsIndexBgBarSprite.width; FavCimsFooterBgBarSprite.height = 15; FavCimsFooterBgBarSprite.texture = FavCimsIndexBgBar; //Printing FavCimsFooterBgBarSprite.relativePosition = new Vector3(21, FavCimsCitizenRowsPanel.relativePosition.y + FavCimsCitizenRowsPanel.height); //Row End //Load Initial Row (People Renamed) foreach (KeyValuePair <InstanceID, string> FavCitizen in FavCimsCore.FavoriteCimsList()) { if (FavCitizen.Key.Type == InstanceType.Citizen) // || FavCitizen.Key.Type == InstanceType.CitizenInstance { CitizenRow FavCimsCitizenSingleRowPanel = FavCimsCitizenRowsPanel.AddUIComponent(typeof(CitizenRow)) as CitizenRow; FavCimsCitizenSingleRowPanel.MyInstanceID = FavCitizen.Key; FavCimsCitizenSingleRowPanel.MyInstancedName = FavCitizen.Value; } } }
private void Initialize(TreeInfo info) { //General name = info.GetUncheckedLocalizedTitle() + "ListItem"; atlas = ResourceLoader.Atlas; width = parent.width; height = Constants.UIItemHeight; isVisible = true; isInteractive = true; tooltipBox.GetComponent <UILabel>().textAlignment = UIHorizontalAlignment.Left; GenerateTooltip(Prefab); eventTooltipEnter += TreeItem_eventTooltipEnter; eventMouseLeave += TreeItem_eventMouseLeave; //Thumbnail thumbNailSprite = AddUIComponent <UITextureSprite>(); thumbNailSprite.texture = info.m_Atlas.sprites.Find(spr => spr.name == info.m_Thumbnail).texture; thumbNailSprite.size = new Vector2(50f, 54.5f); thumbNailSprite.relativePosition = new Vector3(Constants.UISpacing, (Constants.UIItemHeight - thumbNailSprite.height) / 2); //CheckBox includeCheckBox = AddUIComponent <UICheckBox>(); includeCheckBox.size = Constants.UICheckboxSize + new Vector2(3f, 3f); UISprite sprite = includeCheckBox.AddUIComponent <UISprite>(); sprite.atlas = ResourceLoader.Atlas; sprite.spriteName = ResourceLoader.CheckBoxSpriteUnchecked; sprite.size = includeCheckBox.size; sprite.relativePosition = Vector3.zero; includeCheckBox.checkedBoxObject = sprite.AddUIComponent <UISprite>(); ((UISprite)includeCheckBox.checkedBoxObject).atlas = ResourceLoader.Atlas; ((UISprite)includeCheckBox.checkedBoxObject).spriteName = ResourceLoader.CheckBoxSpriteChecked; includeCheckBox.checkedBoxObject.size = includeCheckBox.size; includeCheckBox.checkedBoxObject.relativePosition = Vector3.zero; bool enabled = ForestBrush.Instance.Container.m_variations.Any(v => v.m_finalTree == info); includeCheckBox.isChecked = enabled; includeCheckBox.eventCheckChanged += IncludeCheckBox_eventCheckChanged; includeCheckBox.relativePosition = new Vector3(70.0f, 15f); //Label treeNameLabel = AddUIComponent <UILabel>(); treeNameLabel.text = info.GetUncheckedLocalizedTitle(); treeNameLabel.autoSize = false; treeNameLabel.width = 255.0f; treeNameLabel.relativePosition = new Vector3(96.0f, 15.0f); //slider probabilitySlider = AddUIComponent <UISlider>(); probabilitySlider.atlas = ResourceLoader.Atlas; probabilitySlider.size = new Vector2(230f, 5f); probabilitySlider.color = new Color32(55, 55, 55, 255); probabilitySlider.disabledColor = new Color32(100, 100, 100, 255); probabilitySlider.minValue = 1f; probabilitySlider.maxValue = 100f; probabilitySlider.stepSize = 1f; probabilitySlider.scrollWheelAmount = 1f; probabilitySlider.eventValueChanged += ProbabilitySlider_eventValueChanged; probabilitySlider.eventMouseUp += ProbabilitySlider_eventMouseUp; probabilitySlider.backgroundSprite = ResourceLoader.WhiteRect; probabilitySlider.pivot = UIPivotPoint.TopLeft; probabilitySlider.relativePosition = new Vector3(thumbNailSprite.width + Constants.UISpacing * 2, 42.0f); UISprite thumb = probabilitySlider.AddUIComponent <UISprite>(); thumb.atlas = ResourceLoader.Atlas; thumb.size = new Vector2(8.0f, 15.0f); thumb.spriteName = ResourceLoader.TextFieldPanel; thumb.disabledColor = new Color32(140, 140, 140, 255); probabilitySlider.thumbObject = thumb; probabilitySlider.isEnabled = includeCheckBox.isChecked; //Textfield probabilityTextField = AddUIComponent <UITextField>(); probabilityTextField.atlas = ResourceLoader.Atlas; probabilityTextField.size = new Vector2(35.0f, 19.0f); probabilityTextField.padding = new RectOffset(2, 2, 4, 0); probabilityTextField.builtinKeyNavigation = true; probabilityTextField.isInteractive = true; probabilityTextField.readOnly = false; probabilityTextField.horizontalAlignment = UIHorizontalAlignment.Center; probabilityTextField.selectionSprite = ResourceLoader.EmptySprite; probabilityTextField.selectionBackgroundColor = new Color32(0, 172, 234, 255); probabilityTextField.normalBgSprite = ResourceLoader.TextFieldPanelHovered; probabilityTextField.disabledBgSprite = ResourceLoader.TextFieldPanelHovered; probabilityTextField.textColor = new Color32(0, 0, 0, 255); probabilityTextField.textScale = 0.85f; probabilityTextField.disabledTextColor = new Color32(128, 128, 128, 255); probabilityTextField.color = new Color32(255, 255, 255, 255); probabilityTextField.disabledColor = new Color32(128, 128, 128, 255); probabilityTextField.relativePosition = new Vector3(318.0f, 34.0f); probabilityTextField.eventTextChanged += ProbabilityTextField_eventTextChanged; probabilityTextField.eventKeyPress += ProbabilityTextField_eventKeyPress; probabilityTextField.eventLostFocus += ProbabilityTextField_eventLostFocus; probabilityTextField.eventGotFocus += ProbabilityTextField_eventGotFocus; probabilityTextField.tooltip = Translation.Instance.GetTranslation("FOREST-BRUSH-PROBABILITY"); probabilityTextField.isEnabled = includeCheckBox.isChecked; float probability = GetProbability(info, enabled); probabilitySlider.value = probability; probabilityTextField.text = GetProbability(info, enabled).ToString(); initialized = true; }
public override void Start() { var fontColor = new Color32(254, 254, 254, 255); var namePrefix = GetType().Name; var go = GameObject.Find(InfoViewPanelGameObjectName); var ivp = go.GetComponent(InfoPanelType) as InfoViewPanel; var meter = ivp.Find <UISlider>(MetricSliderName); var sprite = new GameObject(namePrefix + "Sprite") { transform = { parent = transform } }.AddComponent <UISprite>(); sprite.spriteName = IconSpriteName; sprite.size = new Vector2(26f, 26f); sprite.relativePosition = new Vector3(6f, 3f); var label = new GameObject(namePrefix + "Label") { transform = { parent = transform } }.AddComponent <UILabel>(); label.textColor = fontColor; label.textScale = 0.9f; label.textScaleMode = UITextScaleMode.ScreenResolution; label.localeID = StatisticLocaleId; label.relativePosition = new Vector3(35f, 0f); m_Meter = new GameObject(namePrefix + "Slider") { transform = { parent = transform } }.AddComponent <UISlider>(); m_Meter.backgroundSprite = meter.backgroundSprite; m_Meter.size = new Vector2(260f, 12f); m_Meter.relativePosition = new Vector3(35f, 18f); var thumb = new GameObject(namePrefix + "Thumb") { transform = { parent = m_Meter.transform } }.AddComponent <UISprite>(); thumb.spriteName = "MeterIndicator"; thumb.size = new Vector2(14f, 14f); m_Meter.thumbObject = thumb; foreach (var component in meter.components) { var textureSprite = component as UITextureSprite; if (textureSprite != null) { m_CopiedTextureSprite = textureSprite; m_TextureSprite = GameObject.Instantiate <UITextureSprite>(textureSprite); m_TextureSprite.name = (namePrefix + "Gradient"); m_TextureSprite.transform.parent = m_Meter.transform; m_TextureSprite.size = m_Meter.size; m_TextureSprite.transform.localPosition = Vector3.zero; m_TextureSprite.relativePosition = Vector3.zero; m_TextureSprite.renderMaterial.CopyPropertiesFromMaterial(textureSprite.renderMaterial); } } AddSettingsToInfoPanel(namePrefix, meter); }
//public void ButtonEnabler(UITextureSprite sPrite) { //if (sPrite == FavCimsCBMenuSprite) { //FavCimsCBMenuSprite.texture = FavCimsCBETexture; //FavCimsBBMenuSprite.texture = FavCimsBBDTexture; //FavCimsSBMenuSprite.texture = FavCimsSBDTexture; //} else if (sPrite == FavCimsBBMenuSprite) { //FavCimsCBMenuSprite.texture = FavCimsCBDTexture; //FavCimsBBMenuSprite.texture = FavCimsBBETexture; //FavCimsSBMenuSprite.texture = FavCimsSBDTexture; //} else if (sPrite == FavCimsSBMenuSprite) { //FavCimsCBMenuSprite.texture = FavCimsCBDTexture; //FavCimsBBMenuSprite.texture = FavCimsBBDTexture; //FavCimsSBMenuSprite.texture = FavCimsSBETexture; //} //return; //} public override void Start() { var uiView = UIView.GetAView(); this.name = "FavCimsPanel"; this.width = 1200; this.height = 700; this.opacity = 0.95f; this.eventVisibilityChanged += (component, value) => change_visibility_event (); //Main Panel BG Texture Texture FavCimsMainBGTexture = ResourceLoader.loadTexture ((int)this.width, (int)this.height, "UIMainPanel.mainbg.png"); FavCimsMainBGTexture.wrapMode = TextureWrapMode.Clamp; FavCimsMainBGTexture.filterMode = FilterMode.Bilinear; //FavCimsMainBGTexture.anisoLevel = 9; Set 1 Bad to 9 Very God FavCimsMainBGTexture.name = "FavCimsMainBGTexture"; UITextureSprite FavCimsMainBGSprite; FavCimsMainBGSprite = this.AddUIComponent<UITextureSprite> (); FavCimsMainBGSprite.name = "FavCimsMainBGSprite"; FavCimsMainBGSprite.texture = FavCimsMainBGTexture; FavCimsMainBGSprite.relativePosition = new Vector3 (0, 0); FavCimsMainBGSprite.eventMouseDown += delegate { if (Input.GetMouseButton (0)) { if (this.GetComponentInChildren<WindowController> () != null) { this.PanelMover = this.GetComponentInChildren<WindowController> (); this.PanelMover.ComponentToMove = this; this.PanelMover.Stop = false; this.PanelMover.Start (); } else { this.PanelMover = this.AddUIComponent (typeof(WindowController)) as WindowController; this.PanelMover.ComponentToMove = this; } this.opacity = 0.5f; } }; FavCimsMainBGSprite.eventMouseUp += delegate { if (this.PanelMover != null) { this.PanelMover.Stop = true; this.PanelMover.ComponentToMove = null; this.PanelMover = null; } this.opacity = 1f; }; //Main Panel Title Texture Texture FavCimsTitleTexture; FavCimsTitleTexture = ResourceLoader.loadTexture ((int)this.width, 58, "UIMainPanel.favcimstitle.png"); FavCimsTitleTexture.wrapMode = TextureWrapMode.Clamp; FavCimsTitleTexture.filterMode = FilterMode.Bilinear; FavCimsTitleTexture.mipMapBias = -0.5f; //FavCimsTitleTexture.anisoLevel = 9; // Set 1 Bad to 9 Very God FavCimsTitleTexture.name = "FavCimsTitleTexture"; FavCimsTitleSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> (); FavCimsTitleSprite.name = "FavCimsTitleSprite"; FavCimsTitleSprite.texture = FavCimsTitleTexture; float FavCimsTitleSpriteRelPosX = ((this.width / 2) - (float)FavCimsTitleTexture.width / 2); FavCimsTitleSprite.relativePosition = new Vector3 (FavCimsTitleSpriteRelPosX, 0); /////////////////////////////////////////////// //Game Default Close Button ////////////////////////////////////////////// UIButton FavCimsMenuCloseButton = this.AddUIComponent<UIButton> (); FavCimsMenuCloseButton.name = "FavCimsMenuCloseButton"; FavCimsMenuCloseButton.width = 32; FavCimsMenuCloseButton.height = 32; FavCimsMenuCloseButton.normalBgSprite = "buttonclose"; FavCimsMenuCloseButton.hoveredBgSprite = "buttonclosehover"; FavCimsMenuCloseButton.pressedBgSprite = "buttonclosepressed"; FavCimsMenuCloseButton.opacity = 1; FavCimsMenuCloseButton.useOutline = true; FavCimsMenuCloseButton.playAudioEvents = true; FavCimsMenuCloseButton.eventClick += (component, eventParam) => FavoritesCimsButton.FavCimsPanelToggle (); //Printing FavCimsMenuCloseButton.relativePosition = new Vector3 (this.width - (FavCimsMenuCloseButton.width * 1.5f), ((float)FavCimsTitleTexture.height / 2) - FavCimsMenuCloseButton.height / 2); /////////////////////////////////////////////// //Main Panel Menu Background Texture /////////////////////////////////////////////// Texture FavCimsBGMenuTexture; FavCimsBGMenuTexture = ResourceLoader.loadTexture ((int)this.width - 10, 70, "UIMainPanel.submenubar.png"); FavCimsBGMenuTexture.wrapMode = TextureWrapMode.Clamp; FavCimsBGMenuTexture.filterMode = FilterMode.Bilinear; FavCimsBGMenuTexture.name = "FavCimsBGMenuTexture"; UITextureSprite FavCimsBGMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> (); FavCimsBGMenuSprite.name = "FavCimsBGMenuSprite"; FavCimsBGMenuSprite.texture = FavCimsBGMenuTexture; float FavCimsBGMenuSpriteRelPosX = ((this.width / 2) - (float)FavCimsBGMenuTexture.width / 2); FavCimsBGMenuSprite.relativePosition = new Vector3 (FavCimsBGMenuSpriteRelPosX, 58); //Citizen Button Texture (Enabled & Disabled) FavCimsCBETexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.citizenbuttonenabled.png"); FavCimsCBDTexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.citizenbuttondisabled.png"); FavCimsCBETexture.wrapMode = TextureWrapMode.Clamp; FavCimsCBETexture.filterMode = FilterMode.Bilinear; FavCimsCBETexture.name = "FavCimsCBETexture"; FavCimsCBETexture.mipMapBias = -0.5f; FavCimsCBDTexture.wrapMode = TextureWrapMode.Clamp; FavCimsCBDTexture.filterMode = FilterMode.Bilinear; FavCimsCBDTexture.name = "FavCimsCBDTexture"; FavCimsCBDTexture.mipMapBias = -0.5f; FavCimsCBMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> (); FavCimsCBMenuSprite.name = "FavCimsBGMenuSprite"; FavCimsCBMenuSprite.texture = FavCimsCBETexture; //Citizens Transparent Button (For Easy Text Change) FavCimsBCMenuButton = this.AddUIComponent<UIButton> (); FavCimsBCMenuButton.name = "FavCimsBCMenuButton"; FavCimsBCMenuButton.width = FavCimsCBMenuSprite.width; FavCimsBCMenuButton.height = FavCimsCBMenuSprite.height; FavCimsBCMenuButton.useOutline = true; FavCimsBCMenuButton.playAudioEvents = true; FavCimsBCMenuButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsBCMenuButton.textScale = 1.8f; FavCimsBCMenuButton.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsBCMenuButton.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsBCMenuButton.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsBCMenuButton.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsBCMenuButton.textPadding.left = 15; FavCimsBCMenuButton.useDropShadow = true; FavCimsBCMenuButton.tooltipBox = uiView.defaultTooltipBox; //Printing FavCimsCBMenuSprite.relativePosition = new Vector3 (27, 69); FavCimsBCMenuButton.relativePosition = new Vector3 (27, 69); /////////////////////////////////////////////// //Buildings Button Texture (Enabled & Disabled) ////////////////////////////////////////////// /* FavCimsBBETexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.buildingsbuttonenabled.png"); FavCimsBBDTexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.buildingsbuttondisabled.png"); FavCimsBBETexture.wrapMode = TextureWrapMode.Clamp; FavCimsBBETexture.filterMode = FilterMode.Bilinear; FavCimsBBETexture.name = "FavCimsBBETexture"; FavCimsBBETexture.mipMapBias = -0.5f; FavCimsBBDTexture.wrapMode = TextureWrapMode.Clamp; FavCimsBBDTexture.filterMode = FilterMode.Bilinear; FavCimsBBDTexture.name = "FavCimsBBETexture"; FavCimsBBDTexture.mipMapBias = -0.5f; FavCimsBBMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> (); FavCimsBBMenuSprite.name = "FavCimsBBMenuSprite"; FavCimsBBMenuSprite.texture = FavCimsBBDTexture; //Buildings Transparent Button (For Easy Text Change) FavCimsBBMenuButton = this.AddUIComponent<UIButton> (); FavCimsBBMenuButton.name = "FavCimsBBMenuButton"; FavCimsBBMenuButton.width = FavCimsBBETexture.width; FavCimsBBMenuButton.height = FavCimsBBETexture.height; FavCimsBBMenuButton.useOutline = true; FavCimsBBMenuButton.playAudioEvents = true; FavCimsBBMenuButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsBBMenuButton.textScale = 1.8f; FavCimsBBMenuButton.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsBBMenuButton.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsBBMenuButton.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsBBMenuButton.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsBBMenuButton.textPadding.left = 20; FavCimsBBMenuButton.useDropShadow = true; FavCimsBBMenuButton.tooltipBox = uiView.defaultTooltipBox; //Printing //FavCimsBBMenuSprite.relativePosition = new Vector3 (FavCimsCBMenuSprite.position.x + FavCimsBBMenuSprite.width + 21, 69); //html => margin-left:21px; //FavCimsBBMenuButton.relativePosition = new Vector3 (FavCimsBCMenuButton.position.x + FavCimsBBMenuButton.width + 35, 69); /////////////////////////////////////////////// //Stats Button Texture (Enabled & Disabled) ////////////////////////////////////////////// FavCimsSBETexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.statsbuttonenabled.png"); FavCimsSBDTexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.statsbuttondisabled.png"); FavCimsSBETexture.wrapMode = TextureWrapMode.Clamp; FavCimsSBETexture.filterMode = FilterMode.Bilinear; FavCimsSBETexture.name = "FavCimsSBETexture"; FavCimsSBETexture.mipMapBias = -0.5f; FavCimsSBDTexture.wrapMode = TextureWrapMode.Clamp; FavCimsSBDTexture.filterMode = FilterMode.Bilinear; FavCimsSBDTexture.name = "FavCimsSBETexture"; FavCimsSBDTexture.mipMapBias = -0.5f; FavCimsSBMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> (); FavCimsSBMenuSprite.name = "FavCimsSBMenuSprite"; FavCimsSBMenuSprite.texture = FavCimsSBDTexture; //Stats Transparent Button (For Easy Text Change) FavCimsBSMenuButton = this.AddUIComponent<UIButton> (); FavCimsBSMenuButton.name = "FavCimsBSMenuButton"; FavCimsBSMenuButton.width = FavCimsSBETexture.width; FavCimsBSMenuButton.height = FavCimsSBETexture.height; FavCimsBSMenuButton.useOutline = true; FavCimsBSMenuButton.playAudioEvents = true; FavCimsBSMenuButton.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsBSMenuButton.textScale = 1.8f; FavCimsBSMenuButton.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsBSMenuButton.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsBSMenuButton.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsBSMenuButton.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsBSMenuButton.textPadding.left = 0; FavCimsBSMenuButton.useDropShadow = true; FavCimsBSMenuButton.tooltipBox = uiView.defaultTooltipBox; //Printing //FavCimsSBMenuSprite.relativePosition = new Vector3 (FavCimsBBMenuSprite.position.x + FavCimsSBMenuSprite.width + 21, 69); //html => margin-left:21px; //FavCimsBSMenuButton.relativePosition = new Vector3 (FavCimsBBMenuButton.position.x + FavCimsBSMenuButton.width + 21, 69); //html => margin-left:21px; /////////////////////////////////////////////// //Click Operation for Main Buttons ////////////////////////////////////////////// //FavCimsBCMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsCBMenuSprite); //FavCimsBBMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsBBMenuSprite); //FavCimsBSMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsSBMenuSprite); */ /////////////////////////////////////////////// //Citizens Panel ////////////////////////////////////////////// CitizensPanel = this.AddUIComponent<UIPanel> (); CitizensPanel.name = "CitizensPanel"; CitizensPanel.width = 1190; CitizensPanel.height = 558; CitizensPanel.relativePosition = new Vector3 (((this.width / 2) - (float)CitizensPanel.width / 2), 128); /////////////////////////////////////////////// //Citizens Panel Body Background ////////////////////////////////////////////// FavCimsMainBodyTexture = ResourceLoader.loadTexture (1190, 558, "UIMainPanel.bodybg.png"); FavCimsMainBodyTexture.wrapMode = TextureWrapMode.Clamp; FavCimsMainBodyTexture.filterMode = FilterMode.Bilinear; FavCimsMainBodyTexture.name = "FavCimsMainBodyTexture"; FavCimsBodySprite = CitizensPanel.AddUIComponent<UITextureSprite> (); FavCimsBodySprite.name = "FavCimsCBGBodySprite"; FavCimsBodySprite.texture = FavCimsMainBodyTexture; //Printing FavCimsBodySprite.relativePosition = Vector3.zero; /////////////////////////////////////////////// //Index Column Background ////////////////////////////////////////////// Texture FavCimsIndexBgBar = ResourceLoader.loadTexture (1146, 26, "UIMainPanel.indexerbgbar.png"); FavCimsIndexBgBar.wrapMode = TextureWrapMode.Clamp; FavCimsIndexBgBar.filterMode = FilterMode.Bilinear; FavCimsIndexBgBar.name = "FavCimsIndexBgBar"; FavCimsIndexBgBar.mipMapBias = -0.5f; UITextureSprite FavCimsIndexBgBarSprite = CitizensPanel.AddUIComponent<UITextureSprite> (); FavCimsIndexBgBarSprite.name = "FavCimsIndexBgBarSprite"; FavCimsIndexBgBarSprite.texture = FavCimsIndexBgBar; //Printing FavCimsIndexBgBarSprite.relativePosition = new Vector3 (21, 7); //////////////////////////////////////////////// //Index Columns (Button for future sort order...) //////////////////////////////////////////////// //Status FavCimsHappinesColText = CitizensPanel.AddUIComponent<UIButton> (); FavCimsHappinesColText.name = "FavCimsHappinesColText"; FavCimsHappinesColText.width = 60; FavCimsHappinesColText.height = FavCimsIndexBgBar.height; FavCimsHappinesColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsHappinesColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsHappinesColText.playAudioEvents = true; FavCimsHappinesColText.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsHappinesColText.textScale = 0.7f; FavCimsHappinesColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsHappinesColText.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsHappinesColText.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsHappinesColText.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsHappinesColText.textPadding.left = 0; FavCimsHappinesColText.tooltipBox = uiView.defaultTooltipBox; //Printing Status FavCimsHappinesColText.relativePosition = new Vector3 (FavCimsIndexBgBarSprite.relativePosition.x + 6, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Name FavCimsNameColText = CitizensPanel.AddUIComponent<UIButton> (); FavCimsNameColText.name = "FavCimsNameColText"; FavCimsNameColText.width = 180; FavCimsNameColText.height = FavCimsIndexBgBar.height; FavCimsNameColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsNameColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsNameColText.playAudioEvents = true; FavCimsNameColText.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsNameColText.textScale = 0.7f; FavCimsNameColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsNameColText.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsNameColText.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsNameColText.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsNameColText.textPadding.left = 0; FavCimsNameColText.tooltipBox = uiView.defaultTooltipBox; //Printing Name FavCimsNameColText.relativePosition = new Vector3 (FavCimsHappinesColText.relativePosition.x + FavCimsHappinesColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Age Phase FavCimsAgePhaseColText = CitizensPanel.AddUIComponent<UIButton> (); FavCimsAgePhaseColText.name = "FavCimsAgePhaseColText"; FavCimsAgePhaseColText.width = 120; FavCimsAgePhaseColText.height = FavCimsIndexBgBar.height; FavCimsAgePhaseColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsAgePhaseColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsAgePhaseColText.playAudioEvents = true; FavCimsAgePhaseColText.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsAgePhaseColText.textScale = 0.7f; FavCimsAgePhaseColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsAgePhaseColText.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsAgePhaseColText.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsAgePhaseColText.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsAgePhaseColText.textPadding.left = 0; FavCimsAgePhaseColText.tooltipBox = uiView.defaultTooltipBox; //Printing Age Phase FavCimsAgePhaseColText.relativePosition = new Vector3 (FavCimsNameColText.relativePosition.x + FavCimsNameColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Age FavCimsAgeColText = CitizensPanel.AddUIComponent<UIButton> (); FavCimsAgeColText.name = "FavCimsAgeColText"; FavCimsAgeColText.width = 40; FavCimsAgeColText.height = FavCimsIndexBgBar.height; FavCimsAgeColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsAgeColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsAgeColText.playAudioEvents = true; FavCimsAgeColText.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsAgeColText.textScale = 0.7f; FavCimsAgeColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsAgeColText.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsAgeColText.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsAgeColText.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsAgeColText.textPadding.left = 0; FavCimsAgeColText.tooltipBox = uiView.defaultTooltipBox; //Printing Age FavCimsAgeColText.relativePosition = new Vector3 (FavCimsAgePhaseColText.relativePosition.x + FavCimsAgePhaseColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Education FavCimsEduColText = CitizensPanel.AddUIComponent<UIButton> (); FavCimsEduColText.name = "FavCimsEduColText"; FavCimsEduColText.width = 140; FavCimsEduColText.height = FavCimsIndexBgBar.height; FavCimsEduColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsEduColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsEduColText.playAudioEvents = true; FavCimsEduColText.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsEduColText.textScale = 0.7f; FavCimsEduColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsEduColText.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsEduColText.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsEduColText.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsEduColText.textPadding.left = 0; FavCimsEduColText.tooltipBox = uiView.defaultTooltipBox; //Printing Education FavCimsEduColText.relativePosition = new Vector3 (FavCimsAgeColText.relativePosition.x + FavCimsAgeColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Home FavCimsHomeColText = CitizensPanel.AddUIComponent<UIButton> (); FavCimsHomeColText.name = "FavCimsHomeColText"; FavCimsHomeColText.width = 184; FavCimsHomeColText.height = FavCimsIndexBgBar.height; FavCimsHomeColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsHomeColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsHomeColText.playAudioEvents = true; FavCimsHomeColText.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsHomeColText.textScale = 0.7f; FavCimsHomeColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsHomeColText.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsHomeColText.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsHomeColText.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsHomeColText.textPadding.left = 0; FavCimsHomeColText.tooltipBox = uiView.defaultTooltipBox; //Printing Home FavCimsHomeColText.relativePosition = new Vector3 (FavCimsEduColText.relativePosition.x + FavCimsEduColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Working Place FavCimsWorkingPlaceColText = CitizensPanel.AddUIComponent<UIButton> (); FavCimsWorkingPlaceColText.name = "FavCimsWorkingPlaceColText"; FavCimsWorkingPlaceColText.width = 180; FavCimsWorkingPlaceColText.height = FavCimsIndexBgBar.height; FavCimsWorkingPlaceColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsWorkingPlaceColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsWorkingPlaceColText.playAudioEvents = true; FavCimsWorkingPlaceColText.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsWorkingPlaceColText.textScale = 0.7f; FavCimsWorkingPlaceColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsWorkingPlaceColText.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsWorkingPlaceColText.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsWorkingPlaceColText.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsWorkingPlaceColText.textPadding.left = 0; FavCimsWorkingPlaceColText.tooltipBox = uiView.defaultTooltipBox; //Printing Working Place FavCimsWorkingPlaceColText.relativePosition = new Vector3 (FavCimsHomeColText.relativePosition.x + FavCimsHomeColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Last Activity FavCimsLastActColText = CitizensPanel.AddUIComponent<UIButton> (); FavCimsLastActColText.name = "FavCimsLastActColText"; FavCimsLastActColText.width = 180; FavCimsLastActColText.height = FavCimsIndexBgBar.height; FavCimsLastActColText.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsLastActColText.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsLastActColText.playAudioEvents = true; FavCimsLastActColText.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsLastActColText.textScale = 0.7f; FavCimsLastActColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsLastActColText.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsLastActColText.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsLastActColText.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsLastActColText.textPadding.left = 0; FavCimsLastActColText.tooltipBox = uiView.defaultTooltipBox; //Printing Last Activity FavCimsLastActColText.relativePosition = new Vector3 (FavCimsWorkingPlaceColText.relativePosition.x + FavCimsWorkingPlaceColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); //Close Button FavCimsCloseButtonCol = CitizensPanel.AddUIComponent<UIButton> (); FavCimsCloseButtonCol.name = "FavCimsCloseButtonCol"; FavCimsCloseButtonCol.width = 50; FavCimsCloseButtonCol.height = FavCimsIndexBgBar.height; FavCimsCloseButtonCol.textVerticalAlignment = UIVerticalAlignment.Middle; FavCimsCloseButtonCol.textHorizontalAlignment = UIHorizontalAlignment.Center; FavCimsCloseButtonCol.playAudioEvents = true; FavCimsCloseButtonCol.font = UIDynamicFont.FindByName ("OpenSans-Regular"); FavCimsCloseButtonCol.textScale = 0.7f; FavCimsCloseButtonCol.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a FavCimsCloseButtonCol.hoveredTextColor = new Color32 (204, 102, 0, 20); FavCimsCloseButtonCol.pressedTextColor = new Color32 (153, 0, 0, 0); FavCimsCloseButtonCol.focusedTextColor = new Color32 (102, 153, 255, 147); FavCimsCloseButtonCol.textPadding.right = 6; FavCimsCloseButtonCol.tooltipBox = uiView.defaultTooltipBox; //Printing Close Button FavCimsCloseButtonCol.relativePosition = new Vector3 (FavCimsLastActColText.relativePosition.x + FavCimsLastActColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1); /////////////////////////////////////////////// /////Rows Panel Body /////////////////////////////////////////////// FavCimsCitizenRowsPanel = CitizensPanel.AddUIComponent<UIScrollablePanel> (); FavCimsCitizenRowsPanel.name = "FavCimsCitizenRowsPanel"; FavCimsCitizenRowsPanel.width = FavCimsIndexBgBarSprite.width - 12; FavCimsCitizenRowsPanel.height = 500; FavCimsCitizenRowsPanel.autoLayoutDirection = LayoutDirection.Vertical; FavCimsCitizenRowsPanel.autoLayout = true; FavCimsCitizenRowsPanel.clipChildren = true; FavCimsCitizenRowsPanel.autoLayoutPadding = new RectOffset (0, 0, 0, 0); FavCimsCitizenRowsPanel.relativePosition = new Vector3 (FavCimsIndexBgBarSprite.relativePosition.x + 6, FavCimsIndexBgBarSprite.relativePosition.y + FavCimsIndexBgBarSprite.height); //Damn ScrollBar UIScrollablePanel FavCimsCitizenRowsPanelScrollBar = CitizensPanel.AddUIComponent<UIScrollablePanel> (); FavCimsCitizenRowsPanelScrollBar.name = "FavCimsCitizenRowsPanelScrollBar"; FavCimsCitizenRowsPanelScrollBar.width = 10; FavCimsCitizenRowsPanelScrollBar.height = 500; FavCimsCitizenRowsPanelScrollBar.relativePosition = new Vector3 (FavCimsIndexBgBarSprite.relativePosition.x + FavCimsIndexBgBarSprite.width, FavCimsCitizenRowsPanel.relativePosition.y); UIScrollbar FavCimsMainPanelScrollBar = FavCimsCitizenRowsPanelScrollBar.AddUIComponent<UIScrollbar> (); FavCimsMainPanelScrollBar.width = 10; FavCimsMainPanelScrollBar.height = FavCimsCitizenRowsPanel.height; FavCimsMainPanelScrollBar.orientation = UIOrientation.Vertical; FavCimsMainPanelScrollBar.pivot = UIPivotPoint.TopRight; FavCimsMainPanelScrollBar.AlignTo (FavCimsMainPanelScrollBar.parent, UIAlignAnchor.TopRight); FavCimsMainPanelScrollBar.minValue = 0; FavCimsMainPanelScrollBar.value = 0; FavCimsMainPanelScrollBar.incrementAmount = 40; UISlicedSprite FavCimsMainPanelTrackSprite = FavCimsMainPanelScrollBar.AddUIComponent<UISlicedSprite> (); FavCimsMainPanelTrackSprite.relativePosition = FavCimsMainPanelScrollBar.relativePosition; FavCimsMainPanelTrackSprite.autoSize = true; FavCimsMainPanelTrackSprite.size = FavCimsMainPanelTrackSprite.parent.size; FavCimsMainPanelTrackSprite.fillDirection = UIFillDirection.Vertical; FavCimsMainPanelTrackSprite.spriteName = "ScrollbarTrack"; FavCimsMainPanelScrollBar.trackObject = FavCimsMainPanelTrackSprite; UISlicedSprite thumbSprite = FavCimsMainPanelScrollBar.AddUIComponent<UISlicedSprite> (); thumbSprite.relativePosition = FavCimsMainPanelScrollBar.relativePosition; thumbSprite.autoSize = true; thumbSprite.width = thumbSprite.parent.width; thumbSprite.fillDirection = UIFillDirection.Vertical; thumbSprite.spriteName = "ScrollbarThumb"; FavCimsMainPanelScrollBar.thumbObject = thumbSprite; FavCimsCitizenRowsPanel.verticalScrollbar = FavCimsMainPanelScrollBar; /* Thx to CNightwing for this piece of code */ FavCimsCitizenRowsPanel.eventMouseWheel += (component, eventParam) => { var sign = Math.Sign (eventParam.wheelDelta); FavCimsCitizenRowsPanel.scrollPosition += new Vector2 (0, sign * (-1) * FavCimsMainPanelScrollBar.incrementAmount); }; /* End */ FavCimsCitizenRowsPanel.eventComponentAdded += (component, eventParam) => ReorderRowsBackgrounds (); FavCimsCitizenRowsPanel.eventComponentRemoved += (component, eventParam) => ReorderRowsBackgrounds (); /////////////////////////////////////////////// /////Rows Panel Footer /////////////////////////////////////////////// UITextureSprite FavCimsFooterBgBarSprite = CitizensPanel.AddUIComponent<UITextureSprite> (); FavCimsFooterBgBarSprite.name = "FavCimsFooterBgBarSprite"; FavCimsFooterBgBarSprite.width = FavCimsIndexBgBarSprite.width; FavCimsFooterBgBarSprite.height = 15; FavCimsFooterBgBarSprite.texture = FavCimsIndexBgBar; //Printing FavCimsFooterBgBarSprite.relativePosition = new Vector3 (21, FavCimsCitizenRowsPanel.relativePosition.y + FavCimsCitizenRowsPanel.height); //Row End //Load Initial Row (People Renamed) foreach(KeyValuePair<InstanceID, string> FavCitizen in FavCimsCore.FavoriteCimsList()) { if(FavCitizen.Key.Type == InstanceType.Citizen) { // || FavCitizen.Key.Type == InstanceType.CitizenInstance CitizenRow FavCimsCitizenSingleRowPanel = FavCimsCitizenRowsPanel.AddUIComponent(typeof(CitizenRow)) as CitizenRow; FavCimsCitizenSingleRowPanel.MyInstanceID = FavCitizen.Key; FavCimsCitizenSingleRowPanel.MyInstancedName = FavCitizen.Value; } } }
internal void SetupControls() { float offset = 40f; // Title Bar m_title = AddUIComponent <UITitleBar>(); m_title.iconSprite = "InfoIconTrafficCongestion"; m_title.title = AVOMod.ModName + " " + AVOMod.Version; // Category DropDown UILabel label = AddUIComponent <UILabel>(); label.textScale = 0.8f; label.padding = new RectOffset(0, 0, 8, 0); label.relativePosition = new Vector3(10f, offset); label.text = Translations.Translate("AVO_MOD_MP56"); m_category = UIUtils.CreateDropDown(this); m_category.width = 175; for (int i = 0; i < categoryList.Length; i++) { m_category.AddItem(categoryList[i]); } m_category.selectedIndex = 0; m_category.tooltip = Translations.Translate("AVO_MOD_MP39"); m_category.relativePosition = label.relativePosition + new Vector3(75f, 0f); m_category.eventSelectedIndexChanged += (c, t) => { m_category.enabled = false; PopulateList(); m_category.enabled = true; }; // Search m_search = UIUtils.CreateTextField(this); m_search.width = 145f; m_search.height = 30f; m_search.padding = new RectOffset(6, 6, 6, 6); m_search.tooltip = Translations.Translate("AVO_MOD_MP40"); m_search.relativePosition = new Vector3(WIDTHLEFT - m_search.width, offset); m_search.eventTextChanged += (c, t) => PopulateList(); label = AddUIComponent <UILabel>(); label.textScale = 0.8f; label.padding = new RectOffset(0, 0, 8, 0); label.relativePosition = m_search.relativePosition - new Vector3(60f, 0f); label.text = Translations.Translate("AVO_MOD_MP55"); // FastList m_fastList = UIFastList.Create <UIVehicleItem>(this); m_fastList.backgroundSprite = "UnlockingPanel"; m_fastList.width = WIDTHLEFT - 5; m_fastList.height = height - offset - 110; m_fastList.canSelect = true; m_fastList.relativePosition = new Vector3(5, offset + 35); // Configuration file buttons UILabel configLabel = this.AddUIComponent <UILabel>(); configLabel.text = Translations.Translate("AVO_MOD_MP41"); configLabel.textScale = 0.8f; configLabel.relativePosition = new Vector3(16, height - 65); m_import = UIUtils.CreateButton(this); m_import.text = Translations.Translate("AVO_MOD_MP42"); m_import.width = 80; m_import.tooltip = Translations.Translate("AVO_MOD_MP43"); m_import.relativePosition = new Vector3(10, height - 45); m_export = UIUtils.CreateButton(this); m_export.text = Translations.Translate("AVO_MOD_MP44"); m_export.width = 80; m_export.tooltip = Translations.Translate("AVO_MOD_MP45"); m_export.relativePosition = new Vector3(95, height - 45); m_resetall = UIUtils.CreateButton(this); m_resetall.text = Translations.Translate("AVO_MOD_MP46"); m_resetall.width = 80; m_resetall.tooltip = Translations.Translate("AVO_MOD_MP47"); m_resetall.relativePosition = new Vector3(180, height - 45); m_autosave = AddUIComponent <UILabel>(); m_autosave.textScale = 0.6f; m_autosave.text = Translations.Translate("AVO_MOD_MP48"); m_autosave.relativePosition = new Vector3(275, height - 40); m_autosave.autoSize = true; m_autosave.textAlignment = UIHorizontalAlignment.Center; m_autosave.textColor = Color.green; m_autosave.tooltip = Translations.Translate("AVO_MOD_MP49"); m_autosave.isVisible = AdvancedVehicleOptions.AutoSaveVehicleConfig; // Preview UIPanel panel = AddUIComponent <UIPanel>(); panel.backgroundSprite = "GenericPanel"; panel.width = WIDTHRIGHT - 10; panel.height = HEIGHT - 420; panel.relativePosition = new Vector3(WIDTHLEFT + 5, offset); m_preview = panel.AddUIComponent <UITextureSprite>(); m_preview.size = panel.size; m_preview.relativePosition = Vector3.zero; m_previewRenderer = gameObject.AddComponent <PreviewRenderer>(); m_previewRenderer.size = m_preview.size * 2; // Twice the size for anti-aliasing m_preview.texture = m_previewRenderer.texture; // Follow a vehicle if (m_cameraController != null) { m_followVehicle = AddUIComponent <UISprite>(); m_followVehicle.spriteName = "LocationMarkerFocused"; m_followVehicle.width = m_followVehicle.spriteInfo.width; m_followVehicle.height = m_followVehicle.spriteInfo.height; m_followVehicle.tooltip = Translations.Translate("AVO_MOD_MP50"); m_followVehicle.relativePosition = new Vector3(panel.relativePosition.x + panel.width - m_followVehicle.width - 5, panel.relativePosition.y + 5); m_followVehicle.eventClick += (c, p) => FollowNextVehicle(); } //Remove the followed vehicle { m_removeVehicle = AddUIComponent <UISprite>(); m_removeVehicle.Hide(); m_removeVehicle.spriteName = "IconPolicyOldTown"; m_removeVehicle.width = m_removeVehicle.spriteInfo.width - 12; m_removeVehicle.height = m_removeVehicle.spriteInfo.height - 12; m_removeVehicle.tooltip = Translations.Translate("AVO_MOD_MP51"); m_removeVehicle.relativePosition = new Vector3(panel.relativePosition.x + panel.width - m_removeVehicle.width - 33, panel.relativePosition.y + 7); m_removeVehicle.eventClick += (c, p) => RemoveThisVehicle(); } // Option panel m_optionPanel = AddUIComponent <UIOptionPanel>(); m_optionPanel.relativePosition = new Vector3(WIDTHLEFT, height - 370); // Event handlers m_fastList.eventSelectedIndexChanged += OnSelectedItemChanged; m_optionPanel.eventEnableCheckChanged += OnEnableStateChanged; m_import.eventClick += (c, t) => { DefaultOptions.RestoreAll(); AdvancedVehicleOptions.ImportVehicleDataConfig(); optionList = AdvancedVehicleOptions.config.options; }; m_export.eventClick += (c, t) => AdvancedVehicleOptions.ExportVehicleDataConfig(true); m_resetall.eventClick += (c, t) => { ConfirmPanel.ShowModal(Translations.Translate("AVO_MOD_MP52"), Translations.Translate("AVO_MOD_MP53"), (comp, ret) => { if (ret != 1) { return; } DefaultOptions.RestoreAll(); AdvancedVehicleOptions.ResetVehicleDataConfig(); optionList = AdvancedVehicleOptions.config.options; ExceptionPanel resetpanel = UIView.library.ShowModal <ExceptionPanel>("ExceptionPanel"); resetpanel.SetMessage("Advanced Vehicle Options", Translations.Translate("AVO_MOD_MP54"), false); }); }; panel.eventMouseDown += (c, p) => { eventMouseMove += RotateCamera; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; panel.eventMouseUp += (c, p) => { eventMouseMove -= RotateCamera; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; panel.eventMouseWheel += (c, p) => { m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f; if (m_optionPanel.m_options != null && m_optionPanel.m_options.useColorVariations) { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab, m_previewColor); } else { m_previewRenderer.RenderVehicle(m_optionPanel.m_options.prefab); } }; }
protected void Awake() { this.m_Author = base.Find <UILabel>("Author"); this.m_FileList = base.Find <UIListBox>("MapList"); base.ClearListing(); m_FileList.ClearEventInvocations("eventSelectedIndexChanged"); this.m_FileList.eventSelectedIndexChanged += new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnMapSelectionChanged); this.m_MapName = base.Find <UITextField>("MapName"); this.m_MapName.ClearEventInvocations("eventTextChanged"); //this.m_MapName.eventTextChanged += (c, t) => (this.m_Virgin = false); this.m_SnapShot = base.Find <UITextureSprite>("SnapShot"); this.m_BuildableArea = base.Find <UILabel>("BuildableArea"); this.m_OilResources = base.Find <UIProgressBar>("ResourceBarOil"); this.m_OreResources = base.Find <UIProgressBar>("ResourceBarOre"); this.m_ForestryResources = base.Find <UIProgressBar>("ResourceBarForestry"); this.m_FertilityResources = base.Find <UIProgressBar>("ResourceBarFarming"); this.m_WaterResources = base.Find <UIProgressBar>("ResourceBarWater"); this.m_OilNoResources = base.Find("ResourceOil").Find <UISprite>("NoNoNo"); this.m_OreNoResources = base.Find("ResourceOre").Find <UISprite>("NoNoNo"); this.m_ForestryNoResources = base.Find("ResourceForestry").Find <UISprite>("NoNoNo"); this.m_FertilityNoResources = base.Find("ResourceFarming").Find <UISprite>("NoNoNo"); this.m_WaterNoResources = base.Find("ResourceWater").Find <UISprite>("NoNoNo"); this.m_Highway = base.Find <UISprite>("Highway"); this.m_NoHighway = this.m_Highway.Find <UISprite>("NoNoNo"); this.m_InHighway = this.m_Highway.Find <UISprite>("Incoming"); this.m_OutHighway = this.m_Highway.Find <UISprite>("Outgoing"); this.m_Train = base.Find <UISprite>("Train"); this.m_NoTrain = this.m_Train.Find <UISprite>("NoNoNo"); this.m_InTrain = this.m_Train.Find <UISprite>("Incoming"); this.m_OutTrain = this.m_Train.Find <UISprite>("Outgoing"); this.m_Ship = base.Find <UISprite>("Ship"); this.m_NoShip = this.m_Ship.Find <UISprite>("NoNoNo"); this.m_InShip = this.m_Ship.Find <UISprite>("Incoming"); this.m_OutShip = this.m_Ship.Find <UISprite>("Outgoing"); this.m_Plane = base.Find <UISprite>("Plane"); this.m_NoPlane = this.m_Plane.Find <UISprite>("NoNoNo"); this.m_InPlane = this.m_Plane.Find <UISprite>("Incoming"); this.m_OutPlane = this.m_Plane.Find <UISprite>("Outgoing"); this.m_Start = this.Find <UIButton>("Start"); m_Start.ClearEventInvocations("eventClick"); this.m_Start.eventClick += new MouseEventHandler(this.OnStartClick); m_Start.color = Color.red; this.Refresh(); var joinPanel = transform.GetComponent <UIPanel>(); m_playersLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_playersLabel, "Players: ", 505, 100); m_pingLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_pingLabel, "Ping: ", 505, 125); m_errorLabel = joinPanel.AddUIComponent <UILabel>(); SetLabel(m_errorLabel, "", 505, 150); NetPeerConfiguration config = new NetPeerConfiguration("FPSMod"); config.SetMessageTypeEnabled(NetIncomingMessageType.UnconnectedData, true); m_netClient = new NetClient(config); m_netClient.Start(); }
/// <summary> /// Constructor. /// </summary> internal PreviewPanel() { // Size and position. width = RenderWidth + (Margin * 2f); height = RenderHeight + (Margin * 2f); // Appearance. backgroundSprite = "UnlockingPanel2"; opacity = 1.0f; // Drag bar. UIDragHandle dragHandle = AddUIComponent <UIDragHandle>(); dragHandle.width = this.width; dragHandle.height = this.height; dragHandle.relativePosition = Vector3.zero; dragHandle.target = this; // Preview render panel. renderPanel = AddUIComponent <UIPanel>(); renderPanel.backgroundSprite = "AssetEditorItemBackgroundDisabled"; renderPanel.height = RenderHeight; renderPanel.width = RenderWidth; renderPanel.relativePosition = new Vector2(Margin, Margin); previewSprite = renderPanel.AddUIComponent <UITextureSprite>(); previewSprite.size = renderPanel.size; previewSprite.relativePosition = Vector3.zero; noPreviewSprite = renderPanel.AddUIComponent <UISprite>(); noPreviewSprite.size = renderPanel.size; noPreviewSprite.relativePosition = Vector3.zero; thumbnailSprite = renderPanel.AddUIComponent <UISprite>(); thumbnailSprite.size = renderPanel.size; thumbnailSprite.relativePosition = Vector3.zero; // Initialise renderer; use double size for anti-aliasing. renderer = gameObject.AddComponent <PreviewRenderer>(); renderer.Size = previewSprite.size * 2; // Click-and-drag rotation. eventMouseDown += (component, mouseEvent) => { eventMouseMove += RotateCamera; }; eventMouseUp += (component, mouseEvent) => { eventMouseMove -= RotateCamera; }; // Zoom with mouse wheel. eventMouseWheel += (component, mouseEvent) => { renderer.Zoom -= Mathf.Sign(mouseEvent.wheelDelta) * 0.25f; // Render updated image. RenderPreview(); }; }
private void SetupControls() { // Title Bar m_title = AddUIComponent<UITitleBar>(); m_title.title = "Theme Manager"; m_title.iconSprite = "ToolbarIconZoomOutCity"; // Filter m_filter = AddUIComponent<UIBuildingFilter>(); m_filter.width = width - SPACING * 2; m_filter.height = 70; m_filter.relativePosition = new Vector3(SPACING, TITLE_HEIGHT); m_filter.eventFilteringChanged += (c, i) => { if (m_themeSelection != null && m_themeSelection.selectedIndex != -1) { m_buildingSelection.selectedIndex = -1; m_buildingSelection.rowsData = Filter(m_themes[m_themeSelection.selectedIndex]); } }; // Panels UIPanel left = AddUIComponent<UIPanel>(); left.width = LEFT_WIDTH; left.height = HEIGHT - m_filter.height; left.relativePosition = new Vector3(SPACING, TITLE_HEIGHT + m_filter.height + SPACING); UIPanel middle = AddUIComponent<UIPanel>(); middle.width = MIDDLE_WIDTH; middle.height = HEIGHT - m_filter.height; middle.relativePosition = new Vector3(LEFT_WIDTH + SPACING * 2, TITLE_HEIGHT + m_filter.height + SPACING); UIPanel right = AddUIComponent<UIPanel>(); right.width = RIGHT_WIDTH; right.height = HEIGHT - m_filter.height; right.relativePosition = new Vector3(LEFT_WIDTH + MIDDLE_WIDTH + SPACING * 3, TITLE_HEIGHT + m_filter.height + SPACING); // Theme selection m_themeSelection = UIFastList.Create<UIThemeItem>(left); m_themeSelection.backgroundSprite = "UnlockingPanel"; m_themeSelection.width = left.width; m_themeSelection.height = left.height - 40; m_themeSelection.canSelect = true; m_themeSelection.rowHeight = 40; m_themeSelection.autoHideScrollbar = true; m_themeSelection.relativePosition = Vector3.zero; m_themeSelection.rowsData.m_buffer = m_allThemes; m_themeSelection.rowsData.m_size = m_allThemes.Length; m_themeSelection.DisplayAt(0); m_themeSelection.eventSelectedIndexChanged += (c, i) => { if (i == -1) return; int listCount = m_buildingSelection.rowsData.m_size; float pos = m_buildingSelection.listPosition; m_buildingSelection.selectedIndex = -1; m_buildingSelection.rowsData = Filter(m_themes[i]); if (m_filter.buildingStatus == UIBuildingFilter.Status.All && m_buildingSelection.rowsData.m_size == listCount) { m_buildingSelection.DisplayAt(pos); } m_themeRemove.isEnabled = !((Configuration.Theme)m_themeSelection.selectedItem).isBuiltIn; }; // Add theme m_themeAdd = UIUtils.CreateButton(left); m_themeAdd.width = (LEFT_WIDTH - SPACING) / 2; m_themeAdd.text = "New Theme"; m_themeAdd.relativePosition = new Vector3(0, m_themeSelection.height + SPACING); m_themeAdd.eventClick += (c, p) => { UIView.PushModal(UINewThemeModal.instance); UINewThemeModal.instance.Show(true); }; // Remove theme m_themeRemove = UIUtils.CreateButton(left); m_themeRemove.width = (LEFT_WIDTH - SPACING) / 2; m_themeRemove.text = "Delete Theme"; m_themeRemove.isEnabled = false; m_themeRemove.relativePosition = new Vector3(LEFT_WIDTH - m_themeRemove.width, m_themeSelection.height + SPACING); m_themeRemove.eventClick += (c, p) => { ConfirmPanel.ShowModal("Delete Theme", "Are you sure you want to delete '" + selectedTheme.name + "' theme ?", (d, i) => { if (i == 1) DeleteTheme(selectedTheme); }); }; // Building selection m_buildingSelection = UIFastList.Create<UIBuildingItem>(middle); m_buildingSelection.backgroundSprite = "UnlockingPanel"; m_buildingSelection.width = middle.width; m_buildingSelection.height = middle.height - 40; m_buildingSelection.canSelect = true; m_buildingSelection.rowHeight = 40; m_buildingSelection.autoHideScrollbar = true; m_buildingSelection.relativePosition = Vector3.zero; m_buildingSelection.rowsData = new FastList<object>(); BuildingItem selectedItem = null; m_buildingSelection.eventSelectedIndexChanged += (c, i) => { selectedItem = m_buildingSelection.selectedItem as BuildingItem; }; m_buildingSelection.eventMouseLeave += (c, p) => { if (selectedItem != null) UpdateBuildingInfo(selectedItem); else UpdateBuildingInfo(null); }; // Include buttons m_includeNone = UIUtils.CreateButton(middle); m_includeNone.width = 55; m_includeNone.text = "None"; m_includeNone.relativePosition = new Vector3(MIDDLE_WIDTH - m_includeNone.width, m_buildingSelection.height + SPACING); m_includeAll = UIUtils.CreateButton(middle); m_includeAll.width = 55; m_includeAll.text = "All"; m_includeAll.relativePosition = new Vector3(m_includeNone.relativePosition.x - m_includeAll.width - SPACING, m_buildingSelection.height + SPACING); UILabel include = middle.AddUIComponent<UILabel>(); include.width = 100; include.padding = new RectOffset(0, 0, 8, 0); include.textScale = 0.8f; include.text = "Include:"; include.relativePosition = new Vector3(m_includeAll.relativePosition.x - include.width - SPACING, m_buildingSelection.height + SPACING); m_includeAll.eventClick += (c, p) => { for (int i = 0; i < m_buildingSelection.rowsData.m_size; i++) { BuildingItem item = m_buildingSelection.rowsData[i] as BuildingItem; if (item != null) ChangeBuildingStatus(item, true); } m_buildingSelection.Refresh(); }; m_includeNone.eventClick += (c, p) => { for (int i = 0; i < m_buildingSelection.rowsData.m_size; i++) { BuildingItem item = m_buildingSelection.rowsData[i] as BuildingItem; if (item != null) ChangeBuildingStatus(item, false); } m_buildingSelection.Refresh(); }; // Preview UIPanel previewPanel = right.AddUIComponent<UIPanel>(); previewPanel.backgroundSprite = "GenericPanel"; previewPanel.width = right.width; previewPanel.height = (right.height - SPACING * 2) / 2; previewPanel.relativePosition = Vector3.zero; m_preview = previewPanel.AddUIComponent<UITextureSprite>(); m_preview.size = previewPanel.size; m_preview.relativePosition = Vector3.zero; m_noPreview = previewPanel.AddUIComponent<UISprite>(); m_noPreview.spriteName = "Niet"; m_noPreview.relativePosition = new Vector3((previewPanel.width - m_noPreview.spriteInfo.width) / 2, (previewPanel.height - m_noPreview.spriteInfo.height) / 2); m_previewRenderer = gameObject.AddComponent<PreviewRenderer>(); m_previewRenderer.size = m_preview.size * 2; // Twice the size for anti-aliasing previewPanel.eventMouseDown += (c, p) => { eventMouseMove += RotateCamera; }; previewPanel.eventMouseUp += (c, p) => { eventMouseMove -= RotateCamera; }; previewPanel.eventMouseWheel += (c, p) => { m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f; RenderPreview(); }; // Building Options m_buildingOptions = right.AddUIComponent<UIBuildingInfo>(); m_buildingOptions.width = RIGHT_WIDTH; m_buildingOptions.height = (right.height - SPACING * 2) / 2; m_buildingOptions.relativePosition = new Vector3(0, previewPanel.height + SPACING); }