Ejemplo n.º 1
0
        /// <summary>
        /// Create a level with a specified type and a specified size. <remarks>Calls OnLevelsLoad event.</remarks>
        /// </summary>
        /// <param name="size">The size to create the level.</param>
        /// <param name="type">The type of the level you want to create</param>
        /// <param name="name">Name of the level to create</param>
        /// <returns>
        /// returns the level that was created
        /// </returns>
        public static Level CreateLevel(Vector3S size, LevelTypes type, string name = "main")
        {
            Level newlevel = new Level(size)
            {
                Name = name
            };

            switch (type)
            {
            case LevelTypes.Flat:

                var gen = new Generator.LevelGenerator(newlevel);
                for (int i = newlevel.CWMap.Size.z / 2; i >= 0; i--)
                {
                    newlevel.FillPlaneXZ(i, Block.BlockList.DIRT);
                }
                newlevel.FillPlaneXZ(newlevel.CWMap.Size.z / 2, Block.BlockList.GRASS);
                break;

            case LevelTypes.Pixel:
                newlevel.CreatePixelArtLevel();
                break;

            case LevelTypes.Hell:
                var mGen = new Generator.LevelGenerator(newlevel, Generator.GeneratorTemplate.Hell(newlevel));
                mGen.Generate();
                break;
            }
            OnAllLevelsLoad.Call(newlevel, new LevelLoadEventArgs(true));
            return(newlevel);
        }
Ejemplo n.º 2
0
 public Level(LevelTypes levelType, int levelPicId, SortedDictionary <string, string> levelNames, int difficultyLevel)
 {
     LevelType       = levelType;
     LevelPicID      = levelPicId;
     LevelNames      = levelNames;
     DifficultyLevel = difficultyLevel;
 }
Ejemplo n.º 3
0
    //public method, called by gridcontrol
    public void LoadObstaclesIfExist(LevelTypes levelType)
    {
        // State saving stuff here
        StateSavingControl.ResetObstacleList();
        CurrentLevelType = levelType;

        string tooltip;

        if (levelType == LevelTypes.Rocks | levelType == LevelTypes.FewRocks) {
            tooltip = "A sturdy rock. Won't break, even if you punch it.";

            int numberOfRocks = Random.Range(0, 30);
            if (levelType == LevelTypes.FewRocks && numberOfRocks > 9)
            {
                numberOfRocks = 9;
            }
            else if(numberOfRocks > 20)
            {
                numberOfRocks = 20;
            }
            GridControl.PossibleSpawnPoints = S.GridControlInst.EmptyPathSpots();
            for (int i = 0; i < numberOfRocks; i++)
            {
                LoadObstacle("Rock", tooltip);
            }
        }
        else if (levelType == LevelTypes.ScorpionRiver) LoadObstacleSet("Scorpion river");
        else if (levelType == LevelTypes.BloodRiver) LoadObstacleSet("Blood river");
        else if (levelType == LevelTypes.PusRiver) LoadObstacleSet("Pus river");
        // else return; (don't load anything if the type is something not covered here)
    }
Ejemplo n.º 4
0
    public void StartLevel(LevelTypes levelType, Sprite levelSprite)
    {
        _lvltype = levelType;
        GameController.Instance.PanelController.OpenPanel(PanelName.LevelLobbyPanel);

        StartCoroutine(StartCountdown(Countdown));
    }
Ejemplo n.º 5
0
    public static void AddAllLevels()
    {
        Reset();
        foreach (KeyValuePair <LevelTypes, SortedDictionary <string, Level> > kv in LevelDict)
        {
            LevelTypes levelType = kv.Key;
            foreach (string path in Directory.GetFiles(LevelDirectoryDict[levelType], "*.xml"))
            {
                string text;
                using (StreamReader sr = new StreamReader(path))
                {
                    text = sr.ReadToEnd();
                }

                XmlDocument doc = new XmlDocument();
                doc.LoadXml(text);
                XmlElement allLevels = doc.DocumentElement;
                for (int i = 0; i < allLevels.ChildNodes.Count; i++)
                {
                    XmlNode levelInfo = allLevels.ChildNodes.Item(i);
                    Level   level     = GetLevelFromXML(levelInfo, out bool needRefresh);
                    NeedReload |= needRefresh;
                    kv.Value.Add(level.LevelNames["en"], level);
                }
            }
        }

        //If any problem, refresh XML and reload
        if (NeedReload)
        {
            NeedReload = false;
            RefreshAllLevelXML();
            ReloadLevelXML();
        }
    }
Ejemplo n.º 6
0
        public void Default()
        {
            levelLookup.Clear();
            _typeTable.Clear();
            Levels.Clear();
            LevelTypes.Clear();
            LevelTypes.Add(new LevelType("World Map", 0));
            LevelTypes.Add(new LevelType("Grassy/Water", 1));
            LevelTypes.Add(new LevelType("Dungeon", 2));
            LevelTypes.Add(new LevelType("Crystal", 3));
            LevelTypes.Add(new LevelType("Sky Castle", 4));
            LevelTypes.Add(new LevelType("Inner Castle", 5));
            LevelTypes.Add(new LevelType("Island/Sea", 6));
            LevelTypes.Add(new LevelType("Haunted Desert", 7));
            LevelTypes.Add(new LevelType("Subcon", 8));
            LevelTypes.Add(new LevelType("Desert", 9));
            LevelTypes.Add(new LevelType("Pirate Ship", 10));
            LevelTypes.Add(new LevelType("Basic Structure", 11));
            LevelTypes.Add(new LevelType("Snow/Forest", 12));
            LevelTypes.Add(new LevelType("Item Shops", 13));
            LevelTypes.Add(new LevelType("Underground", 14));

            foreach (var l in LevelTypes)
            {
                if (l.InGameID != 0)
                {
                    _typeTable.Add(l.InGameID, l);
                }
            }
        }
Ejemplo n.º 7
0
        // See the attribute guidelines at
        //  http://go.microsoft.com/fwlink/?LinkId=85236
        // This is a positional argument
        public KataTypeAttribute(LevelTypes levelType, int levelValue, string kataId = "")
        {
            LevelType  = levelType;
            LevelValue = levelValue;
            var link = "https://www.codewars.com/kata/" + kataId + "/train/csharp";

            KataLink = new Uri(link);
        }
Ejemplo n.º 8
0
    void Awake()
    {
        UIType.InitUIType(
            isClearStack: false,
            isESCClose: false,
            isClickElsewhereClose: false,
            uiForms_Type: UIFormTypes.Normal,
            uiForms_ShowMode: UIFormShowModes.Normal,
            uiForm_LucencyType: UIFormLucencyTypes.ImPenetrable);

        SaveStoryButton.onClick.AddListener(SaveStory);
        ResetStoryButton.onClick.AddListener(ResetStory);

        LanguageManager.Instance.RegisterTextKeys(
            new List <(Text, string)>
        {
            (StoryEditorWindowText, "StoryEditorPanel_StoryEditorWindowText"),
            (LanguageLabelText, "SettingMenu_Languages"),
            (SaveChapterButtonText, "StoryEditorPanel_SaveChapterButtonText"),
            (SaveStoryButtonText, "StoryEditorPanel_SaveStoryButtonText"),
            (ResetStoryButtonText, "StoryEditorPanel_ResetStoryButtonText"),
            (ReturnToGameButtonText, "StoryEditorPanel_ReturnToGameButtonText"),
            (CardEditorButtonText, "StoryEditorPanel_CardEditorButtonText"),
            (NextChapterButtonText, "StoryEditorPanel_NextChapterButtonText"),
            (PreviousChapterButtonText, "StoryEditorPanel_PreviousChapterButtonText"),
        });

        LanguageDropdown.ClearOptions();
        LanguageDropdown.AddOptions(LanguageManager.Instance.LanguageDescs);

        ReturnToGameButton.onClick.AddListener(ReturnToGame);
        CardEditorButton.onClick.AddListener(GoToCardEditorPanel);
        SaveChapterButton.onClick.AddListener(SaveChapter);
        NextChapterButton.onClick.AddListener(SwitchToNextChapter);
        PreviousChapterButton.onClick.AddListener(SwitchToPreviousChapter);

        InitializeCardPropertyForm();

        foreach (string s in Enum.GetNames(typeof(LevelTypes)))
        {
            LevelTypes lt = (LevelTypes)Enum.Parse(typeof(LevelTypes), s);
            LevelContainerDict.Add(lt, LevelListTabControl.AddTab(
                                       tabTitleStrKey: "StoryEditorPanel_" + lt + "TabButtonTitle",
                                       onAddButtonClick: delegate
            {
                Level newLevel = Level.BaseGenerateEmptyLevel(lt);
                InitializeLevelList();
                SelectTab(lt);
                UIManager.Instance.CloseUIForm <StoryEditorPanel>();
                UIManager.Instance.ShowUIForms <LevelEditorPanel>().SetLevel(newLevel.Clone());
            }));
            MyLevelButtons.Add(lt, new List <StoryEditorPanel_LevelButton>());
        }

        InitializeLevelList();
    }
Ejemplo n.º 9
0
 public static DifficultyController Create(LevelTypes levelType)
 {
     switch (levelType) {
     case LevelTypes.Speed:
         return new SpeedController ();
     case LevelTypes.HandType:
         return new HandTypeController ();
     default:
         return new SpeedController ();
     }
 }
Ejemplo n.º 10
0
        public LevelableModule(Serial serial)
            : base(serial)
        {
            m_RLevel = m_Cap - m_Level;

            Level        = 1;
            ReverseLevel = false;
            StartingCap  = 99;//doing this will it force Cap to be 99 aswell?
            EndingCap    = 100;
            m_Exp        = m_TotalExp = 0;
            LevelsAtBase = 83;
            LevelType    = LevelTypes.None;
        }
Ejemplo n.º 11
0
        public static Level CreateFlatLevel(Point3 size, LevelTypes type)
        {
            Level newLevel = new Level(size);

            switch(type)
            {
                case LevelTypes.Flat:
                    newLevel.CreateFlatLevel();
                    break;

            }

            return newLevel;
        }
Ejemplo n.º 12
0
    public static Level GetLevel(LevelTypes levelType, string levelName, CloneVariantUtils.OperationType operationType)
    {
        if (LevelDict[levelType].ContainsKey(levelName))
        {
            if (operationType == CloneVariantUtils.OperationType.Clone)
            {
                return(LevelDict[levelType][levelName].Clone());
            }
            else
            {
                return(LevelDict[levelType][levelName].Variant());
            }
        }

        return(null);
    }
Ejemplo n.º 13
0
    public void LoadObstaclesFromState(LevelTypes levelType, int[][] positions = null)
    {
        if (positions == null) {
            LoadObstacleSet(levelType.ToString());
        } else {
            string obstacleName = "";
            string tooltip = "";
            if (levelType == LevelTypes.Rocks || levelType == LevelTypes.FewRocks) {
                obstacleName = "Rock";
                tooltip = "A sturdy rock. Won't break, even if you punch it.";
            }

            foreach (int[] position in positions) {
                LoadObstacleBase(obstacleName, position[0], position[1], tooltip);
            }
        }

        CurrentLevelType = levelType;
    }
Ejemplo n.º 14
0
    //public method, called by gridcontrol
    public void LoadObstaclesIfExist(LevelTypes levelType)
    {
        // State saving stuff here
        StateSavingControl.ResetObstacleList();
        CurrentLevelType = levelType;

        string tooltip;

        if (levelType == LevelTypes.Rocks | levelType == LevelTypes.FewRocks)
        {
            tooltip = "A sturdy rock. Won't break, even if you punch it.";

            int numberOfRocks = Random.Range(0, 30);
            if (levelType == LevelTypes.FewRocks && numberOfRocks > 9)
            {
                numberOfRocks = 9;
            }
            else if (numberOfRocks > 20)
            {
                numberOfRocks = 20;
            }
            GridControl.PossibleSpawnPoints = S.GridControlInst.EmptyPathSpots();
            for (int i = 0; i < numberOfRocks; i++)
            {
                LoadObstacle("Rock", tooltip);
            }
        }
        else if (levelType == LevelTypes.ScorpionRiver)
        {
            LoadObstacleSet("Scorpion river");
        }
        else if (levelType == LevelTypes.BloodRiver)
        {
            LoadObstacleSet("Blood river");
        }
        else if (levelType == LevelTypes.PusRiver)
        {
            LoadObstacleSet("Pus river");
        }
        // else return; (don't load anything if the type is something not covered here)
    }
Ejemplo n.º 15
0
    public static Level BaseGenerateEmptyLevel(LevelTypes levelType)
    {
        Level newLevel       = null;
        int   levelIDPostFix = GenerateNewLevelID();

        while (AllLevels.LevelDict[levelType].ContainsKey("New" + levelType + "_" + levelIDPostFix))
        {
            levelIDPostFix = GenerateNewLevelID();
        }

        newLevel = AllLevels.LevelDict[levelType]["New" + levelType]?.Clone();

        if (newLevel != null)
        {
            newLevel.LevelNames["zh"] = "新关卡_" + levelIDPostFix;
            newLevel.LevelNames["en"] = "New" + levelType + "_" + levelIDPostFix;
            AllLevels.RefreshLevelXML(newLevel);
            AllLevels.ReloadLevelXML();
        }

        return(newLevel);
    }
Ejemplo n.º 16
0
    public void LoadObstaclesFromState(LevelTypes levelType, int[][] positions = null)
    {
        if (positions == null)
        {
            LoadObstacleSet(levelType.ToString());
        }
        else
        {
            string obstacleName = "";
            string tooltip      = "";
            if (levelType == LevelTypes.Rocks || levelType == LevelTypes.FewRocks)
            {
                obstacleName = "Rock";
                tooltip      = "A sturdy rock. Won't break, even if you punch it.";
            }

            foreach (int[] position in positions)
            {
                LoadObstacleBase(obstacleName, position[0], position[1], tooltip);
            }
        }

        CurrentLevelType = levelType;
    }
Ejemplo n.º 17
0
 private void SelectTab(LevelTypes levelType)
 {
     LevelListTabControl.SelectTab("StoryEditorPanel_" + levelType + "TabButtonTitle");
 }
Ejemplo n.º 18
0
 public Processor(int id, LevelTypes levelType)
 {
     this.Id        = id;
     this.levelType = levelType;
 }
Ejemplo n.º 19
0
 public static string GetLevelTypeDesc(LevelTypes levelType)
 {
     return(LanguageManager_Common.GetText("LevelType_" + levelType));
 }
Ejemplo n.º 20
0
        public void TestJsonMappingForLevelWithTolerantStringConversion(string json, LevelTypes ptf)
        {
            var obj = JsonConvert.DeserializeObject <ChatbotRequestModel>(json);

            obj.Level.Should().Be(ptf);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Create a level with a specified type and a specified size
        /// </summary>
        /// <param name="size">The size to create the level.</param>
        /// <param name="type">The type of the level you want to create</param>
        /// <param name="name">Name of the level to create</param>
        /// <returns>
        /// returns the level that was created
        /// </returns>
        public static Level CreateLevel(Vector3S size, LevelTypes type, string name = "main")
        {
            Level newlevel = new Level(size) {
                Name = name
            };
            switch (type) {
                case LevelTypes.Flat:
                    var gen = new Generator.LevelGenerator(newlevel);
                    for (int i = newlevel.Size.y / 2 - 1; i > 0; i--)
                        gen.FillPlaneXZ(i, Block.BlockList.DIRT);
                    gen.FillPlaneXZ(newlevel.Size.y / 2, Block.BlockList.GRASS);
                    gen.FillY(0, 0, Block.BlockList.RED_CLOTH);
                    gen.SetPosition();
                    break;
                case LevelTypes.Pixel:
                    newlevel.CreatePixelArtLevel();
                    break;
                case LevelTypes.Hell:
                    Generator.LevelGenerator mGen = new Generator.LevelGenerator(newlevel, Generator.GeneratorTemplate.Hell);
                    mGen.Generate();
                    mGen.SetPosition();
                    break;
            }

            return newlevel;
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Create a level with a specified type and a specified size
        /// </summary>
        /// <param name="size">The size to create the level.</param>
        /// <param name="type">The type of the level you want to create</param>
        /// <param name="name">Name of the level to create</param>
        /// <returns>returns the level that was created</returns>
        public static Level CreateLevel(Vector3 size, LevelTypes type, string name = "main")
        {
            Level newlevel = new Level(size) {
                Name = name
            };
            switch (type) {
                case LevelTypes.Flat:
                    var gen = new Generator.LevelGenerator(newlevel);
                    for (int i = newlevel.Size.y / 2 - 1; i > 0; i--)
                        gen.FillPlaneXZ(i, Block.BlockList.DIRT);
                    gen.FillPlaneXZ(newlevel.Size.y / 2, Block.BlockList.PURPLE_CLOTH);
                    gen.FillY(0, 0, Block.BlockList.RED_CLOTH);
                    gen.SetPosition();
                    break;
                case LevelTypes.Pixel:
                    newlevel.CreatePixelArtLevel();
                    break;
                case LevelTypes.Hell:
                    Generator.LevelGenerator mGen = new Generator.LevelGenerator(newlevel, new Generator.GeneratorArgs() {
                        MaxLevelGenerationHeight = size.y / 2,
                        MinLevelGenerationHeight = 0,
                        TopLayer = Block.BlockList.STONE,
                        BottomLayer = Block.BlockList.COBBLESTONE,
                        OverlayLayer = Block.BlockList.LAVA,
                        Seed = new Random().Next(),
                    });
                    mGen.Init();
                    mGen.Generate();
                    mGen.SetPosition();
                    break;
            }

            return newlevel;
        }
 public static Brush GetLevelColor(this LevelTypes level, Dictionary <LevelTypes, SolidColorBrush> levelColors)
 {
     return(levelColors[level]);
 }
Ejemplo n.º 24
0
 public Level(LevelTypes levelType) : base(150, 75)
 {
     this.levelType = levelType;
     entities       = new GoRogue.MultiSpatialMap <Construct>();
     CreateLevel();
 }
Ejemplo n.º 25
0
        /// <summary>
        /// Create a level with a specified type and a specified size. <remarks>Calls OnLevelsLoad event.</remarks>
        /// </summary>
        /// <param name="size">The size to create the level.</param>
        /// <param name="type">The type of the level you want to create</param>
        /// <param name="name">Name of the level to create</param>
        /// <returns>
        /// returns the level that was created
        /// </returns>
        public static Level CreateLevel(Vector3S size, LevelTypes type, string name = "main")
        {
            Level newlevel = new Level(size)
            {
                Name = name
            };
            switch (type)
            {
                case LevelTypes.Flat:

                    var gen = new Generator.LevelGenerator(newlevel);
                    for (int i = newlevel.CWMap.Size.z / 2; i >= 0; i--)
                        newlevel.FillPlaneXZ(i, Block.BlockList.DIRT);
                    newlevel.FillPlaneXZ(newlevel.CWMap.Size.z / 2, Block.BlockList.GRASS);
                    break;
                case LevelTypes.Pixel:
                    newlevel.CreatePixelArtLevel();
                    break;
                case LevelTypes.Hell:
                    var mGen = new Generator.LevelGenerator(newlevel, Generator.GeneratorTemplate.Hell(newlevel));
                    mGen.Generate();
                    break;
            }
            OnAllLevelsLoad.Call(newlevel, new LevelLoadEventArgs(true));
            return newlevel;
        }
Ejemplo n.º 26
0
 public Command(LevelTypes levelType)
 {
     this.LevelType = levelType;
 }
Ejemplo n.º 27
0
    /// <summary>
    /// Can only be executed in StoryEditor/CardEditor/LevelEditor
    /// </summary>
    public static void DeleteLevel(LevelTypes levelType, string levelName_en)
    {
        string text;

        using (StreamReader sr = new StreamReader(LevelDefaultXMLDict[levelType]))
        {
            text = sr.ReadToEnd();
        }

        XmlDocument doc = new XmlDocument();

        doc.LoadXml(text);
        XmlElement allLevel = doc.DocumentElement;
        SortedDictionary <string, XmlElement> levelNodesDict = new SortedDictionary <string, XmlElement>();

        foreach (XmlElement node in allLevel.ChildNodes)
        {
            string name = node.Attributes["name_en"].Value;
            if (name != levelName_en)
            {
                levelNodesDict.Add(name, node);
            }
        }

        allLevel.RemoveAll();
        foreach (KeyValuePair <string, XmlElement> kv in levelNodesDict)
        {
            allLevel.AppendChild(kv.Value);
        }

        using (StreamWriter sw = new StreamWriter(LevelDefaultXMLDict[levelType]))
        {
            doc.Save(sw);
        }

        ReloadLevelXML();

        // 从Story中移除该Level
        SortedDictionary <string, SortedDictionary <int, List <int> > > removeList = new SortedDictionary <string, SortedDictionary <int, List <int> > >();

        foreach (KeyValuePair <string, Story> kv in AllStories.StoryDict)
        {
            removeList.Add(kv.Key, new SortedDictionary <int, List <int> >());
            foreach (KeyValuePair <int, Chapter> _kv in kv.Value.Chapters)
            {
                removeList[kv.Key].Add(_kv.Key, new List <int>());
                foreach (KeyValuePair <int, Level> KV in _kv.Value.Levels)
                {
                    if (KV.Value.LevelNames["en"].Equals(levelName_en))
                    {
                        removeList[kv.Key][_kv.Key].Add(KV.Key);
                    }
                }
            }
        }

        foreach (KeyValuePair <string, SortedDictionary <int, List <int> > > kv in removeList)
        {
            Story story = AllStories.StoryDict[kv.Key];
            foreach (KeyValuePair <int, List <int> > _kv in kv.Value)
            {
                Chapter chapter = story.Chapters[_kv.Key];
                foreach (int i in _kv.Value)
                {
                    chapter.Levels.Remove(i);
                }
            }

            AllStories.RefreshStoryXML(story);
            AllStories.ReloadStoryXML();
        }
    }
Ejemplo n.º 28
0
        /// <summary>
        /// Create a level with a specified type and a specified size
        /// </summary>
        /// <param name="size">The size to create the level.</param>
        /// <param name="type">The type of the level you want to create</param>
        /// <returns>returns the level that was created</returns>
        public static Level CreateLevel(Point3 size, LevelTypes type, String name = "main")
        {
            Level newlevel = new Level(size);
            newlevel.name = name;

            newlevel.name = name;
            switch(type)
            {
                case LevelTypes.Flat:
                    newlevel.CreateFlatLevel();
                    break;
            }

            return newlevel;
        }
Ejemplo n.º 29
0
    /// <summary>
    /// Can only be executed in StoryEditor/CardEditor/LevelEditor
    /// </summary>
    public static void RenameLevel(LevelTypes levelType, string levelName_en_ori, Level newLevel)
    {
        string text;

        using (StreamReader sr = new StreamReader(LevelDefaultXMLDict[levelType]))
        {
            text = sr.ReadToEnd();
        }

        XmlDocument doc = new XmlDocument();

        doc.LoadXml(text);
        XmlElement allLevel = doc.DocumentElement;

        SortedDictionary <string, XmlElement> levelNodesDict = new SortedDictionary <string, XmlElement>();

        foreach (XmlElement node in allLevel.ChildNodes)
        {
            string name = node.Attributes["name_en"].Value;
            if (name != levelName_en_ori && name != newLevel.LevelNames["en"])
            {
                levelNodesDict.Add(name, node);
            }
        }

        allLevel.RemoveAll();
        newLevel.ExportToXML(allLevel);

        foreach (KeyValuePair <string, XmlElement> kv in levelNodesDict)
        {
            allLevel.AppendChild(kv.Value);
        }

        using (StreamWriter sw = new StreamWriter(LevelDefaultXMLDict[levelType]))
        {
            doc.Save(sw);
        }

        ReloadLevelXML();

        // 从Story中移除该Level
        HashSet <string> changeList = new HashSet <string>();

        foreach (KeyValuePair <string, Story> kv in AllStories.StoryDict)
        {
            foreach (KeyValuePair <int, Chapter> _kv in kv.Value.Chapters)
            {
                foreach (KeyValuePair <int, Level> KV in _kv.Value.Levels)
                {
                    if (KV.Value.LevelNames["en"].Equals(levelName_en_ori))
                    {
                        changeList.Add(kv.Key);
                        KV.Value.LevelNames["en"] = newLevel.LevelNames["en"];
                    }
                }
            }
        }

        foreach (string storyName in changeList)
        {
            Story story = AllStories.StoryDict[storyName];
            AllStories.RefreshStoryXML(story);
            AllStories.ReloadStoryXML();
        }
    }
Ejemplo n.º 30
0
        public static IEnumerable <Session> FindSessions(string[] speakerNames = null, string[] topics = null, string companyName = null, LevelTypes level = LevelTypes.Any)
        {
            var localSpeakerNames = speakerNames;

            if (!String.IsNullOrWhiteSpace(companyName))
            {
                localSpeakerNames = Speakers.Where(k => k.Company.ContainsIgnoreCase(companyName)).Select(k => k.Name).ToArray();
            }
            var topicsRegex = topics?.GetWholeWordsRegex();

            return(CodeCamp.Sessions
                   .Where(s =>
                          localSpeakerNames == null ||
                          localSpeakerNames.Length == 0 ||
                          s.Speakers.ContainIgnoreCase(localSpeakerNames))

                   .Where(s =>
                          topics == null ||
                          (topics.ContainIgnoreCase("misc") && s.AllTracks == true) ||
                          s.Title.RegexMatch(topicsRegex) ||
                          s.Description.RegexMatch(topicsRegex))

                   .Where(s =>
                          level == LevelTypes.None ||
                          level == LevelTypes.Any ||
                          s.Level.ContainsIgnoreCase(level.ToString()))

                   .OrderBy(s => s.StartTime)
                   .Take(10));
        }
Ejemplo n.º 31
0
    public static Level GetLevelFromXML(XmlNode node_levelInfo, out bool needRefresh)
    {
        needRefresh = false;
        string Name_zh = node_levelInfo.Attributes["name_zh"].Value;
        string Name_en = node_levelInfo.Attributes["name_en"].Value;
        SortedDictionary <string, string> names = new SortedDictionary <string, string> {
            { "zh", Name_zh }, { "en", Name_en }
        };
        int        picID           = int.Parse(node_levelInfo.Attributes["picID"].Value);
        LevelTypes levelType       = (LevelTypes)Enum.Parse(typeof(LevelTypes), node_levelInfo.Attributes["levelType"].Value);
        int        difficultyLevel = int.Parse(node_levelInfo.Attributes["difficultyLevel"].Value);

        switch (levelType)
        {
        case LevelTypes.Enemy:
        {
            XmlNode   node_EnemyInfo = node_levelInfo.FirstChild;
            EnemyType enemyType      = (EnemyType)Enum.Parse(typeof(EnemyType), node_EnemyInfo.Attributes["enemyType"].Value);

            BuildInfo bi = BuildInfo.GetBuildInfoFromXML(node_EnemyInfo.FirstChild, out bool _needRefresh_build, BuildCards.DefaultCardLimitNumTypes.BasedOnCardBaseInfoLimitNum);
            needRefresh |= _needRefresh_build;

            XmlNode           node_BonusGroupInfos = node_EnemyInfo.ChildNodes.Item(1);
            List <BonusGroup> BonusGroups          = new List <BonusGroup>();
            for (int i = 0; i < node_BonusGroupInfos.ChildNodes.Count; i++)
            {
                XmlNode    bonusGroupInfo = node_BonusGroupInfos.ChildNodes.Item(i);
                BonusGroup bg             = BonusGroup.GenerateBonusGroupFromXML(bonusGroupInfo, out bool _needRefresh_bonus);
                needRefresh |= _needRefresh_bonus;
                BonusGroups.Add(bg);
            }

            XmlNode      node_CardPriorityInfos = node_EnemyInfo.ChildNodes.Item(2);
            CardPriority CardPriority           = CardPriority.GenerateCardPriorityFromXML(node_CardPriorityInfos, out bool _needRefresh_priority);

            XmlNode          node_ComboListInfos = node_EnemyInfo.ChildNodes.Item(3);
            List <CardCombo> ComboList           = new List <CardCombo>();
            for (int i = 0; i < node_ComboListInfos.ChildNodes.Count; i++)
            {
                XmlNode   comboInfo = node_ComboListInfos.ChildNodes.Item(i);
                CardCombo cc        = CardCombo.GenerateCardComboFromXML(comboInfo, out bool _needRefresh_combo);
                needRefresh |= _needRefresh_combo;
                ComboList.Add(cc);
            }

            Enemy enemy = new Enemy(picID, names, difficultyLevel, bi, enemyType, BonusGroups, ComboList, CardPriority);
            return(enemy);
        }

        case LevelTypes.Shop:
        {
            XmlNode         node_ShopInfo = node_levelInfo.FirstChild;
            List <ShopItem> shopItems     = new List <ShopItem>();
            for (int i = 0; i < node_ShopInfo.ChildNodes.Count; i++)
            {
                XmlNode  node_ShopItem = node_ShopInfo.ChildNodes.Item(i);
                ShopItem si            = ShopItem.GenerateShopItemFromXML(node_ShopItem, out bool _needRefresh_shop);
                needRefresh |= _needRefresh_shop;
                if (si != null)
                {
                    shopItems.Add(si);
                }
            }

            int shopItemCardCount   = int.Parse(node_ShopInfo.Attributes["shopItemCardCount"].Value);
            int shopItemOthersCount = int.Parse(node_ShopInfo.Attributes["shopItemOthersCount"].Value);

            Shop shop = new Shop(picID, names, difficultyLevel, shopItems, shopItemCardCount, shopItemOthersCount);
            return(shop);
        }
        }

        return(null);
    }
Ejemplo n.º 32
0
    public static Level BaseDeserialize(DataStream reader)
    {
        LevelTypes levelType      = (LevelTypes)reader.ReadSInt32();
        int        levelID        = reader.ReadSInt32();
        int        levelPicID     = reader.ReadSInt32();
        int        levelNameCount = reader.ReadSInt32();
        SortedDictionary <string, string> LevelNames = new SortedDictionary <string, string>();

        for (int i = 0; i < levelNameCount; i++)
        {
            string ls    = reader.ReadString8();
            string value = reader.ReadString8();
            LevelNames[ls] = value;
        }

        int difficultyLevel = reader.ReadSInt32();

        Level res = null;

        switch (levelType)
        {
        case LevelTypes.Enemy:
        {
            BuildInfo         BuildInfo   = BuildInfo.Deserialize(reader);
            EnemyType         EnemyType   = (EnemyType)(reader.ReadSInt32());
            int               bonusCount  = reader.ReadSInt32();
            List <BonusGroup> BonusGroups = new List <BonusGroup>();
            for (int i = 0; i < bonusCount; i++)
            {
                BonusGroups.Add(BonusGroup.Deserialize(reader));
            }

            CardPriority cp = CardPriority.Deserialize(reader);

            int cardComboCount             = reader.ReadSInt32();
            List <CardCombo> cardComboList = new List <CardCombo>();
            for (int i = 0; i < cardComboCount; i++)
            {
                cardComboList.Add(CardCombo.Deserialize(reader));
            }

            res = new Enemy(levelPicID, LevelNames, difficultyLevel, BuildInfo, EnemyType, BonusGroups, cardComboList, cp);
            break;
        }

        case LevelTypes.Shop:
        {
            int             count     = reader.ReadSInt32();
            List <ShopItem> shopItems = new List <ShopItem>();
            for (int i = 0; i < count; i++)
            {
                ShopItem si = ShopItem.Deserialize(reader);
                shopItems.Add(si);
            }

            int shopItemCardCount   = reader.ReadSInt32();
            int shopItemOthersCount = reader.ReadSInt32();

            res = new Shop(levelPicID, LevelNames, difficultyLevel, shopItems, shopItemCardCount, shopItemOthersCount);
            break;
        }
        }

        res.LevelID = levelID;
        return(res);
    }
Ejemplo n.º 33
0
    private void OnLevelTypeChange(string value_str)
    {
        LevelTypes type = (LevelTypes)Enum.Parse(typeof(LevelTypes), value_str);

        foreach (PropertyFormRow lpfr in LevelPropertiesCommon)
        {
            lpfr.gameObject.SetActive(true);
        }

        List <PropertyFormRow> targets = LevelTypePropertiesDict[type];

        foreach (PropertyFormRow lpfr in MyPropertiesRows)
        {
            if (!LevelPropertiesCommon.Contains(lpfr))
            {
                lpfr.gameObject.SetActive(targets.Contains(lpfr));
            }
        }

        if (OnChangeLevelTypeByEdit)
        {
            OnChangeLevelTypeByEdit = false;
            LevelEditorPanel_CardComboList.gameObject.SetActive(type == LevelTypes.Enemy);

            switch (type)
            {
            case LevelTypes.Enemy:
            {
                Cur_Level = new Enemy(
                    levelPicID: 0,
                    levelNames: new SortedDictionary <string, string> {
                        { "zh", "新敌人" }, { "en", "newEnemy" }
                    },
                    difficultyLevel: 1,
                    buildInfo: new BuildInfo(
                        buildID: -1,
                        buildName: "TempDeck",
                        buildCards: new BuildCards(BuildCards.DefaultCardLimitNumTypes.BasedOnCardBaseInfoLimitNum),
                        drawCardNum: 1,
                        life: 20,
                        energy: 10,
                        beginMetal: 1,
                        gamePlaySettings: null),
                    enemyType: EnemyType.Soldier,
                    bonusGroups: new List <BonusGroup>(),
                    cardComboList: new List <CardCombo>(),
                    cardPriority: new CardPriority(new List <int>())
                    );
                LevelEditorPanel_CardPriority.Initialize(((Enemy)Cur_Level).CardPriority);
                LevelEditorPanel_CardComboList.Initialize(((Enemy)Cur_Level).CardComboList, Initialize_Right);
                break;
            }

            case LevelTypes.Shop:
            {
                Cur_Level = new Shop(
                    levelPicId: 0,
                    levelNames: new SortedDictionary <string, string> {
                        { "zh", "新商店" }, { "en", "newShop" }
                    },
                    difficultyLevel: 1,
                    shopItems: new List <ShopItem>(),
                    5,
                    0);

                break;
            }
            }

            SetLevel(Cur_Level);
            OnChangeLevelTypeByEdit = true;
        }
    }
Ejemplo n.º 34
0
    public void Initialize(int nodeIndex, UnityAction <int> onSelected, UnityAction <ChapterMapNode> onHovered, LevelTypes levelType = LevelTypes.Enemy, EnemyType enemyType = EnemyType.Soldier)
    {
        IsSelected = false;
        IsHovered  = false;

        OnHovered = onHovered;
        NodeIndex = nodeIndex;

        Button.onClick.RemoveAllListeners();
        Button.onClick.AddListener(delegate { onSelected(NodeIndex); });

        int picID = 0;

        transform.localScale = Vector3.one * 1f;
        switch (levelType)
        {
        case LevelTypes.Enemy:
        {
            switch (enemyType)
            {
            case EnemyType.Soldier:
            {
                picID = (int)AllCards.SpecialPicIDs.LockedEmeny;
                break;
            }

            case EnemyType.Boss:
            {
                Button.transform.localScale = Vector3.one * 1.5f;
                picID = (int)AllCards.SpecialPicIDs.LockedBoss;
                break;
            }
            }

            break;
        }

        case LevelTypes.Rest:
        {
            picID = (int)AllCards.SpecialPicIDs.Rest;
            break;
        }

        case LevelTypes.Shop:
        {
            picID = (int)AllCards.SpecialPicIDs.Shop;
            break;
        }

        case LevelTypes.Start:
        {
            picID = (int)AllCards.SpecialPicIDs.Empty;
            break;
        }

        case LevelTypes.Treasure:
        {
            Button.transform.localScale = Vector3.one * 1.2f;
            picID = (int)AllCards.SpecialPicIDs.Treasure;
            break;
        }
        }

        ClientUtils.ChangeImagePicture(PicImage, picID);
    }