private void ZoneChanged()
        {
            if (chosenZone == -1)
            {
                return;
            }

            lock (GameBase.lockObj)
            {
                int tempStructure = chosenStructure;
                int tempGround    = chosenGround;

                ZoneData zone = DataManager.Instance.GetZone(chosenZone);
                ObservableCollection <string> newStructures = new ObservableCollection <string>();
                for (int ii = 0; ii < zone.Segments.Count; ii++)
                {
                    newStructures.Add(ii.ToString("D2") + ": " + getSegmentString(zone.Segments[ii]));
                }
                Structures      = newStructures;
                ChosenStructure = Math.Min(Math.Max(tempStructure, 0), Structures.Count - 1);

                ObservableCollection <string> newGrounds = new ObservableCollection <string>();
                for (int ii = 0; ii < zone.GroundMaps.Count; ii++)
                {
                    newGrounds.Add(ii.ToString("D2") + ": " + zone.GroundMaps[ii]);
                }
                Grounds      = newGrounds;
                ChosenGround = Math.Min(Math.Max(tempGround, 0), Grounds.Count - 1);
            }
        }
示例#2
0
 public Control[] ControlsForTrainingEntry(TrainingEntry entry)
 {
     return(new Control[] {
         new Label {
             Text = (entry.Date ?? DateTime.MinValue).ToLongDateString(), TextAlign = ContentAlignment.MiddleCenter, Tag = (entry.Date ?? DateTime.MinValue).ToOADate()
         },
         new Label {
             Text = entry.Sport + (entry.TrainingTypeSpecified ? " (" + entry.TrainingType + ")" : ""), TextAlign = ContentAlignment.MiddleCenter, Tag = entry.Sport + (entry.TrainingTypeSpecified ? " (" + entry.TrainingType + ")" : "")
         },
         new Label {
             Text = entry.Duration.ToString(), TextAlign = ContentAlignment.MiddleCenter, Tag = (entry.Duration ?? TimeSpan.Zero).TotalSeconds
         },
         new Label {
             Text = entry.Calories == 0 ? "" : entry.Calories.ToString(), TextAlign = ContentAlignment.MiddleCenter, Tag = entry.Calories ?? 0
         },
         new ZoneDataBox {
             ZoneData = entry.HrZones ?? ZoneData.Empty(), OverlayText = entry.AverageHrSpecified ? '\u00d8' + entry.AverageHr.ToString() : "", Tag = entry.AverageHr ?? 0
         },
         new Label {
             Text = entry.DistanceKm > 0 ? entry.DistanceKm.ToString(CultureInfo.InvariantCulture) : "", TextAlign = ContentAlignment.MiddleCenter, Tag = entry.DistanceM ?? 0
         },
         new Label {
             Text = entry.Feeling == Common.Index.None ? "" : Enum.GetName(typeof(Common.Index), entry.Feeling ?? Common.Index.Count), BackColor = entry.Feeling < Common.Index.Count ? GetColor((double)(entry.Feeling ?? Common.Index.Count) / ((int)Common.Index.Count - 1), Color.Red, Color.Yellow, Color.Green) : _elcTraining.FirstColor, TextAlign = ContentAlignment.MiddleCenter, Tag = entry.Feeling == Common.Index.None ? "" : Enum.GetName(typeof(Common.Index), entry.Feeling ?? Common.Index.Count)
         },
         new Label {
             Text = entry.Note, Tag = entry.Note ?? "", TextAlign = ContentAlignment.MiddleLeft
         }
     });
 }
示例#3
0
            public void StartTracking()
            {
                int      id   = ThreadID;
                ZoneData data = GetData();

                data.Start();
            }
示例#4
0
        private static SpaceSimulationResult SpaceSimulationResult_Cooling(float load_Simulation, int index_Simulation, ZoneData zoneData_Simulation, float load_DesignDay, int index_DesignDay, ZoneData zoneData_DesignDay)
        {
            if (float.IsNaN(load_Simulation) || float.IsNaN(load_DesignDay))
            {
                return(null);
            }

            if (load_Simulation == 0 && load_DesignDay == 0)
            {
                return(SpaceSimulationResult(zoneData_Simulation, LoadType.Cooling));
            }

            int          index        = -1;
            ZoneData     zoneData     = null;
            SizingMethod sizingMethod = SizingMethod.Undefined;

            if (load_Simulation > load_DesignDay)
            {
                sizingMethod = SizingMethod.Simulation;
                index        = index_Simulation;
                zoneData     = zoneData_Simulation;
            }
            else
            {
                sizingMethod = SizingMethod.CDD;
                index        = index_DesignDay;
                zoneData     = zoneData_DesignDay;
            }

            return(SpaceSimulationResult(zoneData, index, LoadType.Cooling, sizingMethod));
        }
示例#5
0
        private void ZoneDataBoxPaint(object sender, PaintEventArgs e)
        {
            if (ZoneData.IsEmpty)
            {
                return;
            }

            var x = 0;

            using (var g = e.Graphics)
            {
                for (var i = 0; i < Brushes.Length; i++)
                {
                    var curWidth = (int)(ZoneData.GetZonePercentage(i + 1) * Width);
                    if (i == Brushes.Length - 1)
                    {
                        curWidth = Width - x;
                    }

                    if (curWidth == 0)
                    {
                        continue;
                    }

                    g.FillRectangle(Brushes[i], x, 0, curWidth, Height);
                    x += curWidth;
                }
            }
        }
示例#6
0
        public static Dictionary <string, ZoneData> ZoneDataDictionary(this HeatingDesignData heatingDesignData)
        {
            if (heatingDesignData == null)
            {
                return(null);
            }

            Dictionary <string, ZoneData> result = new Dictionary <string, ZoneData>();

            int      index    = 1;
            ZoneData zoneData = heatingDesignData.GetZoneData(index);

            while (zoneData != null)
            {
                string reference = zoneData.zoneGUID;
                if (reference == null)
                {
                    continue;
                }

                result[reference] = zoneData;
                index++;
                zoneData = heatingDesignData.GetZoneData(index);
            }
            return(result);
        }
示例#7
0
        SwfTagBase ISwfTagVisitor <ISwfStreamReader, SwfTagBase> .Visit(DefineFontAlignZonesTag tag, ISwfStreamReader reader)
        {
            tag.FontID       = reader.ReadUInt16();
            tag.CsmTableHint = (CSMTableHint)reader.ReadUnsignedBits(2);
            tag.Reserved     = (byte)reader.ReadUnsignedBits(6);

            while (!reader.IsEOF)
            {
                var zone  = new ZoneRecord();
                int count = reader.ReadByte();
                for (var j = 0; j < count; j++)
                {
                    var zoneData = new ZoneData {
                        Position = reader.ReadShortFloat(),
                        Size     = reader.ReadShortFloat()
                    };
                    zone.Data.Add(zoneData);
                }
                zone.Reserved = (byte)reader.ReadUnsignedBits(6);
                zone.ZoneX    = reader.ReadBit();
                zone.ZoneY    = reader.ReadBit();
                tag.ZoneTable.Add(zone);
            }
            return(tag);
        }
    public void Initialize(ZoneData zone)
    {
        this.zone            = zone;
        ZoneName.text        = "Zone " + zone.Zone + " - " + zone.Name;
        ZoneDescription.text = zone.Description;
        //BossPortrait.sprite = zone.BossFight.monsters[0].LoadPortrait();
        ZoneLootArea.Initialize(zone);
        UniqueLootArea.Initialize(zone);

        for (int i = 0; i < BossList.Count; i++)
        {
            if (i < zone.BossFight.monsters.Count && zone.BossFight.monsters[i] != null)
            {
                BossList[i].gameObject.SetActive(true);
                BossList[i].Initialize(zone.BossFight.monsters[i]);
            }
            else
            {
                BossList[i].gameObject.SetActive(false);
            }
        }

        string temp = "Crates:\n";

        foreach (var item in lootCrates)
        {
            temp += " > " + item.lootTableIdentity + " | " + item.CrateType.Identity + "\n";
        }

        UpdateChestText();
    }
示例#9
0
        public List <ZoneData> GetAll()
        {
            List <ZoneData> Lvar     = new List <ZoneData>();
            ZoneData        ZoneData = null;
            DbDataReader    reader   = null;

            try
            {
                using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString))
                {
                    SqlCommand command = new SqlCommand("ZoneGetAll", connection);
                    connection.Open();
                    reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        ZoneData = (ZoneData)GetFromReader(reader);
                        Lvar.Add(ZoneData);
                    }
                }
                return(Lvar);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                CloseReader(reader);
            }
        }
示例#10
0
    public IPromise <NodeResponse> StartExplore(ZoneData zone, List <Hero> party)
    {
        return(API.Explorations.StartExploring(zone, party, DateTime.Now)
               .Then(res => {
            foreach (Hero hero in party)
            {
                if (hero == null)
                {
                    continue;
                }
                hero.ExploringActZone = zone.ActZoneID;
            }

            //This should add the explorations to the DataManager's allExplorationList automatically.
            var exploration = dataMan.ProcessExplorationData(res["exploration"]);

            if (signals.OnExploreStarted != null)
            {
                signals.OnExploreStarted(exploration);
            }
        })
               .Catch(err => {
            traceError("Failed to Start Exploring ActZoneID #" + zone.ActZoneID + ": " + GameAPIManager.GetErrorMessage(err));
            traceError(err.StackTrace);
        }));
    }
示例#11
0
    public void SpawnZones(float radius, int numberOfZones, int maxNeiboringZones, int numberOfPlants, int numberOfAnimals, ZoneSetupType zoneSetup)
    {
        Allocate(numberOfZones, maxNeiboringZones, numberOfPlants, numberOfAnimals);
        float phi = Mathf.PI * (3 - Mathf.Sqrt(5));

        for (int i = 0; i < numberOfZones; i++)
        {
            float yPosition  = 1 - (i / (float)(numberOfZones - 1)) * 2;
            float tempRadius = Mathf.Sqrt(1 - yPosition * yPosition);

            float  theta           = phi * i;
            float  xPosition       = Mathf.Cos(theta) * tempRadius;
            float  zPosition       = Mathf.Sin(theta) * tempRadius;
            float3 newZonePosition = new float3(new Vector3(xPosition, yPosition, zPosition) * radius / 2);
            zones[i] = new ZoneData(newZonePosition);
        }
        double distance = 4 * math.PI * math.pow(radius, 2) / (2600 * math.log10(.00051 * numberOfZones + .49) + 1000) / (radius / 16);
        NativeArray <float> maxZoneSize = new NativeArray <float>(zones.Length, Allocator.TempJob);

        if (zoneSetup == ZoneSetupType.Distance)
        {
            JobHandle zoneDistanceJob = FindDistanceNeiboringZones(distance, maxNeiboringZones, maxZoneSize);
            zoneDistanceJob.Complete();
        }
        else if (zoneSetup == ZoneSetupType.Closest)
        {
            JobHandle zoneClosestJob = FindClosestNeiboringZones(maxNeiboringZones, maxZoneSize);
            zoneClosestJob.Complete();
        }
        for (int i = 0; i < maxZoneSize.Length; i++)
        {
            zones[i] = new ZoneData(zones[i].position, maxZoneSize[i]);
        }
        maxZoneSize.Dispose();
    }
    void SpawnAct(ZoneData zone)
    {
        tempZoneSelector = zoneSelectors.GetOrCreate(ZoneDisplayPrefab, container, isAnchoredZero: true);

        // Init the UI
        tempZoneSelector.GetComponent <CampExploreZoneDetailsInterface>().Initialize(zone);
    }
示例#13
0
    public void CountCurrentPetals()
    {
        ZoneData zoneData    = GetCurrentZone(currentZone);
        int      totalPetals = CountTotalPetals(zoneData);

        this.currentPetals = 0;

        for (int i = 0; i < zoneData.levels.Length; i++)
        {
            //Miro en cada nivel de la zona sus logros
            LevelData m_level = zoneData.levels[i];
            for (int j = 0; j < m_level.logros.Length; j++)
            {
                // Checkeo todos los logros de cada nivel
                if (m_level.logros[j].done)
                {
                    currentPetals++;
                }
            }
        }

        string petalsText = currentPetals + " / " + totalPetals;
        //string zoneText = "Zona " + currentZone;
        string zoneText = GetCurrentZone(currentZone).zoneName;

        if (petalsTextTag)
        {
            petalsTextTag.text = petalsText;
            zoneTextTag.text   = zoneText;
        }
    }
示例#14
0
        public async Task <IEnumerable <EncounterWild> > GetEncounterData(bool edited = false)
        {
            var encounterGarc = await this.GetGarc(GarcNames.EncounterData, useLz : true, edited : edited);

            var zoneDataFileIndex = encounterGarc.Garc.FileCount - this.ZoneDataPositionFromEnd;

            // All files up until the zone data file are the encounter data
            var encounterBuffers = (await encounterGarc.GetFiles()).Take(zoneDataFileIndex).ToArray();
            var zoneDataBuffer   = await encounterGarc.GetFile(zoneDataFileIndex);

            var zoneData = new ZoneData(this.Version);

            zoneData.Read(zoneDataBuffer);

            if (zoneData.Entries.Length > encounterBuffers.Length)
            {
                throw new InvalidDataException($"Zone data and encounter data mismatch. Zone data had {zoneData.Entries.Length} entries, but encounter data only had {encounterBuffers.Length}");
            }

            return(encounterBuffers.Zip(zoneData.Entries, (b, e) => {
                var encounter = EncounterWild.New(this.Version, e.ZoneId);
                encounter.Read(b);
                return encounter;
            }));
        }
示例#15
0
 public static XElement ToXml(ZoneData data)
 {
     return(new XElement("ZoneData",
                         new XAttribute("position", CommonFormatter.Format(data.Position)),
                         new XAttribute("size", CommonFormatter.Format(data.Size))
                         ));
 }
示例#16
0
        public DungeonsMenu(List <int> availables, List <ZoneLoc> groundDests, OnChooseSlot dungeonAction, OnChooseSlot groundAction)
        {
            chooseDungeonAction = dungeonAction;
            chooseGroundAction  = groundAction;
            dungeonIndices      = availables;
            List <MenuChoice> flatChoices = new List <MenuChoice>();

            for (int ii = 0; ii < dungeonIndices.Count; ii++)
            {
                int dungeonIndex = ii;
                flatChoices.Add(new MenuTextChoice(DataManager.Instance.DataIndices[DataManager.DataType.Zone].Entries[dungeonIndices[ii]].GetColoredName(), () => { chooseDungeon(dungeonIndex); }, true,
                                                   (DataManager.Instance.Save.DungeonUnlocks[dungeonIndices[ii]] == GameProgress.UnlockState.Completed) ? Color.White : Color.Cyan));
            }
            for (int ii = 0; ii < groundDests.Count; ii++)
            {
                ZoneData zone        = DataManager.Instance.GetZone(groundDests[ii].ID);
                int      groundIndex = ii;
                flatChoices.Add(new MenuTextChoice(DataManager.Instance.GetGround(zone.GroundMaps[groundDests[ii].StructID.ID]).GetColoredName(), () => { chooseGround(groundIndex); }));
            }
            List <MenuChoice[]> choices = SortIntoPages(flatChoices, SLOTS_PER_PAGE);

            summaryMenu = new DungeonSummary(Rect.FromPoints(new Loc(176, 16), new Loc(GraphicsManager.ScreenWidth - 16, 16 + GraphicsManager.MenuBG.TileHeight * 2 + VERT_SPACE * 7)));

            Initialize(new Loc(0, 0), 160, Text.FormatKey("MENU_DUNGEON_TITLE"), choices.ToArray(), 0, 0, Math.Min(SLOTS_PER_PAGE, flatChoices.Count));
        }
示例#17
0
        public static List <PanelSimulationResult> ToSAM_PanelSimulationResults(this ZoneData zoneData, int index)
        {
            List <SurfaceData> surfaceDatas = zoneData?.SurfaceDatas();

            if (surfaceDatas == null)
            {
                return(null);
            }

            List <PanelSimulationResult> result = new List <PanelSimulationResult>();

            foreach (SurfaceData surfaceData in surfaceDatas)
            {
                PanelSimulationResult panelSimulationResult = surfaceData?.ToSAM(index);
                if (panelSimulationResult == null)
                {
                    continue;
                }

                panelSimulationResult.SetValue(PanelSimulationResultParameter.ZoneName, zoneData.name);

                result.Add(panelSimulationResult);
            }

            return(result);
        }
示例#18
0
        public static SpaceSimulationResult SpaceSimulationResult(this ZoneData zoneData, LoadType loadType)
        {
            if (zoneData == null)
            {
                return(null);
            }

            string name      = zoneData.name;
            string reference = zoneData.zoneGUID;
            double area      = zoneData.floorArea;
            double volume    = zoneData.volume;

            SpaceSimulationResult result = Analytical.Create.SpaceSimulationResult(name, Query.Source(), reference, volume, area, loadType, 0);

            ParameterSet parameterSet = ParameterSet_SpaceSimulationResult(ActiveSetting.Setting, zoneData);

            if (parameterSet != null)
            {
                result.Add(parameterSet);
            }

            result.SetValue(SpaceSimulationResultParameter.ZoneGuid, zoneData.zoneGUID);

            return(result);
        }
示例#19
0
        /// <overloads>This method has two overloads. Both methods will
        /// extract the fields for PI_ZONE_INFO from the returned buffer.
        /// Upon successful execution of this call, the
        /// individual fields can be accessed using the classes 'get' methods.
        /// </overloads>
        /// <summary>
        /// This overload will add a new data record
        /// to the ZoneInfo table of the provided PI dataset and return the
        /// values via the class properties.
        /// </summary>
        /// <remarks>If the data buffer received from the PI server contains
        /// an indication of an error, an ApplicationException is thrown
        /// that should be caught by the application. The exception message
        /// will contain the specific enumeration error code.</remarks>
        /// <param name="dsPI">The PI dataset which includes a zone info table.
        /// If the method execution is successful, a new row will be added
        /// to the zone info table</param>
        /// <param name="src">The byte array that contains the data packet
        /// returned by the PI server.</param>
        public void Deserialize(ref ZoneData dsZone, byte[] src)
        {
            // Throw an exception if we get an error from PI server
            if (src[6] != (byte)ErrorCodes.PI_OK)
            {
                String msg;
                msg = Enum.GetName(typeof(ErrorCodes), src[6]);
                throw(new ApplicationException(msg));
            }



            ZoneData.ZoneInfoRow newZoneInfo;
            newZoneInfo = dsZone.ZoneInfo.NewZoneInfoRow();

            Fleet   = (char)src[8];
            ZoneNbr = BitConverter.ToInt16(src, 10);
            NumTaxisBookedPrimary = BitConverter.ToInt16(src, 12);
            NumTaxisBookedBackup  = BitConverter.ToInt16(src, 14);
            UnassignedCalls       = BitConverter.ToInt16(src, 80);

            newZoneInfo.fleet           = new String((char)src[8], 1);
            newZoneInfo.zone_nbr        = (BitConverter.ToInt16(src, 10)).ToString();
            newZoneInfo.numtaxisprimary = (BitConverter.ToInt16(src, 12)).ToString();
            newZoneInfo.numtaxisbackup  = (BitConverter.ToInt16(src, 14)).ToString();
            newZoneInfo.unassigned      = (BitConverter.ToInt16(src, 80)).ToString();

            dsZone.ZoneInfo.AddZoneInfoRow(newZoneInfo);
        }
示例#20
0
        public ZoneData GetZoneDataByID(string ID)
        {
            ZoneData     ZoneData = new ZoneData();
            DbDataReader reader   = null;

            try
            {
                using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString))
                {
                    SqlCommand command = new SqlCommand(String.Format("Select * From Zone Where Code = {0}", ID), connection);
                    connection.Open();
                    reader = command.ExecuteReader();
                    while (reader.Read())
                    {
                        ZoneData = (ZoneData)GetFromReader(reader);
                    }
                }
                return(ZoneData);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                CloseReader(reader);
            }
        }
示例#21
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            // Input variables
            ZoneData zoneData = null;

            // Catch the input data
            if (!DA.GetData(0, ref zoneData))
            {
                return;
            }

            // Check if the object is valid
            if (!zoneData.IsValid)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "The Zone Data is not valid");
            }

            // Output
            DA.SetData(0, zoneData.Name);
            DA.SetData(1, zoneData.FinePoint);
            DA.SetData(2, zoneData.PathZoneTCP);
            DA.SetData(3, zoneData.PathZoneOrientation);
            DA.SetData(4, zoneData.PathZoneExternalAxes);
            DA.SetData(5, zoneData.ZoneOrientation);
            DA.SetData(6, zoneData.ZoneExternalLinearAxes);
            DA.SetData(7, zoneData.ZoneExternalRotationalAxes);
        }
        public int ZoneCode(ZoneData ItemCode)
        {
            ZoneDal ZoneDal = new ZoneDal();

            try
            {
                switch (ItemCode.DataStatus)
                {
                case DataStatus.New:
                    ZoneDal.Add(ItemCode);
                    break;

                case DataStatus.Modified:
                    ZoneDal.update(ItemCode);
                    break;

                case DataStatus.Deleted:
                    ZoneDal.Delete(ItemCode);
                    return(0);
                }
                return(ItemCode.ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#23
0
        public MmoWorld(string name, Vector minCorner, Vector maxCorner, Vector tileDimensions, Res resource, GameApplication app)
            : base(minCorner, maxCorner, tileDimensions, new MmoItemCache())
        {
            try
            {
                m_App = app;
                log.InfoFormat("world = {0} cons()", name);

                this.resource  = resource;
                this.name      = name;
                this.zone      = (Resource().Zones.ExistZone(this.name) ? Resource().Zones.Zone(this.name) : Resource().Zones.Default(this.name));
                this.ownedRace = (this.zone != null) ? this.zone.InitiallyOwnedRace : Race.None;
                underAttack    = false;

                this.InitializeNpcGroups(Resource());
                asteroidManager     = new WorldAsteroidManager(this);
                npcManager          = new WorldNpcManager(this);
                nebulaObjectManager = new MmoWorldNebulaObjectManager(this);

                log.InfoFormat("base init completed");

                m_Cells.Setup(this);

                //load world info from database
                LoadWorldInfo();
                LoadWorldState();
            }
            catch (System.Exception eee)
            {
                CL.Out(LogFilter.WORLD, "Exception in world constructor");
                CL.Out(eee.Message);
                CL.Out(eee.StackTrace);
            }
        }
示例#24
0
 public Control[] ControlsForUnifiedTrainingEntry(TrainingEntry entry)
 {
     return(new Control[] {
         new Label {
             Text = (entry.Date ?? DateTime.MinValue).ToLongDateString(), TextAlign = ContentAlignment.MiddleCenter, Tag = (entry.Date ?? DateTime.MinValue).ToOADate()
         },
         new Label {
             Text = entry.Sport + (entry.TrainingTypeSpecified ? " (" + entry.TrainingType + ")" : "") + " - " + entry.Duration, TextAlign = ContentAlignment.MiddleCenter, Tag = entry.Sport + (entry.TrainingTypeSpecified ? " (" + entry.TrainingType + ")" : "") + " - " + entry.Duration
         },
         new Label {
             Text = entry.Feeling == Common.Index.None ? "" : Enum.GetName(typeof(Common.Index), (entry.Feeling ?? Common.Index.Count)), BackColor = entry.Feeling < Common.Index.Count ? GetColor((double)(entry.Feeling ?? Common.Index.Count) / ((int)Common.Index.Count - 1), Color.Red, Color.Yellow, Color.Green) : _elcUnified.FirstColor, TextAlign = ContentAlignment.MiddleCenter, Tag = entry.Feeling == Common.Index.None ? "" : Enum.GetName(typeof(Common.Index), (entry.Feeling ?? Common.Index.Count))
         },
         new ZoneDataBox {
             ZoneData = entry.HrZones ?? ZoneData.Empty(), OverlayText = entry.AverageHr == 0 ? "" : '\u00d8' + entry.AverageHr.ToString(), Tag = entry.AverageHr > 0 ? entry.AverageHr.ToString() : ""
         },
         new Label {
             Text = entry.DistanceKm > 0 ? entry.DistanceKm.ToString(CultureInfo.InvariantCulture) + " km" : "", TextAlign = ContentAlignment.MiddleCenter, Tag = entry.DistanceKm
         },
         new Label {
             Text = entry.Calories > 0 ? entry.Calories.ToString() + " kcal" : "", BorderStyle = BorderStyle.None, TextAlign = ContentAlignment.MiddleCenter, Tag = entry.Calories
         },
         new Label {
             Text = entry.Note, TextAlign = ContentAlignment.MiddleLeft, Tag = entry.NoteSpecified ? entry.Note : ""
         }
     });
 }
示例#25
0
 internal MissionRoute(List <MissionRouteSegment> selectedPath)
 {
     routeSegments = new List <MissionRouteSegment>(selectedPath);
     curZone       = routeSegments[curZoneIndex].zone;
     curArea       = curZone.areas.First();
     remainingSegmentPathLength = routeSegments[curZoneIndex].length;
     SetTransferAreaLength();
 }
示例#26
0
 void Awake()
 {
     ZoneData.CreateZoneData(zoneSettings.zone);
     if (ZoneData.GetZoneData(zoneSettings.zone.zoneName) != null)
     {
         zone = (ZoneData.GetZoneData(zoneSettings.zone.zoneName));
     }
 }
示例#27
0
        public Sprite GetZoneSprite(ZoneData data)
        {
            var path  = StringUtil.PathBuilder(PATH, data.SpritesPath, ZONE_EXTENSION);
            var stuff = Resources.LoadAll(path);
            var index = ListUtil <int> .GetRandomElement(data.SpriteIndexes);

            return(stuff[index] as Sprite);
        }
示例#28
0
    public static void AddZoneData(ZoneData data)
    {
        if (data == null)
        {
            return;
        }

        Data.Add(data.ZoneName, data);
    }
示例#29
0
    internal void NextLocation()
    {
        // not last location in area
        if (curLocIndex < curArea.locations.Count - 1)
        {
            // next location in area
            curLocIndex++;
        }
        // last location in area
        else
        {
            // not yet transfer area
            if (remainingSegmentPathLength > transferAreaLength)
            {
                // next interchangeable area
                curArea     = curZone.areas.Where(area => area.type == AreaType.Interchangeable).PickOne();
                curLocIndex = 0;
            }
            // transfer area
            else if (remainingSegmentPathLength > 0 && remainingSegmentPathLength < transferAreaLength)
            {
                var nextZone = routeSegments[curZoneIndex + 1].zone;
                curArea = curZone.areas.Find(
                    area => area.type == AreaType.ZoneTransition && area.targetZone == nextZone);
                curLocIndex = 0;
            }
            // transfer area ended, change zone
            else
            {
                // last zone in route
                if (curZoneIndex >= routeSegments.Count - 1)
                {
                    // TEMP: keep on travelling forever
                    // next interchangeable area
                    curArea     = curZone.areas.Where(area => area.type == AreaType.Interchangeable).PickOne();
                    curLocIndex = 0;
                }
                else
                {
                    var nextSegment = routeSegments[curZoneIndex + 1];
                    var entryArea   = nextSegment.zone.areas.Find(area => area.targetZone = curZone);
                    if (entryArea == null)
                    {
                        Debug.LogError($"Entry area for {curZone.name} in {nextSegment.zone.name} wasn't found");
                    }
                    curZoneIndex++;
                    curZone     = nextSegment.zone;
                    curArea     = entryArea;
                    curLocIndex = 0;
                    SetTransferAreaLength();
                }
            }
        }

        curLocSprite = curArea.locations[curLocIndex];
        remainingSegmentPathLength--;
    }
示例#30
0
            public override void ExitZone()
            {
                ZoneData data = GetData(false);

                if (data != null)
                {
                    data.FinishCollection();
                }
            }
示例#31
0
        public static void HandleZoneOpened(WorldConnector lc, InterPacket packet)
        {
            byte id;
            string ip;
            ushort port;
            int mapcount;
            if (!packet.TryReadByte(out id) || !packet.TryReadString(out ip) || !packet.TryReadUShort(out port) || !packet.TryReadInt(out mapcount))
            {
                return;
            }

            List<MapInfo> maps = new List<MapInfo>();
            for (int j = 0; j < mapcount; j++)
            {
                ushort mapid, viewrange;
                string shortname, fullname;
                int regenx, regeny;
                byte kingdom;
                if (!packet.TryReadUShort(out mapid) || !packet.TryReadString(out shortname) || !packet.TryReadString(out fullname) || !packet.TryReadInt(out regenx) || !packet.TryReadInt(out regeny) || !packet.TryReadByte(out kingdom) || !packet.TryReadUShort(out viewrange))
                {
                    break;
                }
                maps.Add(new MapInfo(mapid, shortname, fullname, regenx, regeny, kingdom, viewrange));
            }

            ZoneData zd;
            if (!Program.Zones.TryGetValue(id, out zd))
            {
                zd = new ZoneData();
            }
            zd.ID = id;
            zd.IP = ip;
            zd.Port = port;
            zd.MapsToLoad = maps;
            Program.Zones[id] = zd;
            Log.WriteLine(LogLevel.Info, "Added zone {0} to zonelist. {1}:{2}", zd.ID, zd.IP, zd.Port);
        }
示例#32
0
    // Use this for initialization
    void Start()
    {
        for ( int i = 0; i < xSize; i++)
        {
            for (int j = 0; j < ySize; j++)
            {
                zones[i, j] = new ZoneData(new Vector2(i, j));
                zones[i, j].Load();
            }

        }
    }