コード例 #1
0
 private static void saveTags(MechComponent target, TagSet tags)
 {
     Control.Log($"saving tags " + target.defId + ":" + tags.ToString());
     if (CustomCombatTagsHelper.checkExistance(target.StatCollection, CustomCombatTagsHelper.CCComponentTagsStatName) == false)
     {
         target.StatCollection.AddStatistic <string>(CustomCombatTagsHelper.CCComponentTagsStatName, tags.ToString());
     }
     else
     {
         target.StatCollection.Set <string>(CustomCombatTagsHelper.CCComponentTagsStatName, tags.ToString());
     }
 }
コード例 #2
0
 private void ShowStartingLocationChoices()
 {
     if ((UnityEngine.Object)titleText != (UnityEngine.Object)null)
     {
         titleText.text = "Choose Starting Location";
     }
     startNodes = worldGen.WorldLayout.GetStartNodes();
     startNodes.Shuffle();
     if (startNodes.Count > 0)
     {
         ChooseBaseLocation(startNodes[0]);
     }
     else
     {
         List <SubWorld> list = new List <SubWorld>();
         for (int i = 0; i < startNodes.Count; i++)
         {
             Tree tree = startNodes[i] as Tree;
             if (tree == null)
             {
                 tree = worldGen.GetOverworldForNode(startNodes[i] as Leaf);
                 if (tree == null)
                 {
                     continue;
                 }
             }
             SubWorld subWorldForNode = worldGen.GetSubWorldForNode(tree);
             if (subWorldForNode != null && !list.Contains(subWorldForNode))
             {
                 list.Add(subWorldForNode);
                 GameObject    gameObject = UnityEngine.Object.Instantiate(locationButtonPrefab);
                 RectTransform component  = gameObject.GetComponent <RectTransform>();
                 component.SetParent(chooseLocationPanel);
                 component.localScale = Vector3.one;
                 Text     componentInChildren = gameObject.GetComponentInChildren <Text>();
                 SubWorld subWorld            = null;
                 Tree     parent = startNodes[i].parent;
                 while (subWorld == null && parent != null)
                 {
                     subWorld = worldGen.GetSubWorldForNode(parent);
                     if (subWorld == null)
                     {
                         parent = parent.parent;
                     }
                 }
                 TagSet tagSet = new TagSet(startNodes[i].tags);
                 tagSet.Remove(WorldGenTags.Feature);
                 tagSet.Remove(WorldGenTags.StartLocation);
                 tagSet.Remove(WorldGenTags.IgnoreCaveOverride);
                 componentInChildren.text = tagSet.ToString();
                 int idx = i;
                 Button.ButtonClickedEvent buttonClickedEvent = new Button.ButtonClickedEvent();
                 buttonClickedEvent.AddListener(delegate
                 {
                     ChooseBaseLocation(startNodes[idx]);
                 });
                 Button component2 = gameObject.GetComponent <Button>();
                 component2.onClick = buttonClickedEvent;
             }
         }
     }
 }