public static bool SupportsPillars(NetInfo prefab, PillarType type) { var netAi = prefab.m_netAI; if (netAi == null) { return(false); } // Disable pillar selection for MOM tracks, as it comes with its own pillar selector! var netAiName = netAi.GetType().Name; if (netAiName == "TrainTrackAIMetro" || netAiName == "TrainTrackBridgeAIMetro" || netAiName == "TrainTrackTunnelAIMetro") { return(false); } if (type == PillarType.Bridge) { return(netAi is RoadBridgeAI || netAi is TrainTrackBridgeAI || netAi is PedestrianBridgeAI || netAi is MonorailTrackAI); } else { return(netAi.RequireDoubleSegments() && (netAi is RoadBridgeAI || netAi is TrainTrackBridgeAI || netAi is MonorailTrackAI)); } }
public static string GetQuestionTypeFromPillarType(PillarType pillarType) { string questionType = QTRandom; switch (pillarType) { case PillarType.Blue: questionType = QTQuran; break; case PillarType.Green: questionType = QTHadith; break; case PillarType.Red: questionType = QTGeneralKnowledge; break; case PillarType.Orange: questionType = QTIslamicScience; break; case PillarType.Purple: questionType = QTTheProphets; break; case PillarType.Yellow: questionType = QTIslamicHistory; break; } return(questionType); }
public BuildingInfo GetActivePillar(NetInfo prefab, PillarType type) { if (prefab == null) { return(null); } var ta = prefab.m_netAI as TrainTrackBridgeAI; var ra = prefab.m_netAI as RoadBridgeAI; var pa = prefab.m_netAI as PedestrianBridgeAI; if (ta != null) { return((type == PillarType.BridgePillar) ? ta.m_bridgePillarInfo : ta.m_middlePillarInfo); } else if (ra != null) { return((type == PillarType.BridgePillar) ? ra.m_bridgePillarInfo : ra.m_middlePillarInfo); } else if (pa != null) { return((type == PillarType.BridgePillar) ? pa.m_bridgePillarInfo : null); } else { return(null); } }
public NavreysPillar(NavreysController controller, PillarType type) : base(0x3BF) { m_Controller = controller; m_Type = type; Movable = false; }
public static PillarType GetColorTypeFromNodeType(NodeType node) { PillarType ptype = PillarType.Gray; switch (node) { case NodeType.Red: ptype = PillarType.Red; break; case NodeType.Blue: ptype = PillarType.Blue; break; case NodeType.Green: ptype = PillarType.Green; break; case NodeType.Orange: ptype = PillarType.Orange; break; case NodeType.Purple: ptype = PillarType.Purple; break; case NodeType.Yellow: ptype = PillarType.Yellow; break; } return(ptype); }
private void UpdateMeshRenderers(PillarType pillarType, List <MeshRenderer> meshRenderers) { int count = meshRenderers.Count; if (pillarType == PillarType.empty && ((floor == 0 && count == 3) || (floor != 0 && count == 2))) { meshRenderers[count - 1].gameObject.SetActive(false); } if (pillarType != PillarType.empty) { if (((floor == 0 && count == 2) || (floor != 0 && count == 1))) { CreateCube(meshRenderers[0].transform.parent, pillarEmptyMaterial, meshRenderers[count - 1].transform.localPosition + new Vector3(0, floorHight / 2, 0), new Vector3(1, floorHight, 1)); } else { meshRenderers[count - 1].gameObject.SetActive(true); } } meshRenderers.ForEach(material => { material.material = pillarType == PillarType.empty ? pillarEmptyMaterial : pillarType == PillarType.toothpaste ? toothpasteMaterial : waterMaterial; }); }
private void UpdateTargetPillar(int id, PillarType pillarType) { pillarDatas[id] = pillarType; List <MeshRenderer> meshRenderers = pillarMaterialList[id]; UpdateMeshRenderers(pillarType, meshRenderers); }
public void SetPillar(NetInfo prefab, PillarType type, BuildingInfo pillar) { var netAI = prefab.m_netAI; var ta = netAI as TrainTrackBridgeAI; var ra = netAI as RoadBridgeAI; var pa = netAI as PedestrianBridgeAI; if (ta != null) { if (type == PillarType.BridgePillar) { ta.m_bridgePillarInfo = pillar; } else { ta.m_middlePillarInfo = pillar; } } else if (ra != null) { if (type == PillarType.BridgePillar) { ra.m_bridgePillarInfo = pillar; } else { ra.m_middlePillarInfo = pillar; } } else if (pa != null) { pa.m_bridgePillarInfo = pillar; } }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); State = (NavreysPillarState)reader.ReadInt(); m_Controller = (NavreysController)reader.ReadItem(); m_Type = (PillarType)reader.ReadInt(); }
public static string GetDescription(this PillarType type) { switch (type) { case PillarType.BridgePillar: return("Bridge Pillar"); case PillarType.MiddlePillar: return("Middle Pillar"); default: throw new ArgumentOutOfRangeException(nameof(type)); } }
public BuildingInfo GetDefaultPillar(NetInfo prefab, PillarType type) { var map = (type == PillarType.BridgePillar) ? defaultBridgePillars : defaultMiddlePillars; BuildingInfo pillar; if (!map.TryGetValue(prefab, out pillar)) { return(null); } return(pillar); }
private void OnGUI() { EditorGUILayout.LabelField("层"); EditorGUILayout.BeginHorizontal(); floor = EditorGUILayout.IntField("层数:", floor); floorHight = EditorGUILayout.FloatField("层高:", floorHight); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); EditorGUILayout.LabelField("排序"); EditorGUILayout.BeginHorizontal(); cellSize = EditorGUILayout.Vector2Field("宽高:", cellSize); sort = EditorGUILayout.Vector2Field("行列:", sort); space = EditorGUILayout.Vector2Field("间距:", space); side = EditorGUILayout.Vector2Field("边距:", side); EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); if (GUILayout.Button("build")) { ReBuild(); } if (rootGameObject == null) { return; } EditorGUILayout.LabelField("地形"); for (int index = 0, id = 0; index < floor - 1; index++) { for (int h = 0; h < sort.y; h++) { EditorGUILayout.BeginHorizontal(); for (int w = 0; w < sort.x; w++, id++) { PillarType curPillar = (PillarType)EditorGUILayout.EnumFlagsField(pillarDatas[id]); if (curPillar != pillarDatas[id]) { UpdateTargetPillar(id, curPillar); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); } }
public PillarPanelController(PillarType type, List <BuildingInfo> availablePillars) { Type = type; _items = new List <Item> { new SimpleItem("#NONE#", null) }; foreach (var pillar in availablePillars) { _items.Add(new SimpleItem(pillar.name, pillar)); } }
public static BuildingInfo GetDefaultPillar(NetInfo prefab, PillarType type) { switch (type) { case PillarType.Bridge: return(GetDefaultBridgePillar(prefab)); case PillarType.Middle: return(GetDefaultMiddlePillar(prefab)); default: return(null); } }
public List <BuildingInfo> GetAvailablePillars(NetInfo prefab, PillarType pillarType) { if (prefab == null) { return(null); } if (prefab.m_netAI is TrainTrackBridgeAI || prefab.m_netAI is RoadBridgeAI || prefab.m_netAI is PedestrianBridgeAI) { if (pillarType == PillarType.MiddlePillar) { var ta = prefab.m_netAI as TrainTrackBridgeAI; var ra = prefab.m_netAI as RoadBridgeAI; if (ta != null) { if (!ta.m_doubleLength) { return(null); } } else if (ra != null) { if (!ra.m_doubleLength) { return(null); } } else { return(null); } } // TODO only return relevant pillars return(availablePillars); } else { return(null); } }
private static void SetPillarFeature(NetInfo netInfo, string pillarName, PillarType type, Dictionary <NetInfo, BuildingInfo> userModePillars) { if (pillarName == null) { return; } BuildingInfo pillar = null; if (pillarName != NoneValue) { pillar = PrefabCollection <BuildingInfo> .FindLoaded(pillarName); } // save previous set pillar userModePillars[netInfo] = PillarCustomizer.instance.GetActivePillar(netInfo, type); PillarCustomizer.instance.SetPillar(netInfo, type, pillar); }
public static string GetQuestionTypeFromPillarType(PillarType pillarType) { string questionType = QTRandom; switch (pillarType) { case PillarType.Blue: questionType = QTQuran; break; case PillarType.Green: questionType = QTHadith; break; case PillarType.Red: questionType = QTGeneralKnowledge; break; case PillarType.Orange: questionType = QTIslamicScience; break; case PillarType.Purple: questionType = QTTheProphets; break; case PillarType.Yellow: questionType = QTIslamicHistory; break; } return questionType; }
private static void SetPillarFeature(NetInfo netInfo, string pillarName, PillarType type, Dictionary<NetInfo, BuildingInfo> userModePillars) { if (pillarName == null) return; BuildingInfo pillar = null; if (pillarName != NoneValue) pillar = PrefabCollection<BuildingInfo>.FindLoaded(pillarName); // save previous set pillar userModePillars[netInfo] = PillarCustomizer.instance.GetActivePillar(netInfo, type); PillarCustomizer.instance.SetPillar(netInfo, type, pillar); }
public PillarModifier(PillarType type, BuildingInfo pillar) : base(NetworkSkinModifierType.Pillar) { Type = type; Pillar = pillar; }
public override void GetNodeBuilding(ushort nodeID, ref NetNode data, out BuildingInfo building, out float heightOffset) { if ((data.m_flags & NetNode.Flags.Outside) == NetNode.Flags.None) { if (this.m_middlePillarInfo != null && (data.m_flags & NetNode.Flags.Double) != NetNode.Flags.None) { building = this.m_middlePillarInfo; heightOffset = this.m_middlePillarOffset - 1f - this.m_middlePillarInfo.m_generatedInfo.m_size.y; return; } if (this.m_bridgePillarInfo != null) { heightOffset = this.m_bridgePillarOffset - 1f - this.m_bridgePillarInfo.m_generatedInfo.m_size.y; building = m_bridgePillarInfo; if (pillarList != null && pillarList.Count > 0) { if (m_NetTool == null) { m_NetTool = FindObjectOfType <NetTool>(); } if (m_NetTool?.Prefab != null) { var elevation = m_NetTool.GetElevation(); var theList = pillarList.Where(d => d.HeightLimit == 0 || d.HeightLimit >= elevation).OrderBy(x => x.HeightLimit).ToList(); BridgePillarItem thePillarInfo = null; if (theList == null || theList.Count == 0) { thePillarInfo = pillarList.LastOrDefault(); } else { thePillarInfo = theList.FirstOrDefault(); } BuildingInfo info = null; BuildingInfo noColInfo = null; if (m_NetTool.Prefab.name.Contains("Bridge")) { pillarType = PillarType.WideMedian; } switch (pillarType) { case PillarType.WideMedian: info = thePillarInfo.WideMedianInfo; noColInfo = thePillarInfo.WideMedianInfoNoCol; break; case PillarType.Wide: info = thePillarInfo.WideInfo; noColInfo = thePillarInfo.WideInfoNoCol; break; case PillarType.NarrowMedian: info = thePillarInfo.NarrowMedianInfo; noColInfo = thePillarInfo.NarrowMedianInfoNoCol; break; case PillarType.Narrow: info = thePillarInfo.NarrowInfo; noColInfo = thePillarInfo.NarrowInfoNoCol; break; } var prefab = m_NetTool.Prefab; if (NoPillarCollision && elevation >= 0) { building = noColInfo; if (m_IntersectClass == null) { m_IntersectClass = prefab.m_intersectClass; } prefab.m_intersectClass = null; } else { building = info; if (m_IntersectClass != null) { prefab.m_intersectClass = m_IntersectClass; } } m_bridgePillarInfo = building; if (thePillarInfo != null && info != null) { heightOffset = thePillarInfo.HeightOffset - 1f - info.m_generatedInfo.m_size.y; } } } return; } } base.GetNodeBuilding(nodeID, ref data, out building, out heightOffset); }