Esempio n. 1
0
        private bool TestEvent(OutpostGenerationParams?param, LocationType?type)
        {
            SubmarineInfo subInfo = SubmarineInfo.SavedSubmarines.FirstOrDefault(info => info.HasTag(SubmarineTag.Shuttle));

            XElement?   eventXml = ExportXML();
            EventPrefab?prefab;

            if (eventXml != null)
            {
                prefab = new EventPrefab(eventXml);
            }
            else
            {
                GUI.AddMessage("Unable to open test enviroment because the event contains errors.", GUI.Style.Red);
                return(false);
            }

            GameSession  gameSession = new GameSession(subInfo, "", GameModePreset.TestMode, CampaignSettings.Empty, null);
            TestGameMode gameMode    = (TestGameMode)gameSession.GameMode;

            gameMode.SpawnOutpost   = true;
            gameMode.OutpostParams  = param;
            gameMode.OutpostType    = type;
            gameMode.TriggeredEvent = prefab;
            gameMode.OnRoundEnd     = () =>
            {
                Submarine.Unload();
                GameMain.EventEditorScreen.Select();
            };

            GameMain.GameScreen.Select();
            gameSession.StartRound(null, false);
            return(true);
        }
Esempio n. 2
0
 public LocationDataMod(int id,
                        string locationName,
                        LocationType?locationType,
                        AudioKlipInfo bgMusic,
                        float?bgYOffset,
                        SpriteInfo finderLocationIcon,
                        GirlStyleType?dateGirlStyleType,
                        string nonStopOptionText,
                        List <LocationSpecialLabelSubDefinition> specialLabels,
                        List <SpriteInfo> backgrounds,
                        List <LogicBundleInfo> arriveBundleList,
                        List <LogicBundleInfo> departBundleList,
                        bool isAdditive = false)
     : base(id, isAdditive)
 {
     LocationName       = locationName;
     LocationType       = locationType;
     BgMusic            = bgMusic;
     BgYOffset          = bgYOffset;
     FinderLocationIcon = finderLocationIcon;
     DateGirlStyleType  = dateGirlStyleType;
     NonStopOptionText  = nonStopOptionText;
     SpecialLabels      = specialLabels;
     Backgrounds        = backgrounds;
     ArriveBundleList   = arriveBundleList;
     DepartBundleList   = departBundleList;
 }
Esempio n. 3
0
 internal SkuLocationAndZones(AzureLocation?location, IReadOnlyList <string> zones, IReadOnlyList <SkuZoneDetail> zoneDetails, IReadOnlyList <string> extendedLocations, LocationType?locationType)
 {
     Location          = location;
     Zones             = zones;
     ZoneDetails       = zoneDetails;
     ExtendedLocations = extendedLocations;
     LocationType      = locationType;
 }
Esempio n. 4
0
 public RequestLocation(string location, LocationType locationType)
 {
     if (locationType is Utils.LocationType.Coordinates)
     {
         throw new InvalidOptionsException("Cannot set Location type to Coordinate .");
     }
     this.location     = location;
     this.LocationType = locationType;
 }
Esempio n. 5
0
 /// <summary>
 /// Initializes a new instance of the Location class.
 /// </summary>
 /// <param name="id">The fully qualified ID of the location. For
 /// example,
 /// /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus.</param>
 /// <param name="subscriptionId">The subscription ID.</param>
 /// <param name="name">The location name.</param>
 /// <param name="type">The location type. Possible values include:
 /// 'Region', 'EdgeZone'</param>
 /// <param name="displayName">The display name of the location.</param>
 /// <param name="regionalDisplayName">The display name of the location
 /// and its region.</param>
 /// <param name="metadata">Metadata of the location, such as lat/long,
 /// paired region, and others.</param>
 public Location(string id = default(string), string subscriptionId = default(string), string name = default(string), LocationType?type = default(LocationType?), string displayName = default(string), string regionalDisplayName = default(string), LocationMetadata metadata = default(LocationMetadata))
 {
     Id                  = id;
     SubscriptionId      = subscriptionId;
     Name                = name;
     Type                = type;
     DisplayName         = displayName;
     RegionalDisplayName = regionalDisplayName;
     Metadata            = metadata;
     CustomInit();
 }
Esempio n. 6
0
        /// <summary> Initializes a new instance of LocationExpanded. </summary>
        /// <param name="id"> The fully qualified ID of the location. For example, /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. </param>
        /// <param name="subscriptionId"> The subscription ID. </param>
        /// <param name="name"> The location name. </param>
        /// <param name="type"> The location type. </param>
        /// <param name="displayName"> The display name of the location. </param>
        /// <param name="regionalDisplayName"> The display name of the location and its region. </param>
        /// <param name="metadata"> Metadata of the location, such as lat/long, paired region, and others. </param>
        internal LocationExpanded(string id, string subscriptionId, string name, LocationType?type, string displayName, string regionalDisplayName, LocationMetadata metadata)
        {
            Id = id;
            ResourceIdentifier subId = new ResourceIdentifier(id);

            SubscriptionId      = subscriptionId ?? subId.SubscriptionId;
            Name                = name;
            Type                = type;
            DisplayName         = displayName;
            RegionalDisplayName = regionalDisplayName;
            Metadata            = metadata;
        }
Esempio n. 7
0
        private bool CreateTestSetupMenu()
        {
            var msgBox = new GUIMessageBox(TextManager.Get("EventEditor.TestPromptHeader"), "", new[] { TextManager.Get("Cancel"), TextManager.Get("OK") },
                                           relativeSize: new Vector2(0.2f, 0.3f), minSize: new Point(300, 175));

            var layout = new GUILayoutGroup(new RectTransform(new Vector2(1f, 0.5f), msgBox.Content.RectTransform));

            new GUITextBlock(new RectTransform(new Vector2(1, 0.25f), layout.RectTransform), TextManager.Get("EventEditor.OutpostGenParams"), font: GUI.SubHeadingFont);
            GUIDropDown paramInput = new GUIDropDown(new RectTransform(new Vector2(1, 0.25f), layout.RectTransform), string.Empty, OutpostGenerationParams.Params.Count);

            foreach (OutpostGenerationParams param in OutpostGenerationParams.Params)
            {
                paramInput.AddItem(param.Identifier, param);
            }
            paramInput.OnSelected = (_, param) =>
            {
                lastTestParam = param as OutpostGenerationParams;
                return(true);
            };
            paramInput.SelectItem(lastTestParam ?? OutpostGenerationParams.Params.FirstOrDefault());

            new GUITextBlock(new RectTransform(new Vector2(1, 0.25f), layout.RectTransform), TextManager.Get("EventEditor.LocationType"), font: GUI.SubHeadingFont);
            GUIDropDown typeInput = new GUIDropDown(new RectTransform(new Vector2(1, 0.25f), layout.RectTransform), string.Empty, LocationType.List.Count);

            foreach (LocationType type in LocationType.List)
            {
                typeInput.AddItem(type.Identifier, type);
            }
            typeInput.OnSelected = (_, type) =>
            {
                lastTestType = type as LocationType;
                return(true);
            };
            typeInput.SelectItem(lastTestType ?? LocationType.List.FirstOrDefault());

            // Cancel button
            msgBox.Buttons[0].OnClicked = (button, o) =>
            {
                msgBox.Close();
                return(true);
            };

            // Ok button
            msgBox.Buttons[1].OnClicked = (button, o) =>
            {
                TestEvent(lastTestParam, lastTestType);
                msgBox.Close();
                return(true);
            };

            return(true);
        }
Esempio n. 8
0
 public LocationDataMod(LocationDefinition def, AssetProvider assetProvider)
     : base(def.id, false)
 {
     LocationName       = def.locationName;
     LocationType       = def.locationType;
     BgMusic            = new AudioKlipInfo(def.bgMusic, assetProvider);
     BgYOffset          = def.bgYOffset;
     FinderLocationIcon = new SpriteInfo(def.finderLocationIcon, assetProvider);
     DateGirlStyleType  = def.dateGirlStyleType;
     NonStopOptionText  = def.nonStopOptionText;
     SpecialLabels      = def.specialLabels;
     Backgrounds        = def.backgrounds.Select(x => new SpriteInfo(x, assetProvider)).ToList();
     ArriveBundleList   = def.arriveBundleList.Select(x => new LogicBundleInfo(x, assetProvider)).ToList();
     DepartBundleList   = def.departBundleList.Select(x => new LogicBundleInfo(x, assetProvider)).ToList();
 }
Esempio n. 9
0
        /// <summary>
        /// Writes the location type.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="fieldName"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        private string WriteFieldLocationType(string name, string fieldName, LocationType?value)
        {
            if (value.HasValue)
            {
                switch (value.Value)
                {
                case LocationType.Stop:
                    return("0");

                case LocationType.Station:
                    return("1");
                }
            }
            return(string.Empty);
        }
Esempio n. 10
0
        private void CreateDummyLocations(LocationType?forceLocationType = null)
        {
            dummyLocations = new Location[2];

            string seed = "";

            if (GameMain.GameSession != null && GameMain.GameSession.Level != null)
            {
                seed = GameMain.GameSession.Level.Seed;
            }
            else if (GameMain.NetLobbyScreen != null)
            {
                seed = GameMain.NetLobbyScreen.LevelSeed;
            }

            MTRandom rand = new MTRandom(ToolBox.StringToInt(seed));

            for (int i = 0; i < 2; i++)
            {
                dummyLocations[i] = Location.CreateRandom(new Vector2((float)rand.NextDouble() * 10000.0f, (float)rand.NextDouble() * 10000.0f), null, rand, requireOutpost: true, forceLocationType: forceLocationType);
            }
        }
Esempio n. 11
0
        /// <summary>
        /// This is the default constructor
        /// </summary>
        /// <param name="item"></param>
        public Stop(CSVRowItem item)
        {
            mID = item.ValidateNotEmptyOrNull("stop_id");

            mCode = item["stop_code"];

            mName = item.ValidateNotEmptyOrNull("stop_name");

            mDesc = item["stop_desc"];

            mLon = decimal.Parse(item["stop_lon"]);
            mLat = decimal.Parse(item["stop_lat"]);

            mZoneID = item["zone_id"];

            string uri = item["stop_url"];

            mUrl = (uri == null || uri == "") ? (Uri)null : new Uri(uri);

            mLocationType = item["location_type"].ToLocationType();

            mParentStation = item["parent_station"];
        }
Esempio n. 12
0
 /// <summary>
 /// This struct contains information about individual locations where vehicles pick up or drop off passengers.
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="Code"></param>
 /// <param name="Name"></param>
 /// <param name="Desc"></param>
 /// <param name="Lon"></param>
 /// <param name="Lat"></param>
 /// <param name="ZoneID"></param>
 /// <param name="Url"></param>
 /// <param name="LocationType"></param>
 /// <param name="ParentStation"></param>
 public Stop(
     string ID,
     string Code,
     string Name,
     string Desc,
     decimal Lon,
     decimal Lat,
     string ZoneID,
     Uri Url,
     LocationType?LocationType,
     string ParentStation
     )
 {
     mID            = ID;
     mCode          = Code;
     mName          = Name;
     mDesc          = Desc;
     mLon           = Lon;
     mLat           = Lat;
     mZoneID        = ZoneID;
     mUrl           = Url;
     mLocationType  = LocationType;
     mParentStation = ParentStation;
 }
 internal static string ToSerializedValue(this LocationType?value)
 {
     return(value == null ? null : ((LocationType)value).ToSerializedValue());
 }
Esempio n. 14
0
 public RequestLocation(double latitude, double longitude)
 {
     this.Latitude  = latitude;
     this.Longitude = longitude;
     LocationType   = null;
 }
Esempio n. 15
0
        /// <summary>
        /// This is the default constructor
        /// </summary>
        /// <param name="item"></param>
        public Stop(CSVRowItem item)
        {
            mID = item.ValidateNotEmptyOrNull("stop_id");

            mCode = item["stop_code"];

            mName = item.ValidateNotEmptyOrNull("stop_name");

            mDesc = item["stop_desc"];

            mLon = decimal.Parse(item["stop_lon"]);
            mLat = decimal.Parse(item["stop_lat"]);

            mZoneID = item["zone_id"];

            string uri = item["stop_url"];
            mUrl = (uri == null || uri == "") ? (Uri)null : new Uri(uri);

            mLocationType = item["location_type"].ToLocationType();

            mParentStation = item["parent_station"];
        }
Esempio n. 16
0
 /// <summary>
 /// This struct contains information about individual locations where vehicles pick up or drop off passengers. 
 /// </summary>
 /// <param name="ID"></param>
 /// <param name="Code"></param>
 /// <param name="Name"></param>
 /// <param name="Desc"></param>
 /// <param name="Lon"></param>
 /// <param name="Lat"></param>
 /// <param name="ZoneID"></param>
 /// <param name="Url"></param>
 /// <param name="LocationType"></param>
 /// <param name="ParentStation"></param>
 public Stop(
     string ID,
     string Code,
     string Name,
     string Desc,
     decimal Lon,
     decimal Lat,
     string ZoneID,
     Uri Url,
     LocationType? LocationType,
     string ParentStation
     )
 {
     mID=ID ;
     mCode = Code;
     mName = Name;
     mDesc = Desc;
     mLon=Lon ;
     mLat=Lat ;
     mZoneID = ZoneID;
     mUrl=Url ;
     mLocationType = LocationType;
     mParentStation = ParentStation;
 }