public override void Update() { if (FavCimsMainClass.UnLoading) return; if (this.isVisible) { if(!HumanWorldInfoPanel.GetCurrentInstanceID().IsEmpty) { ThisHuman = HumanWorldInfoPanel.GetCurrentInstanceID(); int citizenID = (int)((UIntPtr)ThisHuman.Citizen); string CitizenName = MyInstance.GetName (ThisHuman); if(CitizenName != null && CitizenName.Length > 0) { this.tooltip = FavCimsLang.text ("FavStarButton_disable_tooltip"); this.normalBgSprite = "icon_fav_subscribed"; if(!FavCimsCore.RowID.ContainsKey (citizenID) && !FavoriteCimsMainPanel.RowsAlreadyExist(ThisHuman)) { object L = FavCimsCore.GetPrivateVariable<object>(InstanceManager.instance, "m_lock"); do { } while (!Monitor.TryEnter(L, SimulationManager.SYNCHRONIZE_TIMEOUT)); try { CitizenRow FavCimsCitizenSingleRowPanel = FavoriteCimsMainPanel.FavCimsCitizenRowsPanel.AddUIComponent(typeof(CitizenRow)) as CitizenRow; if(FavCimsCitizenSingleRowPanel != null) { FavCimsCitizenSingleRowPanel.MyInstanceID = ThisHuman; FavCimsCitizenSingleRowPanel.MyInstancedName = CitizenName; } } finally { Monitor.Exit(L); } } return; }else{ if(citizenID != 0 && FavCimsCore.RowID.ContainsKey (citizenID)) { MyInstance.SetName(ThisHuman, MyCitizen.GetCitizenName(ThisHuman.Citizen)); this.tooltip = FavCimsLang.text ("FavStarButton_disable_tooltip"); this.normalBgSprite = "icon_fav_subscribed"; }else { this.tooltip = FavCimsLang.text ("FavStarButton_enable_tooltip"); this.normalBgSprite = "icon_fav_unsubscribed"; } } } } }
private void DispatchAutobulldozeEffect(BuildingInfo info, ref Vector3 pos, ref float angle, int length) { EffectInfo mBulldozeEffect = this._buildingManager.m_properties.m_bulldozeEffect; if (mBulldozeEffect == null) { return; } InstanceID instanceID = new InstanceID(); EffectInfo.SpawnArea spawnArea = new EffectInfo.SpawnArea(Matrix4x4.TRS(Building.CalculateMeshPosition(info, pos, angle, length), Building.CalculateMeshRotation(angle), Vector3.one), info.m_lodMeshData); this._effectManager.DispatchEffect(mBulldozeEffect, instanceID, spawnArea, Vector3.zero, 0f, 1f, this._nullAudioGroup); }
// //-- Send Message Calls // This section is for the MESSAGES such as the ones described in the // test instructions. // public static bool SendAffectMessage( InstanceID recipient, EffectType type, int intensity, double time = -1.0d ) { Entity targetEntity = null; if( s_GameEntities.TryGetValue( target, out targetEntity ) ) { targetEntity.Affect( type, intensity ); return true; } return false; }
public override string GenerateName(ushort buildingID, InstanceID caller) { if (this.m_info.m_prefabDataIndex == -1) { return null; } Randomizer randomizer = new Randomizer ((int)buildingID); string key = PrefabCollection<BuildingInfo>.PrefabName ((uint)this.m_info.m_prefabDataIndex); uint num = Locale.CountUnchecked ("BUILDING_NAME", key); if (num != 0u) { return Locale.Get ("BUILDING_NAME", key, randomizer.Int32 (num)); } return BuildingNameGenerator.GenerateName (this.m_info.m_class.m_service, randomizer); }
public static bool SendProcessTargetMessage( InstanceID recipient, int targetID, double time = -1.0d ) { Entity targetEntity = null; if( s_GameEntities.TryGetValue( recipient, out targetEntity ) ) { if( targetEntity is HotSpot ) { HotSpot hs = (HotSpot)targetEntity; hs.ProcessJob( targetID ); } } return true; }
public override void RenderEffect(InstanceID id, EffectInfo.SpawnArea area, Vector3 velocity, float acceleration, float magnitude, float timeDelta, RenderManager.CameraInfo cameraInfo) { var pos = area.m_matrix.MultiplyPoint(Vector3.zero); if ((pos - Camera.main.transform.position).sqrMagnitude > 1000.0f) { return; } var dir = area.m_matrix.MultiplyVector(Vector3.forward); // Log.Warning(dir.ToString()); pos += Vector3.up * 8.0f; pos += dir*5.0f; id.Index = (uint)UnityEngine.Random.Range(0, 256); LightData data = new LightData(id, pos, new Color(1.0f, 0.827f, 0.471f), 0.6f, 32.0f, 10.0f); data.m_type = LightType.Spot; data.m_spotAngle = 60.0f; data.m_rotation = Quaternion.Euler(90, 0, 0); Singleton<RenderManager>.instance.DrawLight(data); }
public override Instance Clone(InstanceState instanceState, ref Matrix4x4 matrix4x, float deltaHeight, float deltaAngle, Vector3 center, bool followTerrain, Dictionary <ushort, ushort> clonedNodes, Action action) { BuildingState state = instanceState as BuildingState; Vector3 newPosition = matrix4x.MultiplyPoint(state.position - center); newPosition.y = state.position.y + deltaHeight; float terrainHeight = TerrainManager.instance.SampleOriginalRawHeightSmooth(newPosition); if (followTerrain) { newPosition.y = newPosition.y + terrainHeight - state.terrainHeight; } MoveableBuilding cloneInstance = null; BuildingInfo info = state.Info.Prefab as BuildingInfo; float newAngle = state.angle + deltaAngle; if (BuildingManager.instance.CreateBuilding(out ushort clone, ref SimulationManager.instance.m_randomizer, info, newPosition, newAngle, state.length, SimulationManager.instance.m_currentBuildIndex)) { SimulationManager.instance.m_currentBuildIndex++; InstanceID cloneID = default; cloneID.Building = clone; cloneInstance = new MoveableBuilding(cloneID); if ((state.flags & Building.Flags.Completed) != Building.Flags.None) { buildingBuffer[clone].m_flags = buildingBuffer[clone].m_flags | Building.Flags.Completed; } if ((state.flags & Building.Flags.FixedHeight) != Building.Flags.None) { buildingBuffer[clone].m_flags = buildingBuffer[clone].m_flags | Building.Flags.FixedHeight; } if ((state.flags & Building.Flags.Historical) != Building.Flags.None) { buildingBuffer[clone].m_flags = buildingBuffer[clone].m_flags | Building.Flags.Historical; } if ((state.flags & Building.Flags.Hidden) != Building.Flags.None) { buildingBuffer[clone].m_flags = buildingBuffer[clone].m_flags | Building.Flags.Hidden; } if (Mathf.Abs(terrainHeight - newPosition.y) > 0.01f) { AddFixedHeightFlag(clone); } else { RemoveFixedHeightFlag(clone); } if (info.m_subBuildings != null && info.m_subBuildings.Length != 0) { Matrix4x4 subMatrix4x = default; subMatrix4x.SetTRS(newPosition, Quaternion.AngleAxis(newAngle * Mathf.Rad2Deg, Vector3.down), Vector3.one); for (int i = 0; i < info.m_subBuildings.Length; i++) { BuildingInfo subInfo = info.m_subBuildings[i].m_buildingInfo; Vector3 subPosition = subMatrix4x.MultiplyPoint(info.m_subBuildings[i].m_position); float subAngle = info.m_subBuildings[i].m_angle * 0.0174532924f + newAngle; if (BuildingManager.instance.CreateBuilding(out ushort subClone, ref SimulationManager.instance.m_randomizer, subInfo, subPosition, subAngle, 0, SimulationManager.instance.m_currentBuildIndex)) { SimulationManager.instance.m_currentBuildIndex++; if (info.m_subBuildings[i].m_fixedHeight) { buildingBuffer[subClone].m_flags = buildingBuffer[subClone].m_flags | Building.Flags.FixedHeight; } } if (clone != 0 && subClone != 0) { buildingBuffer[clone].m_subBuilding = subClone; buildingBuffer[subClone].m_parentBuilding = clone; buildingBuffer[subClone].m_flags = buildingBuffer[subClone].m_flags | Building.Flags.Untouchable; clone = subClone; } } } cloneInstance.ResetSubInstances(); } return(cloneInstance); }
public BulldozeAction() { HashSet <Instance> newSelection = new HashSet <Instance>(selection); HashSet <Instance> extraNodes = new HashSet <Instance>(); HashSet <ushort> segments = new HashSet <ushort>(); // Segments to be removed //string msg = $"\nBasic Selection: {selection.Count}\n"; // Add any segments whose node is selected foreach (Instance instance in selection) { if (instance.isValid) { if (instance.id.Type == InstanceType.NetSegment) { segments.Add(instance.id.NetSegment); } else if (instance.id.Type == InstanceType.NetNode) { for (int i = 0; i < 8; i++) { ushort segment = NetManager.instance.m_nodes.m_buffer[instance.id.NetNode].GetSegment(i); if (segment != 0) { InstanceID instanceID = default(InstanceID); instanceID.NetSegment = segment; if (selection.Contains(instanceID)) { continue; } newSelection.Add(new MoveableSegment(instanceID)); segments.Add(segment); } } } else if (instance.id.Type == InstanceType.Building) { Building building = (Building)((MoveableBuilding)instance).data; ushort nodeId = building.m_netNode; int c = 0; while (nodeId != 0) { NetNode node = NetManager.instance.m_nodes.m_buffer[nodeId]; for (int i = 0; i < 8; i++) { ushort segmentId = node.GetSegment(i); if (segmentId != 0 && MoveableSegment.isSegmentValid(segmentId) && ((NetManager.instance.m_segments.m_buffer[segmentId].m_flags & NetSegment.Flags.Untouchable) == NetSegment.Flags.None)) { InstanceID instanceID = default(InstanceID); instanceID.NetSegment = segmentId; if (selection.Contains(instanceID)) { continue; } newSelection.Add(new MoveableSegment(instanceID)); segments.Add(segmentId); } } nodeId = node.m_nextBuildingNode; if (++c > 32768) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } } } } //msg += $"Selection With Extra Segments: {newSelection.Count}\nTotal Segments: {segments.Count}\n"; // Add any nodes whose segments are all selected foreach (Instance instance in newSelection) { if (instance.isValid) { if (instance.id.Type == InstanceType.NetSegment) { ushort segId = instance.id.NetSegment; ushort[] nodeIds = { NetManager.instance.m_segments.m_buffer[segId].m_startNode, NetManager.instance.m_segments.m_buffer[segId].m_endNode }; foreach (ushort id in nodeIds) { bool toDelete = true; NetNode node = NetManager.instance.m_nodes.m_buffer[id]; for (int i = 0; i < 8; i++) { if (node.GetSegment(i) != 0 && !segments.Contains(node.GetSegment(i))) { toDelete = false; break; } } if (toDelete) { InstanceID instanceId = default(InstanceID); instanceId.NetNode = id; MoveableNode mn = new MoveableNode(instanceId); if (newSelection.Contains(mn)) { continue; } extraNodes.Add(mn); } } } } } foreach (Instance instance in newSelection) { m_states.Add(instance.GetState()); } foreach (Instance instance in extraNodes) { m_states.Add(instance.GetState()); } //Debug.Log(msg + $"Final Selection: {m_states.Count}"); }
public static bool IsBuilding(Type panelType, ushort buildingId, out WorldInfoPanel panel) { InstanceID instance = GetInstanceID(panelType, out panel); return(instance.Type == InstanceType.Building && instance.Building == buildingId); }
internal void GetTags(ushort buildingId, Building data, List <osmWayTag> tags, ref string amenity) { var service = data.Info.m_class.m_service; var ss = data.Info.m_class.m_subService; var landuse = ""; var building = ""; var name = ""; var className = data.Info.m_class.name.ToLower(); if (servicesList.ContainsKey(service.ToString())) { servicesList[service.ToString()]++; } else { servicesList[service.ToString()] = 1; } if (subServicesList.ContainsKey(ss.ToString())) { subServicesList[ss.ToString()]++; } else { subServicesList[ss.ToString()] = 1; } if (classNameList.ContainsKey(className)) { classNameList[className]++; } else { classNameList[className] = 1; } if ((data.m_flags & Building.Flags.CustomName) != Building.Flags.None) { var id = new InstanceID(); id.Building = buildingId; name = Singleton <InstanceManager> .instance.GetName(id); } switch (service) { case ItemClass.Service.Beautification: if (className.Contains("marker")) { return; } landuse = "recreation_ground"; break; case ItemClass.Service.Commercial: building = "retail"; break; case ItemClass.Service.Residential: building = "residential"; break; case ItemClass.Service.Office: building = "commercial"; break; case ItemClass.Service.Industrial: building = "industrial"; break; case ItemClass.Service.Garbage: landuse = "landfill"; break; case ItemClass.Service.Education: amenity = "school"; building = "school"; break; case ItemClass.Service.Electricity: tags.Add(new osmWayTag { k = "power", v = "plant" }); break; case ItemClass.Service.FireDepartment: amenity = "fire_station"; building = "yes"; break; case ItemClass.Service.HealthCare: amenity = "hospital"; building = "yes"; break; case ItemClass.Service.Monument: name = data.Info.name; building = "yes"; break; case ItemClass.Service.PoliceDepartment: amenity = "police"; building = "yes"; break; case ItemClass.Service.PublicTransport: if (!className.Contains("facility")) { return; } if (ss == ItemClass.SubService.PublicTransportBus) { tags.Add(new osmWayTag { k = "amenity", v = "bus_station" }); tags.Add(new osmWayTag { k = "public_transport", v = "station" }); } else if (ss == ItemClass.SubService.PublicTransportTrain) { tags.Add(new osmWayTag { k = "public_transport", v = "station" }); tags.Add(new osmWayTag { k = "railway", v = "station" }); } else if (ss == ItemClass.SubService.PublicTransportTaxi) { tags.Add(new osmWayTag { k = "amenity", v = "taxi" }); tags.Add(new osmWayTag { k = "capacity", v = "8" }); } else if (ss == ItemClass.SubService.PublicTransportPlane) { tags.Add(new osmWayTag { k = "aeroway", v = "terminal" }); } else if (ss == ItemClass.SubService.PublicTransportMetro) { tags.Add(new osmWayTag { k = "railway", v = "subway_entrance" }); } else if (ss == ItemClass.SubService.PublicTransportShip) { tags.Add(new osmWayTag { k = "amenity", v = "ferry_terminal" }); } break; case ItemClass.Service.Tourism: building = "hotel"; break; default: return; } if (className.Contains("beautificationitem")) { tags.Add(new osmWayTag { k = "tourism", v = "attraction" }); tags.Add(new osmWayTag { k = "building", v = "yes" }); } if (landuse != "") { tags.Add(new osmWayTag { k = "landuse", v = landuse }); } if (building != "") { tags.Add(new osmWayTag { k = "building", v = building }); } if (name != "") { name = cleanUpName(name); tags.Add(new osmWayTag { k = "name", v = name }); } }
public MoveableProp(InstanceID instanceID) : base(instanceID) { Info = new Info_Prefab(PropManager.instance.m_props.m_buffer[instanceID.Prop].Info); }
public void CreateBannerLabel(string chirpStr, uint senderID) { if (Shutdown || string.IsNullOrEmpty(chirpStr)) { return; } UILabel newLabel = (UILabel)this.AddUIComponent <UILabel>(); if (newLabel != null) { //newLabel.autoSize = true; //newLabel.autoHeight = true; newLabel.verticalAlignment = UIVerticalAlignment.Middle; newLabel.textAlignment = UIHorizontalAlignment.Left; newLabel.height = this.height; newLabel.padding = new RectOffset(0, 0, 5, 5); newLabel.relativePosition = new Vector3(this.width, 0); newLabel.textScaleMode = UITextScaleMode.ScreenResolution; newLabel.textScale = (float)ChirpyBanner.CurrentConfig.TextSize / 20f; newLabel.opacity = 1.0f; newLabel.processMarkup = true; newLabel.text = chirpStr; newLabel.objectUserData = (object)new InstanceID() { Citizen = senderID }; newLabel.eventClick += (UIComponent comp, UIMouseEventParameter p) => { if (!((UnityEngine.Object)p.source != (UnityEngine.Object)null) || !((UnityEngine.Object)ToolsModifierControl.cameraController != (UnityEngine.Object)null)) { return; } InstanceID id = (InstanceID)p.source.objectUserData; if (!InstanceManager.IsValid(id)) { return; } ToolsModifierControl.cameraController.SetTarget(id, ToolsModifierControl.cameraController.transform.position, true); }; if (OurLabelFont == null) { OurLabelFont = newLabel.font; } if (OurLabelFont != null) { //OurLabelFont.size = ChirpyBanner.CurrentConfig.TextSize; UIFontRenderer fr = OurLabelFont.ObtainRenderer(); fr.textScale = newLabel.textScale; if (fr != null) { Vector2 ms = fr.MeasureString(chirpStr); newLabel.width = ms.x; newLabel.height = ms.y; if (this.height != (newLabel.height + 0)) { this.height = newLabel.height + 0; } } } BannerLabelStruct bls = new BannerLabelStruct(); bls.RelativePosition = new Vector3(this.width, label_y_inset); // starting position is off screen, at max extent of parent panel bls.Label = newLabel; bls.IsCurrentlyVisible = false; // add to queue BannerLabelsQ.Enqueue(bls); } }
///////////////End Bubble/////////////// public void GoToCitizen(InstanceID Target) { if (Target.IsEmpty) return; try { if (MyInstance.SelectInstance (Target)) { if (Input.GetMouseButton (2)) { WorldInfoPanel.Show<CitizenWorldInfoPanel> (this.position, Target); } else if (Input.GetMouseButton (1)) { //Switch Citizen this.MyInstanceID = Target; this.execute = true; LateUpdate(); } else { ToolsModifierControl.cameraController.SetTarget (Target, ToolsModifierControl.cameraController.transform.position, true); WorldInfoPanel.Show<CitizenWorldInfoPanel> (this.position, Target); } } } catch(Exception e) { Debug.Error("Can't find the Citizen " + e.ToString()); } }
public override object Copy(InstanceID sourceInstanceID) => sourceInstanceID.Type switch {
private void UpdateBindings() { ushort vehicleID = 0; ushort lineId = this.GetLineID(out vehicleID); if ((int)lineId == 0) { this._passengerPanel.Hide(); this._statsPanel.Hide(); this._buttonPanel.Hide(); this._publicTransportVehicleWorldInfoPanel.component.height = 229f; } else { this._publicTransportVehicleWorldInfoPanel.component.height = 332f; this._editType.isVisible = !OptionsWrapper <Settings> .Options.HideVehicleEditor; ItemClass itemClass = Singleton <TransportManager> .instance.m_lines.m_buffer[(int)lineId].Info.m_class; ItemClass.SubService subService = itemClass.m_subService; ItemClass.Service service = itemClass.m_service; ItemClass.Level level = itemClass.m_level; switch (subService) { case ItemClass.SubService.PublicTransportBus: case ItemClass.SubService.PublicTransportTours: case ItemClass.SubService.PublicTransportMetro: case ItemClass.SubService.PublicTransportTrain: case ItemClass.SubService.PublicTransportTram: case ItemClass.SubService.PublicTransportShip: case ItemClass.SubService.PublicTransportPlane: case ItemClass.SubService.PublicTransportMonorail: case ItemClass.SubService.PublicTransportCableCar: this._passengerPanel.Show(); if ((int)vehicleID != 0) { this._lastStopExchange.text = string.Format(Localization.Get("VEHICLE_PANEL_LAST_STOP_EXCHANGE"), (object)VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].LastStopGonePassengers, (object)VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].LastStopNewPassengers); } break; case ItemClass.SubService.None: if (service == ItemClass.Service.Disaster && level == ItemClass.Level.Level4) { this._passengerPanel.Show(); if ((int)vehicleID != 0) { this._lastStopExchange.text = string.Format(Localization.Get("VEHICLE_PANEL_LAST_STOP_EXCHANGE"), (object)VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].LastStopGonePassengers, (object)VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].LastStopNewPassengers); } } else { this._passengerPanel.Hide(); } break; default: this._passengerPanel.Hide(); break; } this._distanceTraveled.parent.Show(); this._distanceProgress.parent.Show(); VehicleManager vm = Singleton <VehicleManager> .instance; if ((vm.m_vehicles.m_buffer[(int)vehicleID].m_flags & Vehicle.Flags.Stopped) != ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive)) { if (VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].IsUnbunchingInProgress) { this._status.text = Localization.Get("VEHICLE_PANEL_STATUS_UNBUNCHING"); } this._distance.text = this._status.text; float num = (float)vm.m_vehicles.m_buffer[(int)vehicleID].m_waitCounter / 12f; int p = Mathf.RoundToInt(num * 100f); this._distanceTraveled.value = num; this._distanceTraveled.progressColor = (Color32)Color.green; this._distanceProgress.text = LocaleFormatter.FormatPercentage(p); } else { bool flag = true; string text = Localization.Get("VEHICLE_PANEL_STATUS_NEXT_STOP"); if (subService == ItemClass.SubService.PublicTransportShip) { this.UpdateProgress(); } else if (subService == ItemClass.SubService.PublicTransportPlane) { if ((vm.m_vehicles.m_buffer[(int)vehicleID].m_flags & Vehicle.Flags.Landing) != ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive) || (vm.m_vehicles.m_buffer[(int)vehicleID].m_flags & Vehicle.Flags.TakingOff) != ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive) || (vm.m_vehicles.m_buffer[(int)vehicleID].m_flags & Vehicle.Flags.Flying) == ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive)) { text = this._status.text; flag = false; } this.UpdateProgress(); } this._status.text = text; if (flag) { ushort targetBuilding = vm.m_vehicles.m_buffer[(int)vehicleID].m_targetBuilding; InstanceID id = new InstanceID(); id.NetNode = targetBuilding; string name = Singleton <InstanceManager> .instance.GetName(id); this._target.objectUserData = (object)id; this._target.text = name == null?string.Format(Localization.Get("STOP_LIST_BOX_ROW_STOP"), (object)(TransportLineMod.GetStopIndex(lineId, targetBuilding) + 1)) : name; this._target.Enable(); this._target.Show(); } this._distance.text = ColossalFramework.Globalization.Locale.Get(this._distance.localeID); this._distanceTraveled.progressColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); } this._statsPanel.Show(); this._passengersCurrentWeek.text = VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].PassengersThisWeek.ToString(); this._passengersLastWeek.text = VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].PassengersLastWeek.ToString(); this._passengersAverage.text = VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].PassengersAverage.ToString(); PrefabData prefabData = Array.Find(VehiclePrefabs.instance.GetPrefabs(service, subService, level), item => item.PrefabDataIndex == vm.m_vehicles.m_buffer[(int)vehicleID].Info.m_prefabDataIndex); int num1 = VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].IncomeThisWeek - prefabData.MaintenanceCost; UILabel earningsCurrentWeek = this._earningsCurrentWeek; float num2 = (float)num1 * 0.01f; string str1 = num2.ToString(ColossalFramework.Globalization.Locale.Get("MONEY_FORMAT"), (IFormatProvider)LocaleManager.cultureInfo); earningsCurrentWeek.text = str1; this._earningsCurrentWeek.textColor = (Color32)this.GetColor((float)num1); int incomeLastWeek = VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].IncomeLastWeek; UILabel earningsLastWeek = this._earningsLastWeek; num2 = (float)incomeLastWeek * 0.01f; string str2 = num2.ToString(ColossalFramework.Globalization.Locale.Get("MONEY_FORMAT"), (IFormatProvider)LocaleManager.cultureInfo); earningsLastWeek.text = str2; this._earningsLastWeek.textColor = (Color32)this.GetColor((float)incomeLastWeek); int incomeAverage = VehicleManagerMod.m_cachedVehicleData[(int)vehicleID].IncomeAverage; UILabel earningsAverage = this._earningsAverage; num2 = (float)incomeAverage * 0.01f; string str3 = num2.ToString(ColossalFramework.Globalization.Locale.Get("MONEY_FORMAT"), (IFormatProvider)LocaleManager.cultureInfo); earningsAverage.text = str3; this._earningsAverage.textColor = (Color32)this.GetColor((float)incomeAverage); this._buttonPanel.Show(); } }
public override string GenerateName(ushort buildingID, InstanceID caller) { return(base.m_info.GetUncheckedLocalizedTitle()); }
protected override void OnToolUpdate() { base.OnToolUpdate(); // Raycast to all currently "allowed" Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastInput input = new RaycastInput(ray, Camera.main.farClipPlane); input.m_ignoreTerrain = false; input.m_ignoreSegmentFlags = np_allowSegments ? NetSegment.Flags.Untouchable : NetSegment.Flags.All; input.m_ignoreNodeFlags = np_allowNodes ? NetNode.Flags.Untouchable : NetNode.Flags.All; input.m_ignorePropFlags = np_allowProps ? PropInstance.Flags.None : PropInstance.Flags.All; input.m_ignoreTreeFlags = np_allowTrees ? TreeInstance.Flags.None : TreeInstance.Flags.All; input.m_ignoreBuildingFlags = np_allowBuildings ? Building.Flags.Untouchable : Building.Flags.All; input.m_ignoreCitizenFlags = CitizenInstance.Flags.All; input.m_ignoreVehicleFlags = Vehicle.Flags.Created; input.m_ignoreDisasterFlags = DisasterData.Flags.All; input.m_ignoreTransportFlags = TransportLine.Flags.All; input.m_ignoreParkedVehicleFlags = VehicleParked.Flags.All; input.m_ignoreParkFlags = DistrictPark.Flags.All; RayCast(input, out RaycastOutput output); // Set the world mouse position (useful for my implementation of StepOver) np_mouseCurrentPosition = output.m_hitPos; // Step Over Block. if (Input.GetKeyDown(KeyCode.O)) // @TODO allow user to customize this. { Debug.Log("attempted to step over"); np_stepOverCounter++; if (np_stepOverCounter == 1 && np_hasSteppedOver == false) // Only will be executed the first time we reach 1. { // @TODO populate step over buffer } np_hasSteppedOver = true; if (np_stepOverCounter >= np_stepOverBuffer.Count) { np_stepOverCounter = 0; } np_hoveredObject = np_stepOverBuffer[np_stepOverCounter]; } // This code is used when the step over function is not active. It will choose the closest of any given object and set it as the hovered object. if (!np_hasSteppedOver) { np_stepOverBuffer.Clear(); if (output.m_netSegment != 0) { np_stepOverBuffer.Add(new InstanceID() { NetSegment = output.m_netSegment }); } if (output.m_netNode != 0) { np_stepOverBuffer.Add(new InstanceID() { NetNode = output.m_netNode }); } if (output.m_treeInstance != 0) { np_stepOverBuffer.Add(new InstanceID() { Tree = output.m_treeInstance }); } if (output.m_propInstance != 0) { np_stepOverBuffer.Add(new InstanceID() { NetNode = output.m_propInstance }); } if (output.m_building != 0) { np_stepOverBuffer.Add(new InstanceID() { Building = output.m_building }); } np_stepOverBuffer.Sort((a, b) => Vector3.Distance(a.Position(), np_mouseCurrentPosition).CompareTo(Vector3.Distance(b.Position(), np_mouseCurrentPosition))); if (np_stepOverBuffer.Count > 0) { np_hoveredObject = np_stepOverBuffer[0]; } else { np_hoveredObject = InstanceID.Empty; } } else { // This function resets the step over function. if (np_mouseCurrentPosition != np_stepOverPosition) { np_hasSteppedOver = false; } } // A prefab has been selected. Find it in the UI and enable it. if (Input.GetKeyDown(KeyCode.Return) || Input.GetMouseButtonDown(0)) { ShowInPanelResolveGrowables(Default(np_hoveredObject.Info())); } // Escape key hit = disable the tool if (Input.GetKeyDown(KeyCode.Escape)) { enabled = false; ToolsModifierControl.SetTool <DefaultTool>(); } }
protected override void Handle(ChangeNameCommand command) { IgnoreHelper.StartIgnore(); // The type where the text box is located (can be a base class of the actual panel) Type renameType = null; // List of types where the text box is potentially located (length needs to be equal to length of panelTypes). Leave empty to use renameType. Type[] renameTypes = new Type[0]; // List of panels which potentially can be open. Leave empty when equal to renameType. Type[] panelTypes = new Type[0]; // The instance type the currently opened panel needs to correspond to InstanceType instanceType = command.Type; // The instance id the currently opened panel needs to correspond to int id = command.Id; // The name of the text box field string nameFieldVar = "m_NameField"; // List of names of the text box field (length needs to be equal to length of panelTypes). Leave empty to use nameFieldVar. string[] nameFieldVarArr = new string[0]; switch (command.Type) { case InstanceType.Building: BuildingManager.instance.SetBuildingName((ushort)command.Id, command.Name).MoveNext(); renameType = typeof(BuildingWorldInfoPanel); panelTypes = new Type[] { typeof(CityServiceWorldInfoPanel), typeof(ChirpXPanel), typeof(FestivalPanel), typeof(FootballPanel), typeof(VarsitySportsArenaPanel), typeof(ShelterWorldInfoPanel), typeof(UniqueFactoryWorldInfoPanel), typeof(WarehouseWorldInfoPanel), typeof(ZonedBuildingWorldInfoPanel) }; break; case InstanceType.Citizen: case InstanceType.CitizenInstance: if (command.Type == InstanceType.Citizen) { CitizenManager.instance.SetCitizenName((uint)command.Id, command.Name).MoveNext(); } else { CitizenManager.instance.SetInstanceName((ushort)command.Id, command.Name).MoveNext(); } renameType = typeof(LivingCreatureWorldInfoPanel); panelTypes = new Type[] { typeof(AnimalWorldInfoPanel), typeof(CitizenWorldInfoPanel), typeof(TouristWorldInfoPanel), typeof(ServicePersonWorldInfoPanel) }; break; case InstanceType.Disaster: DisasterManager.instance.SetDisasterName((ushort)command.Id, command.Name).MoveNext(); if (!HandleSpecialMeteorRename((ushort)command.Id, command.Name)) { renameType = typeof(DisasterWorldInfoPanel); nameFieldVar = "m_nameField"; } break; case InstanceType.District: DistrictManager.instance.SetDistrictName(command.Id, command.Name).MoveNext(); renameType = typeof(DistrictWorldInfoPanel); nameFieldVar = "m_DistrictName"; break; case InstanceType.Park: DistrictManager.instance.SetParkName(command.Id, command.Name).MoveNext(); panelTypes = new Type[] { typeof(IndustryWorldInfoPanel), typeof(CampusWorldInfoPanel), typeof(ParkWorldInfoPanel) }; nameFieldVarArr = new string[] { "m_ParkName", "m_campusName", "m_ParkName" }; break; case InstanceType.Event: EventManager.instance.SetEventName((ushort)command.Id, command.Name).MoveNext(); renameType = typeof(ChirpXPanel); nameFieldVar = "m_rocketName"; break; case InstanceType.NetSegment: NetManager.instance.SetSegmentName((ushort)command.Id, command.Name).MoveNext(); renameType = typeof(RoadWorldInfoPanel); break; case InstanceType.TransportLine: TransportManager.instance.SetLineName((ushort)command.Id, command.Name).MoveNext(); // Works fine :) break; case InstanceType.Vehicle: case InstanceType.ParkedVehicle: if (command.Type == InstanceType.Vehicle) { VehicleManager.instance.SetVehicleName((ushort)command.Id, command.Name).MoveNext(); } else { VehicleManager.instance.SetParkedVehicleName((ushort)command.Id, command.Name).MoveNext(); } renameTypes = new Type[] { typeof(VehicleWorldInfoPanel), typeof(VehicleWorldInfoPanel), typeof(VehicleWorldInfoPanel), typeof(VehicleWorldInfoPanel), typeof(MeteorWorldInfoPanel) }; panelTypes = new Type[] { typeof(CitizenVehicleWorldInfoPanel), typeof(CityServiceWorldInfoPanel), typeof(PublicTransportVehicleWorldInfoPanel), typeof(TouristVehicleWorldInfoPanel), typeof(MeteorWorldInfoPanel) }; break; default: LogManager.GetCurrentClassLogger().Warn("Unknown instance type in ChangeNameHandler received!"); break; } if (panelTypes.Length == 0 && renameType != null) { panelTypes = new Type[] { renameType }; } int i = -1; foreach (Type panel in panelTypes) { i++; InstanceID instanceId = InfoPanelHelper.GetInstanceID(panel, out WorldInfoPanel infoPanel); if (instanceId.Type != instanceType && !(instanceId.Type == InstanceType.Building && panel == typeof(ChirpXPanel))) { continue; } bool isEqual = false; switch (instanceType) { case InstanceType.Building: isEqual = instanceId.Building == (ushort)id; break; case InstanceType.Citizen: isEqual = instanceId.Citizen == (uint)id; break; case InstanceType.CitizenInstance: isEqual = instanceId.CitizenInstance == (ushort)id; break; case InstanceType.Disaster: isEqual = instanceId.Disaster == (ushort)id; break; case InstanceType.District: isEqual = instanceId.District == (byte)id; break; case InstanceType.Park: isEqual = instanceId.Park == (byte)id; break; case InstanceType.Event: ushort curEventId = ReflectionHelper.GetAttr <ushort>(infoPanel, "m_currentEventID"); isEqual = curEventId == (ushort)id; break; case InstanceType.NetSegment: isEqual = instanceId.NetSegment == (ushort)id; break; case InstanceType.Vehicle: isEqual = instanceId.Vehicle == (ushort)id; break; case InstanceType.ParkedVehicle: isEqual = instanceId.ParkedVehicle == (ushort)id; break; } if (!isEqual) { continue; } Type renameVarType = panel; if (renameTypes.Length > i) { renameVarType = renameTypes[i]; } else if (renameType != null) { renameVarType = renameType; } string varName = nameFieldVar; if (nameFieldVarArr.Length > i) { varName = nameFieldVarArr[i]; } SetNameField(renameVarType, infoPanel, varName, command.Name); break; } IgnoreHelper.EndIgnore(); }
private void Awake() { TLMUtils.clearAllVisibilityEvents(this.GetComponent <UIPanel>()); base.component.eventZOrderChanged += delegate(UIComponent c, int r) { this.SetBackgroundColor(); }; GameObject.Destroy(base.Find <UICheckBox>("LineVisible").gameObject); GameObject.Destroy(base.Find <UIColorField>("LineColor").gameObject); GameObject.Destroy(base.Find <UIPanel>("WarningIncomplete")); this.m_depotName = base.Find <UILabel>("LineName"); this.m_depotNameField = this.m_depotName.Find <UITextField>("LineNameField"); this.m_depotNameField.maxLength = 256; this.m_depotNameField.eventTextChanged += new PropertyChangedEventHandler <string>(this.OnRename); this.m_depotName.eventMouseEnter += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotName.backgroundSprite = "TextFieldPanelHovered"; }; this.m_depotName.eventMouseLeave += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotName.backgroundSprite = string.Empty; }; this.m_depotName.eventClick += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotNameField.Show(); this.m_depotNameField.text = this.m_depotName.text; this.m_depotNameField.Focus(); }; this.m_depotNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r) { this.m_depotNameField.Hide(); Singleton <BuildingManager> .instance.StartCoroutine(TLMUtils.setBuildingName(this.m_buildingID, this.m_depotNameField.text, () => { this.m_depotName.text = this.m_depotNameField.text; Invalidate(); })); }; GameObject.Destroy(base.Find <UICheckBox>("DayLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("NightLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("DayNightLine").gameObject); GameObject.Destroy(base.Find <UILabel>("LinePassengers").gameObject); m_districtName = base.Find <UILabel>("LineStops"); m_districtName.minimumSize = new Vector2(140, 18); m_districtName.relativePosition = new Vector3(0, 10); m_districtName.pivot = UIPivotPoint.TopLeft; m_districtName.wordWrap = false; m_districtName.autoSize = true; TLMUtils.LimitWidth(m_districtName, (uint)m_districtName.minimumSize.x); if (Singleton <T> .instance.GetTSD().isShelterAiDepot()) { GameObject.Destroy(base.Find <UILabel>("LineVehicles").gameObject); } else { CreatePrefixSelectorUI(); } this.m_Background = base.Find("Background"); this.m_BackgroundColor = this.m_Background.color; this.m_mouseIsOver = false; base.component.eventMouseEnter += new MouseEventHandler(this.OnMouseEnter); base.component.eventMouseLeave += new MouseEventHandler(this.OnMouseLeave); GameObject.Destroy(base.Find <UIButton>("DeleteLine").gameObject); base.Find <UIButton>("ViewLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r) { if (this.m_buildingID != 0) { Vector3 position = Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)this.m_buildingID].m_position; InstanceID instanceID = default(InstanceID); instanceID.Building = this.m_buildingID; ToolsModifierControl.cameraController.SetTarget(instanceID, position, true); if (!Singleton <T> .instance.GetTSD().isShelterAiDepot()) { TLMController.instance.depotInfoPanel.openDepotInfo(m_buildingID, secondary); TLMController.instance.CloseTLMPanel(); } } }; base.component.eventVisibilityChanged += delegate(UIComponent c, bool v) { if (v) { if (m_prefixOptions != null) { m_prefixOptions.items = new string[] { } } ; RefreshData(); } }; }
public override void Do() { float angleDelta; float heightDelta; float distance; Matrix4x4 matrix = default; if (mode == Modes.Quick) { if (selection.Count != 1) { return; } Instance instance = selection.First(); if (!instance.isValid || !(instance is MoveableNode nodeInstance)) { return; } NetNode node = nodeBuffer[nodeInstance.id.NetNode]; int c = 0; for (int i = 0; i < 8; i++) { ushort segId; if ((segId = node.GetSegment(i)) > 0) { if (c > 1) { return; // More than 2 segments found } NetSegment segment = segmentBuffer[segId]; InstanceID instanceID = default; if (segment.m_startNode == nodeInstance.id.NetNode) { instanceID.NetNode = segment.m_endNode; } else { instanceID.NetNode = segment.m_startNode; } keyInstance[c] = new MoveableNode(instanceID); c++; } } } else if (mode == Modes.Auto) { if (selection.Count < 2) { return; } GetExtremeObjects(out keyInstance[0], out keyInstance[1]); } angleDelta = 0 - (float)Math.Atan2(PointB.position.z - PointA.position.z, PointB.position.x - PointA.position.x); heightDelta = PointB.position.y - PointA.position.y; distance = (float)Math.Sqrt(Math.Pow(PointB.position.z - PointA.position.z, 2) + Math.Pow(PointB.position.x - PointA.position.x, 2)); foreach (InstanceState state in m_states) { float distanceOffset, heightOffset; matrix.SetTRS(PointA.position, Quaternion.AngleAxis(angleDelta * Mathf.Rad2Deg, Vector3.down), Vector3.one); distanceOffset = (matrix.MultiplyPoint(state.position - PointA.position) - PointA.position).x; heightOffset = distanceOffset / distance * heightDelta; state.instance.SetHeight(Mathf.Clamp(PointA.position.y + heightOffset, 0f, 1000f)); } }
public override void PlayEffect(InstanceID id, EffectInfo.SpawnArea area, Vector3 velocity, float acceleration, float magnitude, AudioManager.ListenerInfo listenerInfo, AudioGroup audioGroup) { }
public static Triple GetInstance(InstanceID id) { return instances[(int)id]; }
public static bool RowsAlreadyExist(InstanceID instanceID) { CitizenRow[] CitizenRows = FavCimsCitizenRowsPanel.GetComponentsInChildren<CitizenRow> (); foreach (CitizenRow Rows in CitizenRows) { if(Rows.MyInstanceID == instanceID) return true; } return false; }
public void GoToCitizen(InstanceID Target) { if (Target.IsEmpty) return; try { if (MyInstance.SelectInstance (Target)) { if (Input.GetMouseButton (2)) { //DefaultTool.OpenWorldInfoPanel(Target, ToolsModifierControl.cameraController.transform.position); WorldInfoPanel.Show<CitizenWorldInfoPanel> (this.position, Target); } else if (Input.GetMouseButton (1)) { FavCimsMainClass.FavCimsPanel.Hide (); ToolsModifierControl.cameraController.SetTarget (Target, ToolsModifierControl.cameraController.transform.position, true); //DefaultTool.OpenWorldInfoPanel(Target, ToolsModifierControl.cameraController.transform.position); WorldInfoPanel.Show<CitizenWorldInfoPanel> (this.position, Target); } else { ToolsModifierControl.cameraController.SetTarget (Target, ToolsModifierControl.cameraController.transform.position, true); //DefaultTool.OpenWorldInfoPanel(Target, ToolsModifierControl.cameraController.transform.position); WorldInfoPanel.Show<CitizenWorldInfoPanel> (this.position, Target); } } } catch(Exception e) { Debug.Error("Can't find the Citizen " + e.ToString()); } }
internal void FamilyPet(uint m_citizen) { if (m_citizen == 0) return; try { //Family Pets this.CitizenInstance = this.MyCitizen.m_citizens.m_buffer[m_citizen].m_instance; //if (this.CitizenInstance != 0) { this.Pet = (ushort)Array.FindIndex (MyCitizen.m_instances.m_buffer, element => element.m_targetBuilding == this.CitizenInstance); this.PetInstance = this.MyCitizen.m_instances.m_buffer [this.Pet]; //if (this.PetInstance.Info.m_citizenAI.m_info.GetService() == h //Citizen.Flags.DummyTraffic //Vehicle.Flags.WaitingTarget if (this.PetInstance.Info.m_citizenAI.IsAnimal ()) { this.DogOwner = m_citizen; this.MyPetID.CitizenInstance = this.Pet; if (!this.MyPetID.IsEmpty) { InstanceID MyPetTargetID; string petname = MyCitizen.GetInstanceName (Pet); CitizenInfo petinfo = PetInstance.Info; string petstatus = petinfo.m_citizenAI.GetLocalizedStatus (Pet, ref PetInstance, out MyPetTargetID); this.BubbleFamilyBarDogButton.texture = TextureDB.BubbleDog; this.BubbleFamilyBarDogButton.tooltip = petname + " - " + petstatus + " " + this.MyCitizen.GetCitizenName (m_citizen); this.BubbleFamilyBarDogButton.playAudioEvents = true; } } else { this.DogOwner = 0; this.BubbleFamilyBarDogButton.texture = TextureDB.BubbleDogDisabled; this.BubbleFamilyBarDogButton.tooltip = null; this.BubbleFamilyBarDogButton.playAudioEvents = false; this.MyPetID = InstanceID.Empty; } //} else { //return; //} } catch /*(Exception e)*/ { //Debug.Log("Family Dog Error - " + e.ToString()); } }
public override void OnUpdate(float realTimeDelta, float simulationTimeDelta) { //Digest changes if (_config.UndigestedChanges == true) { logger.Message("Applying undigested changes"); _colorStrategy = SetColorStrategy(_config.ColorStrategy); _namingStrategy = SetNamingStrategy(_config.NamingStrategy); _config.UndigestedChanges = false; } if (_initialized == false) return; // try and limit how often we are scanning for lines. this ain't that important if (_nextUpdateTime >= DateTimeOffset.Now) return; var theTransportManager = Singleton<TransportManager>.instance; var lines = theTransportManager.m_lines.m_buffer; try { _nextUpdateTime = DateTimeOffset.Now.AddSeconds(10); _usedColors = lines.Where(l => l.IsActive()).Select(l => l.m_color).ToList(); for (ushort i = 0; i < theTransportManager.m_lines.m_buffer.Length - 1; i++) { var transportLine = lines[i]; //logger.Message(string.Format("Starting on line {0}", i)); if (transportLine.m_flags == TransportLine.Flags.None) continue; if (!transportLine.Complete) continue; // only worry about fully created lines if (!transportLine.IsActive() || transportLine.HasCustomName() || !transportLine.m_color.IsDefaultColor()) continue; logger.Message(string.Format("Working on line {0}", i)); var instanceID = new InstanceID(); var lineName = theTransportManager.GetLineName(i); var newName = _namingStrategy.GetName(transportLine); if (!transportLine.HasCustomColor() || transportLine.m_color.IsDefaultColor()) { var color = _colorStrategy.GetColor(transportLine, _usedColors); logger.Message(string.Format("About to change line color to {0}", color)); transportLine.m_color = color; transportLine.m_flags |= TransportLine.Flags.CustomColor; theTransportManager.SetLineColor(i, color); logger.Message(string.Format("Changed line color. '{0}' {1} -> {2}", lineName, theTransportManager.GetLineColor(i), color)); } if (string.IsNullOrEmpty(newName) == false && transportLine.HasCustomName() == false) { logger.Message(string.Format("About to rename line to {0}", newName)); transportLine.m_flags |= TransportLine.Flags.CustomName; theTransportManager.SetLineName(i, newName); logger.Message(string.Format("Renamed Line '{0}' -> '{1}'", lineName, newName)); } logger.Message(string.Format("Line is now {0} and {1}", theTransportManager.GetLineName(i), theTransportManager.GetLineColor(i))); lines[i] = transportLine; } } catch (Exception ex) { logger.Error(ex.ToString()); } finally { Monitor.Exit(Monitor.TryEnter(lines)); } }
public override void LateUpdate() { if (FavCimsMainClass.UnLoading) { return; } if (this.execute || this.FirstRun) { if(this.isVisible) { try { citizen = MyInstanceID.Citizen; this.CitizenData = this.MyCitizen.m_citizens.m_buffer [citizen]; //Little Screen Labels this.BubbleCitizenAge.text = FavCimsLang.text ("FavCimsAgeColText_text"); this.BubbleCitizenAgePhase.text = FavCimsLang.text ("FavCimsAgePhaseColText_text"); this.BubbleCitizenEducation.text = FavCimsLang.text ("FavCimsEduColText_text"); this.BubbleWealthSprite.tooltip = FavCimsLang.text("Wealth_Label"); this.FavCimsDistrictLabel.text = FavCimsLang.text("District_Label"); //Family Label this.BubbleFamilyBarLabel.text = FavCimsLang.text ("Citizen_Family_unit"); this.NoChildsFButton.text = FavCimsLang.text ("Citizen_Details_No_Childs"); this.NoPartnerFButton.text = FavCimsLang.text ("Citizen_Details_No_Partner"); ///Citizen Family this.MyCitizenUnit = this.CitizenData.GetContainingUnit (citizen, MyBuilding.m_buildings.m_buffer [CitizenData.m_homeBuilding].m_citizenUnits, CitizenUnit.Flags.Home); if (this.MyCitizenUnit != 0) { this.Family = this.MyCitizen.m_units.m_buffer [this.MyCitizenUnit]; //Selected Citizen Data //Citizen Name this.BubbleHeaderCitizenName.text = this.MyCitizen.GetCitizenName (citizen); //Citizen Genre if (Citizen.GetGender (citizen) == Citizen.Gender.Female) { this.BubbleHeaderIconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureFemale; this.BubbleHeaderCitizenName.textColor = new Color32 (255, 102, 204, 213); //r,g,b,a this.BubbleHeaderCitizenName.hoveredTextColor = new Color32 (255, 102, 204, 213); //r,g,b,a this.BubbleHeaderCitizenName.pressedTextColor = new Color32 (255, 102, 204, 213); //r,g,b,a this.BubbleHeaderCitizenName.focusedTextColor = new Color32 (255, 102, 204, 213); //r,g,b,a }else{ this.BubbleHeaderIconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureMale; 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 } //Citizen Health int tmp_health = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_health; string healthIcon = GetHealthString(Citizen.GetHealthLevel (tmp_health)); this.BubbleHealthSprite.normalBgSprite = healthIcon; this.BubbleHealthSprite.tooltip = Locale.Get("INFO_HEALTH_TITLE"); this.BubbleHealthValue.text = FavCimsLang.text("Health_Level_" + sHealthLevels[(int) Citizen.GetHealthLevel (tmp_health)] + "_" + Citizen.GetGender (citizen)); switch (Citizen.GetHealthLevel (tmp_health)) { case Citizen.Health.ExcellentHealth: BubbleHealthValue.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a break; case Citizen.Health.VeryHealthy: BubbleHealthValue.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a break; case Citizen.Health.Healthy: BubbleHealthValue.textColor = new Color32 (102, 204, 0, 60); //r,g,b,a break; case Citizen.Health.PoorHealth: BubbleHealthValue.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a break; case Citizen.Health.Sick: BubbleHealthValue.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a break; case Citizen.Health.VerySick: BubbleHealthValue.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a break; } //Citizen Education var tmp_education = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].EducationLevel; string education = tmp_education.ToString (); this.BubbleRow1EducationTooltipArea.tooltip = FavCimsLang.text ("Education_" + education + "_" + Citizen.GetGender (citizen)); if (education == "ThreeSchools") { this.BubbleEduLevel3.isEnabled = true; this.BubbleEduLevel2.isEnabled = true; this.BubbleEduLevel1.isEnabled = true; } else if (education == "TwoSchools") { this.BubbleEduLevel3.isEnabled = false; this.BubbleEduLevel2.isEnabled = true; this.BubbleEduLevel1.isEnabled = true; } else if (education == "OneSchool") { this.BubbleEduLevel3.isEnabled = false; this.BubbleEduLevel2.isEnabled = false; this.BubbleEduLevel1.isEnabled = true; } else { this.BubbleEduLevel3.isEnabled = false; this.BubbleEduLevel2.isEnabled = false; this.BubbleEduLevel1.isEnabled = false; } //Citizen Wellbeing int tmp_wellbeing = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_wellbeing; //string wellbeing = Citizen.GetWellbeingLevel (tmp_education, tmp_wellbeing).ToString (); string wellbeingIcon = GetHappinessString(Citizen.GetHappinessLevel (tmp_wellbeing)); this.BubbleRow2WellbeingIcon.normalBgSprite = wellbeingIcon; this.BubbleRow2WellbeingIcon.tooltip = FavCimsLang.text("WellBeingLabel") + FavCimsLang.text (wellbeingIcon); //Citizen Wealth var tmp_wealth = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].WealthLevel; this.BubbleRow2WealthValueVal.tooltip = FavCimsLang.text("Wealth_Label"); if(tmp_wealth == Citizen.Wealth.Low) { this.BubbleRow2WealthValueVal.text = FavCimsLang.text("Low_Wealth_" + Citizen.GetGender (citizen)); this.BubbleRow2WealthValueVal.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a }else if (tmp_wealth == Citizen.Wealth.Medium) { this.BubbleRow2WealthValueVal.text = FavCimsLang.text("Mid_Wealth_" + Citizen.GetGender (citizen)); this.BubbleRow2WealthValueVal.textColor = new Color32 (255, 204, 0, 32); }else { this.BubbleRow2WealthValueVal.text = FavCimsLang.text("High_Wealth_" + Citizen.GetGender (citizen)); this.BubbleRow2WealthValueVal.textColor = new Color32 (102, 204, 0, 60); //r,g,b,a } //Citizen Happiness int tmp_happiness = Citizen.GetHappiness (tmp_health, tmp_wellbeing); //string Happiness = Citizen.GetHappinessLevel (tmp_happiness).ToString (); //Bad, Poor, Good, Excellent, Suberb string HappinessIcon = GetHappinessString (Citizen.GetHappinessLevel (tmp_happiness)); this.BubbleRow1HappyIcon.normalBgSprite = HappinessIcon; this.BubbleRow1HappyIcon.tooltip = FavCimsLang.text("HappinessLabel") + FavCimsLang.text (HappinessIcon); //Age Group (Age Phase) int tmp_age = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_age; string agegroup = Citizen.GetAgeGroup (tmp_age).ToString (); this.BubbleCitizenAgePhaseVal.text = FavCimsLang.text ("AgePhase_" + agegroup + "_" + Citizen.GetGender (citizen)); //Real Age this.RealAge = FavCimsCore.CalculateCitizenAge (tmp_age); if (this.RealAge <= 12) { //CHILD this.BubbleCitizenAgeVal.text = this.RealAge.ToString (); this.BubbleCitizenAgeVal.textColor = new Color32 (83, 166, 0, 60); //r,g,b,a this.BubbleCitizenAgePhaseVal.textColor = new Color32 (83, 166, 0, 60); //r,g,b,a } else if (this.RealAge <= 19) { //TEEN this.BubbleCitizenAgeVal.text = this.RealAge.ToString (); this.BubbleCitizenAgeVal.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a this.BubbleCitizenAgePhaseVal.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a } else if (this.RealAge <= 25) { //YOUNG this.BubbleCitizenAgeVal.text = this.RealAge.ToString (); this.BubbleCitizenAgeVal.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.BubbleCitizenAgePhaseVal.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a } else if (this.RealAge <= 65) { //ADULT this.BubbleCitizenAgeVal.text = this.RealAge.ToString (); this.BubbleCitizenAgeVal.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a this.BubbleCitizenAgePhaseVal.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a } else if (this.RealAge <= 90) { //SENIOR this.BubbleCitizenAgeVal.text = this.RealAge.ToString (); this.BubbleCitizenAgeVal.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a this.BubbleCitizenAgePhaseVal.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a } else { //FINAL this.BubbleCitizenAgeVal.text = this.RealAge.ToString (); this.BubbleCitizenAgeVal.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a this.BubbleCitizenAgePhaseVal.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a } //Working Place this.WorkPlace = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_workBuilding; if (this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].GetCurrentSchoolLevel (citizen) != ItemClass.Level.None) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsWorkingPlaceTextureStudent; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; //this.CitizenRowData ["workplace"] = "Student"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("CITIZEN_SCHOOL_LEVEL", this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].GetCurrentSchoolLevel (citizen).ToString ()); } else if (this.WorkPlace == 0) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; if (tmp_age >= 180) { //In Pensione this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsWorkingPlaceTextureRetired; //this.CitizenRowData ["workplace"] = "Retired"; this.FavCimsWorkingPlace.text = FavCimsLang.text ("Citizen_Retired"); this.FavCimsWorkingPlace.isEnabled = false; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Citizen_Retired_tooltip"); this.FavCimsWorkingPlaceSprite.tooltip = null; this.FavCimsWorkingPlaceButtonGamDefImg.tooltip = null; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; } else { this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsWorkingPlaceTexture; //unemployed //this.CitizenRowData ["workplace"] = "Unemployed"; this.FavCimsWorkingPlace.text = Locale.Get ("CITIZEN_OCCUPATION_UNEMPLOYED"); this.FavCimsWorkingPlace.isEnabled = false; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Unemployed_tooltip"); this.FavCimsWorkingPlaceSprite.tooltip = null; this.FavCimsWorkingPlaceButtonGamDefImg.tooltip = null; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; } } //Perchè l'edificio è presente sia che lavori sia che vada a scuola, se lo metto nell'else qui sopra se va a scuola non comparirebbe nulla o dovrei scriverlo 2 volte. if (this.WorkPlace != 0) { this.WorkPlaceID.Building = this.WorkPlace; //this.CitizenRowData ["workplace"] = this.MyBuilding.GetBuildingName (this.WorkPlace, this.MyInstanceID); this.FavCimsWorkingPlace.text = this.MyBuilding.GetBuildingName (this.WorkPlace, this.MyInstanceID); this.FavCimsWorkingPlace.isEnabled = true; this.WorkInfo = this.MyBuilding.m_buildings.m_buffer [WorkPlaceID.Index].Info; if (this.WorkInfo.m_class.m_service == ItemClass.Service.Commercial) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; if (this.WorkInfo.m_class.m_subService == ItemClass.SubService.CommercialHigh) { this.FavCimsWorkingPlace.textColor = new Color32 (0, 51, 153, 147); //r,g,b,a this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenCommercialHighTexture; this.FavCimsWorkingPlace.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", ItemClass.SubService.CommercialHigh.ToString ()); } else { this.FavCimsWorkingPlace.textColor = new Color32 (0, 153, 204, 130); //r,g,b,a this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenCommercialLowTexture; this.FavCimsWorkingPlace.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", ItemClass.SubService.CommercialLow.ToString ()); } switch (this.WorkInfo.m_class.m_level) { case ItemClass.Level.Level3: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [3]; break; case ItemClass.Level.Level2: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [2]; break; default: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [1]; break; } } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Industrial) { this.FavCimsWorkingPlace.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsWorkingPlace.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", "Industrial"); switch (this.WorkInfo.m_class.m_subService) { case ItemClass.SubService.IndustrialFarming: this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyFarming"; break; case ItemClass.SubService.IndustrialForestry: this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ResourceForestry"; break; case ItemClass.SubService.IndustrialOil: this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyOil"; break; case ItemClass.SubService.IndustrialOre: this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyOre"; break; default: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenIndustrialGenericTexture; break; } switch (this.WorkInfo.m_class.m_level) { case ItemClass.Level.Level3: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [3]; break; case ItemClass.Level.Level2: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [2]; break; default: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [1]; break; } } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Office) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; this.FavCimsWorkingPlace.textColor = new Color32 (0, 204, 255, 128); //r,g,b,a this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenOfficeTexture; this.FavCimsWorkingPlace.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", "Office"); switch (this.WorkInfo.m_class.m_level) { case ItemClass.Level.Level3: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [3]; break; case ItemClass.Level.Level2: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [2]; break; default: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [1]; break; } } else { this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlace.textColor = new Color32 (153, 102, 51, 20); //r,g,b,a switch (this.WorkInfo.m_class.m_service) { case ItemClass.Service.FireDepartment: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "InfoIconFireSafety"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "FireDepartment"); break; case ItemClass.Service.HealthCare: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconHealthcareFocused"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Healthcare"); break; case ItemClass.Service.PoliceDepartment: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconPolice"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Police"); break; case ItemClass.Service.Garbage: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyRecycling"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Garbage"); break; case ItemClass.Service.Electricity: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyPowerSaving"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Electricity_job"); break; case ItemClass.Service.Education: this.FavCimsWorkingPlace.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "InfoIconEducationPressed"; break; case ItemClass.Service.Beautification: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "SubBarBeautificationParksnPlazas"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Beautification"); break; case ItemClass.Service.Government: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconGovernment"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Government_job"); break; case ItemClass.Service.Water: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyWaterSaving"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Water_job"); break; case ItemClass.Service.PublicTransport: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyFreePublicTransport"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "PublicTransport"); break; case ItemClass.Service.Monument: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "FeatureMonumentLevel6"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Monuments"); break; default: this.FavCimsWorkingPlace.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyNone"; this.FavCimsWorkingPlace.tooltip = null; break; } } //District this.WorkDistrict = (int)MyDistrict.GetDistrict (this.MyBuilding.m_buildings.m_buffer [WorkPlaceID.Index].m_position); if (this.WorkDistrict == 0) { this.FavCimsWorkingPlaceSprite.tooltip = FavCimsLang.text ("DistrictLabel") + FavCimsLang.text ("DistrictNameNoDistrict"); } else { this.FavCimsWorkingPlaceSprite.tooltip = FavCimsLang.text ("DistrictLabel") + MyDistrict.GetDistrictName (this.WorkDistrict); } }else{ this.FavCimsWorkingPlace.isEnabled = false; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.tooltip = null; this.FavCimsWorkingPlaceSprite.tooltip = null; } //Family House this.CitizenHome = this.MyCitizen.m_citizens.m_buffer [this.MyInstanceID.Index].m_homeBuilding; if (this.CitizenHome != 0) { this.CitizenHomeID.Building = this.CitizenHome; this.BubbleHomeName.text = this.MyBuilding.GetBuildingName (this.CitizenHome, this.MyInstanceID); this.BubbleHomeName.isEnabled = true; this.BubbleHomeIcon.texture = TextureDB.FavCimsCitizenHomeTexture; this.HomeInfo = this.MyBuilding.m_buildings.m_buffer [CitizenHomeID.Index].Info; if (this.HomeInfo.m_class.m_service == ItemClass.Service.Residential) { this.BubbleHomeName.tooltip = null; if (this.HomeInfo.m_class.m_subService == ItemClass.SubService.ResidentialHigh) { this.BubbleHomeName.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a this.BubbleHomeIcon.texture = TextureDB.FavCimsCitizenHomeTextureHigh; this.BubbleHomeName.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", ItemClass.SubService.ResidentialHigh.ToString ()); } else if (this.HomeInfo.m_class.m_subService == ItemClass.SubService.ResidentialLow) { this.BubbleHomeName.textColor = new Color32 (0, 153, 0, 80); //r,g,b,a this.BubbleHomeIcon.texture = TextureDB.FavCimsCitizenHomeTexture; this.BubbleHomeName.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", ItemClass.SubService.ResidentialLow.ToString ()); } switch (this.HomeInfo.m_class.m_level) { case ItemClass.Level.Level5: this.BubbleHomeLevel.texture = TextureDB.FavCimsResidentialLevel [5]; break; case ItemClass.Level.Level4: this.BubbleHomeLevel.texture = TextureDB.FavCimsResidentialLevel [4]; break; case ItemClass.Level.Level3: this.BubbleHomeLevel.texture = TextureDB.FavCimsResidentialLevel [3]; break; case ItemClass.Level.Level2: this.BubbleHomeLevel.texture = TextureDB.FavCimsResidentialLevel [2]; break; default: this.BubbleHomeLevel.texture = TextureDB.FavCimsResidentialLevel [1]; break; } //District this.HomeDistrict = (int)MyDistrict.GetDistrict (this.MyBuilding.m_buildings.m_buffer [this.CitizenHomeID.Index].m_position); if (this.HomeDistrict == 0) { this.BubbleHomeIcon.tooltip = FavCimsLang.text ("DistrictLabel") + FavCimsLang.text ("DistrictNameNoDistrict"); } else { this.BubbleHomeIcon.tooltip = FavCimsLang.text ("DistrictLabel") + MyDistrict.GetDistrictName (this.HomeDistrict); } //Home Status Problems Notification.Problem HomeProblems = MyBuilding.m_buildings.m_buffer[this.CitizenHome].m_problems; if(HomeProblems != Notification.Problem.None) { this.BubbleDetailsBgSprite.texture = TextureDB.BubbleDetailsBgSpriteProblems; }else{ this.BubbleDetailsBgSprite.texture = TextureDB.BubbleDetailsBgSprite; } if(HomeProblems.ToString().Contains(Notification.Problem.Electricity.ToString())) { this.BubbleDetailsElettricity.normalFgSprite = "TutorialGlow"; this.BubbleDetailsElettricity.tooltip = Locale.Get("NOTIFICATION_TITLE","Electricity"); }else{ this.BubbleDetailsElettricity.normalFgSprite = null; this.BubbleDetailsElettricity.tooltip = Locale.Get("NOTIFICATION_NONE"); } if(HomeProblems.ToString().Contains(Notification.Problem.Sewage.ToString())) { this.BubbleDetailsWater.normalFgSprite = "TutorialGlow"; this.BubbleDetailsWater.tooltip = Locale.Get("NOTIFICATION_TITLE","Sewage"); } else if(HomeProblems.ToString().Contains(Notification.Problem.DirtyWater.ToString())) { this.BubbleDetailsWater.normalFgSprite = "TutorialGlow"; this.BubbleDetailsWater.tooltip = Locale.Get("NOTIFICATION_NORMAL","DirtyWater"); } else if(HomeProblems.ToString().Contains(Notification.Problem.Water.ToString())) { this.BubbleDetailsWater.normalFgSprite = "TutorialGlow"; this.BubbleDetailsWater.tooltip = Locale.Get("NOTIFICATION_TITLE","Water"); }else if(HomeProblems.ToString().Contains(Notification.Problem.Flood.ToString())) { this.BubbleDetailsWater.normalFgSprite = "TutorialGlow"; this.BubbleDetailsWater.tooltip = Locale.Get("NOTIFICATION_TITLE","Flood"); }else{ this.BubbleDetailsWater.normalFgSprite = null; this.BubbleDetailsWater.tooltip = Locale.Get("NOTIFICATION_NONE"); } if(HomeProblems.ToString().Contains(Notification.Problem.Death.ToString())) { this.BubbleDetailsDeath.normalFgSprite = "TutorialGlow"; this.BubbleDetailsDeath.tooltip = Locale.Get("NOTIFICATION_TITLE","Death"); }else{ this.BubbleDetailsDeath.normalFgSprite = null; this.BubbleDetailsDeath.tooltip = Locale.Get("NOTIFICATION_NONE"); } if(HomeProblems.ToString().Contains(Notification.Problem.Fire.ToString())) { this.BubbleDetailsFire.normalFgSprite = "TutorialGlow"; this.BubbleDetailsFire.tooltip = Locale.Get("NOTIFICATION_TITLE","Fire"); }else{ this.BubbleDetailsFire.normalFgSprite = null; this.BubbleDetailsFire.tooltip = Locale.Get("NOTIFICATION_NONE"); } if(HomeProblems.ToString().Contains(Notification.Problem.Garbage.ToString())) { this.BubbleDetailsGarbage.normalFgSprite = "TutorialGlow"; this.BubbleDetailsGarbage.tooltip = Locale.Get("NOTIFICATION_TITLE","Garbage"); }else{ this.BubbleDetailsGarbage.normalFgSprite = null; this.BubbleDetailsGarbage.tooltip = Locale.Get("NOTIFICATION_NONE"); } if(HomeProblems.ToString().Contains(Notification.Problem.LandValueLow.ToString())) { this.BubbleDetailsLandValue.normalFgSprite = "TutorialGlow"; this.BubbleDetailsLandValue.tooltip = Locale.Get("NOTIFICATION_TITLE","LandValueLow"); }else if(HomeProblems.ToString().Contains(Notification.Problem.TooFewServices.ToString())) { this.BubbleDetailsLandValue.normalFgSprite = "TutorialGlow"; this.BubbleDetailsLandValue.tooltip = Locale.Get("NOTIFICATION_TITLE","ToofewServices"); }else if(HomeProblems.ToString().Contains(Notification.Problem.TaxesTooHigh.ToString())) { this.BubbleDetailsLandValue.normalFgSprite = "TutorialGlow"; this.BubbleDetailsLandValue.tooltip = Locale.Get("NOTIFICATION_TITLE","TaxesTooHigh"); }else{ this.BubbleDetailsLandValue.normalFgSprite = null; this.BubbleDetailsLandValue.tooltip = Locale.Get("NOTIFICATION_NONE"); } if(HomeProblems.ToString().Contains(Notification.Problem.Noise.ToString())) { this.BubbleDetailsNoise.normalFgSprite = "TutorialGlow"; this.BubbleDetailsNoise.tooltip = Locale.Get("NOTIFICATION_NORMAL","Noise"); }else{ this.BubbleDetailsNoise.normalFgSprite = null; this.BubbleDetailsNoise.tooltip = Locale.Get("NOTIFICATION_NONE"); } if(HomeProblems.ToString().Contains(Notification.Problem.Pollution.ToString())) { this.BubbleDetailsPollution.normalFgSprite = "TutorialGlow"; this.BubbleDetailsPollution.tooltip = Locale.Get("NOTIFICATION_NORMAL","Pollution"); }else{ this.BubbleDetailsPollution.normalFgSprite = null; this.BubbleDetailsPollution.tooltip = Locale.Get("NOTIFICATION_NONE"); } if(HomeProblems.ToString().Contains(Notification.Problem.Crime.ToString())) { this.BubbleDetailsCrime.normalFgSprite = "TutorialGlow"; this.BubbleDetailsCrime.tooltip = Locale.Get("NOTIFICATION_TITLE","Crime"); }else{ this.BubbleDetailsCrime.normalFgSprite = null; this.BubbleDetailsCrime.tooltip = Locale.Get("NOTIFICATION_NONE"); } } } else { this.BubbleHomeName.text = FavCimsLang.text ("Citizen_HomeLess"); this.BubbleHomeName.isEnabled = false; this.BubbleHomeIcon.texture = TextureDB.FavCimsCitizenHomeTextureHomeless; this.BubbleHomeIcon.tooltip = FavCimsLang.text ("DistrictNameNoDistrict"); this.BubbleHomeName.tooltip = FavCimsLang.text ("Citizen_HomeLess_tooltip"); } //Activity Activity(citizen, this.FavCimsLastActivityVehicleButton, this.FavCimsLastActivity, out this.MyVehicleID, out this.MyTargetID); //Now in this District this.MainCitizenInstance = MyCitizen.m_citizens.m_buffer[citizen].m_instance; this.CitizenDistrict = (int)MyDistrict.GetDistrict(MyCitizen.m_instances.m_buffer[this.MainCitizenInstance].GetSmoothPosition(this.MainCitizenInstance)); if (this.CitizenDistrict == 0) { this.FavCimsDistrictValue.tooltip = FavCimsLang.text("District_Label_tooltip"); this.FavCimsDistrictValue.text = FavCimsLang.text ("DistrictNameNoDistrict"); } else { this.FavCimsDistrictValue.tooltip = FavCimsLang.text("District_Label_tooltip"); this.FavCimsDistrictValue.text = MyDistrict.GetDistrictName (this.CitizenDistrict); } //Citizen Have a Car? FamilyVehicle(citizen, BubblePersonalCarButton, out this.PersonalVehicleID); //Family Have a Car? FamilyVehicle(this.Family.m_citizen0, BubbleFamilyBarCarButton, out this.FamilyVehicleID); bool isSon = false; int Sons = 0; //Partner if (this.Family.m_citizen0 != 0 && citizen == this.Family.m_citizen1) { //&& this.Family.m_citizen0 != citizen this.CitizenPartner = this.Family.m_citizen0; this.BubblePartnerLove.normalBgSprite = "InfoIconHealth"; //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.Family.m_citizen1); } } else { if (this.Family.m_citizen1 != 0 && citizen == this.Family.m_citizen0) { this.CitizenPartner = this.Family.m_citizen1; this.BubblePartnerLove.normalBgSprite = "InfoIconHealth"; //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.Family.m_citizen0); } }else if (citizen == this.Family.m_citizen0) { //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(citizen); } this.CitizenPartner = 0; } else { this.BubblePartnerLove.normalBgSprite = "InfoIconAge"; this.CitizenPartner = this.Family.m_citizen0; isSon = true; } } if (this.CitizenPartner != 0) { this.PartnerID.Citizen = CitizenPartner; int CitizenPartnerINT = (int)((UIntPtr)this.CitizenPartner); this.BubblePartnerName.text = this.MyCitizen.GetCitizenName (CitizenPartner); if (Citizen.GetGender (CitizenPartner) == Citizen.Gender.Female) { this.BubblePartnerName.textColor = new Color32 (255, 102, 204, 213); //r,g,b,a } else { this.BubblePartnerName.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a } if (this.PartnerID.IsEmpty) { this.BubblePartnerName.tooltip = null; this.BubblePartnerName.isEnabled = false; } else { this.BubblePartnerName.tooltip = FavCimsLang.text("Right_click_to_swith_tooltip"); this.BubblePartnerName.isEnabled = true; } if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.CitizenPartner); } Activity(this.CitizenPartner, this.BubblePartnerVehicleButton, this.BubblePartnerDestination, out this.PartnerVehID, out this.PartnerTarget); //Real Age this.RealAge = FavCimsCore.CalculateCitizenAge (this.MyCitizen.m_citizens.m_buffer [CitizenPartner].m_age); if (this.RealAge <= 12) { //CHILD this.BubbleParnerAgeButton.text = this.RealAge.ToString (); this.BubbleParnerAgeButton.textColor = new Color32 (83, 166, 0, 60); //r,g,b,a } else if (this.RealAge <= 19) { //TEEN this.BubbleParnerAgeButton.text = this.RealAge.ToString (); this.BubbleParnerAgeButton.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a } else if (this.RealAge <= 25) { //YOUNG this.BubbleParnerAgeButton.text = this.RealAge.ToString (); this.BubbleParnerAgeButton.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a } else if (this.RealAge <= 65) { //ADULT this.BubbleParnerAgeButton.text = this.RealAge.ToString (); this.BubbleParnerAgeButton.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a } else if (this.RealAge <= 90) { //SENIOR this.BubbleParnerAgeButton.text = this.RealAge.ToString (); this.BubbleParnerAgeButton.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a } else { //FINAL this.BubbleParnerAgeButton.text = this.RealAge.ToString (); this.BubbleParnerAgeButton.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a } //Partner is in favorites? if (FavCimsCore.RowID.ContainsKey (CitizenPartnerINT)) { //Yes //this.BubblePartnerFollowToggler.texture = TextureDB.LittleStarGold; this.BubblePartnerFollowToggler.normalBgSprite = "icon_fav_subscribed"; } else { //No //this.BubblePartnerFollowToggler.texture = TextureDB.LittleStarGrey; this.BubblePartnerFollowToggler.normalBgSprite = "icon_fav_unsubscribed"; } this.PartnerPanel.Show (); if(!isSon) this.NoPartnerPanel.Hide(); } else { this.PartnerPanel.Hide (); if(!isSon) this.NoPartnerPanel.Show(); } //Genitore 2 if (isSon) { this.NoPartnerPanel.Hide(); if(this.Family.m_citizen1 != 0) { this.CitizenPartner = this.Family.m_citizen1; this.Parent1ID.Citizen = CitizenPartner; int CitizenPartnerINT = (int)((UIntPtr)this.CitizenPartner); this.BubbleParent1Name.text = this.MyCitizen.GetCitizenName (CitizenPartner); if (Citizen.GetGender (CitizenPartner) == Citizen.Gender.Female) { this.BubbleParent1Name.textColor = new Color32 (255, 102, 204, 213); //r,g,b,a } else { this.BubbleParent1Name.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a } if (this.Parent1ID.IsEmpty) { this.BubbleParent1Name.isEnabled = false; this.BubbleParent1Name.tooltip = null; } else { this.BubbleParent1Name.isEnabled = true; this.BubbleParent1Name.tooltip = FavCimsLang.text("Right_click_to_swith_tooltip"); } Activity(this.CitizenPartner, this.BubbleParent1VehicleButton, this.BubbleParent1Destination, out this.Parent1VehID, out this.Parent1Target); //Real Age this.RealAge = FavCimsCore.CalculateCitizenAge (this.MyCitizen.m_citizens.m_buffer [CitizenPartner].m_age); if (this.RealAge <= 12) { //CHILD this.BubbleParent1AgeButton.text = this.RealAge.ToString (); this.BubbleParent1AgeButton.textColor = new Color32 (83, 166, 0, 60); //r,g,b,a } else if (this.RealAge <= 19) { //TEEN this.BubbleParent1AgeButton.text = this.RealAge.ToString (); this.BubbleParent1AgeButton.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a } else if (this.RealAge <= 25) { //YOUNG this.BubbleParent1AgeButton.text = this.RealAge.ToString (); this.BubbleParent1AgeButton.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a } else if (this.RealAge <= 65) { //ADULT this.BubbleParent1AgeButton.text = this.RealAge.ToString (); this.BubbleParent1AgeButton.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a } else if (this.RealAge <= 90) { //SENIOR this.BubbleParent1AgeButton.text = this.RealAge.ToString (); this.BubbleParent1AgeButton.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a } else { //FINAL this.BubbleParent1AgeButton.text = this.RealAge.ToString (); this.BubbleParent1AgeButton.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a } //Parent1 is in favorites? if (FavCimsCore.RowID.ContainsKey (CitizenPartnerINT)) { //Yes this.BubbleParent1FollowToggler.normalBgSprite = "icon_fav_subscribed"; } else { //No this.BubbleParent1FollowToggler.normalBgSprite = "icon_fav_unsubscribed"; } this.Parent1Panel.Show (); }else{ this.Parent1Panel.Hide (); } } else { this.Parent1Panel.Hide (); } //Parent2 if (this.Family.m_citizen2 != 0 && this.Family.m_citizen2 != citizen) { this.CitizenParent2 = this.Family.m_citizen2; this.Parent2ID.Citizen = CitizenParent2; int CitizenParent2INT = (int)((UIntPtr)this.CitizenParent2); this.BubbleFamilyMember2Name.text = this.MyCitizen.GetCitizenName (CitizenParent2); if (Citizen.GetGender (CitizenParent2) == Citizen.Gender.Female) { this.BubbleFamilyMember2Name.textColor = new Color32 (255, 102, 204, 213); //r,g,b,a this.BubbleFamilyMember2IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureFemale; } else { this.BubbleFamilyMember2Name.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleFamilyMember2IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureMale; } if (this.Parent2ID.IsEmpty) { this.BubbleFamilyMember2Name.isEnabled = false; this.BubbleFamilyMember2Name.tooltip = null; } else { this.BubbleFamilyMember2Name.isEnabled = true; this.BubbleFamilyMember2Name.tooltip = FavCimsLang.text("Right_click_to_swith_tooltip"); } //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.Family.m_citizen2); } Activity(this.CitizenParent2, this.BubbleFamilyMember2ActivityVehicleButton, this.BubbleFamilyMember2ActivityDestination, out this.Parent2VehID, out this.Parent2Target); //Real Age this.RealAge = FavCimsCore.CalculateCitizenAge (this.MyCitizen.m_citizens.m_buffer [CitizenParent2].m_age); if (this.RealAge <= 12) { //CHILD this.BubbleFamilyMember2AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember2AgeButton.textColor = new Color32 (83, 166, 0, 60); //r,g,b,a } else if (this.RealAge <= 19) { //TEEN this.BubbleFamilyMember2AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember2AgeButton.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a } else if (this.RealAge <= 25) { //YOUNG this.BubbleFamilyMember2AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember2AgeButton.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a } else if (this.RealAge <= 65) { //ADULT this.BubbleFamilyMember2AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember2AgeButton.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a } else if (this.RealAge <= 90) { //SENIOR this.BubbleFamilyMember2AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember2AgeButton.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a } else { //FINAL this.BubbleFamilyMember2AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember2AgeButton.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a } //Parent is in favorites? if (FavCimsCore.RowID.ContainsKey (CitizenParent2INT)) { //Yes this.BubbleFamilyMember2FollowToggler.normalBgSprite = "icon_fav_subscribed"; } else { //No this.BubbleFamilyMember2FollowToggler.normalBgSprite = "icon_fav_unsubscribed"; } this.FamilyMember2Panel.Show (); if(!isSon) Sons++; } else { if(this.Family.m_citizen2 == citizen) { //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.Family.m_citizen2); } } this.FamilyMember2Panel.Hide (); } //Parent3 if (this.Family.m_citizen3 != 0 && this.Family.m_citizen3 != citizen) { this.CitizenParent3 = this.Family.m_citizen3; this.Parent3ID.Citizen = CitizenParent3; int CitizenParent3INT = (int)((UIntPtr)this.CitizenParent3); this.BubbleFamilyMember3Name.text = this.MyCitizen.GetCitizenName (CitizenParent3); if (Citizen.GetGender (CitizenParent3) == Citizen.Gender.Female) { this.BubbleFamilyMember3Name.textColor = new Color32 (255, 102, 204, 213); //r,g,b,a this.BubbleFamilyMember3IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureFemale; } else { this.BubbleFamilyMember3Name.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleFamilyMember3IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureMale; } if (this.Parent3ID.IsEmpty) { this.BubbleFamilyMember3Name.isEnabled = false; this.BubbleFamilyMember3Name.tooltip = null; } else { this.BubbleFamilyMember3Name.isEnabled = true; this.BubbleFamilyMember3Name.tooltip = FavCimsLang.text("Right_click_to_swith_tooltip"); } //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.Family.m_citizen3); } Activity(this.CitizenParent3, this.BubbleFamilyMember3ActivityVehicleButton, this.BubbleFamilyMember3ActivityDestination, out this.Parent3VehID, out this.Parent3Target); //Real Age this.RealAge = FavCimsCore.CalculateCitizenAge (this.MyCitizen.m_citizens.m_buffer [CitizenParent3].m_age); if (this.RealAge <= 12) { //CHILD this.BubbleFamilyMember3AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember3AgeButton.textColor = new Color32 (83, 166, 0, 60); //r,g,b,a } else if (this.RealAge <= 19) { //TEEN this.BubbleFamilyMember3AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember3AgeButton.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a } else if (this.RealAge <= 25) { //YOUNG this.BubbleFamilyMember3AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember3AgeButton.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a } else if (this.RealAge <= 65) { //ADULT this.BubbleFamilyMember3AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember3AgeButton.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a } else if (this.RealAge <= 90) { //SENIOR this.BubbleFamilyMember3AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember3AgeButton.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a } else { //FINAL this.BubbleFamilyMember3AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember3AgeButton.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a } //Parent is in favorites? if (FavCimsCore.RowID.ContainsKey (CitizenParent3INT)) { //Yes this.BubbleFamilyMember3FollowToggler.normalBgSprite = "icon_fav_subscribed"; } else { //No this.BubbleFamilyMember3FollowToggler.normalBgSprite = "icon_fav_unsubscribed"; } this.FamilyMember3Panel.Show (); if(!isSon) Sons++; } else { if(this.Family.m_citizen3 == citizen) { //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.Family.m_citizen3); } } this.FamilyMember3Panel.Hide (); } //Parent4 if (this.Family.m_citizen4 != 0 && this.Family.m_citizen4 != citizen) { this.CitizenParent4 = this.Family.m_citizen4; this.Parent4ID.Citizen = CitizenParent4; int CitizenParent4INT = (int)((UIntPtr)this.CitizenParent4); this.BubbleFamilyMember4Name.text = this.MyCitizen.GetCitizenName (CitizenParent4); if (Citizen.GetGender (CitizenParent4) == Citizen.Gender.Female) { this.BubbleFamilyMember4Name.textColor = new Color32 (255, 102, 204, 213); //r,g,b,a this.BubbleFamilyMember4IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureFemale; } else { this.BubbleFamilyMember4Name.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a this.BubbleFamilyMember4IconSprite.texture = TextureDB.BubbleHeaderIconSpriteTextureMale; } if (this.Parent4ID.IsEmpty) { this.BubbleFamilyMember4Name.isEnabled = false; this.BubbleFamilyMember4Name.tooltip = null; } else { this.BubbleFamilyMember4Name.isEnabled = true; this.BubbleFamilyMember4Name.tooltip = FavCimsLang.text("Right_click_to_swith_tooltip"); } //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.Family.m_citizen4); } Activity(this.CitizenParent4, this.BubbleFamilyMember4ActivityVehicleButton, this.BubbleFamilyMember4ActivityDestination, out this.Parent4VehID, out this.Parent4Target); //Real Age this.RealAge = FavCimsCore.CalculateCitizenAge (this.MyCitizen.m_citizens.m_buffer [CitizenParent4].m_age); if (this.RealAge <= 12) { //CHILD this.BubbleFamilyMember4AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember4AgeButton.textColor = new Color32 (83, 166, 0, 60); //r,g,b,a } else if (this.RealAge <= 19) { //TEEN this.BubbleFamilyMember4AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember4AgeButton.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a } else if (this.RealAge <= 25) { //YOUNG this.BubbleFamilyMember4AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember4AgeButton.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a } else if (this.RealAge <= 65) { //ADULT this.BubbleFamilyMember4AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember4AgeButton.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a } else if (this.RealAge <= 90) { //SENIOR this.BubbleFamilyMember4AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember4AgeButton.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a } else { //FINAL this.BubbleFamilyMember4AgeButton.text = this.RealAge.ToString (); this.BubbleFamilyMember4AgeButton.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a } //Parent is in favorites? if (FavCimsCore.RowID.ContainsKey (CitizenParent4INT)) { //Yes this.BubbleFamilyMember4FollowToggler.normalBgSprite = "icon_fav_subscribed"; } else { //No this.BubbleFamilyMember4FollowToggler.normalBgSprite = "icon_fav_unsubscribed"; } this.FamilyMember4Panel.Show (); if(!isSon) Sons++; } else { if(this.Family.m_citizen4 == citizen) { //Have Pet? if(this.DogOwner != 0) { FamilyPet(this.DogOwner); }else{ FamilyPet(this.Family.m_citizen4); } } this.FamilyMember4Panel.Hide (); } if(Sons == 0 && !isSon) { NoChildsPanel.Show(); }else{ NoChildsPanel.Hide(); } }else{ //GameObject.Destroy (this.gameObject); this.Hide(); this.MyInstanceID = InstanceID.Empty; return; } if(this.FirstRun) this.FirstRun = false; } catch /*(Exception e)*/ { //Debug.Error("errore" + e.ToString()); } } } }
public string CustomGetLocalizedStatus(ushort vehicleId, ref Vehicle data, out InstanceID target) { CitizenManager citizenManager = Singleton <CitizenManager> .instance; ushort driverInstanceId = GetDriverInstance(vehicleId, ref data); ushort targetBuildingId = 0; bool targetIsNode = false; if (driverInstanceId != 0) { if ((data.m_flags & Vehicle.Flags.Parking) != 0) { uint citizen = citizenManager.m_instances.m_buffer[driverInstanceId].m_citizen; if (citizen != 0u && citizenManager.m_citizens.m_buffer[citizen].m_parkedVehicle != 0) { target = InstanceID.Empty; return(Locale.Get("VEHICLE_STATUS_PARKING")); } } targetBuildingId = citizenManager.m_instances.m_buffer[driverInstanceId].m_targetBuilding; targetIsNode = (citizenManager.m_instances.m_buffer[driverInstanceId].m_flags & CitizenInstance.Flags.TargetIsNode) != CitizenInstance.Flags.None; } if (targetBuildingId == 0) { target = InstanceID.Empty; return(Locale.Get("VEHICLE_STATUS_CONFUSED")); } string ret; bool leavingCity = (Singleton <BuildingManager> .instance.m_buildings.m_buffer[targetBuildingId].m_flags & Building.Flags.IncomingOutgoing) != Building.Flags.None; if (leavingCity) { target = InstanceID.Empty; ret = Locale.Get("VEHICLE_STATUS_LEAVING"); } else { target = InstanceID.Empty; if (targetIsNode) { target.NetNode = targetBuildingId; } else { target.Building = targetBuildingId; } ret = Locale.Get("VEHICLE_STATUS_GOINGTO"); } // NON-STOCK CODE START if (Options.parkingAI) { ret = AdvancedParkingManager.Instance.EnrichLocalizedCarStatus( ret, ref ExtCitizenInstanceManager.Instance.ExtInstances[driverInstanceId]); } // NON-STOCK CODE END return(ret); }
private static void ApplyFill(ZoneTool z) { bool m_validPosition = (bool)z.GetType().GetField("m_validPosition", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(z); if (!m_validPosition) return; Vector3 position = (Vector3)z.GetType().GetField("m_mousePosition", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(z); Vector3 direction = (Vector3)z.GetType().GetField("m_mouseDirection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(z); float angle = Mathf.Atan2(-direction.x, direction.z); float num1 = position.x - 256f; float num2 = position.z - 256f; float num3 = position.x + 256f; float num4 = position.z + 256f; int num5 = Mathf.Max((int)((num1 - 46f) / 64f + FakeZoneManager.HALFGRID), 0); int num6 = Mathf.Max((int)((num2 - 46f) / 64f + FakeZoneManager.HALFGRID), 0); int num7 = Mathf.Min((int)((num3 + 46f) / 64f + FakeZoneManager.HALFGRID), FakeZoneManager.GRIDSIZE - 1); int num8 = Mathf.Min((int)((num4 + 46f) / 64f + FakeZoneManager.HALFGRID), FakeZoneManager.GRIDSIZE - 1); ZoneManager instance1 = Singleton<ZoneManager>.instance; bool flag = false; for (int index1 = num6; index1 <= num8; ++index1) { for (int index2 = num5; index2 <= num7; ++index2) { ushort blockIndex = FakeZoneManager.zoneGrid[index1 * FakeZoneManager.GRIDSIZE + index2]; int num9 = 0; while ((int)blockIndex != 0) { Vector3 vector3 = instance1.m_blocks.m_buffer[(int)blockIndex].m_position; if ((double)Mathf.Max(Mathf.Max(num1 - 46f - vector3.x, num2 - 46f - vector3.z), Mathf.Max((float)((double)vector3.x - (double)num3 - 46.0), (float)((double)vector3.z - (double)num4 - 46.0))) < 0.0 && ApplyFillBuffer(z, position, direction, angle, blockIndex, ref instance1.m_blocks.m_buffer[(int)blockIndex])) flag = true; blockIndex = instance1.m_blocks.m_buffer[(int)blockIndex].m_nextGridBlock; if (++num9 >= 32768) { CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + System.Environment.StackTrace); break; } } } } if (!flag) return; bool m_zoning = (bool)z.GetType().GetField("m_validPosition", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(z); if (m_zoning) z.GetType().GetMethod("UsedZone", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(z, new object[] { z.m_zone }); EffectInfo effect = instance1.m_properties.m_fillEffect; if (effect == null) return; InstanceID instance2 = new InstanceID(); EffectInfo.SpawnArea spawnArea = new EffectInfo.SpawnArea(position, Vector3.up, 1f); Singleton<EffectManager>.instance.DispatchEffect(effect, instance2, spawnArea, Vector3.zero, 0.0f, 1f, Singleton<AudioManager>.instance.DefaultGroup); }
private static Entity GetEntity( InstanceID instanceID ) { Entity result = null; if( instanceID != InstanceID.Invalid_IID ) { s_GameEntities.TryGetValue( instanceID, out result ); } return result; }
public string CustomGetLocalizedStatus(ushort instanceID, ref CitizenInstance data, out InstanceID target) { if ((data.m_flags & (CitizenInstance.Flags.Blown | CitizenInstance.Flags.Floating)) != CitizenInstance.Flags.None) { target = InstanceID.Empty; return(Locale.Get("CITIZEN_STATUS_CONFUSED")); } CitizenManager instance = Singleton <CitizenManager> .instance; uint citizenId = data.m_citizen; ushort vehicleId = 0; if (citizenId != 0u) { vehicleId = instance.m_citizens.m_buffer[citizenId].m_vehicle; } ushort targetBuilding = data.m_targetBuilding; if (targetBuilding == 0) { target = InstanceID.Empty; return(Locale.Get("CITIZEN_STATUS_CONFUSED")); } bool flag = (Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)targetBuilding].m_flags & Building.Flags.IncomingOutgoing) != Building.Flags.None; bool flag2 = data.m_path == 0u && (data.m_flags & CitizenInstance.Flags.HangAround) != CitizenInstance.Flags.None; String ret = ""; if (vehicleId != 0) { VehicleManager instance2 = Singleton <VehicleManager> .instance; VehicleInfo info = instance2.m_vehicles.m_buffer[(int)vehicleId].Info; if (info.m_class.m_service == ItemClass.Service.Residential && info.m_vehicleType != VehicleInfo.VehicleType.Bicycle) { if (info.m_vehicleAI.GetOwnerID(vehicleId, ref instance2.m_vehicles.m_buffer[(int)vehicleId]).Citizen == citizenId) { if (flag) { target = InstanceID.Empty; return(Locale.Get("CITIZEN_STATUS_DRIVINGTO_OUTSIDE")); } target = InstanceID.Empty; target.Building = targetBuilding; return(Locale.Get("CITIZEN_STATUS_DRIVINGTO")); } } else if (info.m_class.m_service == ItemClass.Service.PublicTransport || info.m_class.m_service == ItemClass.Service.Disaster) { if (flag) { target = InstanceID.Empty; return(Locale.Get("CITIZEN_STATUS_TRAVELLINGTO_OUTSIDE")); } target = InstanceID.Empty; target.Building = targetBuilding; return(Locale.Get("CITIZEN_STATUS_TRAVELLINGTO")); } } if (flag) { target = InstanceID.Empty; return(Locale.Get("CITIZEN_STATUS_GOINGTO_OUTSIDE")); } if (flag2) { target = InstanceID.Empty; target.Building = targetBuilding; return(Locale.Get("CITIZEN_STATUS_VISITING")); } target = InstanceID.Empty; target.Building = targetBuilding; ret = Locale.Get("CITIZEN_STATUS_GOINGTO"); // NON-STOCK CODE START #if BENCHMARK using (var bm = new Benchmark(null, "EnrichLocalizedCitizenStatus")) { #endif if (Options.prohibitPocketCars) { ret = AdvancedParkingManager.Instance.EnrichLocalizedCitizenStatus(ret, ref ExtCitizenInstanceManager.Instance.ExtInstances[instanceID]); } #if BENCHMARK } #endif // NON-STOCK CODE END return(ret); }
public static HashSet <Instance> GetCleanSelection(out Vector3 center) { HashSet <Instance> newSelection = new HashSet <Instance>(selection); InstanceID id = new InstanceID(); // Adding missing nodes foreach (Instance instance in selection) { if (instance is MoveableSegment) { ushort segment = instance.id.NetSegment; id.NetNode = segmentBuffer[segment].m_startNode; newSelection.Add(id); id.NetNode = segmentBuffer[segment].m_endNode; newSelection.Add(id); } } // Adding missing segments foreach (Instance instance in selection) { if (instance.id.Type == InstanceType.NetNode) { ushort node = instance.id.NetNode; for (int i = 0; i < 8; i++) { ushort segment = nodeBuffer[node].GetSegment(i); id.NetSegment = segment; if (segment != 0 && !newSelection.Contains(id)) { ushort startNode = segmentBuffer[segment].m_startNode; ushort endNode = segmentBuffer[segment].m_endNode; if (node == startNode) { id.NetNode = endNode; } else { id.NetNode = startNode; } if (newSelection.Contains(id)) { id.NetSegment = segment; newSelection.Add(id); } } } } } // Remove single nodes HashSet <Instance> toRemove = new HashSet <Instance>(); foreach (Instance instance in newSelection) { if (instance.id.Type == InstanceType.NetNode) { bool found = false; ushort node = instance.id.NetNode; for (int i = 0; i < 8; i++) { ushort segment = nodeBuffer[node].GetSegment(i); id.NetSegment = segment; if (segment != 0 && newSelection.Contains(id)) { found = true; break; } } if (!found) { toRemove.Add(instance); } } } newSelection.ExceptWith(toRemove); if (newSelection.Count > 0) { // Calculate center Bounds totalBounds = default; bool init = false; foreach (Instance instance in newSelection) { if (init) { totalBounds.Encapsulate(instance.GetBounds()); } else { totalBounds = instance.GetBounds(); init = true; } } center = totalBounds.center; } else { center = Vector3.zero; } // Sort segments by buildIndex HashSet <Instance> sorted = new HashSet <Instance>(); List <uint> indexes = new List <uint>(); foreach (Instance instance in newSelection) { if (instance.id.Type != InstanceType.NetSegment) { sorted.Add(instance); } else { uint bi = ((NetSegment)instance.data).m_buildIndex; if (!indexes.Contains(bi)) { indexes.Add(bi); } } } indexes.Sort(); foreach (uint i in indexes) { foreach (Instance instance in newSelection) { if (instance.id.Type == InstanceType.NetSegment) { if (((NetSegment)instance.data).m_buildIndex == i) { sorted.Add(instance); } } } } return(sorted); }
public override void SimulationStep(ushort segmentID, ref NetSegment data) { base.SimulationStep(segmentID, ref data); SimulationManager instance = Singleton <SimulationManager> .instance; NetManager instance2 = Singleton <NetManager> .instance; Notification.Problem problem = Notification.RemoveProblems(data.m_problems, Notification.Problem.Flood | Notification.Problem.Snow); if ((data.m_flags & NetSegment.Flags.AccessFailed) != NetSegment.Flags.None && Singleton <SimulationManager> .instance.m_randomizer.Int32(16u) == 0) { data.m_flags &= ~NetSegment.Flags.AccessFailed; } float num = 0f; uint num2 = data.m_lanes; int num3 = 0; while (num3 < this.m_info.m_lanes.Length && num2 != 0u) { NetInfo.Lane lane = this.m_info.m_lanes[num3]; if ((byte)(lane.m_laneType & (NetInfo.LaneType.Vehicle | NetInfo.LaneType.TransportVehicle)) != 0 && (lane.m_vehicleType & ~VehicleInfo.VehicleType.Bicycle) != VehicleInfo.VehicleType.None) { num += instance2.m_lanes.m_buffer[(int)((UIntPtr)num2)].m_length; } num2 = instance2.m_lanes.m_buffer[(int)((UIntPtr)num2)].m_nextLane; num3++; } int num4 = 0; if (data.m_trafficBuffer == 65535) { if ((data.m_flags & NetSegment.Flags.Blocked) == NetSegment.Flags.None) { data.m_flags |= NetSegment.Flags.Blocked; data.m_modifiedIndex = instance.m_currentBuildIndex++; } } else { data.m_flags &= ~NetSegment.Flags.Blocked; int num5 = Mathf.RoundToInt(num) << 4; if (num5 != 0) { num4 = (int)((byte)Mathf.Min((int)(data.m_trafficBuffer * 100) / num5, 100)); } } data.m_trafficBuffer = 0; if (num4 > (int)data.m_trafficDensity) { data.m_trafficDensity = (byte)Mathf.Min((int)(data.m_trafficDensity + 5), num4); } else if (num4 < (int)data.m_trafficDensity) { data.m_trafficDensity = (byte)Mathf.Max((int)(data.m_trafficDensity - 5), num4); } Vector3 position = instance2.m_nodes.m_buffer[(int)data.m_startNode].m_position; Vector3 position2 = instance2.m_nodes.m_buffer[(int)data.m_endNode].m_position; Vector3 vector = (position + position2) * 0.5f; bool flag = false; if ((this.m_info.m_setVehicleFlags & Vehicle.Flags.Underground) == (Vehicle.Flags) 0) { float num6 = Singleton <TerrainManager> .instance.WaterLevel(VectorUtils.XZ(vector)); // NON-STOCK CODE START if (num6 > vector.y + (float)ModSettings.RoadwayFloodedTolerance / 100) { flag = true; data.m_flags |= NetSegment.Flags.Flooded; problem = Notification.AddProblems(problem, Notification.Problem.Flood | Notification.Problem.MajorProblem); Vector3 min = data.m_bounds.min; Vector3 max = data.m_bounds.max; RoadBaseAI.FloodParkedCars(min.x, min.z, max.x, max.z); } else { data.m_flags &= ~NetSegment.Flags.Flooded; // Rainfall compatibility float add = (float)ModSettings.RoadwayFloodingTolerance / 100; if (num6 > vector.y + add) { flag = true; problem = Notification.AddProblems(problem, Notification.Problem.Flood); } } // NON-STOCK CODE END } DistrictManager instance3 = Singleton <DistrictManager> .instance; byte district = instance3.GetDistrict(vector); DistrictPolicies.CityPlanning cityPlanningPolicies = instance3.m_districts.m_buffer[(int)district].m_cityPlanningPolicies; int num7 = (int)(100 - (data.m_trafficDensity - 100) * (data.m_trafficDensity - 100) / 100); if ((this.m_info.m_vehicleTypes & VehicleInfo.VehicleType.Car) != VehicleInfo.VehicleType.None) { if ((this.m_info.m_setVehicleFlags & Vehicle.Flags.Underground) == (Vehicle.Flags) 0) { if (flag && (data.m_flags & (NetSegment.Flags.AccessFailed | NetSegment.Flags.Blocked)) == NetSegment.Flags.None && instance.m_randomizer.Int32(10u) == 0) { TransferManager.TransferOffer offer = default(TransferManager.TransferOffer); offer.Priority = 4; offer.NetSegment = segmentID; offer.Position = vector; offer.Amount = 1; Singleton <TransferManager> .instance.AddOutgoingOffer(TransferManager.TransferReason.FloodWater, offer); } int num8 = (int)data.m_wetness; if (!instance2.m_treatWetAsSnow) { if (flag) { num8 = 255; } else { int num9 = -(num8 + 63 >> 5); float num10 = Singleton <WeatherManager> .instance.SampleRainIntensity(vector, false); if (num10 != 0f) { int num11 = Mathf.RoundToInt(Mathf.Min(num10 * 4000f, 1000f)); num9 += instance.m_randomizer.Int32(num11, num11 + 99) / 100; } num8 = Mathf.Clamp(num8 + num9, 0, 255); } } else if (this.m_accumulateSnow) { if (flag) { num8 = 128; } else { float num12 = Singleton <WeatherManager> .instance.SampleRainIntensity(vector, false); if (num12 != 0f) { int num13 = Mathf.RoundToInt(num12 * 400f); int num14 = instance.m_randomizer.Int32(num13, num13 + 99) / 100; if (Singleton <UnlockManager> .instance.Unlocked(UnlockManager.Feature.Snowplow)) { num8 = Mathf.Min(num8 + num14, 255); } else { num8 = Mathf.Min(num8 + num14, 128); } } else if (Singleton <SimulationManager> .instance.m_randomizer.Int32(4u) == 0) { num8 = Mathf.Max(num8 - 1, 0); } if (num8 >= 64 && (data.m_flags & (NetSegment.Flags.AccessFailed | NetSegment.Flags.Blocked | NetSegment.Flags.Flooded)) == NetSegment.Flags.None && instance.m_randomizer.Int32(10u) == 0) { TransferManager.TransferOffer offer2 = default(TransferManager.TransferOffer); offer2.Priority = num8 / 50; offer2.NetSegment = segmentID; offer2.Position = vector; offer2.Amount = 1; Singleton <TransferManager> .instance.AddOutgoingOffer(TransferManager.TransferReason.Snow, offer2); } if (num8 >= 192) { problem = Notification.AddProblems(problem, Notification.Problem.Snow); } District[] expr_5B7_cp_0_cp_0 = instance3.m_districts.m_buffer; byte expr_5B7_cp_0_cp_1 = district; expr_5B7_cp_0_cp_0[(int)expr_5B7_cp_0_cp_1].m_productionData.m_tempSnowCover = expr_5B7_cp_0_cp_0[(int)expr_5B7_cp_0_cp_1].m_productionData.m_tempSnowCover + (uint)num8; } } if (num8 != (int)data.m_wetness) { if (Mathf.Abs((int)data.m_wetness - num8) > 10) { data.m_wetness = (byte)num8; InstanceID empty = InstanceID.Empty; empty.NetSegment = segmentID; instance2.AddSmoothColor(empty); empty.NetNode = data.m_startNode; instance2.AddSmoothColor(empty); empty.NetNode = data.m_endNode; instance2.AddSmoothColor(empty); } else { data.m_wetness = (byte)num8; instance2.m_wetnessChanged = 256; } } } int num15; if ((cityPlanningPolicies & DistrictPolicies.CityPlanning.StuddedTires) != DistrictPolicies.CityPlanning.None) { num7 = num7 * 3 + 1 >> 1; num15 = Mathf.Min(700, (int)(50 + data.m_trafficDensity * 6)); } else { num15 = Mathf.Min(500, (int)(50 + data.m_trafficDensity * 4)); } if (!this.m_highwayRules) { int num16 = instance.m_randomizer.Int32(num15, num15 + 99) / 100; data.m_condition = (byte)Mathf.Max((int)data.m_condition - num16, 0); if (data.m_condition < 192 && (data.m_flags & (NetSegment.Flags.AccessFailed | NetSegment.Flags.Blocked | NetSegment.Flags.Flooded)) == NetSegment.Flags.None && instance.m_randomizer.Int32(20u) == 0) { TransferManager.TransferOffer offer3 = default(TransferManager.TransferOffer); offer3.Priority = (int)((255 - data.m_condition) / 50); offer3.NetSegment = segmentID; offer3.Position = vector; offer3.Amount = 1; Singleton <TransferManager> .instance.AddIncomingOffer(TransferManager.TransferReason.RoadMaintenance, offer3); } } } if (!this.m_highwayRules) { if ((cityPlanningPolicies & DistrictPolicies.CityPlanning.HeavyTrafficBan) != DistrictPolicies.CityPlanning.None) { data.m_flags |= NetSegment.Flags.HeavyBan; } else { data.m_flags &= ~NetSegment.Flags.HeavyBan; } if ((cityPlanningPolicies & DistrictPolicies.CityPlanning.BikeBan) != DistrictPolicies.CityPlanning.None) { data.m_flags |= NetSegment.Flags.BikeBan; } else { data.m_flags &= ~NetSegment.Flags.BikeBan; } if ((cityPlanningPolicies & DistrictPolicies.CityPlanning.OldTown) != DistrictPolicies.CityPlanning.None) { data.m_flags |= NetSegment.Flags.CarBan; } else { data.m_flags &= ~NetSegment.Flags.CarBan; } } int num17 = this.m_noiseAccumulation * num7 / 100; if (num17 != 0) { float num18 = Vector3.Distance(position, position2); int num19 = Mathf.FloorToInt(num18 / this.m_noiseRadius); for (int i = 0; i < num19; i++) { Vector3 position3 = Vector3.Lerp(position, position2, (float)(i + 1) / (float)(num19 + 1)); Singleton <ImmaterialResourceManager> .instance.AddResource(ImmaterialResourceManager.Resource.NoisePollution, num17, position3, this.m_noiseRadius); } } if (data.m_trafficDensity >= 50 && data.m_averageLength < 25f && (instance2.m_nodes.m_buffer[(int)data.m_startNode].m_flags & (NetNode.Flags.LevelCrossing | NetNode.Flags.TrafficLights)) == NetNode.Flags.TrafficLights && (instance2.m_nodes.m_buffer[(int)data.m_endNode].m_flags & (NetNode.Flags.LevelCrossing | NetNode.Flags.TrafficLights)) == NetNode.Flags.TrafficLights) { GuideController properties = Singleton <GuideManager> .instance.m_properties; if (properties != null) { Singleton <NetManager> .instance.m_shortRoadTraffic.Activate(properties.m_shortRoadTraffic, segmentID); } } if ((data.m_flags & NetSegment.Flags.Collapsed) != NetSegment.Flags.None) { GuideController properties2 = Singleton <GuideManager> .instance.m_properties; if (properties2 != null) { Singleton <NetManager> .instance.m_roadDestroyed.Activate(properties2.m_roadDestroyed, segmentID); Singleton <NetManager> .instance.m_roadDestroyed2.Activate(properties2.m_roadDestroyed2, this.m_info.m_class.m_service); } if ((ulong)(instance.m_currentFrameIndex >> 8 & 15u) == (ulong)((long)(segmentID & 15))) { int delta = Mathf.RoundToInt(data.m_averageLength); StatisticBase statisticBase = Singleton <StatisticsManager> .instance.Acquire <StatisticInt32>(StatisticType.DestroyedLength); statisticBase.Add(delta); } } data.m_problems = problem; }
public override void Do() { if (MoveItTool.POProcessing > 0) { return; } MoveItTool.instance.m_lastInstance = null; m_clones = new HashSet <Instance>(); m_origToCloneUpdate = new Dictionary <Instance, Instance>(); m_nodeOrigToClone = new Dictionary <ushort, ushort>(); m_stateToClone = new Dictionary <InstanceState, Instance>(); m_InstanceID_origToClone = new Dictionary <InstanceID, InstanceID>(); matrix4x.SetTRS(center + moveDelta, Quaternion.AngleAxis(angleDelta * Mathf.Rad2Deg, Vector3.down), Vector3.one); // Clone nodes first foreach (InstanceState state in m_states) { if (state is NodeState) { Instance clone = state.instance.Clone(state, ref matrix4x, moveDelta.y, angleDelta, center, followTerrain, m_nodeOrigToClone, this); if (clone != null) { m_clones.Add(clone); m_stateToClone.Add(state, clone); m_InstanceID_origToClone.Add(state.instance.id, clone.id); m_origToCloneUpdate.Add(state.instance.id, clone.id); m_nodeOrigToClone.Add(state.instance.id.NetNode, clone.id.NetNode); } } } // Clone everything else except PO foreach (InstanceState state in m_states) { if (!(state is NodeState || state is ProcState)) { Instance clone = state.instance.Clone(state, ref matrix4x, moveDelta.y, angleDelta, center, followTerrain, m_nodeOrigToClone, this); if (clone == null) { Log.Debug($"Failed to clone {state}"); continue; } m_clones.Add(clone); m_stateToClone.Add(state, clone); m_InstanceID_origToClone.Add(state.instance.id, clone.id); m_origToCloneUpdate.Add(state.instance.id, clone.id); ; if (state is SegmentState segmentState) { MoveItTool.NS.SetSegmentModifiers(clone.id.NetSegment, segmentState); if (segmentState.LaneIDs != null) { // old version does not store lane ids var clonedLaneIds = MoveableSegment.GetLaneIds(clone.id.NetSegment); DebugUtils.AssertEq(clonedLaneIds.Count, segmentState.LaneIDs.Count, "clonedLaneIds.Count, segmentState.LaneIDs.Count"); for (int i = 0; i < clonedLaneIds.Count; ++i) { var lane0 = new InstanceID { NetLane = segmentState.LaneIDs[i] }; var lane = new InstanceID { NetLane = clonedLaneIds[i] }; // Log.Debug($"Mapping lane:{lane0.NetLane} to {lane.NetLane}"); m_InstanceID_origToClone.Add(lane0, lane); } } } } } // Clone PO foreach (InstanceState state in m_states) { if (state is ProcState) { _ = state.instance.Clone(state, ref matrix4x, moveDelta.y, angleDelta, center, followTerrain, m_nodeOrigToClone, this); } } if (m_origToClone != null) { Dictionary <Instance, Instance> toReplace = new Dictionary <Instance, Instance>(); foreach (Instance key in m_origToClone.Keys) { toReplace.Add(m_origToClone[key], m_origToCloneUpdate[key]); DebugUtils.Log("To replace: " + m_origToClone[key].id.RawData + " -> " + m_origToCloneUpdate[key].id.RawData); } ActionQueue.instance.ReplaceInstancesForward(toReplace); } m_origToClone = m_origToCloneUpdate; // Select clones selection = m_clones; MoveItTool.m_debugPanel.UpdatePanel(); UpdateArea(GetTotalBounds(false)); MoveItTool.UpdatePillarMap(); }
public override void Undo() { if (m_states == null) { return; } Dictionary <Instance, Instance> toReplace = new Dictionary <Instance, Instance>(); Dictionary <ushort, ushort> clonedNodes = new Dictionary <ushort, ushort>(); // Recreate nodes foreach (InstanceState state in m_states) { if (state.instance.id.Type == InstanceType.NetNode) { Instance clone = state.instance.Clone(state, null); toReplace.Add(state.instance, clone); clonedNodes.Add(state.instance.id.NetNode, clone.id.NetNode); ActionQueue.instance.UpdateNodeIdInStateHistory(state.instance.id.NetNode, clone.id.NetNode); //Debug.Log($"Cloned N:{state.instance.id.NetNode}->{clone.id.NetNode}"); } } // Recreate everything except nodes and segments foreach (InstanceState state in m_states) { if (state.instance.id.Type == InstanceType.NetNode) { continue; } if (state.instance.id.Type == InstanceType.NetSegment) { continue; } Instance clone = state.instance.Clone(state, clonedNodes); toReplace.Add(state.instance, clone); // Add attached nodes to the clonedNode list so other segments reconnect if (state.instance.id.Type == InstanceType.Building) { BuildingState buildingState = state as BuildingState; List <ushort> origNodeIds = new List <ushort>(); MoveableBuilding cb = clone as MoveableBuilding; ushort cloneNodeId = ((Building)cb.data).m_netNode; if (cloneNodeId != 0) { int c = 0; string msg2 = "Original attached nodes:"; foreach (InstanceState i in buildingState.subStates) { if (i is NodeState ns) { InstanceID instanceID = default(InstanceID); instanceID.RawData = ns.id; //msg2 += $"\n{c} - Attached node #{instanceID.NetNode}: {ns.Info.Name}"; origNodeIds.Insert(c++, instanceID.NetNode); } } //Debug.Log(msg2); c = 0; msg2 = ""; while (cloneNodeId != 0) { ushort origNodeId = origNodeIds[c]; NetNode clonedAttachedNode = NetManager.instance.m_nodes.m_buffer[cloneNodeId]; if (clonedAttachedNode.Info.GetAI() is TransportLineAI) { cloneNodeId = clonedAttachedNode.m_nextBuildingNode; continue; } if (clonedNodes.ContainsKey(origNodeId)) { Debug.Log($"Node #{origNodeId} is already in clone list!"); } clonedNodes.Add(origNodeId, cloneNodeId); msg2 += $"\n{c} - {origNodeId} -> {cloneNodeId} {clonedAttachedNode.Info.GetAI()}"; cloneNodeId = clonedAttachedNode.m_nextBuildingNode; if (++c > 32768) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } Debug.Log(msg2); } } } //string msg = "Cloned Nodes:\n"; //foreach (KeyValuePair<ushort, ushort> kvp in clonedNodes) //{ // msg += $"{kvp.Key} => {kvp.Value}\n"; //} //Debug.Log(msg); // Recreate segments foreach (InstanceState state in m_states) { if (state.instance.id.Type == InstanceType.NetSegment) { SegmentState segState = state as SegmentState; if (!clonedNodes.ContainsKey(segState.startNode)) { InstanceID instanceID = InstanceID.Empty; instanceID.NetNode = segState.startNode; // Don't clone if node is missing if (!((Instance)instanceID).isValid) { continue; } clonedNodes.Add(segState.startNode, segState.startNode); } if (!clonedNodes.ContainsKey(segState.endNode)) { InstanceID instanceID = InstanceID.Empty; instanceID.NetNode = segState.endNode; // Don't clone if node is missing if (!((Instance)instanceID).isValid) { continue; } clonedNodes.Add(segState.endNode, segState.endNode); } Instance clone = state.instance.Clone(state, clonedNodes); toReplace.Add(state.instance, clone); } } if (replaceInstances) { ReplaceInstances(toReplace); ActionQueue.instance.ReplaceInstancesBackward(toReplace); selection = m_oldSelection; } }
public static bool BurnTree(TreeManager tm, uint treeIndex, InstanceManager.Group group, int fireIntensity) { unsafe { //TreeManager tm = Singleton<TreeManager>.instance; see above {this} is passed in bydefault by .net as secret first param. TreeManager.BurningTree burningTree = new TreeManager.BurningTree(); //if (Mod.DEBUG_LOG_ON && Mod.DEBUG_LOG_LEVEL > 1) //{ Logger.dbgLog("request to burn tree: " + treeIndex.ToString() ); } if (treeIndex == 0 || (tm.m_trees.m_buffer[treeIndex].m_flags & 64) != 0) { return(false); } if (!Singleton <LoadingManager> .instance.SupportsExpansion(Expansion.NaturalDisasters)) { return(false); } TreeFireControl_Loader.FireStats.totalburncalls++; //our additions if (Mod.DEBUG_LOG_ON && Mod.DEBUG_LOG_LEVEL > 2) { Logger.dbgLog(string.Format("ratetree:{0} ratedistree:{1} fireIntensity:{2}", Mod.config.TreeFireSpreadRate.ToString(), Mod.config.TreeFireDisasterSpreadRate.ToString(), fireIntensity.ToString())); } if (group != null) { ushort disaster = group.m_ownerInstance.Disaster; if (disaster != 0) { if (Mod.DEBUG_LOG_ON && Mod.DEBUG_LOG_LEVEL > 2) { Logger.dbgLog("burn req is connected to disaster"); } TreeFireControl_Loader.FireStats.totalburncallsdisaster++; if (TreeFireControl.TFCTreeManager.Utils.ShouldWeBurnit(ref group, Mod.config.TreeFireDisasterSpreadRate)) { //do nothing == burn tree. and count it toward disaster. Singleton <DisasterManager> .instance.m_disasters.m_buffer[disaster].m_treeFireCount = Singleton <DisasterManager> .instance.m_disasters.m_buffer[disaster].m_treeFireCount + 1; //end org } else { //retruned false - block the burn call. TreeFireControl_Loader.FireStats.totalburncallsblockeddisaster++; return(false); } } else //Was not null but not a valid disaster id. handle like normal. { if (Mod.DEBUG_LOG_ON && Mod.DEBUG_LOG_LEVEL > 2) { Logger.dbgLog("burn req is *not* connected to disaster."); } TreeFireControl_Loader.FireStats.totalburncallsnormal++; if (!TreeFireControl.TFCTreeManager.Utils.ShouldWeBurnit(ref group, Mod.config.TreeFireSpreadRate)) { TreeFireControl_Loader.FireStats.totalburncallsblockednormal++; return(false); //no burning. //else let it continue and burn the tree } } } else //not tied to disasters. { if (Mod.DEBUG_LOG_ON && Mod.DEBUG_LOG_LEVEL > 2) { Logger.dbgLog("burn req is *not* connected to disaster. group null"); } TreeFireControl_Loader.FireStats.totalburncallsnormal++; if (!TreeFireControl.TFCTreeManager.Utils.ShouldWeBurnit(ref group, Mod.config.TreeFireSpreadRate)) { TreeFireControl_Loader.FireStats.totalburncallsblockednormal++; return(false); //no burning. //else let it continue } //burnlog; } //cont org burningTree.m_treeIndex = treeIndex; burningTree.m_fireIntensity = (byte)fireIntensity; burningTree.m_fireDamage = 4; InstanceID instanceID = new InstanceID() { Tree = treeIndex }; Singleton <InstanceManager> .instance.SetGroup(instanceID, group); tm.m_trees.m_buffer[treeIndex].m_flags = (ushort)(tm.m_trees.m_buffer[treeIndex].m_flags | 192); tm.m_burningTrees.Add(burningTree); return(true); } }
/// <summary> /// Makes the given citizen instance enter their parked car. /// </summary> /// <param name="instanceID">Citizen instance id</param> /// <param name="instanceData">Citizen instance data</param> /// <param name="parkedVehicleId">Parked vehicle id</param> /// <param name="vehicleId">Vehicle id</param> /// <returns>true if entering the car succeeded, false otherwise</returns> public static bool EnterParkedCar(ushort instanceID, ref CitizenInstance instanceData, ushort parkedVehicleId, out ushort vehicleId) { #if DEBUG bool citDebug = GlobalConfig.Instance.Debug.CitizenId == 0 || GlobalConfig.Instance.Debug.CitizenId == instanceData.m_citizen; bool debug = GlobalConfig.Instance.Debug.Switches[2] && citDebug; bool fineDebug = GlobalConfig.Instance.Debug.Switches[4] && citDebug; if (debug) { Log._Debug($"CustomHumanAI.EnterParkedCar({instanceID}, ..., {parkedVehicleId}) called."); } #endif VehicleManager vehManager = Singleton <VehicleManager> .instance; NetManager netManager = Singleton <NetManager> .instance; CitizenManager citManager = Singleton <CitizenManager> .instance; Vector3 parkedVehPos = vehManager.m_parkedVehicles.m_buffer[parkedVehicleId].m_position; Quaternion parkedVehRot = vehManager.m_parkedVehicles.m_buffer[parkedVehicleId].m_rotation; VehicleInfo vehicleInfo = vehManager.m_parkedVehicles.m_buffer[parkedVehicleId].Info; PathUnit.Position vehLanePathPos; if (!CustomPathManager._instance.m_pathUnits.m_buffer[instanceData.m_path].GetPosition(0, out vehLanePathPos)) { #if DEBUG if (debug) { Log._Debug($"CustomHumanAI.EnterParkedCar({instanceID}): Could not get first car path position of citizen instance {instanceID}!"); } #endif vehicleId = 0; return(false); } uint vehLaneId = PathManager.GetLaneID(vehLanePathPos); #if DEBUG if (fineDebug) { Log._Debug($"CustomHumanAI.EnterParkedCar({instanceID}): Determined vehicle position for citizen instance {instanceID}: seg. {vehLanePathPos.m_segment}, lane {vehLanePathPos.m_lane}, off {vehLanePathPos.m_offset} (lane id {vehLaneId})"); } #endif Vector3 vehLanePos; float vehLaneOff; netManager.m_lanes.m_buffer[vehLaneId].GetClosestPosition(parkedVehPos, out vehLanePos, out vehLaneOff); byte vehLaneOffset = (byte)Mathf.Clamp(Mathf.RoundToInt(vehLaneOff * 255f), 0, 255); // movement vector from parked vehicle position to road position Vector3 forwardVector = parkedVehPos + Vector3.ClampMagnitude(vehLanePos - parkedVehPos, 5f); if (vehManager.CreateVehicle(out vehicleId, ref Singleton <SimulationManager> .instance.m_randomizer, vehicleInfo, parkedVehPos, TransferManager.TransferReason.None, false, false)) { // update frame data Vehicle.Frame frame = vehManager.m_vehicles.m_buffer[(int)vehicleId].m_frame0; frame.m_rotation = parkedVehRot; vehManager.m_vehicles.m_buffer[vehicleId].m_frame0 = frame; vehManager.m_vehicles.m_buffer[vehicleId].m_frame1 = frame; vehManager.m_vehicles.m_buffer[vehicleId].m_frame2 = frame; vehManager.m_vehicles.m_buffer[vehicleId].m_frame3 = frame; vehicleInfo.m_vehicleAI.FrameDataUpdated(vehicleId, ref vehManager.m_vehicles.m_buffer[vehicleId], ref frame); // update vehicle target position vehManager.m_vehicles.m_buffer[vehicleId].m_targetPos0 = new Vector4(vehLanePos.x, vehLanePos.y, vehLanePos.z, 2f); // update other fields vehManager.m_vehicles.m_buffer[vehicleId].m_flags = (vehManager.m_vehicles.m_buffer[vehicleId].m_flags | Vehicle.Flags.Stopped); vehManager.m_vehicles.m_buffer[vehicleId].m_path = instanceData.m_path; vehManager.m_vehicles.m_buffer[vehicleId].m_pathPositionIndex = 0; vehManager.m_vehicles.m_buffer[vehicleId].m_lastPathOffset = vehLaneOffset; vehManager.m_vehicles.m_buffer[vehicleId].m_transferSize = (ushort)(instanceData.m_citizen & 65535u); if (!vehicleInfo.m_vehicleAI.TrySpawn(vehicleId, ref vehManager.m_vehicles.m_buffer[vehicleId])) { #if DEBUG if (debug) { Log._Debug($"CustomHumanAI.EnterParkedCar({instanceID}): Could not spawn a {vehicleInfo.m_vehicleType} for citizen instance {instanceID}!"); } #endif return(false); } // change instances InstanceID parkedVehInstance = InstanceID.Empty; parkedVehInstance.ParkedVehicle = parkedVehicleId; InstanceID vehInstance = InstanceID.Empty; vehInstance.Vehicle = vehicleId; Singleton <InstanceManager> .instance.ChangeInstance(parkedVehInstance, vehInstance); // set vehicle id for citizen instance instanceData.m_path = 0u; citManager.m_citizens.m_buffer[instanceData.m_citizen].SetParkedVehicle(instanceData.m_citizen, 0); citManager.m_citizens.m_buffer[instanceData.m_citizen].SetVehicle(instanceData.m_citizen, vehicleId, 0u); // update citizen instance flags instanceData.m_flags &= ~CitizenInstance.Flags.WaitingPath; instanceData.m_flags &= ~CitizenInstance.Flags.EnteringVehicle; instanceData.m_flags &= ~CitizenInstance.Flags.TryingSpawnVehicle; instanceData.m_flags &= ~CitizenInstance.Flags.BoredOfWaiting; instanceData.m_waitCounter = 0; // unspawn citizen instance instanceData.Unspawn(instanceID); #if DEBUG if (fineDebug) { Log._Debug($"CustomHumanAI.EnterParkedCar({instanceID}): Citizen instance {instanceID} is now entering vehicle {vehicleId}. Set vehicle target position to {vehLanePos} (segment={vehLanePathPos.m_segment}, lane={vehLanePathPos.m_lane}, offset={vehLanePathPos.m_offset})"); } #endif return(true); } else { // failed to find a road position #if DEBUG if (debug) { Log._Debug($"CustomHumanAI.EnterParkedCar({instanceID}): Could not find a road position for citizen instance {instanceID} near parked vehicle {parkedVehicleId}!"); } #endif return(false); } }
public MoveableNode(InstanceID instanceID) : base(instanceID) { }
private void UpdateHearses() { SkylinesOverwatch.Data data = SkylinesOverwatch.Data.Instance; Vehicle[] vehicles = Singleton<VehicleManager>.instance.m_vehicles.m_buffer; InstanceID instanceID = new InstanceID(); foreach (ushort id in data.VehiclesUpdated) { if (!data.IsHearse(id)) continue; Vehicle v = vehicles[id]; /* * If a hearse is loading corpse, we will remove it from the vehicle grid, * so other cars can pass it and more than one hearse can service a building. * It doesn't really make sense that only one hearse can be at a high rise * at a time. */ if ((v.m_flags & Vehicle.Flags.Stopped) != Vehicle.Flags.None) { if (!_stopped.Contains(id)) { Singleton<VehicleManager>.instance.RemoveFromGrid(id, ref vehicles[id], false); _stopped.Add(id); } continue; } else _stopped.Remove(id); if (!_cemeteries.ContainsKey(v.m_sourceBuilding)) continue; if (v.Info.m_vehicleAI.GetLocalizedStatus(id, ref v, out instanceID) != _collecting) continue; ushort target = _cemeteries[v.m_sourceBuilding].AssignTarget(id); if (target != 0 && target != v.m_targetBuilding) v.Info.m_vehicleAI.SetTarget(id, ref vehicles[id], target); } }
internal void GetTags(ushort buildingId, Building data, List<osmWayTag> tags, ref string amenity) { var service = data.Info.m_class.m_service; var ss = data.Info.m_class.m_subService; var landuse = ""; var building = ""; var name = ""; var className = data.Info.m_class.name.ToLower(); switch (service) { case ItemClass.Service.Beautification: if (className.Contains("marker")){ return; } landuse = "recreation_ground"; break; case ItemClass.Service.Commercial: building = "retail"; break; case ItemClass.Service.Residential: building = "residential"; break; case ItemClass.Service.Office: building = "commercial"; break; case ItemClass.Service.Industrial: building = "industrial"; break; case ItemClass.Service.Garbage: landuse = "landfill"; break; case ItemClass.Service.Education: amenity = "school"; building = "school"; break; case ItemClass.Service.Electricity: tags.Add(new osmWayTag { k = "power", v = "plant" }); break; case ItemClass.Service.FireDepartment: amenity = "fire_station"; building = "yes"; break; case ItemClass.Service.HealthCare: amenity = "hospital"; building = "yes"; break; case ItemClass.Service.Monument: name = data.Info.name; building = "yes"; break; case ItemClass.Service.PoliceDepartment: amenity = "police"; building = "yes"; break; case ItemClass.Service.PublicTransport: if (!className.Contains("facility")) { return; } if (ss == ItemClass.SubService.PublicTransportMetro) { } else { } building = "train_station"; break; case ItemClass.Service.Tourism: building = "hotel"; break; default: return; } if ((data.m_flags & Building.Flags.CustomName) != Building.Flags.None) { var id = new InstanceID(); id.Building = buildingId; name = Singleton<InstanceManager>.instance.GetName(id); } if (landuse != ""){ tags.Add(new osmWayTag { k = "landuse", v = landuse }); } if (building != "") { tags.Add(new osmWayTag { k = "building", v = building }); } if (name != "") { tags.Add(new osmWayTag { k = "name", v = name }); } }
private void RemoveTargetFromJobs( InstanceID targetInstanceID ) { foreach( KeyValuePair<double, LinkedList<HotSpotTarget>> kvp in m_JobCollection ) { //-- Iterate over the targets for this job LinkedListNode<HotSpotTarget> targetIter = kvp.Value.First; while( null != targetIter ) { if( targetInstanceID == targetIter.Value.TargetEntityID ) { //-- We found the matching target, remove it from the job kvp.Value.Remove( targetIter ); //-- The system is designed in such a way that every unique target // is only in the job collection once, so we can stop here return; } //-- Next job target targetIter = targetIter.Next; } } }
public override void Update() { if (FavCimsMainClass.UnLoading) return; if (MyInstanceID.IsEmpty) { //GameObject.Destroy (this.gameObject); return; } if (this.MyInstanceID != this.PrevMyInstanceID) { //clear old var; this.DogOwner = 0; //this.CarOwner = 0; this.FirstRun = true; this.PrevMyInstanceID = this.MyInstanceID; } this.seconds -= 1 * Time.deltaTime; if (this.seconds <= 0 || this.FirstRun) { this.execute = true; this.seconds = Run; } else { this.execute = false; } }
protected override void register_database() { test1_index = manager.database.addData <int>(this.name + InstanceID.ToString() + "test1", test1); }
private Triple(InstanceID id) { Console.WriteLine (string.Format ("Instatnce {0} was created.", (int)id)); }
public bool Equals( InstanceID other ) { return (m_ID == other.m_ID); }
private void SetupRates(BuildingAI ai, Building building, InstanceID instanceId, ref float widestWidth) { bool _ = ai.GetFireParameters(instanceId.Building, ref building, out FireHazard, out int _, out FireTolerance); switch (SelectedBuilding.m_class.m_service) { case ItemClass.Service.Industrial: { var industrialAI = (IndustrialBuildingAI)ai; ElectricityConsumption = industrialAI.GetElectricityRate(instanceId.Building, ref building); WaterConsumption = industrialAI.GetWaterRate(instanceId.Building, ref building); IncomeAccumulation = industrialAI.GetResourceRate(instanceId.Building, ref building, EconomyManager.Resource.PrivateIncome); GarbageAccumulation = industrialAI.GetGarbageRate(instanceId.Building, ref building); LevelUpInfo = industrialAI.GetLevelUpInfo(instanceId.Building, ref building, out LevelUpProgress); Pollution = industrialAI.GetResourceRate(instanceId.Building, ref building, NaturalResourceManager.Resource.Pollution); NoisePollution = industrialAI.GetResourceRate(instanceId.Building, ref building, ImmaterialResourceManager.Resource.NoisePollution); var transferMethod = industrialAI.GetType().GetMethod("GetOutgoingTransferReason", BindingFlags.Instance | BindingFlags.NonPublic); _transferReason = (TransferManager.TransferReason)transferMethod.Invoke(industrialAI, null); ProducedProduct = _transferReason.ToString(); } break; case ItemClass.Service.Commercial: { var commercialAI = (CommercialBuildingAI)ai; LevelUpInfo = commercialAI.GetLevelUpInfo(instanceId.Building, ref building, out LevelUpProgress); Pollution = commercialAI.GetResourceRate(instanceId.Building, ref building, NaturalResourceManager.Resource.Pollution); NoisePollution = commercialAI.GetResourceRate(instanceId.Building, ref building, ImmaterialResourceManager.Resource.NoisePollution); ElectricityConsumption = commercialAI.GetElectricityRate(instanceId.Building, ref building); WaterConsumption = commercialAI.GetWaterRate(instanceId.Building, ref building); IncomeAccumulation = commercialAI.GetResourceRate(instanceId.Building, ref building, EconomyManager.Resource.PrivateIncome); GarbageAccumulation = commercialAI.GetGarbageRate(instanceId.Building, ref building); IncomingResource = commercialAI.m_incomingResource.ToString(); var transferMethod = commercialAI.GetType().GetMethod("GetOutgoingTransferReason", BindingFlags.Instance | BindingFlags.NonPublic); _transferReason = (TransferManager.TransferReason)transferMethod.Invoke(commercialAI, null); ProducedProduct = _transferReason.ToString(); } break; case ItemClass.Service.Residential: { var residentialAI = (ResidentialBuildingAI)ai; /* * ElectricityConsumption = residentialAI.GetElectricityRate(instanceId.Building, ref building); * WaterConsumption = residentialAI.GetWaterRate(instanceId.Building, ref building); * IncomeAccumulation = residentialAI.GetResourceRate(instanceId.Building, ref building, * EconomyManager.Resource.PrivateIncome); * GarbageAccumulation = residentialAI.GetGarbageRate(instanceId.Building, ref building); */ residentialAI.GetConsumptionRates(SelectedBuilding.GetClassLevel(), new Randomizer(instanceId.Building), 100, out ElectricityConsumption, out WaterConsumption, out SewageAccumulation, out GarbageAccumulation, out IncomeAccumulation, out MailAccumulation); LevelUpInfo = residentialAI.GetLevelUpInfo(instanceId.Building, ref building, out LevelUpProgress); Pollution = residentialAI.GetResourceRate(instanceId.Building, ref building, NaturalResourceManager.Resource.Pollution); NoisePollution = residentialAI.GetResourceRate(instanceId.Building, ref building, ImmaterialResourceManager.Resource.NoisePollution); } break; } Dictionary <string, int> _consumptionRates = new Dictionary <string, int> { { "Electricity Consumption", ElectricityConsumption }, { "Water Consumption", WaterConsumption }, { "Sewage Accumulation", SewageAccumulation }, { "Garbage Accumulation", GarbageAccumulation }, { "Income Accumulation", IncomeAccumulation }, { "Pollution", Pollution }, { "Noise Pollution", NoisePollution }, { "Fire Hazard", FireHazard }, { "Fire Tolerance", FireTolerance }, { "Mail Accumulation", MailAccumulation } }; foreach (var kvp in _consumptionRates) { var label = AddUIComponent <UILabel>(); label.name = kvp.Key + "Label"; label.text = kvp.Key; label.textScale = 0.9f; label.isInteractive = false; Inputs.Add(UiUtils.CreateInfoField(this, kvp.Key, kvp.Value)); _labels.Add(label); if (label.width + UiUtils.FieldWidth + UiUtils.FieldMargin * 6 > widestWidth) { widestWidth = label.width + UiUtils.FieldWidth + UiUtils.FieldMargin * 6; } } if (!string.IsNullOrEmpty(IncomingResource)) { var resourceLabel = AddUIComponent <UILabel>(); resourceLabel.name = "IncomingResourceLabel"; resourceLabel.text = "Incoming Resource"; resourceLabel.textScale = 0.9f; resourceLabel.isInteractive = false; Inputs.Add(UiUtils.CreateInfoField(this, "IncomingResource", -201, IncomingResource)); _labels.Add(resourceLabel); if (resourceLabel.width + UiUtils.FieldWidth + UiUtils.FieldMargin * 6 > widestWidth) { widestWidth = resourceLabel.width + UiUtils.FieldWidth + UiUtils.FieldMargin * 6; } } if (!string.IsNullOrEmpty(ProducedProduct)) { var producedLabel = AddUIComponent <UILabel>(); producedLabel.name = "OutgoingResource"; producedLabel.text = "Outgoing Resource"; producedLabel.textScale = 0.9f; producedLabel.isInteractive = false; Inputs.Add(UiUtils.CreateInfoField(this, "OutgoingResource", -201, ProducedProduct)); _labels.Add(producedLabel); if (producedLabel.width + UiUtils.FieldWidth + UiUtils.FieldMargin * 6 > widestWidth) { widestWidth = producedLabel.width + UiUtils.FieldWidth + UiUtils.FieldMargin * 6; } } }
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/////////////// }
internal void GetTags(ushort buildingId, Building data, List<osmWayTag> tags, ref string amenity) { var service = data.Info.m_class.m_service; var ss = data.Info.m_class.m_subService; var landuse = ""; var building = ""; var name = ""; var className = data.Info.m_class.name.ToLower(); if (servicesList.ContainsKey(service.ToString())) servicesList[service.ToString()]++; else servicesList[service.ToString()] = 1; if (subServicesList.ContainsKey(ss.ToString())) subServicesList[ss.ToString()]++; else subServicesList[ss.ToString()] = 1; if (classNameList.ContainsKey(className)) classNameList[className]++; else classNameList[className] = 1; if ((data.m_flags & Building.Flags.CustomName) != Building.Flags.None) { var id = new InstanceID(); id.Building = buildingId; name = Singleton<InstanceManager>.instance.GetName(id); } switch (service) { case ItemClass.Service.Beautification: if (className.Contains("marker")){ return; } landuse = "recreation_ground"; break; case ItemClass.Service.Commercial: building = "retail"; break; case ItemClass.Service.Residential: building = "residential"; break; case ItemClass.Service.Office: building = "commercial"; break; case ItemClass.Service.Industrial: building = "industrial"; break; case ItemClass.Service.Garbage: landuse = "landfill"; break; case ItemClass.Service.Education: amenity = "school"; building = "school"; break; case ItemClass.Service.Electricity: tags.Add(new osmWayTag { k = "power", v = "plant" }); break; case ItemClass.Service.FireDepartment: amenity = "fire_station"; building = "yes"; break; case ItemClass.Service.HealthCare: amenity = "hospital"; building = "yes"; break; case ItemClass.Service.Monument: name = data.Info.name; building = "yes"; break; case ItemClass.Service.PoliceDepartment: amenity = "police"; building = "yes"; break; case ItemClass.Service.PublicTransport: if (!className.Contains("facility")) { return; } if (ss == ItemClass.SubService.PublicTransportBus) { tags.Add(new osmWayTag { k = "amenity", v = "bus_station" }); tags.Add(new osmWayTag { k = "public_transport", v = "station" }); } else if(ss == ItemClass.SubService.PublicTransportTrain) { tags.Add(new osmWayTag { k = "public_transport", v = "station" }); tags.Add(new osmWayTag { k = "railway", v = "station" }); } else if(ss == ItemClass.SubService.PublicTransportTaxi) { tags.Add(new osmWayTag { k = "amenity", v = "taxi" }); tags.Add(new osmWayTag { k = "capacity", v = "8" }); } else if(ss == ItemClass.SubService.PublicTransportPlane) { tags.Add(new osmWayTag { k = "aeroway", v = "terminal" }); } else if(ss == ItemClass.SubService.PublicTransportMetro) { tags.Add(new osmWayTag { k = "railway", v = "subway_entrance" }); } else if(ss == ItemClass.SubService.PublicTransportShip) { tags.Add(new osmWayTag { k = "amenity", v = "ferry_terminal" }); } break; case ItemClass.Service.Tourism: building = "hotel"; break; default: return; } if(className.Contains("beautificationitem")) { tags.Add(new osmWayTag { k = "tourism", v = "attraction" }); tags.Add(new osmWayTag { k = "building", v = "yes" }); } if (landuse != ""){ tags.Add(new osmWayTag { k = "landuse", v = landuse }); } if (building != "") { tags.Add(new osmWayTag { k = "building", v = building }); } if (name != "") { name = cleanUpName(name); tags.Add(new osmWayTag { k = "name", v = name }); } }
internal void Activity(uint m_citizen, UIButton ButtVehicle, UIButton ButtDestination, out InstanceID VehID, out InstanceID MyTargetID) { VehID = InstanceID.Empty; MyTargetID = InstanceID.Empty; if (m_citizen == 0) return; ushort instance = this.MyCitizen.m_citizens.m_buffer[m_citizen].m_instance; CitizenInstance Cinstance = this.MyCitizen.m_instances.m_buffer [instance]; if (Cinstance.m_targetBuilding != 0) { ushort veh = this.MyCitizen.m_citizens.m_buffer [m_citizen].m_vehicle; //bool GoingOutside = (MyBuilding.m_buildings.m_buffer [this.citizenInstance.m_targetBuilding].m_flags & Building.Flags.IncomingOutgoing) != Building.Flags.None; if (veh != 0) { VehID.Vehicle = veh; ButtVehicle.isEnabled = true; VehicleInfo VehInfo = this.MyVehicle.m_vehicles.m_buffer [veh].Info; string CitizenVehicleName = this.MyVehicle.GetVehicleName (veh); if (VehInfo.m_class.m_service == ItemClass.Service.Residential) { if (VehInfo.m_vehicleAI.GetOwnerID (veh, ref MyVehicle.m_vehicles.m_buffer [veh]).Citizen == m_citizen) { ButtVehicle.normalBgSprite = "IconCitizenVehicle"; ButtVehicle.hoveredBgSprite = "IconTouristVehicle"; ButtVehicle.tooltip = CitizenVehicleName; } } else if (VehInfo.m_class.m_service == ItemClass.Service.PublicTransport) { switch (VehInfo.m_class.m_subService) { case ItemClass.SubService.PublicTransportBus: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportBus"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportBusHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportBusFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportBusPressed"; this.FavCimsLastActivityVehicleButton.tooltip = CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Bus"); break; case ItemClass.SubService.PublicTransportMetro: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportMetro"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportMetroHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportMetroFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportMetroPressed"; this.FavCimsLastActivityVehicleButton.tooltip = CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Metro"); break; case ItemClass.SubService.PublicTransportPlane: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportPlane"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportPlaneHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportPlaneFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportPlanePressed"; this.FavCimsLastActivityVehicleButton.tooltip = CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Plane"); break; case ItemClass.SubService.PublicTransportShip: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportShip"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportShipHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportShipFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportShipPressed"; this.FavCimsLastActivityVehicleButton.tooltip = CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Ship"); break; case ItemClass.SubService.PublicTransportTrain: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportTrain"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportTrainHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportTrainFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportTrainPressed"; if (CitizenVehicleName == "VEHICLE_TITLE[Train Passenger]:0") CitizenVehicleName = Locale.Get ("VEHICLE_TITLE", "Train Engine"); this.FavCimsLastActivityVehicleButton.tooltip = CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Train"); break; } } } else { ButtVehicle.disabledBgSprite = "InfoIconPopulationDisabled"; ButtVehicle.isEnabled = false; ButtVehicle.tooltip = FavCimsLang.text ("Vehicle_on_foot"); } } else { ButtVehicle.disabledBgSprite = "InfoIconPopulationDisabled"; ButtVehicle.isEnabled = false; ButtVehicle.tooltip = null; } //Citizen Status CitizenInstanceID.Citizen = m_citizen; CitizenInfo citizenInfo = this.MyCitizen.m_citizens.m_buffer [m_citizen].GetCitizenInfo (m_citizen); string CitizenStatus = citizenInfo.m_citizenAI.GetLocalizedStatus (m_citizen, ref this.MyCitizen.m_citizens.m_buffer [m_citizen], out MyTargetID); string CitizenTarget = this.MyBuilding.GetBuildingName (MyTargetID.Building, CitizenInstanceID); ButtDestination.text = CitizenStatus + " " + CitizenTarget; if (!MyTargetID.IsEmpty) { //District int TargetDistrict = (int)MyDistrict.GetDistrict (this.MyBuilding.m_buildings.m_buffer [MyTargetID.Index].m_position); if (TargetDistrict == 0) { ButtDestination.tooltip = FavCimsLang.text ("DistrictLabel") + FavCimsLang.text ("DistrictNameNoDistrict"); } else { ButtDestination.tooltip = FavCimsLang.text ("DistrictLabel") + MyDistrict.GetDistrictName (TargetDistrict); } } }
private void Awake() { TLMUtils.clearAllVisibilityEvents(this.GetComponent <UIPanel>()); base.component.eventZOrderChanged += delegate(UIComponent c, int r) { this.SetBackgroundColor(); }; this.m_LineIsVisible = base.Find <UICheckBox>("LineVisible"); this.m_LineIsVisible.eventCheckChanged += delegate(UIComponent c, bool r) { if (this.m_LineID != 0) { Singleton <SimulationManager> .instance.AddAction(delegate { if (r) { TransportLine[] expr_2A_cp_0 = Singleton <TransportManager> .instance.m_lines.m_buffer; ushort expr_2A_cp_1 = this.m_LineID; expr_2A_cp_0[(int)expr_2A_cp_1].m_flags = (expr_2A_cp_0[(int)expr_2A_cp_1].m_flags & ~TransportLine.Flags.Hidden); } else { TransportLine[] expr_5C_cp_0 = Singleton <TransportManager> .instance.m_lines.m_buffer; ushort expr_5C_cp_1 = this.m_LineID; expr_5C_cp_0[(int)expr_5C_cp_1].m_flags = (expr_5C_cp_0[(int)expr_5C_cp_1].m_flags | TransportLine.Flags.Hidden); } }); } }; this.m_LineColor = base.Find <UIColorField>("LineColor"); this.m_LineColor.normalBgSprite = ""; this.m_LineColor.focusedBgSprite = ""; this.m_LineColor.hoveredBgSprite = ""; this.m_LineColor.width = 40; this.m_LineColor.height = 40; this.m_LineColor.atlas = TLMController.taLineNumber; this.m_LineNumberFormatted = this.m_LineColor.GetComponentInChildren <UIButton>(); m_LineNumberFormatted.textScale = 1.5f; m_LineNumberFormatted.useOutline = true; this.m_LineColor.eventSelectedColorChanged += new PropertyChangedEventHandler <Color>(this.OnColorChanged); this.m_LineName = base.Find <UILabel>("LineName"); this.m_LineNameField = this.m_LineName.Find <UITextField>("LineNameField"); this.m_LineNameField.maxLength = 256; this.m_LineNameField.eventTextChanged += new PropertyChangedEventHandler <string>(this.OnRename); this.m_LineName.eventMouseEnter += delegate(UIComponent c, UIMouseEventParameter r) { this.m_LineName.backgroundSprite = "TextFieldPanelHovered"; }; this.m_LineName.eventMouseLeave += delegate(UIComponent c, UIMouseEventParameter r) { this.m_LineName.backgroundSprite = string.Empty; }; this.m_LineName.eventClick += delegate(UIComponent c, UIMouseEventParameter r) { this.m_LineNameField.Show(); this.m_LineNameField.text = this.m_LineName.text; this.m_LineNameField.Focus(); }; this.m_LineNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r) { this.m_LineNameField.Hide(); this.m_LineName.text = this.m_LineNameField.text; }; this.m_DayLine = base.Find <UICheckBox>("DayLine"); this.m_NightLine = base.Find <UICheckBox>("NightLine"); this.m_DayNightLine = base.Find <UICheckBox>("DayNightLine"); m_DisabledLine = GameObject.Instantiate(base.Find <UICheckBox>("DayLine"), m_DayLine.transform.parent); this.m_DayLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c) { ushort lineID = this.m_LineID; if (Singleton <SimulationManager> .exists && lineID != 0) { m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate { changeLineTime(true, false); }); } }; this.m_NightLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c) { ushort lineID = this.m_LineID; if (Singleton <SimulationManager> .exists && lineID != 0) { m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate { changeLineTime(false, true); }); } }; this.m_DayNightLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c) { ushort lineID = this.m_LineID; if (Singleton <SimulationManager> .exists && lineID != 0) { m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate { changeLineTime(true, true); }); } }; m_DisabledLine.eventClicked += delegate(UIComponent comp, UIMouseEventParameter c) { ushort lineID = this.m_LineID; if (Singleton <SimulationManager> .exists && lineID != 0) { m_LineOperation = Singleton <SimulationManager> .instance.AddAction(delegate { changeLineTime(false, false); }); } }; if (TLMSingleton.isIPTLoaded) { m_DisabledLine.isEnabled = false; m_DisabledLine.isVisible = false; } else { m_NightLine.relativePosition = new Vector3(678, 8); m_DayNightLine.relativePosition = new Vector3(704, 8); } //this.m_noBudgetWarn = GameObject.Instantiate(base.Find<UILabel>("LineName")); //m_noBudgetWarn.transform.SetParent(m_DayLine.transform.parent); //m_noBudgetWarn.isInteractive = false; //m_noBudgetWarn.relativePosition = new Vector3(615, 2); //m_noBudgetWarn.width = 145; //m_noBudgetWarn.isVisible = false; //m_noBudgetWarn.text = ""; //m_noBudgetWarn.textScale = 0.9f; //m_noBudgetWarn.localeID = "TLM_LINE_DISABLED_NO_BUDGET"; this.m_LineStops = base.Find <UILabel>("LineStops"); this.m_LinePassengers = base.Find <UILabel>("LinePassengers"); this.m_LineVehicles = base.Find <UILabel>("LineVehicles"); //m_LinePassengers.relativePosition -= new Vector3(0, 6, 0); m_LineVehicles.relativePosition = new Vector3(m_LineVehicles.relativePosition.x, 5, 0); m_lineBudgetLabel = GameObject.Instantiate(this.m_LineStops, m_LineStops.transform.parent); //m_LineEarnings = GameObject.Instantiate(this.m_LinePassengers); //m_LineEarnings.transform.SetParent(m_LineStops.transform.parent); //m_LineEarnings.textColor = Color.green; this.m_Background = base.Find("Background"); this.m_BackgroundColor = this.m_Background.color; this.m_mouseIsOver = false; base.component.eventMouseEnter += new MouseEventHandler(this.OnMouseEnter); base.component.eventMouseLeave += new MouseEventHandler(this.OnMouseLeave); base.Find <UIButton>("DeleteLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r) { if (this.m_LineID != 0) { ConfirmPanel.ShowModal("CONFIRM_LINEDELETE", delegate(UIComponent comp, int ret) { if (ret == 1) { Singleton <SimulationManager> .instance.AddAction(delegate { Singleton <TransportManager> .instance.ReleaseLine(this.m_LineID); }); } }); } }; base.Find <UIButton>("ViewLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r) { if (this.m_LineID != 0) { Vector3 position = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)Singleton <TransportManager> .instance.m_lines.m_buffer[(int)this.m_LineID].m_stops].m_position; InstanceID instanceID = default(InstanceID); instanceID.TransportLine = this.m_LineID; TLMController.instance.lineInfoPanel.openLineInfo(lineID); TLMController.instance.defaultListingLinesPanel.Hide(); } }; base.component.eventVisibilityChanged += delegate(UIComponent c, bool v) { if (v) { this.RefreshData(true, true); } }; //Auto color & Auto Name TLMUtils.createUIElement(out UIButton buttonAutoName, transform); buttonAutoName.pivot = UIPivotPoint.TopRight; buttonAutoName.relativePosition = new Vector3(164, 2); buttonAutoName.text = "A"; buttonAutoName.textScale = 0.6f; buttonAutoName.width = 15; buttonAutoName.height = 15; buttonAutoName.tooltip = Locale.Get("TLM_AUTO_NAME_SIMPLE_BUTTON_TOOLTIP"); TLMUtils.initButton(buttonAutoName, true, "ButtonMenu"); buttonAutoName.name = "AutoName"; buttonAutoName.isVisible = true; buttonAutoName.eventClick += (component, eventParam) => { DoAutoName(); }; TLMUtils.createUIElement(out UIButton buttonAutoColor, transform); buttonAutoColor.pivot = UIPivotPoint.TopRight; buttonAutoColor.relativePosition = new Vector3(90, 2); buttonAutoColor.text = "A"; buttonAutoColor.textScale = 0.6f; buttonAutoColor.width = 15; buttonAutoColor.height = 15; buttonAutoColor.tooltip = Locale.Get("TLM_AUTO_COLOR_SIMPLE_BUTTON_TOOLTIP"); TLMUtils.initButton(buttonAutoColor, true, "ButtonMenu"); buttonAutoColor.name = "AutoColor"; buttonAutoColor.isVisible = true; buttonAutoColor.eventClick += (component, eventParam) => { DoAutoColor(); }; m_lineIncompleteWarning = base.Find <UIPanel>("WarningIncomplete"); TLMUtils.createUIElement(out m_perHourBudgetInfo, transform); m_perHourBudgetInfo.name = "PerHourIndicator"; m_perHourBudgetInfo.autoSize = false; m_perHourBudgetInfo.autoHeight = true; m_perHourBudgetInfo.anchor = UIAnchorStyle.CenterHorizontal | UIAnchorStyle.CenterVertical; m_perHourBudgetInfo.width = 180; m_perHourBudgetInfo.height = m_perHourBudgetInfo.parent.height; m_perHourBudgetInfo.verticalAlignment = UIVerticalAlignment.Middle; m_perHourBudgetInfo.textAlignment = UIHorizontalAlignment.Center; m_perHourBudgetInfo.textScale = 1f; m_perHourBudgetInfo.localeID = "TLM_PER_HOUR_BUDGET_ACTIVE_LABEL"; m_perHourBudgetInfo.wordWrap = true; m_perHourBudgetInfo.eventTextChanged += constraintedScale; constraintedScale(m_perHourBudgetInfo, ""); }
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()); } }
private static Matrix4x4 RenderProp(ushort refId, float refAngleRad, RenderManager.CameraInfo cameraInfo, PropInfo propInfo, Color propColor, Vector3 position, Vector4 dataVector, int idx, Vector3 rotation, Vector3 scale, int layerMask, out bool rendered, InstanceID propRenderID2) { rendered = false; var randomizer = new Randomizer((refId << 6) | (idx + 32)); Matrix4x4 matrix = default; matrix.SetTRS(position, Quaternion.AngleAxis(rotation.y + (refAngleRad * Mathf.Rad2Deg), Vector3.down) * Quaternion.AngleAxis(rotation.x, Vector3.left) * Quaternion.AngleAxis(rotation.z, Vector3.back), scale); if (propInfo != null) { propInfo = propInfo.GetVariation(ref randomizer); if (cameraInfo.CheckRenderDistance(position, propInfo.m_maxRenderDistance * scale.sqrMagnitude)) { int oldLayerMask = cameraInfo.m_layerMask; float oldRenderDist = propInfo.m_lodRenderDistance; propInfo.m_lodRenderDistance *= scale.sqrMagnitude; cameraInfo.m_layerMask = 0x7FFFFFFF; try { PropInstance.RenderInstance(cameraInfo, propInfo, propRenderID2, matrix, position, scale.y, refAngleRad + (rotation.y * Mathf.Deg2Rad), propColor, dataVector, true); } finally { propInfo.m_lodRenderDistance = oldRenderDist; cameraInfo.m_layerMask = oldLayerMask; } rendered = true; } } return(matrix); }
public void GoToInstance(InstanceID Target) { if (Target.IsEmpty) return; try { if (MyInstance.SelectInstance (Target)) { if (Input.GetMouseButton (1)) { //ToolsModifierControl.cameraController.SetTarget(Target, ToolsModifierControl.cameraController.transform.position, false); DefaultTool.OpenWorldInfoPanel(Target, ToolsModifierControl.cameraController.transform.position); } else if (Input.GetMouseButton (0)) { ToolsModifierControl.cameraController.SetTarget(Target, ToolsModifierControl.cameraController.transform.position, true); DefaultTool.OpenWorldInfoPanel(Target, ToolsModifierControl.cameraController.transform.position); } } } catch/*(Exception e)*/ { //Debug.Error("Can't find Target " + e.ToString()); } }
protected override void OnToolUpdate() { base.OnToolUpdate(); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastInput input = new RaycastInput(ray, Camera.main.farClipPlane) { m_ignoreTerrain = false, m_ignoreSegmentFlags = NetSegment.Flags.Untouchable, m_ignoreNodeFlags = NetNode.Flags.All, m_ignorePropFlags = PropInstance.Flags.None, m_ignoreTreeFlags = TreeInstance.Flags.None, m_ignoreBuildingFlags = Building.Flags.None, m_ignoreCitizenFlags = CitizenInstance.Flags.All, m_ignoreVehicleFlags = Vehicle.Flags.Created, m_ignoreDisasterFlags = DisasterData.Flags.All, m_ignoreTransportFlags = TransportLine.Flags.All, m_ignoreParkedVehicleFlags = VehicleParked.Flags.All, m_ignoreParkFlags = DistrictPark.Flags.All }; RayCast(input, out RaycastOutput output); // Set the world mouse position (useful for my implementation of StepOver) mouseCurrentPosition = output.m_hitPos; objectBuffer.Clear(); if (output.m_netSegment != 0) { objectBuffer.Add(new InstanceID() { NetSegment = output.m_netSegment }); } if (output.m_treeInstance != 0) { objectBuffer.Add(new InstanceID() { Tree = output.m_treeInstance }); } if (output.m_propInstance != 0) { objectBuffer.Add(new InstanceID() { Prop = output.m_propInstance }); } if (output.m_building != 0) { objectBuffer.Add(new InstanceID() { Building = output.m_building }); } objectBuffer.Sort((a, b) => Vector3.Distance(a.Position(), mouseCurrentPosition).CompareTo(Vector3.Distance(b.Position(), mouseCurrentPosition))); if (objectBuffer.Count > 0) { hoveredId = objectBuffer[0]; } else { hoveredId = InstanceID.Empty; } // A prefab has been selected. Find it in the UI and enable it. if (Input.GetKeyDown(KeyCode.Return) || Input.GetMouseButtonDown(0)) { PrefabInfo info = hoveredId.Info(); if (info == null) { enabled = false; ToolsModifierControl.SetTool <DefaultTool>(); return; } Activate(info); } // Escape key or RMB hit = disable the tool if (Input.GetKeyDown(KeyCode.Escape) || Input.GetMouseButtonDown(1)) { enabled = false; ToolsModifierControl.SetTool <DefaultTool>(); } }
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 Awake() { TLMUtils.clearAllVisibilityEvents(this.GetComponent <UIPanel>()); base.component.eventZOrderChanged += delegate(UIComponent c, int r) { this.SetBackgroundColor(); }; GameObject.Destroy(base.Find <UICheckBox>("LineVisible").gameObject); GameObject.Destroy(base.Find <UIColorField>("LineColor").gameObject); this.m_depotName = base.Find <UILabel>("LineName"); this.m_depotNameField = this.m_depotName.Find <UITextField>("LineNameField"); this.m_depotNameField.maxLength = 256; this.m_depotNameField.eventTextChanged += new PropertyChangedEventHandler <string>(this.OnRename); this.m_depotName.eventMouseEnter += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotName.backgroundSprite = "TextFieldPanelHovered"; }; this.m_depotName.eventMouseLeave += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotName.backgroundSprite = string.Empty; }; this.m_depotName.eventClick += delegate(UIComponent c, UIMouseEventParameter r) { this.m_depotNameField.Show(); this.m_depotNameField.text = this.m_depotName.text; this.m_depotNameField.Focus(); }; this.m_depotNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r) { this.m_depotNameField.Hide(); this.m_depotName.text = this.m_depotNameField.text; }; GameObject.Destroy(base.Find <UICheckBox>("DayLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("NightLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("DayNightLine").gameObject); this.m_prefixOptions = UIHelperExtension.CloneBasicDropDownNoLabel(new string[] { }, onChangePrefixSelected, gameObject.GetComponent <UIPanel>()); m_prefixOptions.area = new Vector4(600, 3, 80, 33); var m_DayLine = base.Find <UICheckBox>("DayLine"); GameObject.Destroy(base.Find <UICheckBox>("NightLine").gameObject); GameObject.Destroy(base.Find <UICheckBox>("DayNightLine").gameObject); GameObject.Destroy(m_DayLine.gameObject); m_districtName = base.Find <UILabel>("LineStops"); m_districtName.size = new Vector2(175, 18); m_districtName.relativePosition = new Vector3(0, 10); m_districtName.pivot = UIPivotPoint.MiddleCenter; m_districtName.wordWrap = true; m_districtName.autoHeight = true; GameObject.Destroy(base.Find <UILabel>("LinePassengers").gameObject); this.m_prefixesServed = base.Find <UILabel>("LineVehicles"); this.m_prefixesServed.size = new Vector2(220, 35); this.m_prefixesServed.autoHeight = true; this.m_prefixesServed.maximumSize = new Vector2(0, 36); this.m_prefixesServed.textScale = 0.7f; this.m_prefixesServed.width = 170; this.m_Background = base.Find("Background"); this.m_BackgroundColor = this.m_Background.color; this.m_mouseIsOver = false; base.component.eventMouseEnter += new MouseEventHandler(this.OnMouseEnter); base.component.eventMouseLeave += new MouseEventHandler(this.OnMouseLeave); GameObject.Destroy(base.Find <UIButton>("DeleteLine").gameObject); base.Find <UIButton>("ViewLine").eventClick += delegate(UIComponent c, UIMouseEventParameter r) { if (this.m_buildingID != 0) { Vector3 position = Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)this.m_buildingID].m_position; InstanceID instanceID = default(InstanceID); instanceID.Building = this.m_buildingID; TLMController.instance.depotInfoPanel.openDepotInfo(m_buildingID); ToolsModifierControl.cameraController.SetTarget(instanceID, position, true); TLMController.instance.defaultListingLinesPanel.Hide(); } }; base.component.eventVisibilityChanged += delegate(UIComponent c, bool v) { if (v) { this.m_prefixOptions.items = new string[] { }; this.RefreshData(); } }; //Buttons TLMUtils.createUIElement <UIButton>(ref m_addPrefixButton, transform); m_addPrefixButton.pivot = UIPivotPoint.TopRight; m_addPrefixButton.relativePosition = new Vector3(730, 2); m_addPrefixButton.text = Locale.Get("TLM_ADD"); m_addPrefixButton.textScale = 0.6f; m_addPrefixButton.width = 50; m_addPrefixButton.height = 15; m_addPrefixButton.tooltip = Locale.Get("TLM_ADD_PREFIX_TOOLTIP"); TLMUtils.initButton(m_addPrefixButton, true, "ButtonMenu"); m_addPrefixButton.name = "Add"; m_addPrefixButton.isVisible = true; m_addPrefixButton.eventClick += (component, eventParam) => { uint prefix = m_prefixOptions.selectedIndex == m_prefixOptions.items.Length - 1 ? 65 : (uint)m_prefixOptions.selectedIndex; TLMDepotAI.addPrefixToDepot(buildingId, prefix); m_addPrefixButton.isVisible = false; m_removePrefixButton.isVisible = true; }; TLMUtils.createUIElement <UIButton>(ref m_removePrefixButton, transform); m_removePrefixButton.pivot = UIPivotPoint.TopRight; m_removePrefixButton.relativePosition = new Vector3(780, 2); m_removePrefixButton.text = Locale.Get("TLM_REMOVE"); m_removePrefixButton.textScale = 0.6f; m_removePrefixButton.width = 50; m_removePrefixButton.height = 15; m_removePrefixButton.tooltip = Locale.Get("TLM_REMOVE_PREFIX_TOOLTIP"); TLMUtils.initButton(m_removePrefixButton, true, "ButtonMenu"); m_removePrefixButton.name = "Remove"; m_removePrefixButton.isVisible = true; m_removePrefixButton.eventClick += (component, eventParam) => { uint prefix = m_prefixOptions.selectedIndex == m_prefixOptions.items.Length - 1 ? 65 : (uint)m_prefixOptions.selectedIndex; TLMDepotAI.removePrefixFromDepot(buildingId, prefix); m_addPrefixButton.isVisible = true; m_removePrefixButton.isVisible = false; }; TLMUtils.createUIElement <UIButton>(ref m_addAllPrefixesButton, transform); m_addAllPrefixesButton.pivot = UIPivotPoint.TopRight; m_addAllPrefixesButton.relativePosition = new Vector3(730, 20); m_addAllPrefixesButton.text = Locale.Get("TLM_ADD_ALL_SHORT");; m_addAllPrefixesButton.textScale = 0.6f; m_addAllPrefixesButton.width = 50; m_addAllPrefixesButton.height = 15; m_addAllPrefixesButton.tooltip = Locale.Get("TLM_ADD_ALL_PREFIX_TOOLTIP"); TLMUtils.initButton(m_addAllPrefixesButton, true, "ButtonMenu"); m_addAllPrefixesButton.name = "AddAll"; m_addAllPrefixesButton.isVisible = true; m_addAllPrefixesButton.eventClick += (component, eventParam) => { TLMDepotAI.addAllPrefixesToDepot(buildingId); m_addPrefixButton.isVisible = false; m_removePrefixButton.isVisible = true; }; TLMUtils.createUIElement <UIButton>(ref m_removeAllPrefixesButton, transform); m_removeAllPrefixesButton.pivot = UIPivotPoint.TopRight; m_removeAllPrefixesButton.relativePosition = new Vector3(780, 20); m_removeAllPrefixesButton.text = Locale.Get("TLM_REMOVE_ALL_SHORT"); m_removeAllPrefixesButton.textScale = 0.6f; m_removeAllPrefixesButton.width = 50; m_removeAllPrefixesButton.height = 15; m_removeAllPrefixesButton.tooltip = Locale.Get("TLM_REMOVE_ALL_PREFIX_TOOLTIP"); TLMUtils.initButton(m_removeAllPrefixesButton, true, "ButtonMenu"); m_removeAllPrefixesButton.name = "RemoveAll"; m_removeAllPrefixesButton.isVisible = true; m_removeAllPrefixesButton.eventClick += (component, eventParam) => { TLMDepotAI.removeAllPrefixesFromDepot(buildingId); m_addPrefixButton.isVisible = true; m_removePrefixButton.isVisible = false; }; }
public override void LateUpdate() { if (FavCimsMainClass.UnLoading) return; if (this.MyInstanceID.IsEmpty || !FavCimsCore.RowID.ContainsKey (citizenINT)) { if(this.MyFamily != null) { this.MyFamily.Hide(); this.MyFamily.MyInstanceID = InstanceID.Empty; this.MyFamily = null; } GameObject.Destroy (this.gameObject); return; } if (this.DeadOrGone || this.HomeLess) { this.OtherInfoButton.isEnabled = false; this.OtherInfoButton.tooltip = FavCimsLang.text ("Citizen_Details_NoUnit"); }else if(GetTemplate() == -1 && (this.MyFamily == null || this.MyFamily.MyInstanceID != MyInstanceID)) { if(this.MyFamily != null && this.MyFamily.MyInstanceID != MyInstanceID) { this.MyFamily = null; } this.OtherInfoButton.isEnabled = false; this.OtherInfoButton.tooltip = FavCimsLang.text ("Citizen_Details_fullTemplate"); } else { if(this.MyFamily != null && this.MyFamily.MyInstanceID == this.MyInstanceID && this.MyFamily.isVisible) { this.OtherInfoButton.normalBgSprite = "CityInfoFocused"; }else{ this.OtherInfoButton.normalBgSprite = "CityInfo"; } this.OtherInfoButton.isEnabled = true; this.OtherInfoButton.tooltip = FavCimsLang.text ("Citizen_Details"); } uint citizen = this.MyInstanceID.Citizen; //Is dead? if((citizen != 0) && this.MyCitizen.m_citizens.m_buffer[citizen].Dead && !this.CitizenIsDead) { this.CitizenIsDead = true; this.CitizenRowData ["deathrealage"] = "0"; } if (this.execute) { try { this.CitizenName = this.MyInstance.GetName (this.MyInstanceID); citizenINT = (int)((UIntPtr)citizen); if (this.CitizenName != null && this.CitizenName.Length > 0 && this.CitizenName != this.MyInstancedName) { this.MyInstancedName = this.CitizenName; } this.citizenInfo = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].GetCitizenInfo (citizen); this.FavCimsRowCloseButton.tooltip = FavCimsLang.text ("FavStarButton_disable_tooltip"); if (this.FavCimsCitizenSingleRowPanel != null && citizen != 0 && this.CitizenName == this.MyInstancedName && FavCimsCore.RowID.ContainsKey (citizenINT)) { //Citizen Gender this.CitizenRowData ["gender"] = Citizen.GetGender (citizen).ToString (); //Name this.CitizenRowData ["name"] = this.MyCitizen.GetCitizenName (citizen); this.FavCimsCitizenName.text = this.CitizenRowData ["name"]; if (this.CitizenRowData ["gender"] == "Female") { this.FavCimsCitizenName.textColor = new Color32 (255, 102, 204, 213); //r,g,b,a } if (this.CitizenDistrict == 0) { this.FavCimsCitizenName.tooltip = FavCimsLang.text ("NowInThisDistrict") + FavCimsLang.text ("DistrictNameNoDistrict"); } else { this.FavCimsCitizenName.tooltip = FavCimsLang.text ("NowInThisDistrict") + MyDistrict.GetDistrictName (this.CitizenDistrict); } //Citizen Health this.tmp_health = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_health; this.CitizenRowData ["health"] = Citizen.GetHealthLevel (this.tmp_health).ToString (); //Citizen Education var tmp_education = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].EducationLevel; this.CitizenRowData ["education"] = tmp_education.ToString (); this.FavCimsEducation.text = FavCimsLang.text ("Education_" + this.CitizenRowData ["education"] + "_" + this.CitizenRowData ["gender"]); if (this.CitizenRowData ["education"] == "ThreeSchools") { this.FavCimsEducation.textColor = new Color32 (102, 204, 0, 60); //r,g,b,a } else if (this.CitizenRowData ["education"] == "TwoSchools") { this.FavCimsEducation.textColor = new Color32 (255, 204, 0, 32); } else if (this.CitizenRowData ["education"] == "OneSchool") { this.FavCimsEducation.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a } else { this.FavCimsEducation.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a } //Citizen Wellbeing this.tmp_wellbeing = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_wellbeing; this.CitizenRowData ["wellbeing"] = Citizen.GetWellbeingLevel (tmp_education, this.tmp_wellbeing).ToString (); //Citizen Happiness this.tmp_happiness = Citizen.GetHappiness (this.tmp_health, this.tmp_wellbeing); //this.CitizenRowData ["happiness"] = Citizen.GetHappinessLevel (this.tmp_happiness).ToString (); //Bad, Poor, Good, Excellent, Suberb this.CitizenRowData ["happiness_icon"] = GetHappinessString (Citizen.GetHappinessLevel (this.tmp_happiness)); this.FavCimsHappyIcon.normalBgSprite = this.CitizenRowData ["happiness_icon"]; this.FavCimsHappyIcon.tooltip = FavCimsLang.text (this.CitizenRowData ["happiness_icon"]); //Age Group (Age Phase) this.tmp_age = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_age; this.CitizenRowData ["agegroup"] = Citizen.GetAgeGroup (this.tmp_age).ToString (); this.FavCimsAgePhase.text = FavCimsLang.text ("AgePhase_" + this.CitizenRowData ["agegroup"] + "_" + this.CitizenRowData ["gender"]); //Real Age this.RealAge = FavCimsCore.CalculateCitizenAge (this.tmp_age); if (this.RealAge <= 12) { //CHILD this.FavCimsRealAge.text = this.RealAge.ToString (); this.FavCimsRealAge.textColor = new Color32 (102, 204, 0, 60); //r,g,b,a this.FavCimsAgePhase.textColor = new Color32 (102, 204, 0, 60); //r,g,b,a } else if (this.RealAge <= 19) { //TEEN this.FavCimsRealAge.text = this.RealAge.ToString (); this.FavCimsRealAge.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a this.FavCimsAgePhase.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a } else if (this.RealAge <= 25) { //YOUNG this.FavCimsRealAge.text = this.RealAge.ToString (); this.FavCimsRealAge.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsAgePhase.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a } else if (this.RealAge <= 65) { //ADULT this.FavCimsRealAge.text = this.RealAge.ToString (); this.FavCimsRealAge.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a this.FavCimsAgePhase.textColor = new Color32 (255, 102, 0, 16); //r,g,b,a } else if (this.RealAge <= 90) { //SENIOR this.FavCimsRealAge.text = this.RealAge.ToString (); this.FavCimsRealAge.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a this.FavCimsAgePhase.textColor = new Color32 (153, 0, 0, 0); //r,g,b,a } else { //FINAL this.FavCimsRealAge.text = this.RealAge.ToString (); this.FavCimsRealAge.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a this.FavCimsAgePhase.textColor = new Color32 (255, 0, 0, 0); //r,g,b,a } //Citizen Home this.CitizenHome = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_homeBuilding; if (this.CitizenHome != 0) { this.HomeLess = false; this.CitizenHomeID.Building = this.CitizenHome; this.FavCimsCitizenHome.text = this.MyBuilding.GetBuildingName (this.CitizenHome, this.MyInstanceID); this.FavCimsCitizenHome.isEnabled = true; this.FavCimsCitizenHomeSprite.texture = TextureDB.FavCimsCitizenHomeTexture; this.HomeInfo = this.MyBuilding.m_buildings.m_buffer [CitizenHomeID.Index].Info; if (this.HomeInfo.m_class.m_service == ItemClass.Service.Residential) { this.FavCimsCitizenHome.tooltip = null; if (this.HomeInfo.m_class.m_subService == ItemClass.SubService.ResidentialHigh) { this.FavCimsCitizenHome.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a this.FavCimsCitizenHomeSprite.texture = TextureDB.FavCimsCitizenHomeTextureHigh; this.FavCimsCitizenHome.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", ItemClass.SubService.ResidentialHigh.ToString ()); } else if (this.HomeInfo.m_class.m_subService == ItemClass.SubService.ResidentialLow) { this.FavCimsCitizenHome.textColor = new Color32 (0, 153, 0, 80); //r,g,b,a this.FavCimsCitizenHomeSprite.texture = TextureDB.FavCimsCitizenHomeTexture; this.FavCimsCitizenHome.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", ItemClass.SubService.ResidentialLow.ToString ()); } switch (this.HomeInfo.m_class.m_level) { case ItemClass.Level.Level5: this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [5]; break; case ItemClass.Level.Level4: this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [4]; break; case ItemClass.Level.Level3: this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [3]; break; case ItemClass.Level.Level2: this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [2]; break; default: this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [1]; break; } /* if (this.HomeInfo.m_class.m_level == ItemClass.Level.Level5) { this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [5]; } else if (this.HomeInfo.m_class.m_level == ItemClass.Level.Level4) { this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [4]; } else if (this.HomeInfo.m_class.m_level == ItemClass.Level.Level3) { this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [3]; } else if (this.HomeInfo.m_class.m_level == ItemClass.Level.Level2) { this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [2]; } else { this.FavCimsCitizenResidentialLevelSprite.texture = TextureDB.FavCimsResidentialLevel [1]; } */ //District this.HomeDistrict = (int)MyDistrict.GetDistrict (this.MyBuilding.m_buildings.m_buffer [CitizenHomeID.Index].m_position); if (this.HomeDistrict == 0) { this.FavCimsCitizenHomeSprite.tooltip = FavCimsLang.text ("DistrictLabel") + FavCimsLang.text ("DistrictNameNoDistrict"); } else { this.FavCimsCitizenHomeSprite.tooltip = FavCimsLang.text ("DistrictLabel") + MyDistrict.GetDistrictName (this.HomeDistrict); } } } else { this.FavCimsCitizenHome.text = FavCimsLang.text ("Citizen_HomeLess"); this.FavCimsCitizenHome.isEnabled = false; this.FavCimsCitizenHomeSprite.texture = TextureDB.FavCimsCitizenHomeTextureHomeless; this.FavCimsCitizenHomeSprite.tooltip = FavCimsLang.text ("DistrictNameNoDistrict"); this.FavCimsCitizenHome.tooltip = FavCimsLang.text ("Citizen_HomeLess_tooltip"); this.FavCimsCitizenResidentialLevelSprite.texture = null; this.HomeLess = true; } //Working Place this.WorkPlace = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_workBuilding; if (this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].GetCurrentSchoolLevel (citizen) != ItemClass.Level.None) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsWorkingPlaceTextureStudent; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; this.FavCimsWorkingPlace.tooltip = Locale.Get ("CITIZEN_SCHOOL_LEVEL", this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].GetCurrentSchoolLevel (citizen).ToString ()); } else if (this.WorkPlace == 0) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; if (this.tmp_age >= 180) { //In Pensione this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsWorkingPlaceTextureRetired; this.FavCimsWorkingPlace.text = FavCimsLang.text ("Citizen_Retired"); this.FavCimsWorkingPlace.isEnabled = false; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Citizen_Retired_tooltip"); this.FavCimsWorkingPlaceSprite.tooltip = null; this.FavCimsWorkingPlaceButtonGamDefImg.tooltip = null; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; } else { this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsWorkingPlaceTexture; //unemployed this.FavCimsWorkingPlace.text = Locale.Get ("CITIZEN_OCCUPATION_UNEMPLOYED"); this.FavCimsWorkingPlace.isEnabled = false; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Unemployed_tooltip"); this.FavCimsWorkingPlaceSprite.tooltip = null; this.FavCimsWorkingPlaceButtonGamDefImg.tooltip = null; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; } } if (this.WorkPlace != 0) { this.WorkPlaceID.Building = this.WorkPlace; this.FavCimsWorkingPlace.text = this.MyBuilding.GetBuildingName (this.WorkPlace, this.MyInstanceID); this.FavCimsWorkingPlace.isEnabled = true; this.WorkInfo = this.MyBuilding.m_buildings.m_buffer [WorkPlaceID.Index].Info; if (this.WorkInfo.m_class.m_service == ItemClass.Service.Commercial) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; if (this.WorkInfo.m_class.m_subService == ItemClass.SubService.CommercialHigh) { this.FavCimsWorkingPlace.textColor = new Color32 (0, 51, 153, 147); //r,g,b,a this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenCommercialHighTexture; this.FavCimsWorkingPlace.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", ItemClass.SubService.CommercialHigh.ToString ()); } else { this.FavCimsWorkingPlace.textColor = new Color32 (0, 153, 204, 130); //r,g,b,a this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenCommercialLowTexture; this.FavCimsWorkingPlace.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", ItemClass.SubService.CommercialLow.ToString ()); } switch (this.WorkInfo.m_class.m_level) { case ItemClass.Level.Level3: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [3]; break; case ItemClass.Level.Level2: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [2]; break; default: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [1]; break; } /* if (this.WorkInfo.m_class.m_level == ItemClass.Level.Level3) { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [3]; } else if (this.WorkInfo.m_class.m_level == ItemClass.Level.Level2) { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [2]; } else { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [1]; } */ } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Industrial) { this.FavCimsWorkingPlace.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsWorkingPlace.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", "Industrial"); switch (this.WorkInfo.m_class.m_subService) { case ItemClass.SubService.IndustrialFarming: this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyFarming"; break; case ItemClass.SubService.IndustrialForestry: this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ResourceForestry"; break; case ItemClass.SubService.IndustrialOil: this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyOil"; break; case ItemClass.SubService.IndustrialOre: this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyOre"; break; default: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenIndustrialGenericTexture; break; } /* if (this.WorkInfo.m_class.m_subService == ItemClass.SubService.IndustrialFarming) { this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyFarming"; } else if (this.WorkInfo.m_class.m_subService == ItemClass.SubService.IndustrialForestry) { this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ResourceForestry"; } else if (this.WorkInfo.m_class.m_subService == ItemClass.SubService.IndustrialOil) { this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyOil"; } else if (this.WorkInfo.m_class.m_subService == ItemClass.SubService.IndustrialOre) { this.FavCimsWorkingPlaceSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyOre"; } else { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenIndustrialGenericTexture; } */ switch (this.WorkInfo.m_class.m_level) { case ItemClass.Level.Level3: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [3]; break; case ItemClass.Level.Level2: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [2]; break; default: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [1]; break; } /* if (this.WorkInfo.m_class.m_level == ItemClass.Level.Level3) { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [3]; } else if (this.WorkInfo.m_class.m_level == ItemClass.Level.Level2) { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [2]; } else { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [1]; } */ } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Office) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = null; this.FavCimsWorkingPlace.textColor = new Color32 (0, 204, 255, 128); //r,g,b,a this.FavCimsWorkingPlaceSprite.texture = TextureDB.FavCimsCitizenOfficeTexture; this.FavCimsWorkingPlace.tooltip = Locale.Get ("ZONEDBUILDING_TITLE", "Office"); switch (this.WorkInfo.m_class.m_level) { case ItemClass.Level.Level3: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [3]; break; case ItemClass.Level.Level2: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [2]; break; default: this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsCommercialLevel [1]; break; } /* if (this.WorkInfo.m_class.m_level == ItemClass.Level.Level3) { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [3]; } else if (this.WorkInfo.m_class.m_level == ItemClass.Level.Level2) { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [2]; } else { this.FavCimsCitizenWorkPlaceLevelSprite.texture = TextureDB.FavCimsIndustrialLevel [1]; } */ } else { this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; this.FavCimsWorkingPlace.textColor = new Color32 (153, 102, 51, 20); //r,g,b,a switch (this.WorkInfo.m_class.m_service) { case ItemClass.Service.FireDepartment: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "InfoIconFireSafety"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "FireDepartment"); break; case ItemClass.Service.HealthCare: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconHealthcareFocused"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Healthcare"); break; case ItemClass.Service.PoliceDepartment: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconPolice"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Police"); break; case ItemClass.Service.Garbage: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyRecycling"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Garbage"); break; case ItemClass.Service.Electricity: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyPowerSaving"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Electricity_job"); break; case ItemClass.Service.Education: this.FavCimsWorkingPlace.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "InfoIconEducationPressed"; break; case ItemClass.Service.Beautification: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "SubBarBeautificationParksnPlazas"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Beautification"); break; case ItemClass.Service.Government: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconGovernment"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Government_job"); break; case ItemClass.Service.Water: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyWaterSaving"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Water_job"); break; case ItemClass.Service.PublicTransport: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyFreePublicTransport"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "PublicTransport"); break; case ItemClass.Service.Monument: this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "FeatureMonumentLevel6"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Monuments"); break; default: this.FavCimsWorkingPlace.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyNone"; this.FavCimsWorkingPlace.tooltip = null; break; } /* if (this.WorkInfo.m_class.m_service == ItemClass.Service.FireDepartment) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "InfoIconFireSafety"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "FireDepartment"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.HealthCare) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconHealthcareFocused"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Healthcare"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.PoliceDepartment) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconPolice"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Police"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Garbage) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyRecycling"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Garbage"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Electricity) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyPowerSaving"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Electricity_job"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Education) { this.FavCimsWorkingPlace.textColor = new Color32 (0, 102, 51, 100); //r,g,b,a this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "InfoIconEducationPressed"; } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Beautification) { //parchi this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "SubBarBeautificationParksnPlazas"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Beautification"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Government) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "ToolbarIconGovernment"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Government_job"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Water) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyWaterSaving"; this.FavCimsWorkingPlace.tooltip = FavCimsLang.text ("Water_job"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.PublicTransport) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyFreePublicTransport"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "PublicTransport"); } else if (this.WorkInfo.m_class.m_service == ItemClass.Service.Monument) { this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "FeatureMonumentLevel6"; this.FavCimsWorkingPlace.tooltip = Locale.Get ("SERVICE_DESC", "Monuments"); } else if (this.WorkInfo.m_class.m_service != ItemClass.Service.None) { this.FavCimsWorkingPlace.textColor = new Color32 (255, 204, 0, 32); //r,g,b,a this.FavCimsWorkingPlaceButtonGamDefImg.normalBgSprite = "IconPolicyNone"; this.FavCimsWorkingPlace.tooltip = null; } */ this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; } //District this.WorkDistrict = (int)MyDistrict.GetDistrict (this.MyBuilding.m_buildings.m_buffer [WorkPlaceID.Index].m_position); if (this.WorkDistrict == 0) { this.FavCimsWorkingPlaceSprite.tooltip = FavCimsLang.text ("DistrictLabel") + FavCimsLang.text ("DistrictNameNoDistrict"); } else { this.FavCimsWorkingPlaceSprite.tooltip = FavCimsLang.text ("DistrictLabel") + MyDistrict.GetDistrictName (this.WorkDistrict); } } else { this.FavCimsWorkingPlace.isEnabled = false; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; this.FavCimsWorkingPlaceButtonGamDefImg.tooltip = null; this.FavCimsWorkingPlaceSprite.tooltip = null; } this.InstanceCitizenID = this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index].m_instance; this.citizenInstance = this.MyCitizen.m_instances.m_buffer [InstanceCitizenID]; if (this.citizenInstance.m_targetBuilding != 0) { this.CitizenVehicle = this.MyCitizen.m_citizens.m_buffer [citizen].m_vehicle; this.MyVehicleID = InstanceID.Empty; GoingOutside = (MyBuilding.m_buildings.m_buffer [this.citizenInstance.m_targetBuilding].m_flags & Building.Flags.IncomingOutgoing) != Building.Flags.None; if (this.CitizenVehicle != 0) { this.MyVehicleID.Vehicle = this.CitizenVehicle; this.FavCimsLastActivityVehicleButton.isEnabled = true; this.VehInfo = this.MyVehicle.m_vehicles.m_buffer [this.CitizenVehicle].Info; this.CitizenVehicleName = this.MyVehicle.GetVehicleName (this.CitizenVehicle); if (this.VehInfo.m_class.m_service == ItemClass.Service.Residential) { //sta usando una macchina if (this.VehInfo.m_vehicleAI.GetOwnerID (this.CitizenVehicle, ref MyVehicle.m_vehicles.m_buffer [this.CitizenVehicle]).Citizen == citizen) { //sta usando la sua macchina. if (GoingOutside) LeaveCity = true; this.FavCimsLastActivityVehicleButton.normalBgSprite = "IconCitizenVehicle"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "IconTouristVehicle"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName; } } else if (this.VehInfo.m_class.m_service == ItemClass.Service.PublicTransport) { //sta usando un mezzo pubblico if (GoingOutside) LeaveCity = true; switch (this.VehInfo.m_class.m_subService) { case ItemClass.SubService.PublicTransportBus: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportBus"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportBusHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportBusFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportBusPressed"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Bus"); break; case ItemClass.SubService.PublicTransportMetro: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportMetro"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportMetroHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportMetroFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportMetroPressed"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Metro"); break; case ItemClass.SubService.PublicTransportPlane: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportPlane"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportPlaneHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportPlaneFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportPlanePressed"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Plane"); break; case ItemClass.SubService.PublicTransportShip: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportShip"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportShipHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportShipFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportShipPressed"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Ship"); break; case ItemClass.SubService.PublicTransportTrain: this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportTrain"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportTrainHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportTrainFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportTrainPressed"; if (this.CitizenVehicleName == "VEHICLE_TITLE[Train Passenger]:0") this.CitizenVehicleName = Locale.Get ("VEHICLE_TITLE", "Train Engine"); this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Train"); break; } /* if (this.VehInfo.m_class.m_subService == ItemClass.SubService.PublicTransportBus) { this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportBus"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportBusHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportBusFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportBusPressed"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Bus"); } else if (this.VehInfo.m_class.m_subService == ItemClass.SubService.PublicTransportMetro) { this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportMetro"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportMetroHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportMetroFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportMetroPressed"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Metro"); } else if (this.VehInfo.m_class.m_subService == ItemClass.SubService.PublicTransportPlane) { this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportPlane"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportPlaneHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportPlaneFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportPlanePressed"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Plane"); } else if (this.VehInfo.m_class.m_subService == ItemClass.SubService.PublicTransportShip) { this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportShip"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportShipHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportShipFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportShipPressed"; this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Ship"); } else if (this.VehInfo.m_class.m_subService == ItemClass.SubService.PublicTransportTrain) { this.FavCimsLastActivityVehicleButton.normalBgSprite = "SubBarPublicTransportTrain"; this.FavCimsLastActivityVehicleButton.hoveredBgSprite = "SubBarPublicTransportTrainHovered"; this.FavCimsLastActivityVehicleButton.focusedBgSprite = "SubBarPublicTransportTrainFocused"; this.FavCimsLastActivityVehicleButton.pressedBgSprite = "SubBarPublicTransportTrainPressed"; if (this.CitizenVehicleName == "VEHICLE_TITLE[Train Passenger]:0") this.CitizenVehicleName = Locale.Get ("VEHICLE_TITLE", "Train Engine"); this.FavCimsLastActivityVehicleButton.tooltip = this.CitizenVehicleName + " - " + Locale.Get ("SUBSERVICE_DESC", "Train"); } */ } } else { if (GoingOutside) LeaveCity = true; this.FavCimsLastActivityVehicleButton.disabledBgSprite = "InfoIconPopulationDisabled"; this.FavCimsLastActivityVehicleButton.isEnabled = false; this.FavCimsLastActivityVehicleButton.tooltip = FavCimsLang.text ("Vehicle_on_foot"); } } else { this.FavCimsLastActivityVehicleButton.disabledBgSprite = "InfoIconPopulationDisabled"; this.FavCimsLastActivityVehicleButton.isEnabled = false; this.FavCimsLastActivityVehicleButton.tooltip = null; } //Citizen Status this.CitizenStatus = citizenInfo.m_citizenAI.GetLocalizedStatus (citizen, ref this.MyCitizen.m_citizens.m_buffer [MyInstanceID.Index], out this.MyTargetID); this.CitizenTarget = this.MyBuilding.GetBuildingName (this.MyTargetID.Building, this.MyInstanceID); this.FavCimsLastActivity.text = this.CitizenStatus + " " + this.CitizenTarget; if (!this.MyTargetID.IsEmpty) { //District this.TargetDistrict = (int)MyDistrict.GetDistrict (this.MyBuilding.m_buildings.m_buffer [MyTargetID.Index].m_position); if (this.TargetDistrict == 0) { this.FavCimsLastActivity.tooltip = FavCimsLang.text ("DistrictLabel") + FavCimsLang.text ("DistrictNameNoDistrict"); } else { this.FavCimsLastActivity.tooltip = FavCimsLang.text ("DistrictLabel") + MyDistrict.GetDistrictName (this.TargetDistrict); } } //Now in this District this.CitizenDistrict = (int)MyDistrict.GetDistrict (citizenInstance.GetSmoothPosition (InstanceCitizenID)); //Il carro funebre lo ha caricato //if (((citizen != 0) && MyCitizen.m_citizens.m_buffer[citizen].Dead) && (MyCitizen.m_citizens.m_buffer[citizen].CurrentLocation == Citizen.Location.Moving)) { if(this.CitizenIsDead) { //try //{ this.FavCimsHappyIcon.normalBgSprite = "NotificationIconDead"; this.FavCimsHappyIcon.tooltip = FavCimsLang.text ("People_Life_Status_Dead"); if(this.CitizenRowData ["deathrealage"] == "0") this.CitizenRowData ["deathrealage"] = this.RealAge.ToString(); this.FavCimsRealAge.text = this.CitizenRowData ["deathrealage"]; if (this.DeathDate == null) { this.DeathDate = GameTime.FavCimsDate (FavCimsLang.text ("time_format"),"n/a"); this.DeathTime = GameTime.FavCimsTime (); } this.FavCimsCitizenName.tooltip = FavCimsLang.text ("People_Life_Status_Dead") + " " + FavCimsLang.text ("People_Life_Status_Dead_date") + " " + this.DeathDate + " " + FavCimsLang.text ("People_Life_Status_Dead_time") + " " + this.DeathTime; if(MyCitizen.m_citizens.m_buffer[citizen].CurrentLocation == Citizen.Location.Moving) { this.hearse = this.MyCitizen.m_citizens.m_buffer [citizen].m_vehicle; if(hearse != 0) { this.CitizenDead.Citizen = citizen; this.MyVehicleID.Vehicle = hearse; this.FavCimsLastActivityVehicleButton.normalBgSprite = "NotificationIconVerySick"; this.FavCimsLastActivityVehicleButton.isEnabled = true; this.FavCimsLastActivityVehicleButton.playAudioEvents = true; this.FavCimsLastActivityVehicleButton.tooltip = Locale.Get ("VEHICLE_TITLE", "Hearse"); this.FavCimsLastActivity.text = FavCimsLang.text("Citizen_on_hearse"); } } else if(MyCitizen.m_citizens.m_buffer[citizen].CurrentLocation != Citizen.Location.Moving && this.hearse == 0) { //Verificare con unspawn //aspetta il carro funebre this.FavCimsLastActivity.text = FavCimsLang.text("Citizen_wait_hearse"); this.FavCimsLastActivityVehicleButton.disabledBgSprite = "NotificationIconVerySick"; this.FavCimsLastActivityVehicleButton.isEnabled = false; } else { //lo stanno seppellendo this.FavCimsLastActivity.text = FavCimsLang.text("Citizen_hisfuneral"); this.FavCimsLastActivityVehicleButton.disabledBgSprite = "NotificationIconVerySick"; this.FavCimsLastActivityVehicleButton.isEnabled = false; } //}catch (Exception e) { // Debug.Log("error + " + e.ToString()); //} } } else { if(this.rowLang == null || this.rowLang != FavCimsLang.GameLanguage) this.DeadOrGone = false; if (!this.DeadOrGone) { this.rowLang = FavCimsLang.GameLanguage; this.DeadOrGone = true; if (this.FavCimsCitizenSingleRowPanel != null && FavCimsCore.RowID.ContainsKey (citizenINT) && this.MyInstancedName.Length > 0) { if(this.DeathDate != null) { this.DeathDate = GameTime.FavCimsDate (FavCimsLang.text ("time_format"), this.DeathDate); } if (this.DeathDate == null) { this.DeathDate = GameTime.FavCimsDate (FavCimsLang.text ("time_format"),"n/a"); this.DeathTime = GameTime.FavCimsTime (); } //if(this.citflags != null) //Debug.Log(this.citflags); //Debug.Log(this.FavCimsCitizenName.text + " is dead on date " + this.DeathDate + " at time " + this.DeathTime); this.FavCimsCitizenName.disabledTextColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsCitizenName.isEnabled = false; this.FavCimsEducation.textColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsRealAge.textColor = new Color32 (51, 51, 51, 160); //r,g,b,a this.FavCimsAgePhase.textColor = new Color32 (51, 51, 51, 160); //r,g,b,a if (!LeaveCity && (this.CitizenIsDead || this.RealAge > 65)) { //Dead Peoples (this.CitizenDead == this.MyInstanceID || this.RealAge > 65) try { //Citizen Life Status //this.CitizenRowData ["lifestatus"] = "People_Life_Status_Dead"; //Happiness x.x //this.CitizenRowData ["happiness_icon"] = "NotificationIconDead"; this.FavCimsHappyIcon.normalBgSprite = "NotificationIconDead"; this.FavCimsHappyIcon.tooltip = FavCimsLang.text ("People_Life_Status_Dead"); //Name //this.CitizenRowData ["name"] = this.MyInstancedName; this.FavCimsCitizenName.text = this.MyInstancedName; this.FavCimsCitizenName.tooltip = FavCimsLang.text ("People_Life_Status_Dead") + " " + FavCimsLang.text ("People_Life_Status_Dead_date") + " " + this.DeathDate + " " + FavCimsLang.text ("People_Life_Status_Dead_time") + " " + this.DeathTime; //Info Button this.OtherInfoButton.isEnabled = false; //AgePhase //this.CitizenRowData ["agegroup"] = "Dead"; this.FavCimsAgePhase.text = FavCimsLang.text ("AgePhaseDead_" + this.CitizenRowData ["gender"]); //Home this.FavCimsCitizenHome.text = FavCimsLang.text ("Home_Location_Dead"); this.FavCimsCitizenHomeSprite.texture = TextureDB.FavCimsCitizenHomeTextureDead; this.FavCimsCitizenHome.tooltip = null; this.FavCimsCitizenHome.isEnabled = false; this.FavCimsCitizenResidentialLevelSprite.texture = null; this.FavCimsCitizenHomeSprite.tooltip = null; //Working Place this.FavCimsWorkingPlace.isEnabled = false; this.FavCimsWorkingPlace.tooltip = null; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; this.FavCimsWorkingPlaceSprite.tooltip = null; this.FavCimsWorkingPlaceButtonGamDefImg.tooltip = null; //Last Activity this.FavCimsLastActivity.isEnabled = false; this.FavCimsLastActivityVehicleButton.isEnabled = false; this.FavCimsLastActivityVehicleButton.disabledBgSprite = "NotificationIconDead"; this.FavCimsLastActivityVehicleButton.tooltip = null; this.FavCimsLastActivity.tooltip = null; this.FavCimsLastActivity.text = FavCimsLang.text("Citizen_buried"); this.CitizenRowData.Clear (); }catch (Exception e) { Debug.Error("error " + e.ToString()); } } else { //Citizen Life Status //this.CitizenRowData ["lifestatus"] = "People_Life_Status_IsGone"; //Happiness ==> //this.CitizenRowData ["happiness_icon"] = ""; this.FavCimsHappyIcon.normalBgSprite = ""; this.FavCimsHappyIcon.tooltip = null; //Happiness Icon Override (For leaving people) this.FavCimsHappyOverride.texture = TextureDB.FavCimsHappyOverride_texture; this.FavCimsHappyOverride.relativePosition = new Vector3 (0, 0); this.FavCimsHappyOverride.tooltip = FavCimsLang.text ("People_Life_Status_IsGone"); //Name //this.CitizenRowData ["name"] = this.MyInstancedName; this.FavCimsCitizenName.text = this.MyInstancedName; this.FavCimsCitizenName.tooltip = FavCimsLang.text ("People_Life_Status_IsGone") + " " + FavCimsLang.text ("People_Life_Status_Dead_date") + " " + this.DeathDate + " " + FavCimsLang.text ("People_Life_Status_Dead_time") + " " + this.DeathTime; //Info Button this.OtherInfoButton.isEnabled = false; //Home this.FavCimsCitizenHome.text = FavCimsLang.text ("HomeOutsideTheCity"); this.FavCimsCitizenHomeSprite.texture = TextureDB.FavCimsCitizenHomeTextureHomeless; this.FavCimsCitizenHome.tooltip = null; this.FavCimsCitizenHome.isEnabled = false; this.FavCimsCitizenResidentialLevelSprite.texture = null; this.FavCimsCitizenHomeSprite.tooltip = null; //Working Place this.FavCimsWorkingPlace.isEnabled = false; this.FavCimsWorkingPlace.tooltip = null; this.FavCimsCitizenWorkPlaceLevelSprite.texture = null; //Last Activity //Ha lasciato la citta'. this.FavCimsLastActivity.isEnabled = false; this.FavCimsLastActivityVehicleButton.isEnabled = false; this.FavCimsLastActivityVehicleButton.disabledBgSprite = "NotificationIconDead"; this.FavCimsLastActivity.tooltip = null; this.CitizenRowData.Clear (); } } else { try { if(this.MyFamily != null) { this.MyFamily.Hide(); this.MyFamily.MyInstanceID = InstanceID.Empty; this.MyFamily = null; } GameObject.Destroy (this.gameObject); } catch { /*(Exception e)*/ //Debug.Log ("CitizenName Error Destroy Object" + e.ToString ()); } } } } } catch { /*(Exception e)*/ //Debug.Error ("Update Row Error" + e.ToString ()); } } return; }
public MoveableProp(InstanceID instanceID) : base(instanceID) { Info = PropLayer.Manager.GetInfo(instanceID); }
private static void ApplyZoning(ZoneTool z) { Vector3 m_startPosition = (Vector3)z.GetType().GetField("m_startPosition", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(z); Vector3 m_mousePosition = (Vector3)z.GetType().GetField("m_mousePosition", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(z); Vector3 m_startDirection = (Vector3)z.GetType().GetField("m_startDirection", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(z); Vector2 vector2_1 = VectorUtils.XZ(m_startPosition); Vector2 vector2_2 = VectorUtils.XZ(m_mousePosition); Vector2 vector2_3 = VectorUtils.XZ(m_startDirection); Vector2 vector2_4 = new Vector2(vector2_3.y, -vector2_3.x); float num1 = Mathf.Round((float)((((double)vector2_2.x - (double)vector2_1.x) * (double)vector2_3.x + ((double)vector2_2.y - (double)vector2_1.y) * (double)vector2_3.y) * 0.125)) * 8f; float num2 = Mathf.Round((float)((((double)vector2_2.x - (double)vector2_1.x) * (double)vector2_4.x + ((double)vector2_2.y - (double)vector2_1.y) * (double)vector2_4.y) * 0.125)) * 8f; float num3 = (double)num1 < 0.0 ? -4f : 4f; float num4 = (double)num2 < 0.0 ? -4f : 4f; Quad2 quad2 = new Quad2(); quad2.a = vector2_1 - vector2_3 * num3 - vector2_4 * num4; quad2.b = vector2_1 - vector2_3 * num3 + vector2_4 * (num2 + num4); quad2.c = vector2_1 + vector2_3 * (num1 + num3) + vector2_4 * (num2 + num4); quad2.d = vector2_1 + vector2_3 * (num1 + num3) - vector2_4 * num4; if ((double)num3 == (double)num4) { Vector2 vector2_5 = quad2.b; quad2.b = quad2.d; quad2.d = vector2_5; } Vector2 vector2_6 = quad2.Min(); Vector2 vector2_7 = quad2.Max(); int num5 = Mathf.Max((int)((vector2_6.x - 46f) / 64f + FakeZoneManager.HALFGRID), 0); int num6 = Mathf.Max((int)((vector2_6.y - 46f) / 64f + FakeZoneManager.HALFGRID), 0); int num7 = Mathf.Min((int)((vector2_7.x + 46f) / 64f + FakeZoneManager.HALFGRID), FakeZoneManager.GRIDSIZE - 1); int num8 = Mathf.Min((int)((vector2_7.y + 46f) / 64f + FakeZoneManager.HALFGRID), FakeZoneManager.GRIDSIZE - 1); var instance1 = ZoneManager.instance; bool flag = false; for (int index1 = num6; index1 <= num8; ++index1) { for (int index2 = num5; index2 <= num7; ++index2) { ushort blockIndex = FakeZoneManager.zoneGrid[index1 * FakeZoneManager.GRIDSIZE + index2]; int num9 = 0; while ((int)blockIndex != 0) { Vector3 vector3 = instance1.m_blocks.m_buffer[(int)blockIndex].m_position; if ((double)Mathf.Max(Mathf.Max(vector2_6.x - 46f - vector3.x, vector2_6.y - 46f - vector3.z), Mathf.Max((float)((double)vector3.x - (double)vector2_7.x - 46.0), (float)((double)vector3.z - (double)vector2_7.y - 46.0))) < 0.0 && ApplyZoning(z, blockIndex, ref instance1.m_blocks.m_buffer[(int)blockIndex], quad2)) flag = true; blockIndex = instance1.m_blocks.m_buffer[(int)blockIndex].m_nextGridBlock; if (++num9 >= 32768) { CODebugBase<LogChannel>.Error(LogChannel.Core, "Invalid list detected!\n" + System.Environment.StackTrace); break; } } } } if (!flag) return; bool m_zoning = (bool)z.GetType().GetField("m_validPosition", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(z); if (m_zoning) z.GetType().GetMethod("UsedZone", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(z, new object[] { z.m_zone }); EffectInfo effect = instance1.m_properties.m_fillEffect; if (effect == null) return; InstanceID instance2 = new InstanceID(); EffectInfo.SpawnArea spawnArea = new EffectInfo.SpawnArea((Vector3)((vector2_1 + vector2_2) * 0.5f), Vector3.up, 1f); Singleton<EffectManager>.instance.DispatchEffect(effect, instance2, spawnArea, Vector3.zero, 0.0f, 1f, Singleton<AudioManager>.instance.DefaultGroup); }
/// <summary> /// Called by the game every simulation step. /// Performs raycasting to select hovered instance. /// </summary> public override void SimulationStep() { // Get base mouse ray. Ray mouseRay = m_mouseRay; // Get raycast input. RaycastInput input = new RaycastInput(mouseRay, m_mouseRayLength) { m_rayRight = m_rayRight, m_netService = GetService(), m_buildingService = GetService(), m_propService = GetService(), m_treeService = GetService(), m_districtNameOnly = Singleton <InfoManager> .instance.CurrentMode != InfoManager.InfoMode.Districts, m_ignoreTerrain = GetTerrainIgnore(), m_ignoreNodeFlags = GetNodeIgnoreFlags(), m_ignoreSegmentFlags = GetSegmentIgnoreFlags(out input.m_segmentNameOnly), m_ignoreBuildingFlags = GetBuildingIgnoreFlags(), m_ignoreTreeFlags = GetTreeIgnoreFlags(), m_ignorePropFlags = GetPropIgnoreFlags(), m_ignoreVehicleFlags = GetVehicleIgnoreFlags(), m_ignoreParkedVehicleFlags = GetParkedVehicleIgnoreFlags(), m_ignoreCitizenFlags = GetCitizenIgnoreFlags(), m_ignoreTransportFlags = GetTransportIgnoreFlags(), m_ignoreDistrictFlags = GetDistrictIgnoreFlags(), m_ignoreParkFlags = GetParkIgnoreFlags(), m_ignoreDisasterFlags = GetDisasterIgnoreFlags(), m_transportTypes = GetTransportTypes() }; // Enable ferry line selection. input.m_netService.m_itemLayers |= ItemClass.Layer.FerryPaths; ToolErrors errors = ToolErrors.None; RaycastOutput output; // Cursor is dark by default. m_cursor = darkCursor; // Is the base mouse ray valid? if (m_mouseRayValid) { // Yes - raycast. if (RayCast(input, out output)) { // Set base tool accurate position. m_accuratePosition = output.m_hitPos; // Select parent building of any 'untouchable' (sub-)building. if (output.m_building != 0 && (Singleton <BuildingManager> .instance.m_buildings.m_buffer[output.m_building].m_flags & Building.Flags.Untouchable) != 0) { output.m_building = Building.FindParentBuilding(output.m_building); } // Check for valid hits by type - network, building, prop, tree, in that order (so e.g. embedded networks can be selected). if (output.m_netSegment != 0) { // Networks. if (CheckSegment(output.m_netSegment, ref errors)) { // CheckSegment passed - record hit position and set cursor to light. output.m_hitPos = Singleton <NetManager> .instance.m_segments.m_buffer[output.m_netSegment].GetClosestPosition(output.m_hitPos); m_cursor = lightCursor; } else { // CheckSegment failed - deselect segment. output.m_netSegment = 0; } } else if (output.m_building != 0) { // Buildings. if (CheckBuilding(output.m_building, ref errors)) { // CheckSigment passed - record hit position and set cursor to light. output.m_hitPos = Singleton <BuildingManager> .instance.m_buildings.m_buffer[output.m_building].m_position; m_cursor = lightCursor; } else { // CheckSegment failed - deselect building. output.m_building = 0; } } else if (output.m_propInstance != 0) { // Map props. if (CheckProp(output.m_propInstance, ref errors)) { // CheckSigment passed - record hit position and set cursor to light. output.m_hitPos = Singleton <PropManager> .instance.m_props.m_buffer[output.m_propInstance].Position; m_cursor = lightCursor; } else { // CheckSegment failed - deselect prop. output.m_propInstance = 0; } } else if (output.m_treeInstance != 0) { // Map trees. if (CheckTree(output.m_treeInstance, ref errors)) { // CheckSigment passed - record hit position and set cursor to light. output.m_hitPos = Singleton <TreeManager> .instance.m_trees.m_buffer[output.m_treeInstance].Position; m_cursor = lightCursor; } else { // CheckSegment failed - deselect tree. output.m_treeInstance = 0u; } } // Create new hover instance and set hovered type (if applicable). InstanceID hoverInstance = InstanceID.Empty; if (output.m_netSegment != 0) { hoverInstance.NetSegment = output.m_netSegment; } else if (output.m_building != 0) { hoverInstance.Building = output.m_building; } else if (output.m_propInstance != 0) { hoverInstance.Prop = output.m_propInstance; } else if (output.m_treeInstance != 0) { hoverInstance.Tree = output.m_treeInstance; } // Has the hovered instance changed since last time? if (hoverInstance != m_hoverInstance) { // Hover instance has changed. // Unhide any previously-hidden props, trees or buildings. if (m_hoverInstance.Prop != 0) { // Unhide previously hovered prop. if (Singleton <PropManager> .instance.m_props.m_buffer[m_hoverInstance.Prop].Hidden) { Singleton <PropManager> .instance.m_props.m_buffer[m_hoverInstance.Prop].Hidden = false; } } else if (m_hoverInstance.Tree != 0) { // Unhide previously hovered tree. if (Singleton <TreeManager> .instance.m_trees.m_buffer[m_hoverInstance.Tree].Hidden) { Singleton <TreeManager> .instance.m_trees.m_buffer[m_hoverInstance.Tree].Hidden = false; Singleton <TreeManager> .instance.UpdateTreeRenderer(m_hoverInstance.Tree, updateGroup : true); } } else if (m_hoverInstance.Building != 0) { // Unhide previously hovered building. if ((Singleton <BuildingManager> .instance.m_buildings.m_buffer[m_hoverInstance.Building].m_flags & Building.Flags.Hidden) != 0) { Singleton <BuildingManager> .instance.m_buildings.m_buffer[m_hoverInstance.Building].m_flags &= ~Building.Flags.Hidden; Singleton <BuildingManager> .instance.UpdateBuildingRenderer(m_hoverInstance.Building, updateGroup : true); } } // Update tool hover instance. m_hoverInstance = hoverInstance; } } else { // Raycast failed. errors = ToolErrors.RaycastFailed; } } else { // No valid mouse ray. output = default; errors = ToolErrors.RaycastFailed; } // Set mouse position and record errors. m_mousePosition = output.m_hitPos; m_selectErrors = errors; }