Пример #1
0
        public HappeningOption(string id, int i)
        {
            Happening = HappeningRegistry.Get(id);
            Id        = id;

            var name = Locale.Get($"happening_{id}");

            Num        = i;
            Name       = name.ToLower();
            Label      = $"#{i} {name}";
            LabelWidth = Font.Small.MeasureString($"{Label} (100%)").Width;
        }
Пример #2
0
        private void AddOption(string id, int i)
        {
            var happening = HappeningRegistry.Get(id);

            if (happening == null)
            {
                return;
            }

            var option = new HappeningOption(id, i);

            options.Add(option);

            float x = Display.UiWidth;

            foreach (var o in options)
            {
                x -= o.LabelWidth + 8;
            }

            option.Position = new Vector2(x, 18);
        }
Пример #3
0
        public override void Run(Console Console, string[] Args)
        {
            if (Args.Length == 1)
            {
                var h = HappeningRegistry.Get(Args[0]);

                if (h == null)
                {
                    return;
                }

                try {
                    var p = LocalPlayer.Locate(Engine.Instance.State.Area);
                    h.Happen(p);

                    Timer.Add(() => {
                        h.End(p);
                    }, h.GetVoteDelay());
                } catch (Exception e) {
                    Log.Error(e);
                }
            }
        }