Beispiel #1
0
    private void SetSkinInfo(GameObject skinParent, GameObject skinPrefab, SkinObject skinData)
    {
        skinPrefab.transform.SetParent(skinParent.transform);
        skinPrefab.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);

        SkinUI ui = skinPrefab.GetComponent <SkinUI>();

        ui.SetICON(skinData.GetSkinICON());
        ui.SetSkinID(skinData.GetSkinID());

        if (PlayerDataManager.instance.GetUsingSkin() == skinData.GetSkinID())
        {
            ui.SetLabel(m_selectLabel);
            m_skinSelectButton.GetComponent <SkinChooseUI>().HoldSkinUI(ui);
            m_skinSelectButton.GetComponent <SkinChooseUI>().SetSkinUI();
        }
        else
        {
            if (!PlayerDataManager.instance.GetSkin(skinData.GetSkinID()))
            {
                ui.SetLabel(m_lockedLabel);
            }
            else
            {
                ui.HideLabel();
            }
        }

        ui.GetButton().onClick.AddListener(delegate
        {
            SelectSkin(skinData.GetSkinID(), ui);
        });
    }
    public override void ApplySkin()
    {
        _skinObject = _skinManager.skinLookup[type];

        ApplyMaterials();
        ApplyColors();
    }
Beispiel #3
0
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2952"), Translator.GetInstance().GetString("MessageBox", "2952", "message"), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                Skin selectedSkin = (Skin)cbSkin.SelectedItem;

                SkinObject.GetInstance().setCurrentSkin(selectedSkin);

                GeneralHelpers.GameSpeedValue speed = (GeneralHelpers.GameSpeedValue)Enum.ToObject(typeof(GeneralHelpers.GameSpeedValue), (int)slGameSpeed.Value);

                Language language = (Language)cbLanguage.SelectedItem;
                AppSettings.GetInstance().setLanguage(language);
                Settings.GetInstance().MailsOnLandings   = cbMailOnLandings.IsChecked.Value;
                Settings.GetInstance().MailsOnBadWeather = cbMailOnBadWeather.IsChecked.Value;
                Settings.GetInstance().MinutesPerTurn    = (int)cbTurnMinutes.SelectedItem;
                Settings.GetInstance().CurrencyShorten   = cbShortenCurrency.IsChecked.Value;


                foreach (RadioButton rbAirportCode in rbAirportCodes)
                {
                    if (rbAirportCode.IsChecked.Value)
                    {
                        Settings.GetInstance().AirportCodeDisplay = (Settings.AirportCode)rbAirportCode.Tag;
                    }
                }

                PageNavigator.NavigateTo(new PageSettings());
            }
        }
Beispiel #4
0
    public void SetUI(SkinObject item)
    {
        if (item.CanUnlock())//GameManager.Instance.GetCoins))
        {
            item.Unlocked = true;
        }

        if (item == GameManager.instance.CurrentSkin)
        {
            SetCurrent();
        }



        Icon.sprite = item.ShopIcon;
        Title.text  = item.Unlocked ? item.name : "Reach \n " + item.UnlockScore;

        SelectButton.interactable = item.Unlocked;

        SelectButton.onClick.AddListener(() =>
        {
            SetCurrent();
            GameManager.instance.CurrentSkin = item;
        });
    }
Beispiel #5
0
    protected override void CreateBall()
    {
        if (BallInstance != null)
        {
            Destroy(BallInstance);
        }
        BallInstance = Instantiate(BallPrefab);
        float size = Random.Range(MinSize, MaxSize);

        BallInstance.transform.localScale = new Vector3(size, size, 1);
        Rigidbody2D rb        = BallInstance.GetComponent <Rigidbody2D>();
        Vector2     direction = Random.insideUnitCircle.normalized;

        if (Mathf.Abs(direction.y) < Mathf.Abs(direction.x))
        {
            direction = Vector2.Perpendicular(direction);
        }
        float velocity = Random.Range(MinVelocity, MaxVelocity);

        rb.velocity = direction * velocity;
        SkinObject selectedSkin = SkinsController.Instance.GetSelectedSkin();

        if (selectedSkin != null)
        {
            SpriteRenderer renderer = BallInstance.GetComponent <SpriteRenderer>();
            renderer.color = selectedSkin.Colour;
        }
    }
Beispiel #6
0
 // Use this for initialization
 void Start()
 {
     shop       = GetComponentInParent <ShopPanel>();
     data       = Director.UI.skins[skinId];
     price.text = data.price.ToString();
     text.text  = data.skinName;
     UpdateState();
 }
Beispiel #7
0
    public static void Create()
    {
        SkinObject asset = ScriptableObject.CreateInstance <SkinObject>();

        AssetDatabase.CreateAsset(asset, "Assets/NewSkinObject.asset");
        AssetDatabase.SaveAssets();
        EditorUtility.FocusProjectWindow();
        Selection.activeObject = asset;
    }
Beispiel #8
0
 private void btnUndo_Click(object sender, RoutedEventArgs e)
 {
     cbSkin.SelectedItem          = SkinObject.GetInstance().CurrentSkin;
     cbLanguage.SelectedItem      = AppSettings.GetInstance().getLanguage();
     cbMailOnLandings.IsChecked   = Settings.GetInstance().MailsOnLandings;
     cbMailOnBadWeather.IsChecked = Settings.GetInstance().MailsOnBadWeather;
     cbTurnMinutes.SelectedItem   = Settings.GetInstance().MinutesPerTurn;
     cbShortenCurrency.IsChecked  = Settings.GetInstance().CurrencyShorten;
 }
Beispiel #9
0
    public override void ApplySkin()
    {
        _skinObject = _skinManager.skinLookup[type];

        if (changeLightColor)
        {
            _light.color = _skinObject.lightObject.lightColor;
        }
        if (changeLightIntensity)
        {
            _light.intensity = _skinObject.lightObject.intensity;
        }
    }
Beispiel #10
0
    private void CreateSkin(GameObject skinParent, SkinObject skinData)
    {
        GameObject skinPrefab = Instantiate(m_skinPrefab);

        SetSkinInfo(skinParent, skinPrefab, skinData);
    }
Beispiel #11
0
 public void SetSkin(SkinObject skin)
 {
     SetSkin(skin.body, skin.head, skin.hat, skin.glass, skin.bear, skin.shirt, skin.skirt);
 }
Beispiel #12
0
        public PageSettings()
        {
            InitializeComponent();

            this.Uid   = "1000";
            this.Title = Translator.GetInstance().GetString("PageSettings", this.Uid);

            StackPanel settingsPanel = new StackPanel();

            settingsPanel.Margin = new Thickness(10, 0, 10, 0);

            StandardContentPanel panelContent = new StandardContentPanel();

            panelContent.setContentPage(settingsPanel, StandardContentPanel.ContentLocation.Left);

            ListBox lbSettings = new ListBox();

            lbSettings.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbSettings.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");

            settingsPanel.Children.Add(lbSettings);

            WrapPanel panelSpeed = new WrapPanel();

            slGameSpeed                      = new Slider();
            slGameSpeed.Minimum              = (int)GeneralHelpers.GameSpeedValue.Fastest;
            slGameSpeed.Maximum              = (int)GeneralHelpers.GameSpeedValue.Slowest;
            slGameSpeed.Width                = 100;
            slGameSpeed.IsDirectionReversed  = true;
            slGameSpeed.IsSnapToTickEnabled  = true;
            slGameSpeed.IsMoveToPointEnabled = true;
            slGameSpeed.TickFrequency        = 500;
            slGameSpeed.ToolTip              = UICreator.CreateToolTip("1005");


            slGameSpeed.ValueChanged += new RoutedPropertyChangedEventHandler <double>(slGameSpeed_ValueChanged);

            panelSpeed.Children.Add(slGameSpeed);

            txtGameSpeed.Margin            = new Thickness(5, 0, 0, 0);
            txtGameSpeed.VerticalAlignment = System.Windows.VerticalAlignment.Bottom;

            panelSpeed.Children.Add(txtGameSpeed);

            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1001"), panelSpeed));

            cbTurnMinutes       = new ComboBox();
            cbTurnMinutes.Width = 100;
            cbTurnMinutes.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbTurnMinutes.Items.Add(15);
            cbTurnMinutes.Items.Add(30);
            cbTurnMinutes.Items.Add(60);
            cbTurnMinutes.ToolTip = UICreator.CreateToolTip("1006");

            cbTurnMinutes.SelectedItem = Settings.GetInstance().MinutesPerTurn;

            if (!GameObject.GetInstance().DayRoundEnabled)
            {
                lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1006"), cbTurnMinutes));
            }


            cbLanguage       = new ComboBox();
            cbLanguage.Width = 200;
            cbLanguage.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            // chs, 2011-10-11 changed to display flag together with language
            cbLanguage.ItemTemplate = this.Resources["LanguageItem"] as DataTemplate;
            cbLanguage.ToolTip      = UICreator.CreateToolTip("1007");


            foreach (Language language in Languages.GetLanguages().FindAll(l => l.IsEnabled))
            {
                cbLanguage.Items.Add(language);
            }

            cbLanguage.SelectedItem = AppSettings.GetInstance().getLanguage();

            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1002"), cbLanguage));


            cbSkin = new ComboBox();
            cbSkin.SetResourceReference(ComboBox.StyleProperty, "ComboBoxTransparentStyle");
            cbSkin.Width             = 200;
            cbSkin.SelectedValuePath = "Name";
            cbSkin.DisplayMemberPath = "Name";
            cbSkin.ToolTip           = UICreator.CreateToolTip("1008");

            foreach (Skin skin in Skins.GetSkins())
            {
                cbSkin.Items.Add(skin);
            }

            cbSkin.SelectedItem = SkinObject.GetInstance().CurrentSkin;

            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1003"), cbSkin));

            cbMailOnLandings           = new CheckBox();
            cbMailOnLandings.IsChecked = Settings.GetInstance().MailsOnLandings;
            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1004"), cbMailOnLandings));
            cbMailOnLandings.ToolTip = UICreator.CreateToolTip("1009");

            cbMailOnBadWeather           = new CheckBox();
            cbMailOnBadWeather.IsChecked = Settings.GetInstance().MailsOnBadWeather;
            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1007"), cbMailOnBadWeather));
            cbMailOnBadWeather.ToolTip = UICreator.CreateToolTip("1010");

            cbShortenCurrency           = new CheckBox();
            cbShortenCurrency.IsChecked = Settings.GetInstance().CurrencyShorten;
            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1008"), cbShortenCurrency));
            cbShortenCurrency.ToolTip = UICreator.CreateToolTip("1011");

            rbAirportCodes = new RadioButton[Enum.GetValues(typeof(Settings.AirportCode)).Length];

            WrapPanel panelAirpodeCode = new WrapPanel();
            int       i = 0;

            foreach (Settings.AirportCode code in Enum.GetValues(typeof(Settings.AirportCode)))
            {
                rbAirportCodes[i]           = new RadioButton();
                rbAirportCodes[i].Content   = code.ToString();
                rbAirportCodes[i].GroupName = "AirportCode";
                rbAirportCodes[i].Tag       = code;
                rbAirportCodes[i].Margin    = new Thickness(0, 0, 5, 0);
                rbAirportCodes[i].IsChecked = code == Settings.GetInstance().AirportCodeDisplay;
                rbAirportCodes[i].ToolTip   = UICreator.CreateToolTip("1012");

                panelAirpodeCode.Children.Add(rbAirportCodes[i]);
                i++;
            }
            lbSettings.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PageSettings", "1005"), panelAirpodeCode));


            WrapPanel buttonsPanel = new WrapPanel();

            buttonsPanel.Margin = new Thickness(0, 10, 0, 0);
            settingsPanel.Children.Add(buttonsPanel);

            Button btnOk = new Button();

            btnOk.Uid = "100";
            btnOk.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnOk.Height  = Double.NaN;
            btnOk.Width   = Double.NaN;
            btnOk.Content = Translator.GetInstance().GetString("General", btnOk.Uid);
            //btnOk.Click += new RoutedEventHandler(btnOk_Click);
            btnOk.Click += new RoutedEventHandler(btnOk_Click);
            btnOk.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            buttonsPanel.Children.Add(btnOk);

            Button btnUndo = new Button();

            btnUndo.Uid = "103";
            btnUndo.SetResourceReference(Button.StyleProperty, "RoundedButton");
            btnUndo.Height  = Double.NaN;
            btnUndo.Margin  = new Thickness(5, 0, 0, 0);
            btnUndo.Width   = Double.NaN;
            btnUndo.Click  += new RoutedEventHandler(btnUndo_Click);
            btnUndo.Content = Translator.GetInstance().GetString("General", btnUndo.Uid);
            btnUndo.SetResourceReference(Button.BackgroundProperty, "ButtonBrush");

            buttonsPanel.Children.Add(btnUndo);

            base.setContent(panelContent);

            base.setHeaderContent(this.Title);


            showPage(this);
        }
Beispiel #13
0
 public SkinObjectFieldList(SkinObject source)
 {
     SourceObject = source;
 }