コード例 #1
0
 public void Click()
 {
     if (usable == true)
     {
         GetComponent <AudioSource>().Play();
         Controller.Score = 0;
         foreach (GameObject AllBoats in GameObject.FindGameObjectsWithTag("boat"))
         {
             GameObject.Destroy(AllBoats);
         }
         foreach (GameObject AllGrids in GameObject.FindGameObjectsWithTag("point"))
         {
             AllGrids.GetComponent <Pointbehavoir>().Image.enabled = false;
             AllGrids.GetComponent <Pointbehavoir>().CanInteract   = false;
         }
         Controller.StartLevel(levelName);
         foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("level"))
         {
             AllLevels.GetComponent <Image>().sprite = unUsingSprite;
             StartCoroutine(AllLevels.GetComponent <Menu>().Working());
         }
         foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("niveau"))
         {
             StartCoroutine(AllLevels.GetComponent <Menu>().Working());
         }
         GetComponent <Image>().sprite = UsingSprite;
         Controller.LevelName          = levelName;
     }
 }
コード例 #2
0
    /// <summary>
    /// Can only be executed in StoryEditor/CardEditor/LevelEditor
    /// </summary>
    public void DeleteBuild(BuildGroups buildGroup, string buildName)
    {
        string text;
        using (StreamReader sr = new StreamReader(BuildGroupXMLDict[buildGroup]))
        {
            text = sr.ReadToEnd();
        }

        XmlDocument doc = new XmlDocument();
        doc.LoadXml(text);
        XmlElement allBuilds = doc.DocumentElement;
        SortedDictionary<string, XmlElement> buildNodesDict = new SortedDictionary<string, XmlElement>();
        foreach (XmlElement node in allBuilds.ChildNodes)
        {
            string name = node.Attributes["BuildName"].Value;
            if (name != buildName)
            {
                buildNodesDict.Add(name, node);
            }
        }

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

        using (StreamWriter sw = new StreamWriter(BuildGroupXMLDict[buildGroup]))
        {
            doc.Save(sw);
        }

        ReloadBuildXML();

        //删除Story中同名的Level
        SortedDictionary<LevelTypes, List<string>> removeLevelPath = new SortedDictionary<LevelTypes, List<string>>();
        foreach (KeyValuePair<LevelTypes, SortedDictionary<string, Level>> kv in AllLevels.LevelDict)
        {
            removeLevelPath.Add(kv.Key, new List<string>());
            foreach (KeyValuePair<string, Level> _kv in kv.Value)
            {
                if (_kv.Value is Enemy enemy)
                {
                    if (enemy.BuildInfo.BuildName.Equals(buildName))
                    {
                        removeLevelPath[kv.Key].Add(_kv.Key);
                    }
                }
            }
        }

        foreach (KeyValuePair<LevelTypes, List<string>> kv in removeLevelPath)
        {
            SortedDictionary<string, Level> dict = AllLevels.LevelDict[kv.Key];
            foreach (string s in kv.Value)
            {
                AllLevels.DeleteLevel(dict[s].LevelType, dict[s].LevelNames["en"]);
            }
        }
    }
コード例 #3
0
ファイル: NextLevel.cs プロジェクト: huijkelom/SailAway
 void _NextLevel()
 {
     if (usable == true)
     {
         GetComponent <AudioSource>().Play();
         Controller.Score = 0;
         foreach (GameObject AllBoats in GameObject.FindGameObjectsWithTag("boat"))
         {
             GameObject.Destroy(AllBoats);
         }
         foreach (GameObject AllGrids in GameObject.FindGameObjectsWithTag("point"))
         {
             AllGrids.GetComponent <Pointbehavoir>().Image.enabled = false;
             AllGrids.GetComponent <Pointbehavoir>().CanInteract   = false;
         }
         foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("level"))
         {
             //AllLevels.GetComponent<Image>().sprite = unUsingSprite;
             StartCoroutine(AllLevels.GetComponent <Menu>().Working());
         }
         Controller.StartLevel(Controller.LevelName + 1);
         foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("niveau"))
         {
             StartCoroutine(AllLevels.GetComponent <Menu>().Working());
         }
         transform.position = new Vector2(100, 100);
         GetComponent <SpriteRenderer>().sprite = NotPushed;
         Controller.LevelName = Controller.LevelName + 1;
         GetComponent <BoxCollider2D>().enabled = true;
         Debug.Log(Controller.LevelName);
     }
 }
コード例 #4
0
 public void Niveau()
 {
     if (usable == true)
     {
         GetComponent <AudioSource>().Play();
         foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("level"))
         {
             AllLevels.GetComponent <Menu>().levelName = AllLevels.GetComponent <Menu>().level + levelName;
             int LevelAmount = AllLevels.GetComponent <Menu>().levelName = AllLevels.GetComponent <Menu>().level + levelName + 1;
             AllLevels.GetComponentInChildren <Text>().text = "Level " + LevelAmount;
             AllLevels.GetComponent <Image>().sprite        = unUsingSprite;
             if (AllLevels.GetComponent <Menu>().levelName == Controller.LevelName)
             {
                 AllLevels.GetComponent <Image>().sprite = AllLevels.GetComponent <Menu>().UsingSprite;
             }
             StartCoroutine(AllLevels.GetComponent <Menu>().Working());
         }
         foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("niveau"))
         {
             AllLevels.GetComponent <Image>().sprite = unUsingSprite;
             StartCoroutine(AllLevels.GetComponent <Menu>().Working());
         }
         GetComponent <Image>().sprite = UsingSprite;
     }
 }
コード例 #5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            this.DispatcherUnhandledException          += App_DispatcherUnhandledException;
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            AppDomain.CurrentDomain.AssemblyResolve    += CurrentDomain_AssemblyResolve;

            if (IsAlreadyRunning())
            {
                UIHelper.ShowError(Constants.APP_NAME + " is already running.");
                Application.Current.Shutdown();
                return;
            }

            //SystemHelper.SetNativeDllPath();
            //SystemHelper.SetLoadOnStartup();

            if (!AllLevels.LoadLevels())
            {
                UIHelper.ShowError("ERROR while reading PlayerData XML." + Environment.NewLine + "Press OK to quit.");
                Application.Current.Shutdown();
                return;
            }

            base.OnStartup(e);
        }
コード例 #6
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(AllLevels != null ? AllLevels.GetHashCode() : 0);
     }
 }
コード例 #7
0
    void Start()
    {
        /* Game.current = new Game(); */
        /* Game.current.setupEmpty(); */
        /* SaveLoad.Save(); */

        if (!SaveLoad.Load())
        {
            Game.current = new Game();
            Game.current.setupEmpty();
            //Game.current.setupFull();
        }

        levelMap = new Dictionary <string, LevelData>();
        //string path = Path.Combine(Application.StreamingAssetsPath, gameDataFileName);
        string path = "Assets/Data/levels.json";

        /* print("checking if path exists"); */
        if (File.Exists(path))
        {
            /* print("path exists"); */
            string    dataAsJson = File.ReadAllText(path);
            AllLevels loadedData = JsonUtility.FromJson <AllLevels>(dataAsJson);
            levelNames = loadedData.levels;
        }
        else
        {
            Debug.LogError("Cannot load level data");
        }

        unlockLevels();
    }
コード例 #8
0
 public DataLevel(ExternalCommandData commandData)
 {
     doc         = commandData.Application.ActiveUIDocument.Document;
     filterUtils = new FilterUtils(commandData);
     //
     AllLevels        = filterUtils.CollectLevels();
     StructuralLevels = AllLevels.Where(x => x.Name.Contains("结构")).ToList();
 }
コード例 #9
0
 public QuoteSystem(QuotationMark firstLevel, string quotationDashMarker = null, string quotationDashEndMarker = null) : this()
 {
     AllLevels.Add(firstLevel);
     if (quotationDashMarker != null)
     {
         AllLevels.Add(new QuotationMark(quotationDashMarker, quotationDashEndMarker, null, 1, QuotationMarkingSystemType.Narrative));
     }
 }
コード例 #10
0
ファイル: LevelLoader.cs プロジェクト: collar50/Switcheroo
    // Use this for initialization
    void Start()
    {
        AllLevels allLevels =
            GameObject.Find("Persistent Data").GetComponent <AllLevels>();

        BuildingBlockManager buildingBlockManager =
            GameObject.Find("Persistent Data").GetComponent <BuildingBlockManager>();

        int currentLevelIndex = allLevels.currentLevel;


        if (currentLevelIndex < allLevels.BuiltInLevels.Count)
        {
            BuiltInLevel currentLevel = allLevels.BuiltInLevels[currentLevelIndex];

            for (int i = 0; i < currentLevel.Prefabs.Count; i++)
            {
                Vector3 piecePosition = currentLevel.PiecePositions[i];

                Quaternion pieceRotation =
                    Quaternion.Euler(
                        0f,
                        0f,
                        currentLevel.PieceRotations[i]);

                string tag = currentLevel.Prefabs[i];

                Instantiate(
                    buildingBlockManager.searchBuiltInPrefabs(tag),
                    piecePosition,
                    pieceRotation);
            }
        }
        else if (currentLevelIndex >= allLevels.BuiltInLevels.Count)
        {
            CustomLevel currentLevel = allLevels.CustomLevels[currentLevelIndex];

            for (int i = 0; i < currentLevel.Prefabs.Count; i++)
            {
                Vector3 piecePosition = currentLevel.PiecePositions[i];

                Quaternion pieceRotation =
                    Quaternion.Euler(
                        0f,
                        0f,
                        currentLevel.PieceRotations[i]);

                string tag = currentLevel.Prefabs[i];

                Instantiate(
                    buildingBlockManager.searchBuiltInPrefabs(tag),
                    piecePosition,
                    pieceRotation);
            }
        }
    }
コード例 #11
0
 private void createNewLevel(
     AllLevels pLevelManager,
     Transform pNewLevel,
     string pNewLevelName)
 {
     mLevelManager.addLevel(
         mNewBuildingBlock,
         mNewLevelName.text,
         mDescription.text);
 }
コード例 #12
0
    private void Awake()
    {
        var levGen = new LevelGenerator(m_AsteroidPrefabs.Length);

        m_AllLevels = levGen.GetLevels(m_Saver, m_LevelPresets);

        NormalizedTimer
        .Where(x => x >= 1f)
        .Subscribe(LevelComplete);
    }
コード例 #13
0
 public void AddLevel(string levelCode, string submitter, int timesToEnter)
 {
     if (AllLevels.Any(t => t.Item1 == levelCode))
     {
         return;
     }
     for (int i = 1; i <= timesToEnter; i++)
     {
         AllLevels.Add(new Tuple <string, string>(levelCode, submitter));
     }
 }
コード例 #14
0
 public static void Load(string configFolderPath)
 {
     ConfigFolderPath = configFolderPath;
     AllColors.AddAllColors();
     AllSideEffects.AddAllSideEffects();
     AllScriptExecuteSettings.AddAllScriptExecuteSettings();
     AllBuffs.AddAllBuffs();
     AllCards.AddAllCards();
     AllBuilds.AddAllBuilds();
     AllLevels.AddAllLevels();
     AllStories.AddAllStories();
     AllCards.RefreshAllCardXML();
 }
コード例 #15
0
        /// <summary>
        /// Updates also level status (finished, unlocked, etc.)
        /// </summary>
        /// <param name="puzzle"></param>
        public AfterSolvedInfo UpdateSolved(Puzzle puzzle, int moves)
        {
            var lastPuzzleState = GetSolvedState(puzzle);
            var lastLevelState  = GetLevelState(puzzle.LevelRef);
            var lastTypeStats   = GetTypeStats(puzzle.level.type);

            var newState = EstimateSolvedState(puzzle, moves);

            if (newState <= lastPuzzleState)
            {
                return(AfterSolvedInfo.NoChanges);
            }

            var newStars = GetNewStars(lastPuzzleState, newState);

            db.SetPuzzleState(puzzle, newState);

            if (puzzle.level.IsTutorial)
            {
                Settings.Instance.TutorialDone = true;
            }
            var ass        = new AfterSolvedState(AfterSolvedState.PUZZLE_SOLVED);
            var levelState = GetLevelState(puzzle.LevelRef);

            if (levelState != lastLevelState)
            {
                ass.LevelMastered = (levelState == SolvedState.Mastered);
                ass.LevelFinished = (levelState == SolvedState.Finished) || ((levelState == SolvedState.Mastered) && lastLevelState == SolvedState.Unsolved);
            }
            ass.LevelUnlocked = AnyLevelUnlocked(stars, stars + newStars);

            var typeStats = GetTypeStats(puzzle.level.type);

            if (typeStats.State != lastTypeStats.State)
            {
                ass.TypeMastered = (typeStats.State == SolvedState.Mastered);
                ass.TypeFinished = (typeStats.State == SolvedState.Finished) || ((typeStats.State == SolvedState.Mastered) && (lastTypeStats.State == SolvedState.Unsolved));
            }

            var levelStats  = db.GetLevelStats(AllLevels.Select(l => l.Ref));
            var numMastered = levelStats.Values.Where(s => s.State == SolvedState.Mastered).Count();
            var numFinished = levelStats.Values.Where(s => s.State == SolvedState.Finished).Count();

            ass.AllLevelsMastered = (numMastered == NUM_LEVELS);
            ass.AllLevelsFinished = (numFinished == NUM_LEVELS);

            return(new AfterSolvedInfo(newStars, ass));
        }
コード例 #16
0
 protected bool Equals(QuoteSystem other)
 {
     if (other == null)
     {
         return(false);
     }
     if (AllLevels == null)
     {
         return(other.AllLevels == null);
     }
     if (other.AllLevels == null)
     {
         return(false);
     }
     return(AllLevels.SequenceEqual(other.AllLevels));
 }
コード例 #17
0
        /// <summary>
        /// Randomly picks LevelLimit amount of levels from AllLevels
        /// and puts them in FinalLevels
        /// </summary>
        private void randomlyPickLevels()
        {
            int counter = LevelLimit;

            while (counter > 0 && AllLevels.Count > 0)
            {
                int rand = r.Next(0, AllLevels.Count);
                Tuple <string, string> randomlySelectedLevel = AllLevels[rand];
                _finalLevels.Add(randomlySelectedLevel);
                AllLevels.RemoveAll(t => t.Item1 == randomlySelectedLevel.Item1);
                if (_finalLevels.Count(t => t.Item2 == randomlySelectedLevel.Item2) >= BotSettings.MaxSubmissionsForSingleUser)
                {
                    AllLevels.RemoveAll(t => t.Item2 == randomlySelectedLevel.Item2);
                }
                counter--;
            }
        }
コード例 #18
0
        public void LevelCompleted(Level level, bool advanceToNextLevel)
        {
            AllLevels.SaveLevels();
            AllLevels.LoadLevels();

            if (advanceToNextLevel)
            {
                if (level.Number == Constants.MaxLevels)
                {
                    LoadMenu();
                }
                else
                {
                    Constants.CurrentLevel = level.Number + 1;
                    LevelSelected();
                }
            }
        }
コード例 #19
0
        /// <summary>
        /// A method that updates the list of userLevels, used for editing and creating new users and assigning them a user level using the API
        /// </summary>
        /// <returns>A Task of type ObservableCollection of userLevels that is from the lowest level up to but not including the level of the logged in user</returns>
        public static async Task <ObservableCollection <UserLevel> > UpdateUserLevels()
        {
            AllLevels = await APIHandler <Dictionary <int, UserLevel> > .GetOne("UserLevels");

            OwnerID = AllLevels.FirstOrDefault(l => l.Value.Name == "Owner").Value.Id;
            ObservableCollection <UserLevel> userLevels = new ObservableCollection <UserLevel>();

            foreach (UserLevel uL in Data.AllLevels.Values)
            {
                if (AuthHandler.ActiveUser.UserLevelId != uL.Id)
                {
                    userLevels.Add(uL);
                }
                else
                {
                    break;
                }
            }

            return(userLevels);
        }
コード例 #20
0
    public void method()
    {
        string Difficulty = GlobalGameSettings.GetSetting("Difficulty");

        switch (Difficulty)
        {
        case "Beginner":
            _Difficulty = 0;
            break;

        case "Intermediate":
            _Difficulty = 10;
            break;

        case "Advanced":
            _Difficulty = 20;
            break;

        case "Expert":
            _Difficulty = 30;
            break;
        }
        foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("level"))
        {
            AllLevels.GetComponent <Menu>().levelName = AllLevels.GetComponent <Menu>().level + _Difficulty;
            int LevelAmount = AllLevels.GetComponent <Menu>().levelName = AllLevels.GetComponent <Menu>().level + levelName + 1;
            AllLevels.GetComponentInChildren <Text>().text = "Level " + LevelAmount;
            AllLevels.GetComponent <Image>().sprite        = unUsingSprite;
            if (AllLevels.GetComponent <Menu>()._Difficulty == Controller.LevelName)
            {
                AllLevels.GetComponent <Image>().sprite = AllLevels.GetComponent <Menu>().UsingSprite;
            }
            StartCoroutine(AllLevels.GetComponent <Menu>().Working());
        }
        foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("niveau"))
        {
            AllLevels.GetComponent <Image>().sprite = unUsingSprite;
            StartCoroutine(AllLevels.GetComponent <Menu>().Working());
        }
    }
コード例 #21
0
    // Use this for initialization
    void OnEnable()
    {
        AllLevels = GameObject.Find("Persistent Data")
                    .GetComponent <AllLevels>();


        levelDropdown.ClearOptions();
        List <string> options = new List <string>();

        foreach (BuiltInLevel level in AllLevels.BuiltInLevels)
        {
            options.Add(level.Name);
        }
        foreach (CustomLevel level in AllLevels.CustomLevels)
        {
            options.Add(level.Name);
        }
        levelDropdown.AddOptions(options);

        levelDropdown.value = AllLevels.currentLevel;
        SelectLevel();
    }
コード例 #22
0
ファイル: Level.cs プロジェクト: Biang2016/Mech-Storm
    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);
    }
コード例 #23
0
    private void SaveLevel()
    {
        bool isExistedInLibrary = AllLevels.LevelDict[Cur_Level.LevelType].ContainsKey(Cur_Level.LevelNames["en"]);
        bool isNameChanged      = !LastLevelEnglishName.Equals(Cur_Level.LevelNames["en"]);
        bool isInvalidName      = Cur_Level.LevelNames["en"].Equals("New" + Cur_Level.LevelType);

        if (isInvalidName)
        {
            NoticeManager.Instance.ShowInfoPanelCenter(string.Format(LanguageManager.Instance.GetText("Notice_LevelEditorPanel_SaveLevelInvalidName"), Cur_Level.LevelNames["en"]), 0f, 1f);
            return;
        }

        if (isExistedInLibrary)
        {
            if (isNameChanged)
            {
                ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>();
                cp.Initialize(String.Format(LanguageManager.Instance.GetText("LevelEditorPanel_OverrideExistedLevel"), Cur_Level.LevelNames["en"]),
                              LanguageManager.Instance.GetText("Common_Yes"),
                              LanguageManager.Instance.GetText("Common_No"),
                              delegate
                {
                    cp.CloseUIForm();
                    NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f);
                    AllLevels.RenameLevel(Cur_Level.LevelType, LastLevelEnglishName, Cur_Level);
                    LastLevelEnglishName = Cur_Level.LevelNames["en"];
                    AllLevels.ReloadLevelXML();
                },
                              delegate { cp.CloseUIForm(); });
            }
            else
            {
                NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f);
                AllLevels.RefreshLevelXML(Cur_Level);
                LastLevelEnglishName = Cur_Level.LevelNames["en"];
                AllLevels.ReloadLevelXML();
            }
        }
        else
        {
            if (isNameChanged)
            {
                ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>();
                cp.Initialize(String.Format(LanguageManager.Instance.GetText("LevelEditorPanel_DeleteOriginalLevel"), LastLevelEnglishName),
                              LanguageManager.Instance.GetText("Common_Yes"),
                              LanguageManager.Instance.GetText("Common_No"),
                              delegate
                {
                    cp.CloseUIForm();
                    NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f);
                    AllLevels.RenameLevel(Cur_Level.LevelType, LastLevelEnglishName, Cur_Level);
                    LastLevelEnglishName = Cur_Level.LevelNames["en"];
                    AllLevels.ReloadLevelXML();
                },
                              delegate
                {
                    cp.CloseUIForm();
                    NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f);
                    AllLevels.RefreshLevelXML(Cur_Level);
                    LastLevelEnglishName = Cur_Level.LevelNames["en"];
                    AllLevels.ReloadLevelXML();
                });
            }
            else
            {
                NoticeManager.Instance.ShowInfoPanelCenter("Success", 0, 1f);
                AllLevels.RefreshLevelXML(Cur_Level);
                AllLevels.ReloadLevelXML();
            }
        }
    }
コード例 #24
0
ファイル: AllCards.cs プロジェクト: tuita520/Mech-Storm
    /// <summary>
    /// Can only be executed in StoryEditor/CardEditor/LevelEditor
    /// </summary>
    public static void DeleteCard(int cardID)
    {
        string text;

        using (StreamReader sr = new StreamReader(CardsXMLFile))
        {
            text = sr.ReadToEnd();
        }

        XmlDocument doc = new XmlDocument();

        doc.LoadXml(text);
        XmlElement allCards = doc.DocumentElement;
        SortedDictionary <int, XmlElement> cardNodesDict = new SortedDictionary <int, XmlElement>();

        foreach (XmlElement node in allCards.ChildNodes)
        {
            int id = int.Parse(node.Attributes["id"].Value);
            if (cardID != id)
            {
                cardNodesDict.Add(id, node);
            }
        }

        allCards.RemoveAll();
        foreach (KeyValuePair <int, XmlElement> kv in cardNodesDict)
        {
            allCards.AppendChild(kv.Value);
        }

        using (StreamWriter sw = new StreamWriter(CardsXMLFile))
        {
            doc.Save(sw);
        }

        ReloadCardXML();

        //从 Story、Builds、 Levels、和AddCard类型的SideEffect中移除该卡片ID
        //Story

        List <Story> refreshStories = new List <Story>();

        foreach (KeyValuePair <string, Story> kv in AllStories.StoryDict)
        {
            bool thisNeedsRefresh = false;
            foreach (KeyValuePair <int, BuildInfo> _kv in kv.Value.PlayerBuildInfos)
            {
                if (_kv.Value.M_BuildCards.CardSelectInfos.ContainsKey(cardID))
                {
                    _kv.Value.M_BuildCards.CardSelectInfos.Remove(cardID);
                    thisNeedsRefresh = true;
                }
            }

            if (thisNeedsRefresh)
            {
                refreshStories.Add(kv.Value);
                kv.Value.RefreshBaseCardLimitDict();
            }
        }

        foreach (Story story in refreshStories)
        {
            AllStories.RefreshStoryXML(story);
        }

        if (refreshStories.Count > 0)
        {
            AllStories.ReloadStoryXML();
        }

        //Build
        bool buildXMLNeedsReload = false;
        Dictionary <BuildGroups, List <BuildInfo> > refreshBuildInfoDict = new Dictionary <BuildGroups, List <BuildInfo> >();

        foreach (KeyValuePair <BuildGroups, BuildGroup> kv in AllBuilds.BuildGroupDict)
        {
            refreshBuildInfoDict.Add(kv.Key, new List <BuildInfo>());
            foreach (KeyValuePair <string, BuildInfo> _kv in kv.Value.Builds)
            {
                if (_kv.Value.M_BuildCards.CardSelectInfos.ContainsKey(cardID))
                {
                    _kv.Value.M_BuildCards.CardSelectInfos.Remove(cardID);
                    refreshBuildInfoDict[kv.Key].Add(_kv.Value);
                    buildXMLNeedsReload = true;
                }
            }
        }

        foreach (KeyValuePair <BuildGroups, List <BuildInfo> > kv in refreshBuildInfoDict)
        {
            foreach (BuildInfo bi in kv.Value)
            {
                AllBuilds.RefreshBuildXML(kv.Key, bi);
            }
        }

        if (buildXMLNeedsReload)
        {
            AllBuilds.ReloadBuildXML();
        }

        //Levels
        List <Level> refreshLevel = new List <Level>();

        foreach (KeyValuePair <LevelTypes, SortedDictionary <string, Level> > kv in AllLevels.LevelDict)
        {
            foreach (KeyValuePair <string, Level> _kv in kv.Value)
            {
                bool thisNeedsRefresh = _kv.Value.DeleteCard(cardID);
                refreshLevel.Add(_kv.Value);
            }
        }

        foreach (Level level in refreshLevel)
        {
            AllLevels.RefreshLevelXML(level);
        }

        if (refreshLevel.Count > 0)
        {
            AllLevels.ReloadLevelXML();
        }

        //SideEffect, ICardDeckLinked
        bool sideEffectNeedsReload = false;

        foreach (KeyValuePair <int, CardInfo_Base> kv in CardDict)
        {
            bool thisCardNeedsRefresh = false;
            foreach (SideEffectExecute see in kv.Value.SideEffectBundle.SideEffectExecutes)
            {
                foreach (SideEffectBase se in see.SideEffectBases)
                {
                    if (se is ICardDeckLinked link_se)
                    {
                        int value = link_se.GetCardIDSideEffectValue().Value;
                        if (value == cardID)
                        {
                            link_se.GetCardIDSideEffectValue().SetValue(((int)EmptyCardTypes.NoCard).ToString());
                            sideEffectNeedsReload = true;
                            thisCardNeedsRefresh  = true;
                        }
                    }
                }
            }

            if (thisCardNeedsRefresh)
            {
                RefreshCardXML(kv.Value);
            }
        }

        if (sideEffectNeedsReload)
        {
            ReloadCardXML();
        }
    }
コード例 #25
0
 private void Start()
 {
     mLevelManager     = GameObject.Find("Persistent Data").GetComponent <AllLevels>();
     mNewBuildingBlock = GameObject.Find("New Building Block").transform;
 }
コード例 #26
0
 public QuoteSystem(QuoteSystem quoteSystem) : this()
 {
     AllLevels.AddRange(quoteSystem.AllLevels.Select(l => new QuotationMark(l.Open, l.Close, l.Continue, l.Level, l.Type)));
 }
コード例 #27
0
    public void ChangeLevel()
    {
        AllLevels allLevels =
            GameObject.Find("Persistent Data").GetComponent <AllLevels>();

        BuildingBlockManager buildingBlockManager =
            GameObject.Find("Persistent Data").GetComponent <BuildingBlockManager>();

        Transform levelContainer = GameObject.Find("Level Container").transform;

        foreach (Transform child in levelContainer)
        {
            Destroy(child.gameObject);
        }

        int currentLevelIndex = allLevels.currentLevel;


        if (currentLevelIndex < allLevels.BuiltInLevels.Count)
        {
            BuiltInLevel currentLevel = allLevels.BuiltInLevels[currentLevelIndex];

            for (int i = 0; i < currentLevel.Prefabs.Count; i++)
            {
                Vector3 piecePosition = currentLevel.PiecePositions[i];

                Quaternion pieceRotation =
                    Quaternion.Euler(
                        0f,
                        0f,
                        currentLevel.PieceRotations[i]);

                string tag = currentLevel.Prefabs[i];

                Transform piece = Instantiate(
                    buildingBlockManager.searchBuiltInPrefabs(tag),
                    piecePosition,
                    pieceRotation);

                piece.parent = levelContainer;
            }
        }
        else if (currentLevelIndex >= allLevels.BuiltInLevels.Count)
        {
            CustomLevel currentLevel = allLevels.CustomLevels[currentLevelIndex];

            for (int i = 0; i < currentLevel.Prefabs.Count; i++)
            {
                Vector3 piecePosition = currentLevel.PiecePositions[i];

                Quaternion pieceRotation =
                    Quaternion.Euler(
                        0f,
                        0f,
                        currentLevel.PieceRotations[i]);

                string tag = currentLevel.Prefabs[i];

                Transform piece = Instantiate(
                    buildingBlockManager.searchBuiltInPrefabs(tag),
                    piecePosition,
                    pieceRotation);

                piece.parent = levelContainer;
            }
        }
    }
コード例 #28
0
 public void SetBaseLevel(string levelName)
 {
     BaseLevel = AllLevels
                 .First(l => l.Name == levelName as string);
 }
コード例 #29
0
    public void InitializeLevelList()
    {
        SelectTab(LevelTypes.Enemy);
        foreach (KeyValuePair <LevelTypes, List <StoryEditorPanel_LevelButton> > kv in MyLevelButtons)
        {
            foreach (StoryEditorPanel_LevelButton btn in kv.Value)
            {
                btn.PoolRecycle();
            }

            kv.Value.Clear();
        }

        foreach (KeyValuePair <LevelTypes, SortedDictionary <string, Level> > kv in AllLevels.LevelDict)
        {
            SortedDictionary <int, List <Level> > sortedListByLevelDifficulty = new SortedDictionary <int, List <Level> >();

            if (kv.Key == LevelTypes.Enemy)
            {
                foreach (KeyValuePair <string, Level> _kv in kv.Value)
                {
                    if (!sortedListByLevelDifficulty.ContainsKey(_kv.Value.DifficultyLevel))
                    {
                        sortedListByLevelDifficulty.Add(_kv.Value.DifficultyLevel, new List <Level>());
                    }

                    sortedListByLevelDifficulty[_kv.Value.DifficultyLevel].Add(_kv.Value);
                }

                foreach (KeyValuePair <int, List <Level> > KV in sortedListByLevelDifficulty)
                {
                    foreach (Level lv in KV.Value)
                    {
                        if (lv.LevelNames["en"].Equals("New" + kv.Key))
                        {
                            continue;
                        }
                        StoryEditorPanel_LevelButton btn = StoryEditorPanel_LevelButton.BaseInitialize(
                            level : lv.Clone(),
                            parent : LevelContainerDict[kv.Key],
                            onSetButtonClick : delegate(Level level) { ChapterMap.SetCurrentNodeLevel(level); },
                            onEditButtonClick: delegate
                        {
                            UIManager.Instance.CloseUIForm <StoryEditorPanel>();
                            UIManager.Instance.ShowUIForms <LevelEditorPanel>().SetLevel(lv.Clone());
                        },
                            onDeleteButtonClick: delegate
                        {
                            ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>();
                            cp.Initialize(LanguageManager.Instance.GetText("StoryEditorPanel_DeleteLevelFormLibrary0"),
                                          LanguageManager.Instance.GetText("Common_Yes"),
                                          LanguageManager.Instance.GetText("Common_No"),
                                          delegate
                            {
                                cp.CloseUIForm();
                                AllLevels.DeleteLevel(kv.Key, lv.LevelNames["en"]);
                                InitializeLevelList();
                                SelectTab(kv.Key);
                                SetStory(AllStories.GetStory("DefaultStory", CloneVariantUtils.OperationType.Clone));
                            },
                                          delegate { cp.CloseUIForm(); });
                        }
                            );
                        MyLevelButtons[kv.Key].Add(btn);
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <string, Level> _kv in kv.Value)
                {
                    if (_kv.Key.Equals("New" + kv.Key))
                    {
                        continue;
                    }
                    StoryEditorPanel_LevelButton btn = StoryEditorPanel_LevelButton.BaseInitialize(
                        level : _kv.Value.Clone(),
                        parent : LevelContainerDict[kv.Key],
                        onSetButtonClick : delegate(Level level) { ChapterMap.SetCurrentNodeLevel(level); },
                        onEditButtonClick: delegate
                    {
                        UIManager.Instance.CloseUIForm <StoryEditorPanel>();
                        UIManager.Instance.ShowUIForms <LevelEditorPanel>().SetLevel(_kv.Value.Clone());
                    },
                        onDeleteButtonClick: delegate
                    {
                        ConfirmPanel cp = UIManager.Instance.ShowUIForms <ConfirmPanel>();
                        cp.Initialize(LanguageManager.Instance.GetText("StoryEditorPanel_DeleteLevelFormLibrary0"),
                                      LanguageManager.Instance.GetText("Common_Yes"),
                                      LanguageManager.Instance.GetText("Common_No"),
                                      delegate
                        {
                            cp.CloseUIForm();
                            AllLevels.DeleteLevel(kv.Key, _kv.Value.LevelNames["en"]);
                            InitializeLevelList();
                            SelectTab(kv.Key);
                            SetStory(AllStories.GetStory("DefaultStory", CloneVariantUtils.OperationType.Clone));
                        },
                                      delegate { cp.CloseUIForm(); });
                    }
                        );
                    MyLevelButtons[kv.Key].Add(btn);
                }
            }
        }
    }
コード例 #30
0
    private void Start()
    {
        string Difficulty = GlobalGameSettings.GetSetting("Difficulty");

        switch (Difficulty)
        {
        case "Beginner":
            _Difficulty = 0;
            break;

        case "Easy":
            _Difficulty = 8;
            break;

        case "Medium":
            _Difficulty = 16;
            break;

        case "Hard":
            _Difficulty = 24;
            break;

        case "Expert":
            _Difficulty = 32;
            break;
        }
        int Level;

        int.TryParse(GlobalGameSettings.GetSetting("Level"), out Level);
        foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("level"))
        {
            AllLevels.GetComponent <Menu>().levelName = AllLevels.GetComponent <Menu>().level + _Difficulty;//+1;
            int LevelAmount = AllLevels.GetComponent <Menu>().levelName = AllLevels.GetComponent <Menu>().level + _Difficulty;
            AllLevels.GetComponentInChildren <Text>().text = "Level " + LevelAmount;
            //AllLevels.GetComponent<Image>().sprite = unUsingSprite;
            //if (AllLevels.GetComponent<Menu>()._Difficulty == Controller.LevelName)
            //{
            //    AllLevels.GetComponent<Image>().sprite = AllLevels.GetComponent<Menu>().UsingSprite;
            //}
            StartCoroutine(AllLevels.GetComponent <Menu>().Working());
        }
        foreach (GameObject AllLevels in GameObject.FindGameObjectsWithTag("niveau"))
        {
            //AllLevels.GetComponent<Image>().sprite = unUsingSprite;
            StartCoroutine(AllLevels.GetComponent <Menu>().Working());
        }
        foreach (GameObject AllGrids in GameObject.FindGameObjectsWithTag("point"))
        {
            AllGrids.GetComponent <Pointbehavoir>().Image.enabled = false;
            AllGrids.GetComponent <Pointbehavoir>().CanInteract   = false;
        }
        if (off_LEvelName == 0)
        {
            StartLevel((Level - 1) + _Difficulty);
            LevelName          = ((Level) + _Difficulty);
            LevelNameText.text = Difficulty + ":" + Level;
            minimaleZetten     = Levels[LevelName - 1].minimaleZetten;
        }
        else
        {
            int _lev = Level;
            StartLevel(_LevelName);
            LevelName = (_LevelName);
            int _switch = 0;
            _lev = (LevelName + 1);
            Debug.Log(_lev);
            while (_lev > 0)
            {
                _lev = _lev - 8;
                _switch++;
            }
            switch (_switch)
            {
            case 1:
                Difficulty = "Beginner";
                break;

            case 2:
                Difficulty = "Easy";
                break;

            case 3:
                Difficulty = "Medium";
                break;

            case 4:
                Difficulty = "Hard";
                break;

            case 5:
                Difficulty = "Expert";
                break;
            }
            Debug.Log(_lev);
            _lev = _lev + 8;
            LevelNameText.text = Difficulty + ":" + _lev;
            minimaleZetten     = Levels[LevelName].minimaleZetten;
        }
    }