Esempio n. 1
0
 public void AddLaunchPoint(LaunchPoint l)
 {
     if (!launchPoints.Contains(l))
     {
         launchPoints.Add(l);
     }
 }
Esempio n. 2
0
 public LaunchPoint GetCorrectLaunchPoint(LaunchPoint l)
 {
     foreach (LaunchPoint r in launchPoints)
     {
         if ((r.position - l.position).Length() <= 5f)
         {
             return(r);
         }
     }
     return(l);
 }
Esempio n. 3
0
        public string AddLaunchPoint(int i, int j, string name, Dimensions.Dimensions dim, bool originFound)
        {
            LaunchPoint l = new LaunchPoint(i, j, name, mod, originFound, dim);

            foreach (LaunchPoint r in launchPoints)
            {
                if (r == l)
                {
                    return(r.name);
                }
            }
            return(l.name);
        }
Esempio n. 4
0
        public void Update()
        {
            if (((StarSailorMod)mod).inLaunchGui)
            {
                Rectangle mouseRect = new Rectangle(Mouse.GetState().X, Mouse.GetState().Y, 1, 1);
                Vector2   dims      = Main.fontDeathText.MeasureString(text);
                Rectangle textRect  = new Rectangle((int)location.X - (int)(dims.X / 2f), (int)location.Y - (int)(dims.Y / 2f), (int)dims.X, (int)dims.Y);
                if (mouseRect.Intersects(textRect))
                {
                    HoverUpdate(true);
                    if (Main.mouseLeft && Main.mouseLeftRelease)
                    {
                        int r = DoPress();
                        switch (r)
                        {
                        case -1:
                            ((StarSailorMod)mod).ExitRocketGui();
                            break;

                        case -2:
                            ((StarSailorMod)mod).inLaunchGui = false;
                            //ModContent.GetInstance<Rocket>().takeOffAnimate = true;
                            LaunchPoint   destination = ModContent.GetInstance <LaunchPointManager>().SetDestination();
                            SequenceQueue sq          = SequenceBuilder.ConstructSpaceSequence(ModContent.GetInstance <DimensionManager>().currentDimension, destination.dimension, Main.LocalPlayer, 16 * (destination.position + new Vector2(0, -3)), destination.needPlatform);
                            sq.Execute();
                            break;

                        case -3:
                            ((StarSailorMod)mod).nameButton.active = !((StarSailorMod)mod).nameButton.active;
                            break;

                        default:
                            bool temp = active;
                            ModContent.GetInstance <LaunchPointManager>().DeactivateLocations();
                            active = !temp;
                            break;
                        }
                    }
                }
                else
                {
                    HoverUpdate(false);
                }
                if (active && fn == Function.Name)
                {
                    text = Main.GetInputText(text);
                    //text = ((StarSailorMod)mod).InputText(text);
                }
            }
        }
Esempio n. 5
0
        public List <LaunchPoint> GetLaunchPoints(LaunchPoint current)
        {
            List <LaunchPoint> returns = new List <LaunchPoint>();
            DimensionManager   dm      = ModContent.GetInstance <DimensionManager>();

            for (int i = 0; i < launchPoints.Count; i++)
            {
                switch (launchPoints[i].CheckValidity())
                {
                case "":
                    if (launchPoints[i] != current)
                    {
                        returns.Add(launchPoints[i]);
                    }
                    break;

                default:
                    launchPoints.RemoveAt(i);
                    i--;
                    break;
                }
            }
            Main.NewText("midway count is " + returns.Count);
            foreach (Dimensions.Dimensions dim in typeof(Dimensions.Dimensions).GetEnumValues())
            {
                if (dm.dimensions[(int)dim].haveDiscovered && dim != dm.currentDimension)
                {
                    bool havePoint = false;
                    foreach (LaunchPoint l in returns)
                    {
                        //Main.NewText(l.dimension + " comp to " + dim);
                        if (l.dimension == dim)
                        {
                            havePoint = true;
                            break;
                        }
                    }
                    if (!havePoint)
                    {
                        returns.Add(new LaunchPoint(dm.dimensions[(int)dim].GetDestination(), dm.dimensions[(int)dim].name, mod, dim, true));
                    }
                }
            }
            Main.NewText("final count is " + returns.Count);
            return(returns);
        }
Esempio n. 6
0
        public LaunchPoint SetDestination()
        {
            int index = 0;

            for (int i = 0; i < ((StarSailorMod)mod).locationButtons.Length; i++)
            {
                if (((StarSailorMod)mod).locationButtons[i].active)
                {
                    index = i;
                    break;
                }
            }
            List <LaunchPoint> launches    = GetLaunchPoints(currentLaunchPoint);
            LaunchPoint        destination = launches[(((StarSailorMod)mod).rocketGuiPageNum * 10) + index];

            return(destination);
            //ModContent.GetInstance<Rocket>().destination = destination.position + new Vector2(0, -3);
        }
Esempio n. 7
0
 public override void Initialize()
 {
     launchPoints       = new List <LaunchPoint>();
     currentLaunchPoint = null;
     base.Initialize();
 }