internal override void Clear()
        {
            TouchCountSource = null;
            HangarLayer      = null;

            this.PartCarousel          = null;
            this.TakeoffCollectionNode = null;

            this.TakeoffNode           = null;
            this.HangarOptionWorkshop  = null;
            this.HangarOptionScrapyard = null;
            this.HangarOptionHangar    = null;
            this.HangarOptionCarousel  = null;

            this.GOButton = null;
            //this.DragAndDropObject = null;

            this.challengeNode = null;

            this.FirstTouchListener = null;
            //this.Scroller.MoveFunction = null;
            this.Scroller = null;


            this.StopAllActions();
            this.ResetCleanState();
        }
示例#2
0
 internal MathNode(string mathInfix, string mathLaTeX, MathChallengeNode mathChallengeParent)
 {
     MathChallengeNode = mathChallengeParent;
     Scale             = 1f;
     AnchorPoint       = CCPoint.AnchorMiddle;
     AddChild(DrawNode);
     MathSprite = new MathSprite(mathInfix, mathLaTeX);
     AddChild(MathSprite, 1);
     MakeClickable(touchMustEndOnIt: false);
 }
 internal override void Clear()
 {
     TouchCountSource        = null;
     WreckageLayer           = null;
     this.mathChallengeNode  = null;
     this.FirstTouchListener = null;
     //this.Scroller.MoveFunction = null;
     this.Scroller = null;
     this.StopAllActions();
     this.ResetCleanState();
 }
示例#4
0
 internal void StartRepair()
 {
     State = WreckageState.REPAIR;
     // only go into repair-mode when the wreck-percentile can still actually be increased
     if (GetWreckPercentile(MiddleAircraft) < GetWreckMaxPercentile(MiddleAircraft))
     {
         // generate and show math
         var mathChNode = new MathChallengeNode(MiddleAircraft.GetChallenge());
         GUILayer.MathChallengeNode = mathChNode;
         mathChNode.Position        = new CCPoint(0, -mathChNode.ContentSize.Height);
         mathChNode.AddAction(new CCEaseOut(new CCMoveTo(0.5f, CCPoint.Zero), 3f));
         mathChNode.AnswerChosenEvent += AnswerChosen;
     }
     else
     {
         EndRepair(false);
     }
 }
 internal void CreateSameChallenge(float multiplVisible = 1)
 {
     CurrentMathChallengeNode = new MathChallengeNode(CurrentMathChallengeNode.MathChallenge, multiplVisible);
 }
        internal void UpdateDrawNode(bool useMultiplGoal = false)
        {
            if (MyDrawNode == null)
            {
                return;
            }
            MyDrawNode.Clear();
            if (LootboxCount != 0)
            {
                // visualize lootbar-progress
                const float GROWTH_FACTOR = 1.3f;
                const float BORDER_WIDTH  = 4f;
                CCColor4B   white         = new CCColor4B(1f, 1f, 1f, DrawNodeAlpha);
                CCColor4B   bright        = new CCColor4B(1f, 1f, 1f, DrawNodeAlpha);
                CCRect      progressRect  = new CCRect(-(ContentSize.Width * GROWTH_FACTOR) / 2, -(ContentSize.Height * GROWTH_FACTOR) / 2, ContentSize.Width * GROWTH_FACTOR, ContentSize.Height * GROWTH_FACTOR);
                // draw the progress bar
                var progressPoly = new List <CCPoint> {
                    CCPoint.Zero, new CCPoint(0, (ContentSize.Height * GROWTH_FACTOR) / 2)
                };
                if (LootboxProgress >= 0.125f)
                {
                    progressPoly.Add(progressRect.UpperRight);
                }
                else
                {
                    progressPoly.Add(new CCPoint(LootboxProgress / 0.125f * progressRect.MaxX, progressRect.MaxY));
                    goto done;
                }
                if (LootboxProgress >= 0.375f)
                {
                    progressPoly.Add(new CCPoint(progressRect.MaxX, progressRect.MinY));
                }
                else
                {
                    progressPoly.Add(new CCPoint(progressRect.MaxX, progressRect.MaxY - progressRect.Size.Height * ((LootboxProgress - 0.125f) * 4)));
                    goto done;
                }
                if (LootboxProgress >= 0.625f)
                {
                    progressPoly.Add(new CCPoint(progressRect.MinX, progressRect.MinY));
                }
                else
                {
                    progressPoly.Add(new CCPoint(progressRect.MaxX - progressRect.Size.Width * ((LootboxProgress - 0.375f) * 4), progressRect.MinY));
                    goto done;
                }
                if (LootboxProgress >= 0.875f)
                {
                    progressPoly.Add(new CCPoint(progressRect.MinX, progressRect.MaxY));
                }
                else
                {
                    progressPoly.Add(new CCPoint(progressRect.MinX, progressRect.MinY + progressRect.Size.Height * ((LootboxProgress - 0.625f) * 4)));
                    goto done;
                }
                if (LootboxProgress > 0.875f)
                {
                    progressPoly.Add(new CCPoint(progressRect.MinX + progressRect.Size.Width * (LootboxProgress - 0.875f) * 2, progressRect.MaxY));
                }
done:
                var progressPolyPoints = progressPoly.ToArray();
                MyDrawNode.DrawPolygon(progressPolyPoints, progressPolyPoints.Length, bright, 0f, CCColor4B.Transparent);
                // draw the progress bar border
                MyDrawNode.DrawRect(progressRect, CCColor4B.Transparent, BORDER_WIDTH, white);
            }

            // additionally color the button depending on the multiplier progress
            int   multiplier = 1;
            float progress   = 0;

            if (useMultiplGoal)
            {
                multiplier = (int)CurrentMathChallengeNode.MultiplGoal;
                progress   = CurrentMathChallengeNode.MathChallenge.MultiplProgress;
            }
            else
            {
                multiplier = CurrentMathChallengeNode.Multiplier;
                progress   = CurrentMathChallengeNode.MultiplProgressVisible;
            }
            var lastColor     = MathChallengeNode.MultiplierBarColor(multiplier - 1);
            var nextColor     = MathChallengeNode.MultiplierBarColor(multiplier);
            var currentColor  = multiplier <= 5 ? CCColor4B.Lerp(lastColor, nextColor, progress) : lastColor;
            var darkenedColor = CCColor4B.Lerp(currentColor, CCColor4B.Black, 0.25f);

            darkenedColor.A = (byte)(DrawNodeAlpha * byte.MaxValue);
            MyDrawNode.DrawRect(new CCRect(-(ContentSize.Width) / 2, -(ContentSize.Height) / 2, ContentSize.Width, ContentSize.Height), darkenedColor);
        }