void Start() { // BOX containerMat = Instantiate(meshRenderers[0].material); containerMat.color = FlagReader.GetSchemeColor(linkedBlock.scheme); foreach (MeshRenderer mr in meshRenderers) { mr.material = containerMat; } oColor = containerMat.color; cColor = oColor; // ICON MESH PLANE iconMat = Instantiate(iconRenderers[0].material); foreach (MeshRenderer ic in iconRenderers) { ic.material = iconMat; } Sprite sprite = GameManager.instance.library.buildingsIcons[(int)FlagReader.GetCategory(linkedBlock.scheme)]; Texture2D croppedTexture = new Texture2D((int)sprite.rect.width, (int)sprite.rect.height); Color[] pixels = sprite.texture.GetPixels ( (int)sprite.rect.x, (int)sprite.rect.y, (int)sprite.rect.width, (int)sprite.rect.height ); croppedTexture.SetPixels(pixels); croppedTexture.Apply(); iconMat.mainTexture = croppedTexture; }
static bool parseCommandLine(string[] args) { GlobalConfig.inputFile = ""; GlobalConfig.outputFile = ""; GlobalConfig.mainProc = ""; if (args.Length < 2) { return(false); } GlobalConfig.inputFile = args[0]; GlobalConfig.outputFile = args[1]; var rest = new string[args.Length - 2]; for (int i = 2; i < args.Length; i++) { rest[i - 2] = args[i]; } var flags = FlagReader.read(rest); flags.Iter(f => processFlag(f)); return(true); }
public void SetBlocksColor() { foreach (Block block in GameManager.instance.systemManager.AllBlocks) { Color chosenColor = defaultColor; foreach (Flag flag in block.activeFlags) { if (FlagReader.GetCategory(block.scheme) == CityManager.BuildingType.Habitation) { chosenColor = color.Evaluate(0f); } else if (FlagReader.GetCategory(block.scheme) == CityManager.BuildingType.Occupators) { chosenColor = color.Evaluate(0.5f); } else if (FlagReader.GetCategory(block.scheme) == CityManager.BuildingType.Services) { chosenColor = color.Evaluate(1f); } } block.overlayVisuals.Activate(chosenColor); } }
private void FillCategories() { foreach (BlockScheme block in GameManager.instance.library.blocks) { if (!block.isBuyable) { continue; } CityManager.BuildingType category = FlagReader.GetCategory(block); if (!categories.ContainsKey(category)) { categories[category] = new List <BlockScheme>(); } categories[category].Add(block); } }
public static List <Entry> GetBuildingTooltip(BlockScheme scheme, List <Entry> _entries = null) { List <Entry> entries = new List <Entry>(); entries.Add(new Entry("block" + scheme.ID.ToString(), "blockName", informationType.Neutral)); entries.Add(new Entry("block" + scheme.ID.ToString(), "blockDescription", informationType.Neutral)); entries.Add(new Entry(entryType.LineBreak)); // Porting previous block tooltip entries to this list if (_entries != null) { foreach (Entry tte in _entries) { entries.Add(tte); } entries.Add(new Entry(entryType.LineBreak)); } // Flag reading to get the block bonuses and maluses foreach (List <string> flag in FlagReader.GetFlags(scheme)) { string name = flag[0]; flag.Remove(name); string[] parameters = flag.ToArray(); for (int i = 0; i < parameters.Length; i++) { string popInfo = ""; bool wasPop = false; foreach (string popName in parameters[i].Split('-')) { if (GameManager.instance.populationManager.GetPopulationByCodename(popName) != null) { if (popInfo.Length > 0) { popInfo += " " + GameManager.instance.localization.GetLineFromCategory("stats", "orSeparator") + " "; } popInfo += GameManager.instance.localization.GetLineFromCategory("populationType", popName); wasPop = true; } } if (wasPop) { parameters[i] = popInfo; } } entries.Add(new Entry( name.ToLower(), "flagParameter", FlagReader.IsPositive(name) ? informationType.Positive : informationType.Negative, parameters )); } // Conditional unlocking ConditionalUnlocks unlocker = GameManager.instance.cityManager.conditionalUnlocker; if (!unlocker.CanBeUnlocked(scheme.ID)) { entries.Add(new Entry(entryType.LineBreak)); // Bold line entries.Add(new Entry( "toUnlockThisBuildingYouMust", "conditionalUnlock", informationType.Neutral ) { formatters = new string[1] { "b" } }); // Condition (= <= >= < >) foreach (ScriptInterpreter.FormattedComparison condition in unlocker.GetFormattedUnlockConditions(scheme.ID)) { // If Int, no need to tranlate it entries.Add(new Entry( condition.oprtr, "conditionalUnlock", informationType.Negative, condition.lefthandData.GetLocalization(GameManager.instance.localization), condition.righthandData.GetLocalization(GameManager.instance.localization) )); } } return(entries); }
void FindAllReferences() { // SYSTEM if (temporality == null) { temporality = FindObjectOfType <Temporality>(); } if (flagReader == null) { flagReader = FindObjectOfType <FlagReader>(); } if (library == null) { library = FindObjectOfType <Library>(); } if (soundManager == null) { soundManager = FindObjectOfType <SoundManager>(); } if (systemManager == null) { systemManager = FindObjectOfType <SystemManager>(); } if (missionCallbackManager == null) { missionCallbackManager = FindObjectOfType <MissionCallbackManager>(); } if (missionManager == null) { missionManager = FindObjectOfType <MissionManager>(); } if (cursorManagement == null) { cursorManagement = FindObjectOfType <CursorManagement>(); } if (gridManagement == null) { gridManagement = FindObjectOfType <GridManagement>(); } if (populationManager == null) { populationManager = FindObjectOfType <PopulationManager>(); } if (saveManager == null) { saveManager = FindObjectOfType <SaveManager>(); } if (cinematicManager == null) { cinematicManager = FindObjectOfType <CinematicManager>(); } if (cityManager == null) { cityManager = FindObjectOfType <CityManager>(); } if (bulletinsManager == null) { bulletinsManager = FindObjectOfType <BulletinsManager>(); } if (overlayManager == null) { overlayManager = FindObjectOfType <OverlayManager>(); } if (timelineController == null) { timelineController = FindObjectOfType <TimelineController>(); } if (player == null) { player = FindObjectOfType <Player>(); } if (eventManager == null) { eventManager = FindObjectOfType <EventManager>(); } if (animationManager == null) { animationManager = FindObjectOfType <AnimationManager>(); } if (achievementManager == null) { achievementManager = FindObjectOfType <AchievementManager>(); } if (roamerManager == null) { roamerManager = FindObjectOfType <RoamerManager>(); } if (environmentalFX == null) { environmentalFX = FindObjectOfType <EnvironmentalFX>(); } // INTERFACE if (localization == null) { localization = FindObjectOfType <Localization>(); } if (displayerManager == null) { displayerManager = FindObjectOfType <DisplayerManager>(); } // INTERFACE - INGAME if (temporalityInterface == null) { temporalityInterface = FindObjectOfType <TemporalityInterface>(); } if (tooltipGO == null) { tooltipGO = FindObjectOfType <TooltipGO>(); } // DEBUG if (logger == null) { logger = FindObjectOfType <Logger>(); } }