예제 #1
0
 public CategoryPageVersion()
 {
     Id = 0;
     PageId = string.Empty;            
     AdminName = string.Empty;
     AvailableScheduleId = 0;
     AvailableStartDateUtc = new DateTime(1900, 1, 1);
     AvailableEndDateUtc = new DateTime(9999, 1, 1);
     Root = new RootColumn();            
     PublishedStatus = PublishStatus.Draft;
     Areas = new AreaData();
 }
예제 #2
0
    public void CreateArea(AreaData areaData)
    {
        GameObject area = Instantiate <GameObject>(AreaPrefab, this.transform);

        area.transform.SetParent(this.transform);
        area.transform.localPosition = PointerToIcometric(new Point(areaData.x, areaData.y), tileWidth, tileHeight);

        var areaDispay = area.GetComponent <AreaDisplay>();

        areaDispay.areaData = areaData;
        areaDispay.Init();

        Areas[areaData.x, areaData.y] = area as GameObject;
    }
예제 #3
0
        private static void onRegisterHeartGem(On.Celeste.SaveData.orig_RegisterHeartGem orig, SaveData self, AreaKey area)
        {
            orig(self, area);

            if (IsHeartSide(area.GetSID()))
            {
                string lobby = GetLobbyForLevelSet(area.GetLevelSet());
                if (lobby != null)
                {
                    // register the heart gem for the lobby as well.
                    self.RegisterHeartGem(AreaData.Get(lobby).ToKey());
                }
            }
        }
예제 #4
0
        public override bool IsStart(Overworld overworld, Overworld.StartMode start)
        {
            if (start == Overworld.StartMode.AreaComplete || start == Overworld.StartMode.AreaQuit)
            {
                AreaData area = AreaData.Get(SaveData.Instance.LastArea.ID);
                area = AreaDataExt.Get(area?.GetMeta()?.Parent) ?? area;
                if (area != null)
                {
                    SaveData.Instance.LastArea.ID = area.ID;
                }
            }

            return(orig_IsStart(overworld, start));
        }
예제 #5
0
        private void AreaOpened(AreaDataObservable area)
        {
            CameraReset();
            _loadedAreaData = _objectMapper.Map <AreaData>(area);
            _loadedArea     = _entityFactory.Create <Area, AreaData>(_loadedAreaData);

            Texture2D texture = _loadedArea.GetComponent <Renderable>().Texture;

            _objectPainter = _entityFactory.Create <ObjectPainter, Texture2D>(texture);
            Paintable paintable = _objectPainter.GetComponent <Paintable>();

            paintable.AreaHeight = _loadedAreaData.Height;
            paintable.AreaWidth  = _loadedAreaData.Width;
        }
예제 #6
0
        public override void Added(Scene scene)
        {
            AreaData area = AreaData.Get(scene);

            Color[] prevColors = area.CobwebColor;
            if (OverrideColors != null)
            {
                area.CobwebColor = OverrideColors;
            }

            orig_Added(scene);

            area.CobwebColor = prevColors;
        }
예제 #7
0
        public static void Reload(bool recrawl)
        {
            SaveData saveData = SaveData.Instance;

            // ChapterSelect only updates the ID.
            string lastAreaSID = saveData == null ? null : (AreaData.Get(saveData.LastArea.ID)?.ToKey().GetSID() ?? AreaKey.Default.GetSID());

            // Note: SaveData.Instance.LastArea is reset by AreaData.Interlude_Safe -> SaveData.LevelSetStats realizing that AreaOffset == -1
            // Store the "resolved" last selected area in a local variable, then re-set it after reloading.

            // Reload all maps.
            if (recrawl)
            {
                Everest.Content.Recrawl();
            }

            lock (AreaReloadLock) { // prevent anything from calling AreaData.Get during this.
                AreaData.Unload();
                AreaData.Load();
                AreaData.ReloadMountainViews();

                // Fake a save data reload to resync the save data to the new area list.
                if (saveData != null)
                {
                    AreaData lastArea = AreaDataExt.Get(lastAreaSID);
                    saveData.LastArea = lastArea?.ToKey() ?? AreaKey.Default;
                    saveData.BeforeSave();
                    saveData.AfterInitialize();
                }
            }

            if (Engine.Scene is Overworld overworld)
            {
                if (overworld.Mountain.Area >= AreaData.Areas.Count)
                {
                    overworld.Mountain.EaseCamera(0, AreaData.Areas[0].MountainIdle, null, true);
                }

                OuiChapterSelect chapterSelect = overworld.GetUI <OuiChapterSelect>();
                overworld.UIs.Remove(chapterSelect);
                overworld.Remove(chapterSelect);

                chapterSelect         = new OuiChapterSelect();
                chapterSelect.Visible = false;
                overworld.Add(chapterSelect);
                overworld.UIs.Add(chapterSelect);
                chapterSelect.IsStart(overworld, (Overworld.StartMode)(-1));
            }
        }
예제 #8
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Teleport")
        {
            Debug.Log("Teleport");
            //TeleportAI(collision.GetComponent<Teleport>());
            StartCoroutine(StartTeleport(collision.GetComponent <Teleport>()));
        }

        if (collision.gameObject.layer == LayerMask.NameToLayer("Area"))
        {
            currentArea = collision.GetComponent <AreaData>();
            OnEnterArea.Invoke();
        }
    }
예제 #9
0
        // prism:InvokeCommandActionのCommandプロパティでバインドした場合は、DelegateCommand<T>のパラメータにはイベントパラメータが渡ってきて利用できる。
        private void AAreasComboBox_SelectionChanged(SelectionChangedEventArgs e)
        {
            ComboBox sender        = (ComboBox)e.Source; // イベント発火元コントロールはEventArgsのSourceプロパティで取得可能。
            AreaData selectedAArea = (AreaData)e.AddedItems[0];

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("・EventSender's Name from EventArgs: " + sender.Name);
            sb.AppendLine("・SelectedArea's Value&Name from EventArgs: " + selectedAArea.Value + "," + selectedAArea.Name);
            sb.AppendLine("・SelectedArea's Value&Name from BindingProp: " + this.SelectedAArea.Value + "," + this.SelectedAArea.Name);
            this.SelectedAAreaInfo = sb.ToString();

            // MainWindowViewModelにアクセス
            _mainWindowViewModel.MainWindowVMAccessTestLabel = this.SelectedAArea.Value + "," + this.SelectedAArea.Name + "from " + nameof(ViewUsrCtrlCViewModel);
        }
예제 #10
0
            public void ctor(Session session)
            {
                // Initialize the artist. If we are in a vanilla level, it will be replaced afterwards.
                AreaData area = AreaData.Get(session);

                artist = Dialog.Get(area.Name + "_remix_artist");

                orig_ctor(session);

                // Replace the album if defined in the language file.
                if (string.IsNullOrEmpty(album) || Dialog.Has(area.Name + "_remix_album"))
                {
                    album = Dialog.Get(area.Name + "_remix_album");
                }
            }
예제 #11
0
        public MapDataFixup(MapData map)
        {
            MapData        = map;
            AreaKey        = map.Area;
            AreaData       = AreaData.Get(AreaKey);
            ParentAreaData = AreaDataExt.Get(AreaData.GetMeta()?.Parent) ?? AreaData;
            Mode           = AreaData.Mode[(int)AreaKey.Mode];
            ParentMode     = ParentAreaData.Mode.ElementAtOrDefault((int)AreaKey.Mode) ?? Mode;
            ParentMapData  = ParentMode?.MapData ?? map;

            foreach (EverestModule module in Everest._Modules)
            {
                module.PrepareMapDataProcessors(this);
            }
        }
예제 #12
0
        /* public static void fix_area_exits(AreaData area)
         * {
         *   for (int rnum = area.LowRoomNumber; rnum <= area.HighRoomNumber; rnum++)
         *   {
         *       RoomTemplate room = RepositoryManager.Instance.ROOMS.CastAs<Repository<long, RoomTemplate>>().Get(rnum);
         *       if (room == null)
         *           continue;
         *
         *       bool fexit = false;
         *       foreach (ExitData exit in room.Exits)
         *       {
         *           fexit = true;
         *           exit.Room_vnum = room.Vnum;
         *           exit.Destination = exit.vnum <= 0 ? 0 : RepositoryManager.Instance.ROOMS.CastAs<Repository<long, RoomTemplate>>().Get(exit.vnum).ID;
         *       }
         *       if (!fexit)
         *           room.Flags.SetBit((int)RoomFlags.NoMob);
         *   }
         *
         *   for (int rnum = area.LowRoomNumber; rnum <= area.HighRoomNumber; rnum++)
         *   {
         *       RoomTemplate room = RepositoryManager.Instance.ROOMS.CastAs<Repository<long, RoomTemplate>>().Get(rnum);
         *       if (room == null)
         *           continue;
         *
         *       foreach (ExitData exit in room.Exits)
         *       {
         *           if (exit.Reverse < -0)
         *           {
         *               ExitData reverseExit = exit.GetDestination().GetExitTo(GameConstants.rev_dir[(int)exit.Direction], room.Vnum);
         *               if (reverseExit != null)
         *               {
         *                   exit.Reverse = reverseExit.ID;
         *                   reverseExit.Reverse = exit.ID;
         *               }
         *           }
         *       }
         *   }
         * }*/

        public static void process_sorting(AreaData area)
        {
            /*if (DatabaseManager.BootDb)
             * {
             *  sort_area_by_name(area);
             *  sort_area(area, false);
             * }*/

            var buffer =
                $"{area.Filename}:\n\tRooms: {area.LowRoomNumber} - {area.HighRoomNumber}\n\tObjects: {area.LowObjectNumber} - {area.HighObjectNumber}\n\tMobs: {area.LowMobNumber} - {area.HighMobNumber}\n";

            LogManager.Instance.Boot(buffer);

            area.status.SetBit((int)AreaFlags.Loaded);
        }
예제 #13
0
        /// <summary>
        /// Returns the SID of the lobby corresponding to this level set.
        /// </summary>
        /// <param name="levelSet">The level set name</param>
        /// <returns>The SID of the lobby for this level set, or null if the given level set does not belong to a collab or has no matching lobby.</returns>
        public static string GetLobbyForLevelSet(string levelSet)
        {
            string collab = collabNames.FirstOrDefault(collabName => levelSet.StartsWith($"{collabName}/"));

            if (collab != null)
            {
                // build the expected lobby name (SpringCollab2020/1-Beginner => SpringCollab2020/0-Lobbies/1-Beginner) and check it exists before returning it.
                string expectedLobbyName = $"{collab}/0-Lobbies/{levelSet.Substring($"{collab}/".Length)}";
                if (AreaData.Get(expectedLobbyName) != null)
                {
                    return(expectedLobbyName);
                }
            }
            return(null);
        }
예제 #14
0
 private void SetRunAnim()
 {
     if (Renderer.Area < 0 || AreaData.Get(Renderer.Area).IsOfficialLevelSet())
     {
         orig_SetRunAnim();
     }
     else if (AreaData.Get(Renderer.Area).Mode[0].Inventory.Dashes > 1)
     {
         frames = MTN.Mountain.GetAtlasSubtextures("marker/runNoBackpack");
     }
     else
     {
         frames = MTN.Mountain.GetAtlasSubtextures("marker/runBackpack");
     }
 }
예제 #15
0
        private IEnumerator StartRoutine(AreaData area, AreaMode mode = AreaMode.Normal, string checkpoint = null)
        {
            Overworld.Maddy.Hide(false);
            area.Wipe(Overworld, false, null);
            Audio.SetMusic(null, true, true);
            Audio.SetAmbience(null, true);
            if ((area.ID == 0 || area.ID == 9) && checkpoint == null && mode == AreaMode.Normal)
            {
                Overworld.RendererList.UpdateLists();
                Overworld.RendererList.MoveToFront(Overworld.Snow);
            }
            yield return(0.5f);

            LevelEnter.Go(new Session(area.ToKey(mode), checkpoint), false);
        }
예제 #16
0
        public override void Added(Scene scene)
        {
            AreaData area = AreaData.Get(scene);

            string prevTexture = area.CrumbleBlock;

            if (OverrideTexture != null)
            {
                area.CrumbleBlock = OverrideTexture;
            }

            orig_Added(scene);

            area.CrumbleBlock = prevTexture;
        }
예제 #17
0
            public void ctor(Session session)
            {
                orig_ctor(session);

                AreaData area = AreaData.Get(session);

                if (string.IsNullOrEmpty(artist) || Dialog.Has(area.Name + "_remix_artist"))
                {
                    artist = Dialog.Get(area.Name + "_remix_artist");
                }
                if (string.IsNullOrEmpty(album) || Dialog.Has(area.Name + "_remix_album"))
                {
                    album = Dialog.Get(area.Name + "_remix_album");
                }
            }
예제 #18
0
        public override void Added(Scene scene)
        {
            AreaData area = AreaData.Get(scene);

            string prevTexture = area.WoodPlatform;

            if (OverrideTexture != null)
            {
                area.WoodPlatform = OverrideTexture;
            }

            orig_Added(scene);

            area.WoodPlatform = prevTexture;
        }
예제 #19
0
        /// <summary>
        /// Retorna un LISTA de registros de la Entidad RecursosHumanos.Empleado
        /// En la BASE de DATO la Tabla : [RecursosHumanos.Empleado]
        /// <summary>
        /// <returns>List</returns>
        public List <AreaEntity> ListarAreas()
        {
            List <AreaEntity> lstAreaEntity = new List <AreaEntity>();

            try
            {
                objAreaData   = new AreaData();
                lstAreaEntity = objAreaData.Listar();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lstAreaEntity);
        }
예제 #20
0
    bool EnterArea(List <string> param, out bool closeWnd)
    {
        closeWnd = true;
        int areaIndex = 0;

        if (int.TryParse(param[0], out areaIndex))
        {
            AreaData nextAreaData = LevelManager.level.GetAreaData(areaIndex);
            if (nextAreaData != null)
            {
            }
        }

        return(true);
    }
예제 #21
0
 private int SortAltSidesLast(On.Celeste.AreaData.orig_AreaComparison orig, AreaData a, AreaData b)
 {
     if (string.Equals(a.LevelSet, b.LevelSet))
     {
         if (!(GetMetaForAreaData(a)?.AltSideData?.IsAltSide ?? false) && (GetMetaForAreaData(b)?.AltSideData?.IsAltSide ?? false))
         {
             return(-1);
         }
         if ((GetMetaForAreaData(a)?.AltSideData?.IsAltSide ?? false) && !(GetMetaForAreaData(b)?.AltSideData?.IsAltSide ?? false))
         {
             return(1);
         }
     }
     return(orig(a, b));
 }
예제 #22
0
        private void LoadCompleteThread()
        {
            AreaData area = AreaData.Get(session);

            if ((completeMeta = area.GetMeta()?.CompleteScreen) != null && completeMeta.Atlas != null)
            {
                completeAtlas = Atlas.FromAtlas(Path.Combine("Graphics", "Atlases", completeMeta.Atlas), Atlas.AtlasDataFormat.PackerNoAtlas);
            }
            else if ((completeXml = area.CompleteScreenXml) != null && completeXml.HasAttr("atlas"))
            {
                completeAtlas = Atlas.FromAtlas(Path.Combine("Graphics", "Atlases", completeXml.Attr("atlas")), Atlas.AtlasDataFormat.PackerNoAtlas);
            }

            completeLoaded = true;
        }
예제 #23
0
        private void HideAltSides(On.Celeste.OuiChapterSelect.orig_Added orig, OuiChapterSelect self, Scene scene)
        {
            orig(self, scene);
            var icons = new DynData <OuiChapterSelect>(self).Get <List <OuiChapterSelectIcon> >("icons");

            for (int i = icons.Count - 1; i >= 0; i--)
            {
                var meta = GetMetaForAreaData(AreaData.Get(icons[i].Area));
                if (meta?.AltSideData.IsAltSide ?? false)
                {
                    icons[i].Area = -1;
                    icons[i].Hide();
                }
            }
        }
예제 #24
0
        private void MainThreadHook(On.Celeste.AutoSplitterInfo.orig_Update orig, AutoSplitterInfo self)
        {
            orig(self);

            if (AreaHandoff != null)
            {
                AreaData.Areas.Add(AreaHandoff);
                var key = new AreaKey(AreaData.Areas.Count - 1); // does this trigger some extra behavior
                AreaHandoff = null;
            }
            if (StartMe != null && !Entering)
            {
                var newArea = StartMe.Value;
                Audio.SetMusic((string)null, true, true);
                Audio.SetAmbience((string)null, true);
                Audio.Play("event:/ui/main/savefile_begin");

                // use the debug file
                SaveData.InitializeDebugMode();
                // turn on/off variants mode
                SaveData.Instance.VariantMode = Settings.Variants;
                SaveData.Instance.AssistMode  = false;
                // mark as completed to spawn golden berry
                SaveData.Instance.Areas[newArea.ID].Modes[0].Completed = true;
                // mark heart as not collected
                SaveData.Instance.Areas[newArea.ID].Modes[0].HeartGem = false;
                Entering = true;

                var fade = new FadeWipe(Engine.Scene, false, () => {   // assign to variable to suppress compiler warning
                    var session = new Session(newArea, null, null)
                    {
                        FirstLevel           = true,
                        StartedFromBeginning = true,
                    };
                    session.SeedCleanRandom(Settings.SeedType == SeedType.Random);
                    SaveData.Instance.StartSession(session);    // need to set this earlier than we would get otherwise
                    LevelEnter.Go(session, true);
                    StartMe  = null;
                    Entering = false;
                });

                /*foreach (AreaData area in AreaData.Areas) {
                 *  Logger.Log("randomizer", $"Skeleton for {area.GetSID()}");
                 *  RandoConfigFile.YamlSkeleton(area);
                 *
                 * }*/
            }
        }
예제 #25
0
        private void SetPoemColour(On.Celeste.Poem.orig_ctor orig, Poem self, string text, int heartIndex, float heartAlpha)
        {
            var data = AreaData.Get((Engine.Scene as Level).Session.Area);
            var m    = GetModeMetaForAltSide(data);

            if (data != null)
            {
                Logger.Log("AltSidesHelper", $"Customising poem UI for \"{data.SID}\".");
            }
            if (!(m?.ShowHeartPoem) ?? false)
            {
                text = null;
            }
            orig(self, text, heartIndex, heartAlpha);
            // customize heart gem icon
            string animId = null;

            // our sprite ID will be "AltSidesHelper_<heart sprite path keyified>"
            // log duplicate entries for a map
            var   sid               = (Engine.Scene as Level).Session.Area.SID;
            Color?color             = null;
            AltSidesHelperMode mode = GetModeMetaForAltSide(AreaData.Get(sid));

            if (mode != null && mode.OverrideHeartTextures)
            {
                animId = mode.ChapterPanelHeartIcon.DialogKeyify();
                if (!mode.HeartColour.Equals(""))
                {
                    color = Calc.HexToColor(mode.HeartColour);
                }
            }

            if (animId != null)
            {
                if (HeartSpriteBank.Has(animId))
                {
                    HeartSpriteBank.CreateOn(self.Heart, animId);
                    self.Heart.Play("spin");
                    self.Heart.CenterOrigin();
                    Logger.Log("AltSidesHelper", $"Changed poem heart sprite for \"{data.SID}\".");
                }
            }
            if (color != null)
            {
                new DynData <Poem>(self)["Color"] = color;
                Logger.Log("AltSidesHelper", $"Changed poem colour for \"{data.SID}\".");
            }
        }
        public override void Awake(Scene scene)
        {
            AreaData areaData = AreaData.Get(scene);
            string   jumpthru = areaData.Jumpthru;

            if (!string.IsNullOrEmpty(overrideTexture) && !overrideTexture.Equals("default"))
            {
                jumpthru = overrideTexture;
            }

            MTexture mTexture = GFX.Game["objects/jumpthru/" + jumpthru];
            int      num      = mTexture.Width / 8;

            for (int i = 0; i < lines; i++)
            {
                int xTilePosition;
                int yTilePosition;
                if (i == 0)
                {
                    xTilePosition = 0;
                    yTilePosition = ((!CollideCheck <Solid>(Position + new Vector2(0f, -1f))) ? 1 : 0);
                }
                else if (i == lines - 1)
                {
                    xTilePosition = num - 1;
                    yTilePosition = ((!CollideCheck <Solid>(Position + new Vector2(0f, 1f))) ? 1 : 0);
                }
                else
                {
                    xTilePosition = 1 + Calc.Random.Next(num - 2);
                    yTilePosition = Calc.Random.Choose(0, 1);
                }
                Image image = new Image(mTexture.GetSubtexture(xTilePosition * 8, yTilePosition * 8, 8, 8));
                image.Y        = i * 8;
                image.Rotation = (float)(Math.PI / 2);

                if (AllowLeftToRight)
                {
                    image.X = 8;
                }
                else
                {
                    image.Scale.Y = -1;
                }

                Add(image);
            }
        }
예제 #27
0
        private IEnumerator ErrorRoutine(string message)
        {
            yield return(1f);

            Add(postcard = new Postcard(message, "event:/ui/main/postcard_csides_in", "event:/ui/main/postcard_csides_out"));
            yield return(postcard.DisplayRoutine());

            SaveData.Instance.CurrentSession = session;
            SaveData.Instance.LastArea       = session.Area;
            if (AreaData.Get(session.Area) == null)
            {
                // the area we are returning to doesn't exist anymore. return to Prologue instead.
                SaveData.Instance.LastArea = AreaKey.Default;
            }
            Engine.Scene = new OverworldLoader(Overworld.StartMode.AreaQuit);
        }
 public ActionResult GetArea(int cityId)
 {
     AreaData ad = new AreaData();
     List<Area> list = new List<Area>();
     Dictionary<string, object> dic = new Dictionary<string, object>();
     foreach (var i in ad.Get().ToList().Where(a => a.cityId == cityId))
     {
         list.Add(new Area()
         {
             num = i.num,
             AreaName = i.AreaName
         });
     }
     dic.Add("list", list);
     return Json(dic);
 }
예제 #29
0
 /// <summary>
 /// 只能由Level调用
 /// </summary>
 public IEnumerator DestroyArea(LevelInstance level, ExitAreaType type)
 {
     if (isEnterArea)
     {
         Debug.LogError("区域还没有退出,不能直接销毁");
     }
     GameEvent.AreaEvent.FireOnBeginDestroyArea(level, this, type);
     foreach (RoomInstance room in new List <RoomInstance>(m_Rooms))
     {
         yield return(DestroyRoom(room, type));
     }
     GameEvent.AreaEvent.FireOnDestroyAreaComplete(level, this, type);
     level      = null;
     m_AreaData = null;
     DestroyImmediate(gameObject);
 }
예제 #30
0
        public ActionResult GetAreaJsonData(string area, string name)
        {
            var areaData = new AreaData();

            switch (area)
            {
            case "province":
                var cityDataList = areaData.GetCitiesData(name);
                return(Json(cityDataList));

            case "city":
                var districtDataList = areaData.GetDistrictsData(name);
                return(Json(districtDataList));
            }
            return(null);
        }
예제 #31
0
        public override void Update(Scene scene)
        {
            AreaData area = -1 < Area && Area < (AreaData.Areas?.Count ?? 0) ? AreaData.Get(Area) : null;
            MapMeta  meta = area?.GetMeta();

            if (meta?.Mountain?.ShowCore ?? false)
            {
                Area = 9;
                orig_Update(scene);
                Area = area.ID;
            }
            else
            {
                orig_Update(scene);
            }
        }
예제 #32
0
    void AddAreaByName(string areaName)
    {
        TextAsset asset = Resources.Load("areas/" + areaName) as TextAsset;

        if (asset != null)
        {
            AreaData areaDataActive = JsonUtility.FromJson <AreaData> (asset.text);
            totalDistance += areaDataActive.z_length / 2;
            areaCreator.AddSceneObjectsToNewArea(areaName, areaDataActive, totalDistance);
            totalDistance += areaDataActive.z_length / 2;
        }
        else
        {
            Debug.LogError("Loco, no existe esta area: " + areaName + " en Respurces/areas/");
        }
    }
예제 #33
0
파일: Data.cs 프로젝트: pontura/ArtPlacer
    void Awake()
    {
        if (!mInstance)
            mInstance = this;
        //otherwise, if we do, kill this thing
        else
        {
            Destroy(this.gameObject);
            return;
        }
        artData = GetComponent<ArtData>();

        filtersManager = GetComponent<FiltersManager>();

        StartCoroutine(GetServerData(json_galleries_Url));

        cameraData = GetComponent<CameraData>();

        fade = GetComponentInChildren<Fade>();
        areaData = GetComponent<AreaData>();

        fade.gameObject.SetActive(true);

        roomsData = GetComponent<RoomsData>();

        filtersManager = GetComponent<FiltersManager>();

        DontDestroyOnLoad(this.gameObject);

        Screen.autorotateToLandscapeLeft = true;
        Screen.autorotateToLandscapeRight = false;
        Screen.autorotateToPortrait = false;
        Screen.autorotateToPortraitUpsideDown = false;

        Events.ToggleUnit += ToggleUnits;
    }
예제 #34
0
 void AddConfirmSizes(AreaData.Area area)
 {
     Invoke("SelectArea", 0.1f);
 }
예제 #35
0
파일: DungeonRegion.cs 프로젝트: Vinna/aura
		/// <summary>
		/// Generates areas, incl (client) props and events.
		/// </summary>
		private void GenerateAreas()
		{
			this.Data = new RegionInfoData();

			var areaId = 2;
			var floor = this.Floor;

			for (int x = 0; x < floor.MazeGenerator.Width; ++x)
			{
				for (int y = 0; y < floor.MazeGenerator.Height; ++y)
				{
					var room = floor.MazeGenerator.GetRoom(x, y);
					var roomTrait = floor.GetRoom(x, y);

					if (!room.Visited)
						continue;

					var isStart = (roomTrait.RoomType == RoomType.Start);
					var isEnd = (roomTrait.RoomType == RoomType.End);
					var isRoom = (roomTrait.RoomType >= RoomType.Start);
					var isBossRoom = (floor.HasBossRoom && isEnd);
					var eventId = 0L;

					if (!isBossRoom)
					{
						var areaData = new AreaData();
						areaData.Id = areaId++;
						areaData.Name = "Tile" + areaData.Id;

						areaData.X1 = x * Dungeon.TileSize;
						areaData.Y1 = y * Dungeon.TileSize;
						areaData.X2 = x * Dungeon.TileSize + Dungeon.TileSize;
						areaData.Y2 = y * Dungeon.TileSize + Dungeon.TileSize;

						this.Data.Areas.Add(areaData);

						var type = (isRoom ? DungeonBlockType.Room : DungeonBlockType.Alley);

						var propEntityId = MabiId.ClientProps | ((long)this.Id << 32) | ((long)areaData.Id << 16) | 1;
						var block = this.Dungeon.Data.Style.Get(type, room.Directions);
						var tileCenter = new Point(x * Dungeon.TileSize + Dungeon.TileSize / 2, y * Dungeon.TileSize + Dungeon.TileSize / 2);

						var prop = new Prop(propEntityId, block.PropId, this.Id, tileCenter.X, tileCenter.Y, MabiMath.DegreeToRadian(block.Rotation), 1, 0, "", "", "");
						this.AddProp(prop);

						// Debug
						//foreach (var points in prop.Shapes)
						//{
						//	foreach (var point in points)
						//	{
						//		var pole = new Prop(30, this.Id, point.X, point.Y, 0, 1, 0, "", "", "");
						//		pole.Shapes.Clear();
						//		this.AddProp(pole);
						//	}
						//}

						// TODO: This region/data stuff is a mess... create
						//   proper classes, put them in the regions and be
						//   done with it.

						if (isStart || isEnd)
						{
							var xp = tileCenter.X;
							var yp = tileCenter.Y;

							if (roomTrait.DoorType[Direction.Up] >= 3000)
								yp += 400;
							else if (roomTrait.DoorType[Direction.Right] >= 3000)
								xp += 400;
							else if (roomTrait.DoorType[Direction.Down] >= 3000)
								yp -= 400;
							else if (roomTrait.DoorType[Direction.Left] >= 3000)
								xp -= 400;

							var eventData = new EventData();
							eventData.Id = MabiId.AreaEvents | ((long)this.Id << 32) | ((long)areaData.Id << 16) | eventId++;
							eventData.Name = (isStart ? "Indoor_RDungeon_SB" : "Indoor_RDungeon_EB");
							eventData.X = xp;
							eventData.Y = yp;

							var shape = new ShapeData();
							shape.DirX1 = 1;
							shape.DirY2 = 1;
							shape.LenX = 100;
							shape.LenY = 100;
							shape.PosX = xp;
							shape.PosY = yp;
							eventData.Shapes.Add(shape);

							areaData.Events.Add(eventData.Id, eventData);
							_clientEvents.Add(eventData.Id, new ClientEvent(eventData, this.Data.Name, areaData.Name));
						}
					}
					else
					{
						// Big main room
						var areaData = new AreaData();
						areaData.Id = areaId++;
						areaData.Name = "Tile" + areaData.Id;

						areaData.X1 = x * Dungeon.TileSize - Dungeon.TileSize;
						areaData.Y1 = y * Dungeon.TileSize;
						areaData.X2 = x * Dungeon.TileSize + Dungeon.TileSize * 2;
						areaData.Y2 = y * Dungeon.TileSize + Dungeon.TileSize * 2;

						this.Data.Areas.Add(areaData);

						var block = this.Dungeon.Data.Style.Get(DungeonBlockType.BossRoom);
						var propEntityId = MabiId.ClientProps | ((long)this.Id << 32) | ((long)areaData.Id << 16) | 1;
						var tileCenter = new Point(x * Dungeon.TileSize + Dungeon.TileSize / 2, y * Dungeon.TileSize + Dungeon.TileSize);

						var prop = new Prop(propEntityId, block.PropId, this.Id, tileCenter.X, tileCenter.Y, MabiMath.DegreeToRadian(block.Rotation), 1, 0, "", "", "");
						this.AddProp(prop);

						// Debug
						//foreach (var points in prop.Shapes)
						//{
						//	foreach (var point in points)
						//	{
						//		var pole = new Prop(30, this.Id, point.X, point.Y, 0, 1, 0, "", "", "");
						//		pole.Shapes.Clear();
						//		this.AddProp(pole);
						//	}
						//}

						// Treasure room
						areaData = new AreaData();
						areaData.Id = areaId++;
						areaData.Name = "Tile" + areaData.Id;

						areaData.X1 = x * Dungeon.TileSize;
						areaData.Y1 = y * Dungeon.TileSize + Dungeon.TileSize * 2;
						areaData.X2 = x * Dungeon.TileSize + Dungeon.TileSize;
						areaData.Y2 = y * Dungeon.TileSize + Dungeon.TileSize * 2 + Dungeon.TileSize;

						this.Data.Areas.Add(areaData);
					}
				}
			}
		}