Пример #1
0
        // TODO
        //
        // - XenoIndustryLaunchCosts
        // --- loading from config files using a rule system
        // - ClusterioConnector
        // --- ability to connect to multiple masters and hold multiple connections open
        // --- only acts on external commands, no "smart" behaviour of its own
        //
        // - a single class
        //
        // ADD
        // - XenoIndustryCargo - dedicated cargo tanks (separate for solids and liquids) than can be loaded and unloaded using an interface when on the launchpad
        // - XenoIndustrySignpost
        // --- class handling the Clusterio connections based on planets (planetName => urlAddress dictionary)
        // --- loading from signpost.json file (later from a signpost server?)
        // --- other classes should route their requests through the XenoIndustrySignpost one, which then in turn sends the proper url address to ClusterioConnector
        // --- should even decide which connections to keep open and how long
        //

        public void Awake()
        {
            instance = this;

            DontDestroyOnLoad(this);

            GameEvents.onGUIApplicationLauncherReady.Add(OnGUIAppLauncherReady);
            GameEvents.onGUIApplicationLauncherDestroyed.Add(OnGUIApplicationLauncherDestroyed);

            StreamReader reader = new StreamReader(MOD_PATH + "config.json");

            if (reader != null)
            {
                JSONNode modConfig = JSON.Parse(reader.ReadToEnd());

                if (modConfig["debug"] != null)
                {
                    Debug.Log(String.Format("ClusterioTest: sciencePerSciencePack is {0}", modConfig["sciencePerSciencePack"]));
                    debug = modConfig["debug"];
                }
            }

            XenoIndustrySignpost.LoadSignpost();

            windowRect = new Rect(Screen.width / 2 - 150, Screen.height / 2 - 150, 300, 100);

            clusterioInventory = new Dictionary <string, int>();
        }