Пример #1
0
        public Disease(string id, byte strength, RangeInfo temperature_range, RangeInfo temperature_half_lives, RangeInfo pressure_range, RangeInfo pressure_half_lives)
            : base(id, null, null)
        {
            name    = new StringKey("STRINGS.DUPLICANTS.DISEASES." + id.ToUpper() + ".NAME");
            this.id = id;
            DiseaseVisualization.Info info = Assets.instance.DiseaseVisualization.GetInfo(id);
            overlayColour        = info.overlayColour;
            temperatureRange     = temperature_range;
            temperatureHalfLives = temperature_half_lives;
            pressureRange        = pressure_range;
            pressureHalfLives    = pressure_half_lives;
            PopulateElemGrowthInfo();
            ApplyRules();
            string str = Strings.Get("STRINGS.DUPLICANTS.DISEASES." + id.ToUpper() + ".LEGEND_HOVERTEXT").ToString();

            overlayLegendHovertext = str + DUPLICANTS.DISEASES.LEGEND_POSTAMBLE;
            Attribute attribute  = new Attribute(id + "Min", "Minimum" + id.ToString(), string.Empty, string.Empty, 0f, Attribute.Display.Normal, false, null, null);
            Attribute attribute2 = new Attribute(id + "Max", "Maximum" + id.ToString(), string.Empty, string.Empty, 1E+07f, Attribute.Display.Normal, false, null, null);

            amountDeltaAttribute = new Attribute(id + "Delta", id.ToString(), string.Empty, string.Empty, 0f, Attribute.Display.Normal, false, null, null);
            amount = new Amount(id, id + " " + DUPLICANTS.DISEASES.GERMS, id + " " + DUPLICANTS.DISEASES.GERMS, attribute, attribute2, amountDeltaAttribute, false, Units.Flat, 0.01f, true, null, null);
            Db.Get().Attributes.Add(attribute);
            Db.Get().Attributes.Add(attribute2);
            Db.Get().Attributes.Add(amountDeltaAttribute);
            cureSpeedBase           = new Attribute(id + "CureSpeed", false, Attribute.Display.Normal, false, 0f, null, null);
            cureSpeedBase.BaseValue = 1f;
            cureSpeedBase.SetFormatter(new ToPercentAttributeFormatter(1f, GameUtil.TimeSlice.None));
            Db.Get().Attributes.Add(cureSpeedBase);
        }
    public KAnim.Anim GetAnim(int index)
    {
        Debug.Assert(index >= 0 && index < animCount);
        KBatchGroupData batchGroupData = KAnimBatchManager.Instance().GetBatchGroupData(animBatchTag);

        if (batchGroupData == null)
        {
            Debug.LogError($"[{name}] No such batch group [{animBatchTag.ToString()}]");
        }
        return(batchGroupData.GetAnim(index + firstAnimIndex));
    }
Пример #3
0
    private BuildMenuCategoriesScreen CreateCategorySubMenu(HashedString category, int depth, object data, Dictionary <HashedString, List <BuildingDef> > categorized_building_map, Dictionary <HashedString, List <HashedString> > categorized_category_map, Dictionary <Tag, HashedString> tag_category_map, BuildMenuBuildingsScreen buildings_screen)
    {
        BuildMenuCategoriesScreen buildMenuCategoriesScreen = Util.KInstantiateUI <BuildMenuCategoriesScreen>(categoriesMenuPrefab.gameObject, base.gameObject, true);

        buildMenuCategoriesScreen.Show(false);
        buildMenuCategoriesScreen.Configure(category, depth, data, categorizedBuildingMap, categorizedCategoryMap, buildingsScreen);
        BuildMenuCategoriesScreen buildMenuCategoriesScreen2 = buildMenuCategoriesScreen;

        buildMenuCategoriesScreen2.onCategoryClicked = (Action <HashedString, int>)Delegate.Combine(buildMenuCategoriesScreen2.onCategoryClicked, new Action <HashedString, int>(OnCategoryClicked));
        buildMenuCategoriesScreen.name = "BuildMenu_" + category.ToString();
        return(buildMenuCategoriesScreen);
    }
Пример #4
0
    public static GeyserType FindType(HashedString typeId)
    {
        GeyserType geyserType = null;

        if (typeId != HashedString.Invalid)
        {
            geyserType = geyserTypes.Find((GeyserType t) => (HashedString)t.id == typeId);
        }
        if (geyserType == null)
        {
            Debug.LogError($"Tried finding a geyser with id {typeId.ToString()} but it doesn't exist!");
        }
        return(geyserType);
    }
    public static KAnimFile GetAnim(HashedString name)
    {
        if (!name.IsValid)
        {
            Debug.LogWarning("Invalid hash name");
            return(null);
        }
        KAnimFile value = null;

        AnimTable.TryGetValue(name, out value);
        if ((UnityEngine.Object)value == (UnityEngine.Object)null)
        {
            Debug.LogWarning("Missing Anim: [" + name.ToString() + "]. You may have to run Collect Anim on the Assets prefab");
        }
        return(value);
    }
Пример #6
0
    private void BuildButtonList(HashedString plan_category, GameObject parent)
    {
        IOrderedEnumerable <BuildingDef> orderedEnumerable = from def in Assets.BuildingDefs
                                                             where tagCategoryMap.ContainsKey(def.Tag) && tagCategoryMap[def.Tag] == plan_category && !def.Deprecated
                                                             orderby tagOrderMap[def.Tag]
                                                             select def;

        ActiveToggles.Clear();
        int    num            = 0;
        string plan_category2 = plan_category.ToString();

        foreach (BuildingDef item in orderedEnumerable)
        {
            if (item.ShowInBuildMenu)
            {
                CreateButton(item, parent, plan_category2, num);
                num++;
            }
        }
    }