Beispiel #1
0
        public static void OpenLoadErrorScreen(List <ModError> errors)
        {
            GameUIRoot.Instance.Manager.RenderCamera.depth          += 10f;
            GameUIRoot.Instance.Manager.RenderCamera.enabled         = true;
            GameUIRoot.Instance.Manager.overrideClearFlags           = CameraClearFlags.Color;
            GameUIRoot.Instance.Manager.RenderCamera.backgroundColor = Color.black;

            LoadErrorModLabels = new List <dfLabel>();
            for (int i = 0; i < errors.Count; i++)
            {
                var mod_name = GameUIRoot.Instance.Manager.AddControl <dfLabel>();
                mod_name.zindex          = 3;
                mod_name.AutoSize        = true;
                mod_name.Text            = errors[i].DisplayName;
                mod_name.BackgroundColor = Color.black;
                mod_name.Color           = Color.white;
                mod_name.Font            = GungeonFont;
                mod_name.TextScale       = 3;
                mod_name.IsVisible       = false;

                var mod_err = GameUIRoot.Instance.Manager.AddControl <dfLabel>();
                mod_err.zindex          = 3;
                mod_err.AutoSize        = true;
                mod_err.Text            = LocalizeException(errors[i].Exception);
                mod_err.BackgroundColor = Color.black;
                mod_err.Color           = Color.gray;
                mod_err.Font            = UI.GungeonFont;
                mod_err.TextScale       = 3;
                mod_err.IsVisible       = false;
                mod_err.WordWrap        = true;
                mod_err.MaximumSize     = new Vector3(Screen.width * 0.95f, Screen.height);

                LoadErrorModLabels.Add(mod_name);
                LoadErrorModLabels.Add(mod_err);
            }

            UpdateLoadErrorScreen();
            LoadErrorTitle.Show();
            LoadErrorSubtitle.Show();
            for (int i = 0; i < LoadErrorModLabels.Count; i++)
            {
                LoadErrorModLabels[i].Show();
            }
            LoadErrorOKButton.Show();
            LoadErrorOKButton.Focus();
        }
Beispiel #2
0
    public void SetWeapon(Weapon weapon)
    {
        if (weaponButton == null)
        {
            // print("Weapon button is null");
        }
        if (weapon == null)
        {
            // print("NulL");
        }
        else
        {
            // print("Notnull");
        }
        this.Weapon = weapon;
        if (NameLabel == null)
        {
            // print("WTF?");
        }
        WeaponAvatar.SpriteName = weapon.AvatarPath;
        NameLabel.Text          = weapon.Name;
        if (weapon.MinimumDamage < weapon.MaximumDamage)
        {
            DamageLabel.Text = string.Format("{0} - {1}", weapon.MinimumDamage, weapon.MaximumDamage);
        }
        else
        {
            DamageLabel.Text = weapon.MaximumDamage + "";
        }
        AttackSpeedLabel.Text = string.Format("{0:0.00} attacks per second", weapon.AttackSpeed);
        SlowdownLabel.Text    = string.Format("{0:0} % slowdown", weapon.SlowDown);

        if (Player.MeleeWeapon != null && Player.MeleeWeapon.Equals(weapon.Name) ||
            Player.RangedWeapon != null && Player.RangedWeapon.Equals(weapon.Name) ||
            Player.MortarWeapon != null && Player.MortarWeapon.Equals(weapon.Name))
        {
            weaponButton.Focus();
        }
    }
Beispiel #3
0
    public void SetDialog(string title, string text, string buttonText, bool pause, bool endGame, GameObject prefab = null)
    {
        if (prefab != null)
        {
            guiCamera      = (GameObject)Instantiate(guiCameraPrefab, Vector3.zero, Quaternion.identity);
            guiCameraLight = (GameObject)Instantiate(guiCameraLightPrefab, Vector3.zero, Quaternion.identity);
            renderObject   = (GameObject)Instantiate(prefab, guiCamera.transform.position + guiCamera.transform.forward * 32, Quaternion.identity);
            renderObject.transform.Translate(guiCamera.transform.up * -9);
            Building b = renderObject.GetComponent <Building>();
            if (b != null)
            {
                text = text + "\n\n" + b.StatsText();
            }
            //renderObject.transform.Rotate(100, 0, 0);
            timestamp = System.DateTime.Now;
            dialogImage.Parent.Show();
            dialogImage.Show();
        }
        else
        {
            dialogImage.Parent.Hide();
            dialogImage.Hide();
        }

        dialogTitle.Text  = title;
        dialogText.Text   = text;
        dialogButton.Text = buttonText;


        dialogButton.Focus();
        //show the dialog and pause time if desired
        dialogPanel.Show();
        if (pause)
        {
            Time.timeScale = 0;
        }
        this.endGame = endGame;
    }