Exemple #1
0
        public static void delayedupdate()
        {
            int delaydelta = delay++ % 100;

            if (delaydelta == 1)
            {
                ScriptingCore.OnEvent("update");
            }
            if (delaydelta == 10)
            {
                onchange();
            }
            if (delaydelta == 20)
            {
                newday();
            }
            if (delaydelta == 30)
            {
                noon();
            }
        }
Exemple #2
0
        public static bool SetResearchCost(string research, string costtype, float costamount)
        {
            if (Db.Get().Techs.resources == null)
            {
                return(false);
            }
            foreach (Tech techtoadd in Db.Get().Techs.resources)
            {
                if (techtoadd.Id == research)
                {
                    var res = Research.Instance.Get(techtoadd);

                    if (res.tech.costsByResearchTypeID.ContainsKey(costtype))
                    {
                        res.tech.costsByResearchTypeID[costtype] = costamount;
                    }
                    return(true);
                }
            }
            ScriptingCore.DebugLogError("SetResearchCost did not find: " + research);
            return(false);
        }
Exemple #3
0
 public static bool AddResearch(string research)
 {
     foreach (Tech techtoadd in Db.Get().Techs.resources)
     {
         if (techtoadd.Id == research)
         {
             var res = Research.Instance.Get(techtoadd);
             var req = Research.Instance.Get(techtoadd).tech.requiredTech;
             foreach (var i in req)
             {
                 AddResearch(i.Id);
             }
             if (res == null)
             {
                 ScriptingCore.DebugLogError("AddResearch did not find: " + research);
                 return(false);
             }
             res.Purchased();
             return(true);
         }
     }
     ScriptingCore.DebugLogError("AddResearch did not find: " + research);
     return(false);
 }
Exemple #4
0
 void start()
 {
     var scriptingcore = new ScriptingCore();
 }
 public static void Postfix()
 {
     ScriptingCore.OnEvent("update");
 }
 public static void Postfix()
 {
     ScriptingCore.OnEvent("maploaded");
 }
Exemple #7
0
 public static void onchangegame()
 {
     ScriptingCore.OnEvent("onchangegame");
 }
Exemple #8
0
 public static void Prefix()
 {
     ScriptingCore.OnEvent("directupdate");
     delayedupdate();
 }
Exemple #9
0
 public static void Prefix()
 {
     ScriptingCore.OnEvent("newgame");
 }
Exemple #10
0
 public static void Postfix()
 {
     ScriptingCore.DebugLog("loadbuildings");
     ScriptingCore.OnEvent("loadbuildings");
 }
Exemple #11
0
 public static void Prefix()
 {
     ScriptingCore.ScriptInit();
     ScriptingCore.DebugLog("preloadbuildings");
     ScriptingCore.OnEvent("preloadbuildings");
 }