Пример #1
0
        public void CloseNode()
        {
            if (((GDWorldHUD)Owner.HUD).SelectedNode == this)
            {
                ((GDWorldHUD)Owner.HUD).SelectNode(null);
            }

            if (StateSum == BistateProgress.Closing)
            {
                return;
            }

            var progress = FindFirstOperationProgress(p => p.Name == "LevelNode::Open::root");

            AbortAllOperations(p => p.Name == "LevelNode::Open::root");
            var o = new LambdaOperation <LevelNode>("LevelNode::Close::root", TOTAL_EXPANSION_TIME, (n, p) => RootExpansionProgress = 1 - p);

            AddOperation(o);
            if (progress != null)
            {
                o.ForceSetProgress(1 - progress.Value);
            }

            CloseExtender(FractionDifficulty.DIFF_0);
            CloseExtender(FractionDifficulty.DIFF_1);
            CloseExtender(FractionDifficulty.DIFF_2);
            CloseExtender(FractionDifficulty.DIFF_3);

            MainGame.Inst.GDSound.PlayEffectClose();
        }
Пример #2
0
        public void OpenNode()
        {
            AbortAllOperations(p => p.Name == "LevelNode::Center");
            AbortAllOperations(p => p.Name == "LevelNode::CenterShake");

#if DEBUG
            if (!NodeEnabled && DebugSettings.Get("UnlockNode"))
            {
                NodeEnabled = true;
            }
#endif
            if (!NodeEnabled)
            {
                MainGame.Inst.GDSound.PlayEffectError();

                AddOperation(new ScreenShakeAndCenterOperation(this, GDOwner));

                Owner.HUD.ShowToast("LN::LOCKED", L10N.T(L10NImpl.STR_GLOB_LEVELLOCK), 40, FlatColors.Pomegranate, FlatColors.Foreground, 1.5f);

                return;
            }

            ((GDWorldHUD)Owner.HUD).SelectNode(this);

            var progress = FindFirstOperationProgress(p => p.Name == "LevelNode::Close::root");
            AbortAllOperations(p => p.Name == "LevelNode::Close::root");
            var o = new LambdaOperation <LevelNode>("LevelNode::Open::root", TOTAL_EXPANSION_TIME, (n, p) => RootExpansionProgress = p);
            AddOperation(o);
            if (progress != null)
            {
                o.ForceSetProgress(1 - progress.Value);
            }

            if (Blueprint.UniqueID == Levels.LEVELID_1_1 && !LevelData.HasCompletedOrBetter(FractionDifficulty.DIFF_0))
            {
                OpenExtender(FractionDifficulty.DIFF_0);
            }
            else
            {
                OpenExtender(FractionDifficulty.DIFF_0);
                OpenExtender(FractionDifficulty.DIFF_1);
                OpenExtender(FractionDifficulty.DIFF_2);
                OpenExtender(FractionDifficulty.DIFF_3);
            }

            AddOperation(new CenterNodeOperation(GDOwner));

            MainGame.Inst.GDSound.PlayEffectOpen();
        }