상속: StateFunding.View
예제 #1
0
        public void load()
        {
            Log.Info("StateFunding Mod Loading");
            //AppLauncher = new StateFundingApplicationLauncher();
            AppLauncher = OnSpaceCentre.Instance.gameObject.AddComponent <StateFundingApplicationLauncher>();


            InitGovernments();
            InitEvents();
            VesselHelper.LoadAliases();
            StateFundingGlobal.isLoaded = true;

            //StateFundingGlobal.Sun = Planetarium.fetch.Sun.GetName();

            Log.Info("StateFunding Mod Loaded");

            if (StateFundingGlobal.needsDataInit)
            {
                Log.Info("StateFunding performing data init");
                var NewView = new NewInstanceConfigView();
                NewView.OnCreate((InstanceData Inst) =>
                {
                    for (int i = 0; i < StateFundingGlobal.fetch.Governments.ToArray().Length; i++)
                    {
                        Government Gov = StateFundingGlobal.fetch.Governments.ToArray()[i];
                        if (Gov.name == Inst.govName)
                        {
                            Inst.Gov = Gov;
                            break;
                        }
                    }
                    HighLogic.CurrentGame.Parameters.CustomParams <StateFundingSettings>().budgetPeriodsPerYear = Inst.Gov.budgetPeriodsPerYear;

                    StateFundingScenario.Instance.data   = Inst;
                    StateFundingScenario.Instance.isInit = true;
                    StateFundingGlobal.needsDataInit     = false;
                    Log.Info("StateFunding data init completed");
                    ReviewMgr.CompleteReview();
                });
            }
            else
            {
                for (int i = 0; i < StateFundingGlobal.fetch.Governments.ToArray().Length; i++)
                {
                    Government Gov = StateFundingGlobal.fetch.Governments.ToArray()[i];
                    if (Gov.name == StateFundingScenario.Instance.data.govName)
                    {
                        StateFundingScenario.Instance.data.Gov = Gov;
                    }
                }
            }
        }
예제 #2
0
 public void createInstance (Action <Instance>Callback) {
   NewView = new NewInstanceConfigView ();
   NewView.OnCreate (Callback);
 }
예제 #3
0
 public void createInstance(Action <Instance> Callback)
 {
     NewView = new NewInstanceConfigView();
     NewView.OnCreate(Callback);
 }
        //load scenario
        public override void OnLoad(ConfigNode node)
        {
            try {
            if (node.HasNode(CONFIG_NODENAME)) {
              //load
              Debug.Log("StateFundingScenario loading from persistence");
              ConfigNode loadNode = node.GetNode(CONFIG_NODENAME);
              ConfigNode.LoadObjectFromConfig(data, loadNode);
              isInit = true;
            }
            else {
              Debug.Log("StateFundingScenario default init");
              //default init
              var NewView = new NewInstanceConfigView ();
              NewView.OnCreate ((InstanceData Inst) => {
            data = Inst;
            ReviewMgr.CompleteReview ();
              });
              isInit = true;
            }

            for (int i = 0; i < StateFundingGlobal.fetch.Governments.ToArray ().Length; i++) {
              Government Gov = StateFundingGlobal.fetch.Governments.ToArray () [i];
              if (Gov.name == data.govName) {
            data.Gov = Gov;
              }
            }

              }
              catch {

              }
        }