상속: MonoBehaviour
예제 #1
0
        public override void OnRemovedFromHudContainer(HudContainer hudContainer)
        {
            base.OnRemovedFromHudContainer(hudContainer);
            mapUiTempManager.OnSelectedMapAndDifficulty -= MapButtonContainer_OnSelectedMapAndDifficulty;

            Controller.Instance.Input.Hud.Exit.performed -= Exit_performed;
        }
예제 #2
0
        public override void OnAddedToHudContainer(HudContainer hudContainer)
        {
            base.OnAddedToHudContainer(hudContainer);
            buttonPlay.onClick.AddListener(Button_OnClick_Play);
            buttonPlayInAutoplayMode.onClick.AddListener(Button_OnClick_Autoplay);

            Controller.Instance.Input.Hud.Exit.performed += Exit_performed;
        }
예제 #3
0
        public override void OnRemovedFromHudContainer(HudContainer hudContainer)
        {
            buttonPlay.onClick.RemoveAllListeners();
            buttonPlayInAutoplayMode.onClick.RemoveAllListeners();

            Controller.Instance.Input.Hud.Exit.performed -= Exit_performed;

            base.OnRemovedFromHudContainer(hudContainer);
        }
예제 #4
0
        public override void OnAddedToHudContainer(HudContainer hudContainer)
        {
            animator = GetComponent <Animator>();

            base.OnAddedToHudContainer(hudContainer);
            mapUiTempManager.OnSelectedMapAndDifficulty += MapButtonContainer_OnSelectedMapAndDifficulty;

            Controller.Instance.Input.Hud.Exit.performed += Exit_performed;
        }
예제 #5
0
        private void MapButtonContainer_OnSelectedMapAndDifficulty(int mapId, int diffId)
        {
            Debug.Log("Starting " + mapId + ":" + diffId);

            MenuPlayMap lScreen = HudManager.Instance.GetTemplateMenuPlayMap();

            lScreen.mapId  = (uint)mapId;
            lScreen.diffId = (uint)diffId;

            HudContainer.SetScreen(lScreen);
        }
예제 #6
0
        public static void Load(UnityModManager.ModEntry entry)
        {
            Mod                 = entry;
            entry.OnUnload      = Unload;
            entry.OnFixedUpdate = OnUpdate;
            entry.OnGUI         = OnGui;

            CmdHandler = new CommandHandler();
            NetHandler = new NetworkCommandListener();

            _harmony = HarmonyInstance.Create(entry.Info.Id);
            _harmony.PatchAll();

            Console.onLogReceived += ChatOnChatChanged;

            GameObject gameObject = new GameObject();

            gameObject.AddComponent <SetDontDestroyOnLoad>();
            _hudContainer = gameObject.AddComponent <HudContainer>();
        }
예제 #7
0
 private void Exit_performed(InputAction.CallbackContext obj)
 {
     HudContainer.SetScreen(HudManager.Instance.GetTemplateMenu());
 }
예제 #8
0
        public void EnterEndLevelMode()
        {
            if (EndLevelMode)
            {
                return;
            }

            this.WriteLine("init: EnterEndLevelMode");

            if (Sync_EnterEndLevelMode != null)
            {
                Sync_EnterEndLevelMode();
            }

            var ScoreContainer = new Sprite().AttachTo(this);

            ScoreContainer.alpha = 0.8;

            Bitmap scroll       = Assets.Default.scroll.AttachTo(ScoreContainer);
            var    scroll_scale = DefaultControlHeight / scroll.height;

            scroll.scaleX = scroll_scale;
            scroll.scaleY = scroll_scale;

            scroll.MoveTo(DefaultControlWidth - scroll.width, 0);
            scroll.filters = new BitmapFilter[] { new DropShadowFilter() };

            new Bitmap(EgoView.Buffer.clone())
            {
                scaleX = DefaultScale,
                scaleY = DefaultScale
            }.AttachTo(this).FadeOutAndOrphanize(1000 / 24, 0.1);

            if (music != null)
            {
                music.stop();
            }

            EndLevelMode             = true;
            MovementEnabled_IsInGame = false;

            var music_endlevel = Assets.Default.Music.music_endlevel.play(1);

            this.WriteLine("init: music_endlevel");

            this.EgoView.Image.filters = new BitmapFilter[] {
                Filters.GrayScaleFilter,
            };

            this.EgoView.ViewPositionLock = TheGoldStack.Position;
            this.EgoView.ViewPosition     = TheGoldStack.Position;

            var FrozenLook = (45 + 180);

            var p = new PointInt32
            {
                X = (int)Math.Floor(TheGoldStack.Position.x),
                Y = (int)Math.Floor(TheGoldStack.Position.y),
            };

            // where should we look actually?
            if (EgoView.Map.WallMap[p.X - 1, p.Y] != 0)
            {
                FrozenLook = (90 + 180);
            }

            if (EgoView.Map.WallMap[p.X, p.Y - 1] != 0)
            {
                FrozenLook = (0 + 180);
            }

            this.EgoView.ViewDirection = FrozenLook.DegreesToRadians();

            HudContainer.FadeOut(1000 / 15, 0.2,
                                 delegate
            {
                CompassContainer.alpha = 0;
            }
                                 );


            var onClick = default(Action <MouseEvent>);
            var onKeyUp = default(Action <KeyboardEvent>);


            #region EnterEndLevelMode_ReadyToContinue
            EnterEndLevelMode_ReadyToContinue =
                delegate
            {
                if (EnterEndLevelMode_ReadyToContinue == null)
                {
                    this.WriteLine("EnterEndLevelMode_ReadyToContinue already disabled?");

                    return;
                }

                this.WriteLine("EnterEndLevelMode_ReadyToContinue is now disabled!");
                if (Sync_ExitEndLevelMode != null)
                {
                    Sync_ExitEndLevelMode();
                }

                EnterEndLevelMode_ReadyToContinue = null;

                music_endlevel.stop();


                ScoreContainer.FadeOut(
                    delegate
                {
                    ScoreContainer.Orphanize();

                    PrepareToCallReadyForNextLevel();
                }
                    );

                stage.keyUp -= onKeyUp;
                stage.click -= onClick;
            };
            #endregion



            1500.AtDelayDo(
                delegate
            {
                // level ends for all

                // list current scores

                ShowScoreTable(ScoreContainer, scroll);



                #region exit this menu
                music_endlevel.soundComplete +=
                    delegate
                {
                    // we are ready to continue...
                    // are other players?

                    if (EnterEndLevelMode_ReadyToContinue != null)
                    {
                        EnterEndLevelMode_ReadyToContinue();
                    }
                };


                onClick =
                    delegate
                {
                    if (!MovementEnabled_IsFocused)
                    {
                        return;
                    }

                    if (EnterEndLevelMode_ReadyToContinue != null)
                    {
                        EnterEndLevelMode_ReadyToContinue();
                    }
                };

                onKeyUp =
                    delegate
                {
                    if (!MovementEnabled_IsFocused)
                    {
                        return;
                    }

                    if (EnterEndLevelMode_ReadyToContinue != null)
                    {
                        EnterEndLevelMode_ReadyToContinue();
                    }
                };
                #endregion

                stage.click += onClick;
                stage.keyUp += onKeyUp;

                // should add click / any key to dismiss this menu
            }
                );
        }
예제 #9
0
 private void MapLoader_OnFinish()
 {
     Debug.Log("Map loader has finished");
     HudContainer.SetScreen(HudManager.Instance.GetTemplateMenu());
 }
예제 #10
0
 public override void OnAddedToHudContainer(HudContainer hudContainer)
 {
     base.OnAddedToHudContainer(hudContainer);
     MapLoader.StartLoad(MapLoader_OnFinish);
 }