예제 #1
0
        public void Init(AircraftMenuControl acMenu,
                         FuelPlanningControl fuelMenu,
                         TOPerfControl toMenu,
                         LandingPerfControl ldgMenu,
                         MiscInfoControl miscInfoMenu,
                         TracksControl tracksMenu,
                         WindControl windControl,
                         AboutPageControl aboutMenu,
                         Panel innerPanel)
        {
            this.acMenu       = acMenu;
            this.fuelMenu     = fuelMenu;
            this.toMenu       = toMenu;
            this.ldgMenu      = ldgMenu;
            this.miscInfoMenu = miscInfoMenu;
            this.tracksMenu   = tracksMenu;
            this.windControl  = windControl;
            this.aboutMenu    = aboutMenu;
            this.innerPanel   = innerPanel;

            EnableViewControl();
            EnableControlColors();
            SetExtraLblStyle();
            SetManualLblListener();
        }
예제 #2
0
        private void FillDaily(MyWeather weather)
        {
            tabControlWeather.TabPages[0].Controls.Clear();

            List <WeatherItem> items = new List <WeatherItem>();


            int count = 0;

            foreach (Daily day in weather.Daily)
            {
                string iconName = day.weather[0].icon;
                var    icon     = (Image)Properties.Resources.ResourceManager.GetObject("_" + iconName);

                items.Add(new WeatherItem(count.ToString(), icon, (int)day.temp.day, day.wind_deg, (int)day.wind_speed, day.dt
                                          , day.weather[0].main, (int)day.rain, (int)day.feels_like.day, (int)day.dew_point, (int)day.pressure, (int)day.clouds, (int)day.temp.max, (int)day.temp.min, UnixTimeStampToDateTime(day.sunset).ToString("HH:mm"), UnixTimeStampToDateTime(day.sunrise).ToString("HH:mm")));
                count++;
            }
            items.Reverse();

            foreach (WeatherItem item in items)
            {
                WindControl w = new WindControl();

                if (item == items[items.Count - 1])
                {
                    w.Title = "Now";
                }
                else
                {
                    w.Title = item.Time.ToString();
                    DateTime today = UnixTimeStampToDateTime(item.Time);
                    w.Title = today.DayOfWeek.ToString().Substring(0, 3);
                }
                w.WeatherImage = item.WeatherImage;
                w.Temperature  = item.Temperature;
                w.Degrees      = item.WindDirection;
                w.WindSpeed    = item.WindSpeed;
                w.Weather      = item.Weather;
                w.FeelsLike    = item.FeelsLike;
                w.DewPoint     = item.DewPoint;
                w.Pressure     = item.Pressure;
                w.Clouds       = item.Clouds;
                w.MaxTemp      = item.MaxTemp;
                w.MinTemp      = item.MinTemp;
                w.Sunrise      = item.Sunrise;
                w.Sunset       = item.Sunset;
                w.Dock         = DockStyle.Left;
                w.Padding      = new Padding(0, 10, 0, 0);
                Panel spacer = new Panel();
                spacer.Width  = 5;
                spacer.Height = w.Height;
                spacer.Dock   = DockStyle.Left;
                tabControlWeather.TabPages[0].Controls.Add(spacer);
                tabControlWeather.TabPages[0].Controls.Add(w);
            }
        }
예제 #3
0
        private void FillHourly(MyWeather weather)
        {
            tabControlWeather.TabPages[1].Controls.Clear();

            List <WeatherItem> items = new List <WeatherItem>();


            int count = 0;
            IEnumerable <Hourly> hours = weather.Hourly.Take <Hourly>(12);

            foreach (Hourly hour in hours)
            {
                string iconName = hour.weather[0].icon;
                var    icon     = (Image)Properties.Resources.ResourceManager.GetObject("_" + iconName);

                items.Add(new WeatherItem(count.ToString(), icon, (int)hour.temp, hour.wind_deg, (int)hour.wind_speed, hour.dt, hour.weather[0].main, (int)hour.feels_like, (int)hour.dew_point, hour.pressure, hour.clouds));
                count++;
            }
            items.Reverse();

            foreach (WeatherItem item in items)
            {
                WindControl w = new WindControl();

                if (item == items[items.Count - 1])
                {
                    w.Title = "Now";
                }
                else
                {
                    w.Title = item.Time.ToString();
                    DateTime today = UnixTimeStampToDateTime(item.Time);
                    w.Title = today.Hour + ":00";
                }
                w.WeatherImage = item.WeatherImage;
                w.Temperature  = item.Temperature;
                w.Degrees      = item.WindDirection;
                w.WindSpeed    = item.WindSpeed;
                w.Weather      = item.Weather;
                w.FeelsLike    = item.FeelsLike;
                w.DewPoint     = item.DewPoint;
                w.Pressure     = item.Pressure;
                w.Clouds       = item.Clouds;
                w.Dock         = DockStyle.Left;
                w.Padding      = new Padding(0, 10, 0, 0);
                Panel spacer = new Panel();
                spacer.Width  = 5;
                spacer.Height = w.Height;
                spacer.Dock   = DockStyle.Left;
                tabControlWeather.TabPages[1].Controls.Add(spacer);
                tabControlWeather.TabPages[1].Controls.Add(w);
            }
        }
예제 #4
0
        private void AddControls()
        {
            acMenu        = new AircraftMenuControl();
            fuelMenu      = new FuelPlanningControl();
            toMenu        = new TOPerfControl();
            ldgMenu       = new LandingPerfControl();
            miscInfoMenu  = new MiscInfoControl();
            tracksContorl = new TracksControl();
            windControl   = new WindControl();
            aboutMenu     = new AboutPageControl();

            foreach (var i in Pages)
            {
                i.Location = Point.Empty;
                i.Visible  = i == acMenu;
                panel2.Controls.Add(i);
            }
        }
예제 #5
0
    void Map_Create(int map_num)
    {
        string     path   = "Prefabs/";
        Quaternion rotate = new Quaternion();

        for (int j = 0; j <= numberOfHeightBolcks; j++)
        {
            for (int i = (map_num - 1) * numberOfWidthBlocks; i < map_num * numberOfWidthBlocks; i++)
            {
                Vector3 position     = new Vector3(i * blockSize, -j * blockSize + cameraHeight / 2f - blockSize / 2, 0);
                Object  currentBlock = null;
                switch ((int)(MapObjects[i + "," + j]))
                {
                case (int)RObjectType.BLANK:
                    break;

                case (int)RObjectType.STANDARD:
                    int randBlock = Random.Range(1, 4);
                    if (randBlock != 2)
                    {
                        currentBlock = Instantiate(Resources.Load(path + "Wall"), position, rotate);
                    }
                    else
                    {
                        currentBlock = Instantiate(Resources.Load(path + "Wall2"), position, rotate);
                    }
                    break;

                case (int)RObjectType.POINT:
                    Instantiate(Resources.Load(path + "Score_Item"), position, rotate);
                    break;

                case (int)RObjectType.FALLING:
                    currentBlock = Instantiate(Resources.Load(path + "Drop_Wall"), position, rotate);
                    break;

                case (int)RObjectType.SLIP:
                    currentBlock = Instantiate(Resources.Load(path + "Slip_Wall"), position, rotate);
                    break;

                case (int)RObjectType.ITEM:
                    currentBlock = Instantiate(Resources.Load(path + "Scale_Change"), position, rotate);
                    break;

                case (int)RObjectType.ARROW:
                    position.y   = 0;
                    currentBlock = Instantiate(Resources.Load(path + "ArrowCollider"), position, rotate);
                    break;

                case (int)RObjectType.TEXT:
                    currentBlock = Instantiate(Resources.Load(path + "TextImagePrefab"), position, rotate);

                    break;

                case (int)RObjectType.WIND_0:
                case (int)RObjectType.WIND_UP:
                case (int)RObjectType.WIND_DOWN:
                case (int)RObjectType.WIND_NONE_GRAVITY:
                {
                    position.y   = 0;
                    currentBlock = Instantiate(Resources.Load(path + "WindCollider"), position, rotate);
                    WindControl a = ((GameObject)currentBlock).GetComponent <WindControl>();
                    if ((int)MapObjects[i + "," + j] == (int)RObjectType.WIND_UP)
                    {
                        a.x_Strength = 0;
                        a.y_Strength = 60;
                    }
                    else if ((int)MapObjects[i + "," + j] == (int)RObjectType.WIND_DOWN)
                    {
                        a.x_Strength = 0;
                        a.y_Strength = -20;
                    }
                    else if ((int)MapObjects[i + "," + j] == (int)RObjectType.WIND_NONE_GRAVITY)
                    {
                        a.x_Strength = 0;
                        a.y_Strength = -Physics.gravity.y * player.GetComponent <Rigidbody2D>().mass * 1.25f;
                    }
                }
                break;

                case (int)RObjectType.STOP:
                    currentBlock = Instantiate(Resources.Load(path + "WallStopper"), position, rotate);
                    break;

                case (int)RObjectType.MOVE_UP:
                case (int)RObjectType.MOVE_RIGHT:
                case (int)RObjectType.MOVE_DOWN:
                case (int)RObjectType.MOVE_LEFT:
                    currentBlock = Instantiate(Resources.Load(path + "Wall"), position, rotate);
                    Wall move = ((GameObject)currentBlock).GetComponent <Wall>();
                    move.movable = true;
                    move.speed   = 2f;
                    if ((int)MapObjects[i + "," + j] == (int)RObjectType.MOVE_UP)
                    {
                        move.direction = 1;
                        move.transform.Rotate(0, 0, 270);
                    }
                    else if ((int)MapObjects[i + "," + j] == (int)RObjectType.MOVE_RIGHT)
                    {
                        move.direction = 2;
                        move.transform.Rotate(0, 0, 180);
                    }
                    else if ((int)MapObjects[i + "," + j] == (int)RObjectType.MOVE_DOWN)
                    {
                        move.direction = 3;
                        move.transform.Rotate(0, 0, 90);
                    }
                    else if ((int)MapObjects[i + "," + j] == (int)RObjectType.MOVE_LEFT)
                    {
                        move.direction = 0;
                    }
                    break;
                }
                if (currentBlock && (int)MapObjects[i + "," + j] != (int)RObjectType.ARROW)
                {
                    ((GameObject)currentBlock).transform.localScale = new Vector3(0.4f * blockSize, 0.4f * blockSize, 1);
                }
            }
        }
    }
예제 #6
0
    private void UpdateSettings()
    {
        Quadcopter.Settings S = _Main._Settings;

        // Menu Left / Right
        int Direction = 0;

        if (Quadcopter.QuadcopterControls.MenuLeft())
        {
            Direction -= 1;
        }
        if (Quadcopter.QuadcopterControls.MenuRight())
        {
            Direction += 1;
        }

        Left  = (Direction < 0);
        Right = (Direction > 0);

        string text = "";

        switch (_PageIndex)
        {
        case 0:
        {
            float       Pitch       = S._CameraPitchAngle;
            float       FOV         = S._CameraFOV;
            WindControl Wind        = WindGlobal.GetInstance()._Control;
            float       GlobalSpeed = S._GlobalSpeedModifier;
            bool        RestMode    = S._ThrusterRest;

            AddText(ref text, Pitch, 1, true);
            AddText(ref text, FOV, 1, true);
            AddText(ref text, Wind.ToString());
            AddText(ref text, GlobalSpeed);
            AddText(ref text, RestMode);

            // Controls
            switch (_SelectionIndex)
            {
            case 0:
                UpdateValue(ref S._CameraPitchAngle, 1.0f, -45.0f, 45.0f);
                S.UpdateCameraPitch();
                break;

            case 1:
                UpdateValue(ref S._CameraFOV, 1.0f, 90.0f, 170.0f);
                S.UpdateFOV();
                break;

            case 2:
                if (Left)
                {
                    WindGlobal.GetInstance()._Control -= 1;
                }
                if (Right)
                {
                    WindGlobal.GetInstance()._Control += 1;
                }

                // Clamp
                if ((int)WindGlobal.GetInstance()._Control >= WindGlobal.WindControlTotal)
                {
                    WindGlobal.GetInstance()._Control = WindControl.NONE;
                }
                if ((int)WindGlobal.GetInstance()._Control < 0)
                {
                    WindGlobal.GetInstance()._Control = WindControl.CONSISTENT_CALM;
                }

                break;

            case 3:
                UpdateValue(ref S._GlobalSpeedModifier, 0.01f, 0.0f, 1.0f);
                break;

            case 4:
                UpdateValue(ref S._ThrusterRest);
                break;
            }
        }
        break;

        case 1:
        {
            float T_S = S._ThrusterSpeed;
            Quadcopter.AnalogPossibilities T_C = S._ThrusterControl;
            bool T_I = S._InverseThrusters;

            AddText(ref text, T_S, 2);
            AddText(ref text, T_C.ToString());
            AddText(ref text, T_I);

            switch (_SelectionIndex)
            {
            case 0:
                UpdateValue(ref S._ThrusterSpeed, 0.02f, 0.0f, 5.0f);
                break;

            case 1:
                break;

            case 2:
                UpdateValue(ref S._InverseThrusters);
                break;
            }
        }
        break;

        case 2:
        {
            float Pitch_S = S._PitchSpeed;
            float Yaw_S   = S._YawSpeed;
            float Roll_S  = S._RollSpeed;

            Quadcopter.AnalogPossibilities Pitch_C = S._YawControl;
            Quadcopter.AnalogPossibilities Yaw_C   = S._YawControl;
            Quadcopter.AnalogPossibilities Roll_C  = S._YawControl;

            bool Pitch_I = S._InversePitch;
            bool Yaw_I   = S._InverseYaw;
            bool Roll_I  = S._InverseRoll;

            AddText(ref text, Pitch_S, 2);
            AddText(ref text, Yaw_S, 2);
            AddText(ref text, Roll_S, 2);
            AddText(ref text, Pitch_C.ToString());
            AddText(ref text, Yaw_C.ToString());
            AddText(ref text, Roll_C.ToString());
            AddText(ref text, Pitch_I);
            AddText(ref text, Yaw_I);
            AddText(ref text, Roll_I);

            switch (_SelectionIndex)
            {
            case 0:
                UpdateValue(ref S._PitchSpeed, 0.02f, 0.0f, 5.0f);
                break;

            case 1:
                UpdateValue(ref S._YawSpeed, 0.02f, 0.0f, 5.0f);
                break;

            case 2:
                UpdateValue(ref S._RollSpeed, 0.02f, 0.0f, 5.0f);
                break;

            case 6:
                UpdateValue(ref S._InversePitch);
                break;

            case 7:
                UpdateValue(ref S._InverseYaw);
                break;

            case 8:
                UpdateValue(ref S._InverseRoll);
                break;
            }
        }
        break;
        }

        _SettingsData.text = text;
    }