Inheritance: RuleChoiceDef
コード例 #1
0
        public static void AddVoteChoice(RuleDef selection, ChoiceMenu choiceMenu)
        {
            VoteChoiceDef choice = CreateChoice(ref selection, choiceMenu.TooltipName, null, false);

            choice.tooltipNameToken = choiceMenu.TooltipName;
            choice.tooltipNameColor = choiceMenu.TooltipNameColor;
            choice.tooltipBodyToken = choiceMenu.TooltipBody;
            choice.tooltipBodyColor = choiceMenu.TooltipBodyColor;
            choice.spritePath       = choiceMenu.IconPath;
            //choice.unlockableName = choiceMenu.UnlockableName;
            choice.VoteIndex = choiceMenu.ChoiceIndex;
        }
コード例 #2
0
        static VoteChoiceDef CreateChoice(ref RuleDef selection, string choiceName, object extraData = null, bool excludeByDefault = false)
        {
            RuleChoiceDef choice = new VoteChoiceDef();

            choice.ruleDef          = selection;
            choice.localName        = choiceName;
            choice.globalName       = selection.globalName + "." + choiceName;
            choice.localIndex       = selection.choices.Count;
            choice.extraData        = extraData;
            choice.excludeByDefault = excludeByDefault;
            selection.GetFieldValue <List <RuleChoiceDef> >("choices").Add(choice);
            return((VoteChoiceDef)choice);
        }
コード例 #3
0
 static void ApplyVotes(On.RoR2.Run.orig_SetRuleBook orig, Run self, RuleBook newRuleBook)
 {
     VoteResults = VoteMask.none;
     for (int i = 0; i < RegisteredVoteSelections.Count; i++)
     {
         VoteChoiceDef voteChoice = (VoteChoiceDef)newRuleBook.GetRuleChoice(RegisteredVoteSelections[i]);
         if (voteChoice.VoteIndex > 0)
         {
             VoteResults.AddVote(voteChoice.VoteIndex);
         }
     }
     orig(self, newRuleBook);
 }