コード例 #1
0
ファイル: MainScene.cs プロジェクト: takishita2nd/FarmGame
        protected override void OnAdded()
        {
            //背景
            var background = new SpriteNode();

            background.Texture  = Texture2D.Load("bg_main.jpg");
            background.Position = new Vector2F(0, 0);
            background.ZOrder   = Common.Parameter.ZOrder.BackGround;
            AddChildNode(background);

            var sign = new SpriteNode();

            sign.Texture  = Texture2D.Load("homesign.png");
            sign.Position = new Vector2F(0, 0);
            sign.ZOrder   = Common.Parameter.ZOrder.Panel;
            AddChildNode(sign);

            _powerPanel = new PowerPanel();
            _powerPanel.SetPosition(new Vector2F(sign.Texture.Size.X, 0));
            _powerPanel.SetNode(this);
            _powerPanel.UpdateValue();

            _moneyPanel = new MoneyPanel();
            _moneyPanel.SetPosition(new Vector2F(sign.Texture.Size.X, _powerPanel.GetHeight()));
            _moneyPanel.SetNode(this);
            _moneyPanel.SetValue(GameData.PlayerData.Money);

            _weatherPanel = new WeatherPanel();
            _weatherPanel.SetPosition(new Vector2F(sign.Texture.Size.X, _powerPanel.GetHeight() + _moneyPanel.GetHeight()));
            _weatherPanel.SetNode(this);
            _weatherPanel.UpdateValue();

            menu = new CommonMenu(this);
        }
コード例 #2
0
        public override T GetPanel <T>(params object[] parameters)
        {
            try
            {
                var weatherPanel   = new WeatherPanel();
                var weatherContext = weatherPanel.DataContext as WeatherContext;

                if (weatherContext != null)
                {
                    Settings.ApplyToProperties(weatherContext, "Location");
                    weatherContext.SaveAction = () =>
                    {
                        try
                        {
                            Settings["Location"].Value = weatherContext.Location;
                            VA.SettingsManager.Save(Settings, StringResource.WeatherPlugin_SettingsSavedMessage);
                        }
                        catch (Exception exception)
                        {
                            VA.Logger.Error(exception);
                        }
                    };
                }

                return(weatherPanel as T);
            }
            catch (Exception exception)
            {
                VA.Logger.Error(exception);
            }

            return(null);
        }
コード例 #3
0
    /// <summary>
    /// Zeigt den Timer an und bepflanzt nach Ablauf der Zeit die leeren Felder.
    /// </summary>
    void Update()
    {
        if (timeLeft > 10)
        {
            countdown.text = (timeLeft + " Sek."); // Zeit im Canvas anzeigen
        }
        else
        {
            countdown.text = ("<color=red>" + timeLeft + "<color=white>" + " Sek."); // Zeit im Canvas in rot anzeigen
        }

        if (timeLeft == 0 && a == 0 && !(weather.GetComponent <Weather>().seasonNumber == 0))
        {
            SelectionPanel.SetActive(false);
            WeatherPanel.SetActive(false);


            timeLeft = 0;
            a        = 1;
            if (field1.GetComponent <Field>().plantName == "")
            {
                field1.GetComponent <Field>().plantName       = "Empty";
                field1.GetComponent <SpriteRenderer>().sprite = empty;
                field1.GetComponent <Field>().plant           = emptyPlant;
                field1.GetComponent <Field>().fieldIsChecked  = true;
            }
            if (field2.GetComponent <Field>().plantName == "")
            {
                field2.GetComponent <Field>().plantName       = "Empty";
                field2.GetComponent <SpriteRenderer>().sprite = empty;
                field2.GetComponent <Field>().plant           = emptyPlant;
                field2.GetComponent <Field>().fieldIsChecked  = true;
            }
            if (field3.GetComponent <Field>().plantName == "")
            {
                field3.GetComponent <Field>().plantName       = "Empty";
                field3.GetComponent <SpriteRenderer>().sprite = empty;
                field3.GetComponent <Field>().plant           = emptyPlant;
                field3.GetComponent <Field>().fieldIsChecked  = true;
            }
            if (field4.GetComponent <Field>().plantName == "")
            {
                field4.GetComponent <Field>().plantName       = "Empty";
                field4.GetComponent <SpriteRenderer>().sprite = empty;
                field4.GetComponent <Field>().plant           = emptyPlant;
                field4.GetComponent <Field>().fieldIsChecked  = true;
            }
        }
        if (field1.GetComponent <Field>().plantName != "" && field2.GetComponent <Field>().plantName != "" && field3.GetComponent <Field>().plantName != "" &&
            field4.GetComponent <Field>().plantName != "")
        {
            timeLeft       = 0;
            countdown.text = (timeLeft + " Sek.");
        }
    }
コード例 #4
0
    public void AddPanel()
    {
        if (panels.Count != 0)
        {
            panels = panels.Where(item => item != null).ToList();
        }
        var obj = (GameObject)Instantiate(Resources.Load("_Prefabs/uGUI/WeatherPanel"));

        obj.transform.SetParent(GetComponent <RectTransform>());
        WeatherPanel p = obj.GetComponent <WeatherPanel>();

        panels.Add(p);
        if (panels.Count == 1)
        {
            p.GetComponent <RectTransform>().anchoredPosition = new Vector3(-150, 50, 0);
        }
        lRect.list.Add(p.GetComponent <RectTransform>());
    }
コード例 #5
0
ファイル: VisitModule.cs プロジェクト: linxscc/LoveGame
    public override void OnMessage(Message message)
    {
        string name = message.Name;

        object[] body = message.Params;
        switch (name)
        {
        case MessageConst.MODULE_VISIT_SHOW_VISIT_PANEL:
            HideAll();
            if (_visitPanel == null)
            {
                _visitPanel = new VisitPanel();
                _visitPanel.Init(this);
            }
            else
            {
                _visitPanel.Refeash();
            }
            _visitPanel.Show(0.5f);
            break;

        case MessageConst.MODULE_VISIT_SHOW_WEATHER_PANEL:
            HideAll();
            if (_weatherPanel == null)
            {
                _weatherPanel = new WeatherPanel();
                _weatherPanel.Init(this);
            }
            PlayerPB npcId = (PlayerPB)body[0];
            _weatherPanel.SetData(npcId);
            _weatherPanel.Show(0.5f);
            break;

        case MessageConst.MODULE_VISIT_SHOW_LEVEL_PANEL:
            HideAll();
            if (_visitLevelPanel == null)
            {
                _visitLevelPanel = new VisitLevelPanel();
                _visitLevelPanel.Init(this);
            }
            _visitLevelPanel.SetData((PlayerPB)body[0]);
            _visitLevelPanel.Show(0.5f);
            break;

        case MessageConst.MODULE_VISIT_WEATHER_SET_BACKBTNSHOWORHIDE:
            if (_weatherPanel != null)
            {
                bool isShow = (bool)body[0];
                if (!isShow)
                {
                    _weatherPanel.HideBackBtn();
                }
                else
                {
                    _weatherPanel.ShowBackBtn();
                }
            }
            break;

        default:
            break;
        }
    }