Example #1
0
        public Task ShowMessage(string msg)
        {
            //await Task.Run(() =>{ });
            DebugTextBox.AppendText("\n" + msg + "\n");

            return(null);
        }
        private void Log(string message, LogLevel level)
        {
            Color color;

            switch (level)
            {
            case LogLevel.Info:
                color = Color.Green;
                break;

            case LogLevel.Warning:
                color = Color.DarkOrange;
                break;

            case LogLevel.Error:
                color = Color.Red;
                break;

            case LogLevel.Critical:
                color = Color.Brown;
                break;

            case LogLevel.Default:
                color = Color.Black;
                break;

            default:
                color = Color.Black;
                break;
            }
            DebugTextBox.AppendText(message, color);
        }
        public HistoricImageHud(string historyFileName) : base("data/White Texture.png", true, false)
        {
            var bg = new EasyDraw(game.width, game.height, false);

            bg.Clear(Color.FromArgb(0, Color.Black));
            AddChild(bg);

            _mainImage = new Sprite(historyFileName, true, false);
            AddChild(_mainImage);

            //_mainImage.scale = 0.5f;
            _mainImage.SetOriginToCenter();
            _mainImage.SetXY(MyGame.HALF_SCREEN_WIDTH, MyGame.HALF_SCREEN_HEIGHT);

            DrawableTweener.TweenSpriteAlpha(_mainImage, 0, 1, 400, Easing.Equation.CubicEaseOut);

            var textBg = new EasyDraw(game.width, 30, false);

            textBg.Clear(Color.Black);
            AddChild(textBg);
            textBg.SetXY(0, game.height - 30);

            var pressToContinueText = new DebugTextBox("Press Esc to continue", game.width, 30, 0xffffff, 0x00010101,
                                                       CenterMode.Center, CenterMode.Center);

            AddChild(pressToContinueText);
            pressToContinueText.SetXY(0, game.height - 30);

            DrawableTweener.Blink(pressToContinueText, 1, 0, 400);
        }
Example #4
0
    public MyGame() : base(SCREEN_WIDTH, SCREEN_HEIGHT, Settings.FullScreen) // Create a window that's 800x600 and NOT fullscreen
    {
        SCREEN_WIDTH  = game.width;
        SCREEN_HEIGHT = game.height;

        HALF_SCREEN_WIDTH  = SCREEN_WIDTH / 2;
        HALF_SCREEN_HEIGHT = SCREEN_HEIGHT / 2;

        ShowMouse(true);

        string[] tmxFiles = TmxFilesLoader.GetTmxFileNames("Level*.tmx");
        var      mapData  = TiledMapParserExtended.MapParser.ReadMap(tmxFiles[0]);

        _caveLevelMap = new CaveLevelMapGameObject(mapData);

        _cam       = new FollowCamera(0, 0, game.width, game.height);
        _cam.scale = Settings.Camera_Scale;
        Cam        = _cam;

        var gameSoundManager = new GameSoundManager(mapData);

        AddChild(gameSoundManager);

        var startScreen = new PreGameStartScreen(Settings.StartScreen_Bg_Image, Settings.StartScreen_Music, () =>
        {
            var inGameStartScreen1 =
                new PreGameStartScreen(Settings.In_Game_StartScreen_1_Bg_Image, Settings.In_Game_StartScreen_1_Music,
                                       () =>
            {
                var inGameStartScreen2 =
                    new PreGameStartScreen(Settings.In_Game_StartScreen_2_Bg_Image, Settings.In_Game_StartScreen_2_Music,
                                           () =>
                {
                    var inGameStartScreen3 =
                        new PreGameStartScreen(Settings.In_Game_StartScreen_3_Bg_Image, null,
                                               () =>
                    {
                        GameSoundManager.Instance.FadeOutCurrentMusic();
                        CoroutineManager.StartCoroutine(LoadLevelWithDelay(), this);
                    });
                    AddChild(inGameStartScreen3);
                });
                AddChild(inGameStartScreen2);
            });
            AddChild(inGameStartScreen1);
        });

        AddChild(startScreen);

        //Debug
        _fpsCounter = new FpsCounter();
        AddChild(_fpsCounter);

        _debugText = new DebugTextBox("Hello World", width, 100);
        _cam.AddChild(_debugText);
        _debugText.x = -SCREEN_WIDTH / 2;
        _debugText.y = -SCREEN_HEIGHT / 2;
        _debugText.SetActive(false);
    }
Example #5
0
        public void OnDebugOutput(string arg)
        {
            // AppendText() is much faster than data binding.
            DebugTextBox.AppendText(arg);

            DebugTextBox.CaretIndex = DebugTextBox.Text.Length;
            DebugTextBox.ScrollToEnd();
        }
 public void _Write(string text)
 {
     DebugTextBox.Dispatcher.InvokeAsync(
         new Action(() => {
         DebugTextBox.AppendText(text);
         DebugTextBox.ScrollToEnd();
     })
         );
 }
Example #7
0
        public void DisplayDebug()
        {
            foreach (string oneItem in  JerkHub.Ptr2Debug.DebugLineItemsList)
            {
                DebugTextBox.AppendText(oneItem);
            }

            // ptr2FormObj.DebugTextBox.Text = debugTextToDate
            DebugTextBox.Select();
            DebugTextBox.Refresh();
        }
Example #8
0
        internal void Append(string line)
        {
            if (!this.Dispatcher.HasThreadAccess)
            {
#pragma warning disable 4014
                this.Dispatcher.RunAsync(CoreDispatcherPriority.High, () => Append(line));
#pragma warning restore 4014

                return;
            }

            DebugTextBox.Text += line;
            var sv = DebugTextBox.GetFirstDescendantOfType <ScrollViewer>();

            if (sv != null &&
                sv.VerticalOffset + sv.ViewportHeight >= sv.ScrollableHeight - 1)
            {
                sv.ChangeView(0, 10000000, 1);
            }
        }
Example #9
0
 public void Clear() => DebugTextBox.Clear();
Example #10
0
        public void Init(CircularSelector <PlayerFireStrategy> fireStrategies, PowerupMenu powerupMenu)
        {
            Instance = this;

            _GameManager = GameManager.Instance;
            _PowerupMenu = powerupMenu;

            DebugTextBox = new DebugTextBox(InputField);

#if !UNITY_EDITOR
            Vector3 newScale = MobileGuiScaleVector;
            InputField.transform.localScale = newScale;

            var setAll = new Component[]
            {
                InputField,
                Button,
                DropdownFireType,
                ButtonShowPowerupMenu,
                PowerupRow,
                SliderFireLevel,
                TextFireLevel,
                SliderGameSpeed,
                TextGameSpeed,
                ToggleCanGameOver,
                ToggleGodMode,
            };
            foreach (Component component in setAll)
            {
                component.transform.localScale = newScale;
            }

            ToggleCanGameOver.isOn = true;
            ToggleGodMode.isOn     = false;
#else
            ToggleCanGameOver.isOn  = false;
            ToggleGodMode.isOn      = true;
            Player.Instance.GodMode = true;
#endif

            var inputPos = SpaceUtil.ScreenMap.BottomLeft + new Vector3(DebugBorderOffset, DebugBorderOffset);
            SpaceUtil.SetLeftToPosition(InputField, inputPos);

            var buttonPos = SpaceUtil.ScreenMap.BottomRight + new Vector3(-DebugBorderOffset, DebugBorderOffset);
            SpaceUtil.SetRightToPosition(Button, buttonPos);

            var dropdownFireTypePos = SpaceUtil.ScreenMap.Right + new Vector3(-DebugBorderOffset, 0);
            SpaceUtil.SetRightToPosition(DropdownFireType, dropdownFireTypePos);

#if UNITY_EDITOR
            const int OffsetScale = 1;
#else
            const int OffsetScale = 5;
#endif

            void SetRight(MonoBehaviour target, float offsetScaleMultiplier)
            {
                float   offsetY = offsetScaleMultiplier * OffsetScale;
                Vector3 pos     = SpaceUtil.ScreenMap.Right + new Vector3(-DebugBorderOffset, offsetY);

                SpaceUtil.SetRightToPosition(target, pos);
            }

            SetRight(ButtonShowPowerupMenu, -50);
            SetRight(PowerupRow, -120);
            SetRight(ToggleCanGameOver, -180);

            ToggleCanGameOver.onValueChanged.AddListener(isOn => GameManager.Instance.CanGameOver = isOn);

            SetRight(ToggleGodMode, -210);
            ToggleGodMode.onValueChanged.AddListener(isOn => Player.Instance.GodMode = isOn);

            var strategiesToAdd = fireStrategies.Select(x => x.GetType().Name).ToList();
            DropdownFireType.AddOptions(strategiesToAdd);
            DropdownFireType.SetValueWithoutNotify(GameManager.Instance.DefaultFireTypeIndex);
            DropdownFireType.onValueChanged.AddListener(delegate
            {
                if (!ShouldSkipSettingFireTimeInGameManager)
                {
                    _GameManager.SetFireType(DropdownFireType.value, skipDropDown: true, skipMessage: true, endlessTime: ShouldSetEndlessWeaponTime);
                }
            });

            SetRight(SliderFireLevel, 35);
            SetRight(TextFireLevel, 55);
            SetRight(SliderGameSpeed, 180);
            SetRight(TextGameSpeed, 200);

            //SliderFireLevel.value = 0;
            //DebugSliderFireLevelChanged(SliderFireLevel);

            //TimeSpan frameTime = TimeSpan.FromSeconds((double)1 / (double)Application.targetFrameRate);
            //SetDebugLabel("FRAMETIME", frameTime);

            DebugSliderGameSpeedChanged(SliderGameSpeed);

            PowerupRow.Init(CurrentDebugPowerup);

#if !UNITY_EDITOR
            ToggleUI();
#endif
        }
Example #11
0
 public void Logout(string str)
 {
     DebugTextBox.AppendText("\n" + "[" + DateTime.Now.ToLongTimeString() + "]" + str);
     DebugTextBox.ScrollToEnd();
 }
 private void DebugTextBox_TextChanged(object sender, EventArgs e)
 {
     DebugTextBox.SelectionStart = DebugTextBox.Text.Length;
     DebugTextBox.ScrollToCaret();
 }
Example #13
0
 public void OnDebugClear()
 {
     DebugTextBox.Clear();
 }
Example #14
0
 private void DebugLine(string text)
 {
     //DebugTextBox.Text += text + Environment.NewLine;
     DebugTextBox.AppendText(text);
 }
Example #15
0
 private void AppendDebugLine(string line)
 {
     DebugTextBox.AppendText(line + "\r\n");
 }