コード例 #1
0
        public void DoWindowContents(Rect inRect)
        {
            Listing_Standard listing = new Listing_Standard();

            listing.Begin(inRect);

            listing.Label("Input how many bits you want to set as a goal before your colony is raided.");

            string bitGoalBuffer = bitGoal.ToString();

            listing.TextFieldNumericLabeled("How many bits until you get raided", ref bitGoal, ref bitGoalBuffer, 1);

            listing.Gap();

            listing.ColumnWidth = inRect.width / 2;

            listing.CheckboxLabeled("Enable Dev Mode", ref devMode, "Use Dev Mode for testing or to fix a bug");

            if (devMode)
            {
                string bitsToAddBuffer = bitsToAddToGoal.ToString();
                listing.TextFieldNumericLabeled("Bits to Add", ref bitsToAddToGoal, ref bitsToAddBuffer);

                if (listing.ButtonText("Add Bits to Goal"))
                {
                    if (bitsToAddToGoal > 0 && Current.Game != null)
                    {
                        BitParser bitParser = Current.Game.GetComponent <BitParser>();

                        if (bitParser != null)
                        {
                            bitParser.currentBitCounter += bitsToAddToGoal;
                            bitParser.CheckIfCanRaid();
                        }
                    }
                }

                if (listing.ButtonText("Reset Bit Counter"))
                {
                    BitParser bitParser = Current.Game.GetComponent <BitParser>();

                    if (bitParser != null)
                    {
                        bitParser.currentBitCounter = 0;
                    }
                }
            }

            listing.End();
        }
コード例 #2
0
        private static void RecacheCurrentBits()
        {
            if (frameCounter >= 100)
            {
                frameCounter = 0;

                BitParser bitParser = Current.Game.GetComponent <BitParser>();

                if (bitParser != null)
                {
                    currentBitCounterCached = bitParser.currentBitCounter;
                }
            }
        }