Пример #1
0
 public void Awake()
 {
     TrandTheme    = SaveManager.Data.TrandTheme;
     TrandStyle    = SaveManager.Data.TrandStyle;
     AutotuneTrand = SaveManager.Data.AutotuneTrand;
     DisplayTrands();
 }
        public static void SetMetroStyle(this BuildingInfo.PathInfo info, TrackStyle style)
        {
            if (info.m_finalNetInfo.IsAbovegroundMetroStationTrack())
            {
                var trackName = info.m_finalNetInfo.name;
                if (style == TrackStyle.Modern)
                {
                    if (trackName.ToLower().StartsWith("steel"))
                    {
                        trackName = trackName.Substring(6);
                    }

                    info.AssignNetInfo(trackName, false);
                }
                else if (style == TrackStyle.Classic)
                {
                    if (trackName.ToLower().StartsWith("steel") == false)
                    {
                        trackName = "Steel " + trackName;
                    }

                    info.AssignNetInfo(trackName, false);
                }
            }
        }
Пример #3
0
 public TrackItem(TrackSharp trackSharp, TrackStyle trackStyle, string xText, string yText, string note = "")
 {
     this.TrackSharp = trackSharp;
     this.TrackStyle = trackStyle;
     this.XText      = xText;
     this.YText      = yText;
     this.Note       = note;
 }
 public static unsafe void GetTrackDefaultDimensions(TrackStyle inStyle, int *outWidth, int *outCanBeLit)
 {
     IL.DeclareLocals(false);
     Guard.NotNull(GetTrackDefaultDimensionsPtr);
     IL.Push(inStyle);
     IL.Push(outWidth);
     IL.Push(outCanBeLit);
     IL.Push(GetTrackDefaultDimensionsPtr);
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(void), typeof(TrackStyle), typeof(int *), typeof(int *)));
 }
Пример #5
0
        /// <summary>
        /// Обновить трэнды
        /// </summary>
        public void UpdateTrands()
        {
            var themes = Enum.GetValues(typeof(TrackTheme));

            TrandTheme = (TrackTheme)themes.GetValue(Random.Range(0, themes.Length));
            var styles = Enum.GetValues(typeof(TrackStyle));

            TrandStyle    = (TrackStyle)styles.GetValue(Random.Range(0, styles.Length));
            AutotuneTrand = Random.Range(0, 2) > 0;
            var trandMessage = $"Новости трэндов! Публика предпочитает стиль \"{TrandStyle.GetDescription()}\" " +
                               $"и тематику \"{TrandTheme.GetDescription()}\". Автотюн {(AutotuneTrand ? "" : " не ")} в моде";

            AlertManager.ShowMessage(trandMessage, 15);
            DisplayTrands();
        }
Пример #6
0
        /// <summary>
        ///
        ///       FULL    BUY    ADD     SELL    CLOSE LINKED
        ///   0    │             │       │        │
        ///        │             │       │        │
        ///   1    │      O      O+     -O        └─
        ///        │      │      |
        ///   2    │      │      |
        /// </summary>
        /// <param name="g"></param>
        /// <param name="columnIndex"></param>
        /// <param name="trackStyle"></param>
        private static void AddTrack(Grid g, int columnIndex, TrackStyle trackStyle)
        {
            //-----------------------------------------------------------------
            // Add a new column
            ColumnDefinition cd = new ColumnDefinition();

            cd.Width = new GridLength(18);
            g.ColumnDefinitions.Add(cd);


            //-----------------------------------------------------------------
            // Add a the vertical bar
            //
            Border b = new Border();

            b.Background          = lineColorBrush;
            b.Width               = 2;
            b.HorizontalAlignment = HorizontalAlignment.Center;
            b.VerticalAlignment   = VerticalAlignment.Stretch;

            if (trackStyle == TrackStyle.ClosePositive || trackStyle == TrackStyle.CloseNegative || trackStyle == TrackStyle.CloseLinked)
            {
                // From top to center
                Grid.SetRow(b, 0);
                Grid.SetRowSpan(b, 2);
            }
            else if (trackStyle == TrackStyle.Buy)
            {
                // From center to bottom
                Grid.SetRow(b, 1);
                Grid.SetRowSpan(b, 2);
            }
            else
            {
                // Full vertical length
                Grid.SetRow(b, 0);
                Grid.SetRowSpan(b, 3);
            }

            Grid.SetColumn(b, columnIndex);
            g.Children.Add(b);


            //-----------------------------------------------------------------
            // Add the Circle
            //
            if (trackStyle != TrackStyle.Full)
            {
                Border spot = new Border();
                spot.BorderThickness = new Thickness(2);
                spot.Height          = 10;
                spot.Width           = 10;
                Grid.SetRow(spot, 1); // Always in the center row
                Grid.SetColumn(spot, columnIndex);
                g.Children.Add(spot);


                Label label = new Label();
                label.FontSize   = 11;
                label.FontWeight = FontWeights.UltraBold;
                label.Height     = 16;
                label.Width      = 16;
                spot.Child       = label;

                switch (trackStyle)
                {
                case TrackStyle.Buy:
                    spot.BorderBrush         = lineColorBrush;
                    spot.Background          = Brushes.AliceBlue;
                    spot.CornerRadius        = shapeStart;
                    spot.HorizontalAlignment = HorizontalAlignment.Center;
                    spot.VerticalAlignment   = VerticalAlignment.Top;

                    label.Content = "+";
                    label.Margin  = new Thickness(0, -5, 0, 0);
                    label.HorizontalContentAlignment = spot.HorizontalAlignment;
                    label.VerticalContentAlignment   = spot.VerticalAlignment;
                    label.HorizontalAlignment        = spot.HorizontalAlignment;
                    label.VerticalAlignment          = spot.VerticalAlignment;

                    break;

                case TrackStyle.Add:
                    spot.BorderBrush                 = lineColorBrush;
                    spot.Background                  = Brushes.AliceBlue;
                    spot.CornerRadius                = shapeAdd;
                    spot.HorizontalAlignment         = HorizontalAlignment.Right;
                    spot.VerticalAlignment           = VerticalAlignment.Center;
                    label.Content                    = "+";
                    label.Margin                     = new Thickness(-1, -3, 0, 0);
                    label.HorizontalContentAlignment = spot.HorizontalAlignment;
                    label.VerticalContentAlignment   = spot.VerticalAlignment;
                    label.HorizontalAlignment        = spot.HorizontalAlignment;
                    label.VerticalAlignment          = spot.VerticalAlignment;
                    break;

                case TrackStyle.Sell:
                    spot.BorderBrush                 = lineColorBrush;
                    spot.Background                  = lineColorBrush;
                    spot.CornerRadius                = shapeSubtract;
                    spot.HorizontalAlignment         = HorizontalAlignment.Left;
                    spot.VerticalAlignment           = VerticalAlignment.Center;
                    label.Content                    = "-";
                    label.Margin                     = new Thickness(1, -4, 0, 0);
                    label.Foreground                 = new SolidColorBrush(Colors.White);
                    label.HorizontalContentAlignment = spot.HorizontalAlignment;
                    label.VerticalContentAlignment   = spot.VerticalAlignment;
                    label.HorizontalAlignment        = spot.HorizontalAlignment;
                    label.VerticalAlignment          = spot.VerticalAlignment;
                    break;

                case TrackStyle.CloseNegative:
                    spot.BorderBrush         = Brushes.Red;
                    spot.Background          = Brushes.Red;
                    spot.CornerRadius        = shapeStop;
                    spot.HorizontalAlignment = HorizontalAlignment.Center;
                    spot.VerticalAlignment   = VerticalAlignment.Bottom;
                    break;

                case TrackStyle.ClosePositive:
                    spot.BorderBrush         = Brushes.Green;
                    spot.Background          = Brushes.Green;
                    spot.CornerRadius        = shapeStop;
                    spot.HorizontalAlignment = HorizontalAlignment.Center;
                    spot.VerticalAlignment   = VerticalAlignment.Bottom;
                    break;
                }
            }
        }
Пример #7
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string valueAsString = (string)value;

            if (valueAsString == null)
            {
                return(value);
            }

            Grid g = new Grid();

            g.Opacity = 0.66;

            g.RowDefinitions.Add(new RowDefinition());
            g.RowDefinitions[0].Height = new GridLength(1, GridUnitType.Star);

            g.RowDefinitions.Add(new RowDefinition());
            g.RowDefinitions[1].Height = new GridLength(1, GridUnitType.Star);

            g.RowDefinitions.Add(new RowDefinition());
            g.RowDefinitions[2].Height = new GridLength(1, GridUnitType.Star);

            int        column = 0;
            TrackStyle ts     = TrackStyle.Empty;

            foreach (char c in valueAsString)
            {
                switch (c)
                {
                case 'B':
                    ts = TrackStyle.Buy;
                    break;

                case 'A':
                    ts = TrackStyle.Add;
                    break;

                case '|':
                    ts = TrackStyle.Full;
                    break;

                case 'S':
                    ts = TrackStyle.Sell;
                    break;

                case 'L':
                    ts = TrackStyle.CloseLinked;
                    break;

                case 'C':
                    ts = TrackStyle.ClosePositive;
                    break;

                case 'c':
                    ts = TrackStyle.CloseNegative;
                    break;
                }

                AddTrack(g, column, ts);
                column++;
            }

            return(g);
        }
Пример #8
0
 /// <summary>
 /// Обработчик завершения изучения нового стиля
 /// </summary>
 private void NewStyleFinish(TrackStyle style)
 {
     PlayerManager.GetSkills().TrackStyles.Add(style);
     ShowActionResult($"Изучен новый стиль: {style.GetDescription()}");
 }
 public static unsafe void GetTrackMetrics(int inX1, int inY1, int inX2, int inY2, int inMin, int inMax, int inValue, TrackStyle inTrackStyle, int *outIsVertical, int *outDownBtnSize, int *outDownPageSize, int *outThumbSize, int *outUpPageSize, int *outUpBtnSize)
 {
     IL.DeclareLocals(false);
     Guard.NotNull(GetTrackMetricsPtr);
     IL.Push(inX1);
     IL.Push(inY1);
     IL.Push(inX2);
     IL.Push(inY2);
     IL.Push(inMin);
     IL.Push(inMax);
     IL.Push(inValue);
     IL.Push(inTrackStyle);
     IL.Push(outIsVertical);
     IL.Push(outDownBtnSize);
     IL.Push(outDownPageSize);
     IL.Push(outThumbSize);
     IL.Push(outUpPageSize);
     IL.Push(outUpBtnSize);
     IL.Push(GetTrackMetricsPtr);
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(void), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(TrackStyle), typeof(int *), typeof(int *), typeof(int *), typeof(int *), typeof(int *), typeof(int *)));
 }
 public static void DrawTrack(int inX1, int inY1, int inX2, int inY2, int inMin, int inMax, int inValue, TrackStyle inTrackStyle, int inLit)
 {
     IL.DeclareLocals(false);
     Guard.NotNull(DrawTrackPtr);
     IL.Push(inX1);
     IL.Push(inY1);
     IL.Push(inX2);
     IL.Push(inY2);
     IL.Push(inMin);
     IL.Push(inMax);
     IL.Push(inValue);
     IL.Push(inTrackStyle);
     IL.Push(inLit);
     IL.Push(DrawTrackPtr);
     IL.Emit.Calli(new StandAloneMethodSig(CallingConvention.Cdecl, typeof(void), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(TrackStyle), typeof(int)));
 }
Пример #11
0
        private void MakeTrack(Person val, string mark)
        {
            var birt = val.Birth;
            var deat = val.Death;
            var name = val.Name;

            float yrs   = JDN1800_01_01;
            float start = 60.0f;

            // TODO this is looking awkward
            TrackStyle startStyle = TrackStyle.Precise;
            var        bdate      = val.BirthDate;

            if (bdate == null)
            {
                startStyle = TrackStyle.Imprecise;
                yrs        = JDN2017_01_01 - 100 * 365;
                name       = name + "*";
            }
            else if (bdate.Type == GEDDate.Types.Estimated)
            {
                startStyle = TrackStyle.Imprecise;
                yrs        = bdate.JDN;
                name       = name + "*";
            }
            else
            {
                yrs = bdate.JDN;
            }

            yrs = (yrs - JDN1800_01_01) / 365.0f;
            int   yr1  = (int)yrs + 1800;
            float secs = yrs * 6;

            start = 60.0f + secs;

            if (deat == null || val.Indi.Living || deat.GedDate == null)
            {
                yrs = JDN2017_01_01;
            }
            else
            {
                yrs = deat.GedDate.JDN;
            }
            yrs = (yrs - JDN1800_01_01) / 365.0f;
            int yr2 = (int)yrs + 1800;

            secs = yrs * 6;
            float end = 60.0f + secs;

            int?showEnd = null;

            if (deat != null && !val.Indi.Living && deat.GedDate != null)
            {
                showEnd = yr2;
            }

            var outName = string.Format("{0}({1})[{2}-{3}]", name, mark, yr1, showEnd.HasValue ? yr2.ToString() : "");

            var aml = new AdjustMyLength();

            aml.Id         = val.Id;
            aml.StartStyle = startStyle;
            aml.Start      = yr1;
            if (deat != null && !val.Indi.Living && deat.GedDate != null)
            {
                aml.End = yr2;
            }
            aml.Name = outName;

            if (mark == "S") // TODO hack
            {
                aml.Split = true;
            }

            if (mark != "C") // TODO hack
            {
                var onions = val.SpouseIn;
                foreach (var onion in onions)
                {
                    var mdate = onion.MarriageDate;
                    if (mdate != null && mdate.Type != GEDDate.Types.Unknown)
                    {
                        Marker marky = new Marker();
                        marky.Char  = "\u2665";
                        marky.Time  = mdate.Year;
                        marky.Above = true;
                        if (aml.Marks == null)
                        {
                            aml.Marks = new List <Marker>();
                        }
                        aml.Marks.Add(marky);
                    }

                    var divE = onion.GetEvent("DIV");
                    if (divE != null && divE.GedDate != null && divE.GedDate.Type != GEDDate.Types.Unknown)
                    {
                        Marker marky = new Marker();
                        marky.Char  = "D";
                        marky.Time  = divE.GedDate.Year;
                        marky.Above = false;
                        if (aml.Marks == null)
                        {
                            aml.Marks = new List <Marker>();
                        }
                        aml.Marks.Add(marky);
                    }
                }
            }

            timeline1.AddTrack(aml);
        }