示例#1
0
        private void OnClick(GameEntityMouseArea sender, SAMTime gameTime, InputState istate)
        {
            if (GDOwner.ZoomState != BistateProgress.Normal && GDOwner.ZoomState != BistateProgress.Expanded)
            {
                return;
            }

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

                if (GDOwner.ZoomState == BistateProgress.Expanded)
                {
                    AddEntityOperation(new ScreenShakeOperation2(this, GDOwner));
                }
                else
                {
                    AddEntityOperation(new ScreenShakeAndCenterOperation2(this, GDOwner));
                }

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

                return;
            }

            Owner.AddAgent(new LeaveTransitionGameEndAgent(GDOwner, GDOwner.ZoomState == BistateProgress.Expanded, this));
            MainGame.Inst.GDSound.PlayEffectZoomOut();
        }
示例#2
0
        public override void OnInitialize(EntityManager manager)
        {
            clickAreaThis = AddClickMouseArea(FRectangle.CreateByCenter(0, 0, DIAMETER, DIAMETER), OnClick, OnDown, OnUp);

            var cfg = new ParticleEmitterConfig.ParticleEmitterConfigBuilder
            {
                // red fire
                TextureIndex         = 12,
                SpawnRate            = 20,
                ParticleLifetimeMin  = 1.0f,
                ParticleLifetimeMax  = 2.5f,
                ParticleVelocityMin  = 24f,
                ParticleVelocityMax  = 32f,
                ParticleSizeInitial  = 64,
                ParticleSizeFinalMin = 32,
                ParticleSizeFinalMax = 48,
                ParticleAlphaInitial = 1f,
                ParticleAlphaFinal   = 0f,
                ColorInitial         = Color.DarkOrange,
                ColorFinal           = Color.DarkRed,
            }.Build(Textures.TexParticle);

            emitter = new PointCPUParticleEmitter(Owner, Position, cfg, GDConstants.ORDER_MAP_NODEPARTICLES);

            manager.AddEntity(emitter);
        }
示例#3
0
        protected override void OnClick(GameEntityMouseArea area, SAMTime gameTime, InputState istate)
        {
#if DEBUG
            if (DebugSettings.Get("UnlockNode"))
            {
                OnClickUnlocked(); return;
            }

            if (DebugSettings.Get("WorldPreview"))
            {
                MainGame.Inst.Profile.PurchasedWorlds.Clear(); ShowPreview(); return;
            }
#endif

            _ustate = UnlockManager.IsUnlocked(Blueprint, true);

            if (_ustate == WorldUnlockState.Unlocked)
            {
                OnClickUnlocked();
            }
            else if (_ustate == WorldUnlockState.NeedsAction)
            {
                OnClickNeedsAction();
            }
            else if (_ustate == WorldUnlockState.FullyLocked)
            {
                OnClickFullyLocked();
            }
        }
示例#4
0
        protected OverworldNode(GDOverworldScreen scrn, FPoint pos, int l10ntext, Guid id) : base(scrn, GDConstants.ORDER_WORLD_NODE)
        {
            _l10ndescription = l10ntext;
            NodePos          = pos;
            ContentID        = id;

            clickArea = AddClickMouseArea(FRectangle.CreateByCenter(FPoint.Zero, new FSize(SIZE, SIZE)), OnClick);
        }
示例#5
0
        public GameEntityMouseArea AddMouseArea(IFShape shape, IGameEntityMouseAreaListener listener, bool swallowEvents = true)
        {
            var area = new GameEntityMouseArea(this, shape, swallowEvents);

            area.AddListener(listener);
            MouseAreas.Add(area);
            return(area);
        }
示例#6
0
        private void OnDown(GameEntityMouseArea sender, SAMTime gameTime, InputState istate)
        {
            if (GDOwner.ZoomState != BistateProgress.Normal && GDOwner.ZoomState != BistateProgress.Expanded)
            {
                return;
            }

            GDOwner.PreventZoomInCtr = MonoSAMGame.GameCycleCounter;
        }
示例#7
0
        public override void OnInitialize(EntityManager manager)
        {
            clickAreaThis = AddClickMouseArea(new FCircle(0, 0, DIAMETER / 2f), OnClickCenter);

            clickAreaD0 = AddClickMouseArea(rectExpanderNorth.RelativeTo(Position).AsDeflated(0, 0, INSET_EXTENDER, 0), OnClickDiff1);
            clickAreaD1 = AddClickMouseArea(rectExpanderEast.RelativeTo(Position).AsDeflated(0, 0, 0, INSET_EXTENDER), OnClickDiff2);
            clickAreaD2 = AddClickMouseArea(rectExpanderSouth.RelativeTo(Position).AsDeflated(INSET_EXTENDER, 0, 0, 0), OnClickDiff3);
            clickAreaD3 = AddClickMouseArea(rectExpanderWest.RelativeTo(Position).AsDeflated(0, INSET_EXTENDER, 0, 0), OnClickDiff4);
        }
示例#8
0
        private void OnClick(GameEntityMouseArea sender, SAMTime gameTime, InputState istate)
        {
            if (GDOwner.ZoomState != BistateProgress.Normal && GDOwner.ZoomState != BistateProgress.Expanded)
            {
                return;
            }

            Owner.AddAgent(new LeaveTransitionOverworldOperation(GDOwner.ZoomState == BistateProgress.Expanded));
            MainGame.Inst.GDSound.PlayEffectZoomOut();
        }
示例#9
0
        public GameEntityMouseArea AddMouseDownMouseArea(IFShape shape, Action <GameEntityMouseArea, SAMTime, InputState> clickListener, bool swallowEvents = true)
        {
            var area = new GameEntityMouseArea(this, shape, swallowEvents);

            area.AddListener(new GameEntityMouseAreaLambdaAdapter {
                MouseDown = clickListener
            });
            MouseAreas.Add(area);
            return(area);
        }
        protected override void OnClick(GameEntityMouseArea area, SAMTime gameTime, InputState istate)
        {
            var ownr = ((GDOverworldScreen)Owner);

            if (ownr.IsTransitioning)
            {
                return;
            }

            Owner.HUD.AddModal(new MultiplayerMainPanel(), true, 0.5f, 1f);
        }
示例#11
0
        protected override void OnClick(GameEntityMouseArea area, SAMTime gameTime, InputState istate)
        {
            var ownr = ((GDOverworldScreen)Owner);

            if (ownr.IsTransitioning)
            {
                return;
            }

            //MainGame.Inst.GDBridge.IAB.SynchronizePurchases(GDConstants.IABList);

            Owner.HUD.AddModal(new MultiplayerMainPanel(), true, 0.5f, 1f);
        }
        protected override void OnClick(GameEntityMouseArea area, SAMTime gameTime, InputState istate)
        {
            var ownr = ((GDOverworldScreen)Owner);

            if (ownr.IsTransitioning)
            {
                return;
            }
            ownr.IsTransitioning = true;

            ownr.AddAgent(new TransitionZoomInToTutorialAgent(ownr, this));

            MainGame.Inst.GDSound.PlayEffectZoomIn();
        }
示例#13
0
        private void OnClickDiff4(GameEntityMouseArea owner, SAMTime dateTime, InputState istate)
        {
#if DEBUG
            if (istate.IsKeyDown(SKeys.A))
            {
                MainGame.Inst.Profile.SetCompleted(Blueprint.UniqueID, FractionDifficulty.DIFF_3, 60000, true); MainGame.Inst.SaveProfile(); return;
            }
            if (istate.IsKeyDown(SKeys.X))
            {
                MainGame.Inst.Profile.SetNotCompleted(Blueprint.UniqueID, FractionDifficulty.DIFF_3); MainGame.Inst.SaveProfile(); return;
            }
#endif

            MainGame.Inst.SetLevelScreen(Blueprint, FractionDifficulty.DIFF_3, GDScreen.GraphBlueprint);
        }
示例#14
0
        private void OnClickCenter(GameEntityMouseArea owner, SAMTime dateTime, InputState istate)
        {
            if (GDOwner.ZoomState != BistateProgress.Normal)
            {
                return;
            }

            var stat = StateSum;

            if (stat == BistateProgress.Closed || stat == BistateProgress.Closing)
            {
                OpenNode();
            }
            else if (stat == BistateProgress.Open || stat == BistateProgress.Opening || stat == BistateProgress.Undefined)
            {
                CloseNode();
            }
        }
示例#15
0
        protected override void OnClick(GameEntityMouseArea area, SAMTime gameTime, InputState istate)
        {
            var ownr = ((GDOverworldScreen)Owner);

            if (ownr.IsTransitioning)
            {
                return;
            }

            if (MainGame.Inst.Profile.AccountType == AccountType.Local)
            {
                MainGame.Inst.ShowToast(null, L10N.T(L10NImpl.STR_MP_CONNECTING), 40, FlatColors.Emerald, FlatColors.Foreground, 2f);
                MainGame.Inst.Backend.CreateUser(MainGame.Inst.Profile).RunAsync();
                return;
            }

            //MainGame.Inst.GDBridge.IAB.SynchronizePurchases(GDConstants.IABList);

            var ustate = UnlockManager.IsUnlocked(Levels.WORLD_ID_ONLINE, true);

            switch (ustate)
            {
            case WorldUnlockState.OpenAndUnlocked:
                Owner.HUD.AddModal(new SCCMMainPanel(), true, 0.5f, 1f);
                break;

            case WorldUnlockState.ReachableButMustBePreviewed:
            case WorldUnlockState.UnreachableButCanBePreviewed:
                Owner.HUD.AddModal(new SCCMPreviewPanel(), true, 0.5f, 1f);
                break;

            case WorldUnlockState.UnreachableAndFullyLocked:
                Owner.HUD.ShowToast("ONSCCM::LOCKED(MULTI)", L10N.T(L10NImpl.STR_GLOB_WORLDLOCK), 40, FlatColors.Pomegranate, FlatColors.Foreground, 1.5f);
                MainGame.Inst.GDSound.PlayEffectError();

                AddOperation(new ShakeNodeOperation());
                break;

            default:
                SAMLog.Error("ONSCCM::EnumSwitch_OC", "ustate: " + ustate);
                throw new ArgumentOutOfRangeException();
            }
        }
示例#16
0
        protected override void OnClick(GameEntityMouseArea area, SAMTime gameTime, InputState istate)
        {
#if DEBUG
            if (DebugSettings.Get("UnlockNode"))
            {
                OnClick_OpenAndUnlocked(); return;
            }

            if (DebugSettings.Get("WorldPreview"))
            {
                MainGame.Inst.Profile.PurchasedWorlds.Clear(); ShowPreview(); return;
            }
#endif

            _ustate = UnlockManager.IsUnlocked(Blueprint, true);

            //MainGame.Inst.GDBridge.IAB.SynchronizePurchases(GDConstants.IABList);

            switch (_ustate)
            {
            case WorldUnlockState.OpenAndUnlocked:
                OnClick_OpenAndUnlocked();
                break;

            case WorldUnlockState.ReachableButMustBePreviewed:
                OnClick_ReachableButMustBeBought();
                break;

            case WorldUnlockState.UnreachableButCanBePreviewed:
                OnClick_UnreachableButCanBeBought();
                break;

            case WorldUnlockState.UnreachableAndFullyLocked:
                OnClick_UnreachableAndFullyLocked();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
示例#17
0
 public void OnMouseDown(GameEntityMouseArea sender, SAMTime gameTime, InputState istate)
 {
     MouseDown?.Invoke();
 }
示例#18
0
 protected abstract void OnClick(GameEntityMouseArea area, SAMTime gameTime, InputState istate);
示例#19
0
 public void OnMouseMove(GameEntityMouseArea sender, SAMTime gameTime, InputState istate)
 {
     //
 }
示例#20
0
 public void OnMouseClick(GameEntityMouseArea sender, SAMTime gameTime, InputState istate)
 {
     Click?.Invoke();
 }