Exemplo n.º 1
0
        public static LaunchEvent FromJson(string jsonString)
        {
            DeserializedLaunchEvent parsed = JsonConvert.DeserializeObject <DeserializedLaunchEvent>(jsonString);

            GameTick currentTick = Game.TimeMachine.GetCurrentTick();
            GameTick eventTick   = GameTick.FromTickNumber(parsed.GameTick);

            // Go to the time the event occurred.
            Game.TimeMachine.GoTo(eventTick);
            GameState state = Game.TimeMachine.GetState();

            ILaunchable source = state.GetOutpostById(parsed.Source);

            if (source == null)
            {
                source = state.GetSubById(parsed.Source);
            }

            ICombatable destination = state.GetOutpostById(parsed.Destination);

            if (destination == null)
            {
                destination = state.GetSubById(parsed.Destination);
            }

            Game.TimeMachine.GoTo(currentTick);

            return(new LaunchEvent(eventTick, source, parsed.Drillers, destination));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor for a sub launch event.
 /// </summary>
 /// <param name="launchTime">The time of the launch</param>
 /// <param name="source">The source</param>
 /// <param name="drillerCount">The number of drillers to send</param>
 /// <param name="destination">The destination</param>
 public LaunchEvent(GameTick launchTime, ILaunchable source, int drillerCount, ICombatable destination)
 {
     this._launchTime   = launchTime;
     this._source       = source;
     this._drillerCount = drillerCount;
     this._destination  = destination;
     this.EventName     = "Launch Event";
 }
Exemplo n.º 3
0
        public ServiceRunner(Func <ILaunchable> factory)
        {
            _instance = factory();

            CanHandlePowerEvent         = false;
            CanHandleSessionChangeEvent = false;
            CanPauseAndContinue         = false;
            CanShutdown = false;
            CanStop     = true;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Sub constructor
 /// </summary>
 /// <param name="source">The initial location of the sub</param>
 /// <param name="destination">The destination of the sub</param>
 /// <param name="launchTime">The time of launch</param>
 /// <param name="drillerCount">The amount of drillers to launch</param>
 /// <param name="owner">The owner</param>
 public Sub(ILaunchable source, ITargetable destination, GameTick launchTime, int drillerCount, Player owner) : base()
 {
     this._id                = IdGenerator.GetNextId();
     this._source            = source;
     this._destination       = destination;
     this._launchTime        = launchTime;
     this._drillerCount      = drillerCount;
     this.Position           = source.GetCurrentPosition();
     this._owner             = owner;
     this._specialistManager = new SpecialistManager(3);
 }
        private void InputText_TextChanged(object sender, TextChangedEventArgs e)
        {
            string text = (sender as TextBox).Text.ToLower();

            if (text.Length == 0)
            {
                Candidates.Height = 0.0;
                Height            = initialHeight;

                Candidates.DataContext = null;
                return;
            }

            var keyword = text.Split(" ".ToCharArray()).First().ToLower();
            // ## Spec of listing order
            // 1. equals to keyword
            // 2. launched count
            // 3. forward match(any word)
            // 4. partial match
            var candidates = entries.Where(en => en.Name.ToLower().Contains(keyword)).OrderByDescending((en) =>
            {
                var name = en.Name.ToLower();
                if (name == keyword)
                {
                    return(int.MaxValue);
                }
                var words      = name.Split(" ".ToCharArray());
                var startsWith = words.Where((word) => word.StartsWith(keyword)).Count();
                return((en.Launched << 1) | (startsWith > 0 ? 1 : 0));
            }).Distinct(new LaunchableEqualityComparer());

            if (candidates.Count() == 0)
            {
                candidates = new ILaunchable[] { new UriLauncher("Search on Web", $"http://www.bing.com/search?q={text}") };
            }

            Candidates.DataContext   = candidates;
            Candidates.SelectedIndex = 0;

            Candidates.Height = candidatesHeight;
            Height            = initialHeight + Candidates.Height + Candidates.Margin.Bottom;
        }
Exemplo n.º 6
0
    public void NextArrow()
    {
        int switchCount = 0;

        while (arrowNums[currentArrowType] <= 0)
        {
            currentArrowType = (currentArrowType + 1) % arrowPrefabs.Count;
            switchCount++;
            if (arrowNums[currentArrowType] > 0)
            {
                arrowSwitchToggles[currentArrowType].isOn = true;
                return;
            }
            if (switchCount > arrowPrefabs.Count - 1)
            {
                return;
            }
        }

        Debug.Log("UIForceArrowButtonController.nextArrow()");
        currentArrow = Instantiate(arrowPrefabs[currentArrowType], cupidAnchor).GetComponent <ILaunchable>();
        currentArrow.mGameObject.GetComponent <SpriteRenderer>().sortingOrder = 10;
        currentArrow.uIForceArrowButtonController = this;
    }
Exemplo n.º 7
0
 public LaunchInfo(float time, ILaunchable target)
 {
     mTime   = time;
     mTarget = target;
 }
Exemplo n.º 8
0
 public void Add(ILaunchable target, float time = 1f)
 {
     mList.Add(new LaunchInfo(time, target));
 }
Exemplo n.º 9
0
 public ConsoleRunner(Func <ILaunchable> factory)
 {
     _instance = factory();
 }
Exemplo n.º 10
0
 public Execute(ILaunchable target, string arguments)
 {
     this.target = target;
       this.arguments = arguments;
 }
Exemplo n.º 11
0
 public AppAlias(string name, ILaunchable aLaunchable)
 {
     this.name = name;
     target    = aLaunchable;
 }
Exemplo n.º 12
0
        private void SetSubject(ILaunchable launchable)
        {
            ClearSubject();
              subject_launchable = launchable;

              if (launchable != null)
              {
            subject_name_label.Text += launchable.Name;
            subject_path_label.Text += launchable.FullName;
            subject_last_accessed_label.Text += new System.IO.FileInfo(launchable.FullName).LastAccessTime.ToString();
            subject_thumbnail.Image = launchable.Preview;
              }
        }