Example #1
0
        /// <summary>
        /// チャプターが開始前の場合に、状態をアクティブに変更します。
        /// </summary>
        private void ActivateChapter(KerbalStoryScenario scenario)
        {
            if (scenario.State != StoryState.Introduction) {
                return;
            }

            var currentChapterId = this.chapterIds.FirstOrDefault(id => id == scenario.Chapter);
            if (String.IsNullOrEmpty(currentChapterId)) {
                return;
            }

            var contract = StoryContract.Generate(currentChapterId);
            ContractSystem.Instance.Contracts.Add(contract);
            scenario.State = StoryState.Active;
        }
 public override void OnAwake()
 {
     Instance = this;
 }
Example #3
0
        /// <summary>
        /// Modを初期化します。
        /// </summary>
        /// <returns></returns>
        private IEnumerator ModInitialize(KerbalStoryScenario scenario)
        {
            if (scenario.Initialized == true) {
                yield break;
            }

            // ダイアログを表示
            ConfirmDialog.ShowDialog("KerbalStoryを有効にしますか?", () => {
                scenario.Initialized = true;
                scenario.Enabled = true;
                scenario.Chapter = this.chapterIds[0];
                scenario.State = StoryState.Introduction;

                var configNode = GameDatabase.Instance.GetConfigNodes("KERBALSTORY").First();
                Debug.Log(configNode);

                var funding = Funding.Instance;
                funding.AddFunds((-1 * funding.Funds), TransactionReasons.None);
                funding.AddFunds(Int32.Parse(configNode.GetValue("startFunds")), TransactionReasons.None);

                ResearchAndDevelopment.Instance.AddScience(Int32.Parse(configNode.GetValue("startScience")), TransactionReasons.None);
            }, () => {
                scenario.Initialized = true;
                scenario.Enabled = false;
            });

            while (true) {
                if (scenario.Initialized == true) {
                    break;
                }
                yield return 0;
            }
        }
Example #4
0
        /// <summary>
        /// チャプタークリア済みの場合に次のチャプターに移動させます。
        /// </summary>
        private void MoveToNextChapter(KerbalStoryScenario scenario)
        {
            if (scenario.State != StoryState.Completed) {
                return;
            }

            var nextChapterId = this.chapterIds.SkipWhile(id => id != scenario.Chapter).Skip(1).FirstOrDefault();
            if (nextChapterId == null) {
                return;
            }

            scenario.Chapter = nextChapterId;
            scenario.State = StoryState.Introduction;
        }