LogKV() public static method

public static LogKV ( string key, string message ) : void
key string
message string
return void
Beispiel #1
0
    public void castSpell(GameObject target)
    {
        if (target.GetComponent("Enchantable") == null)
        {
            TraceLogger.LogKVtime("attempt", getSpellName());
            TraceLogger.LogKV("target", target.GetInstanceID().ToString() + ", " + target.name + ", " + target.transform.position);
            TraceLogger.LogKV("player", "" + ObjectManager.FindById("Me").transform.position);
            (GameObject.Find("Popup").GetComponent("Popup") as Popup).popup("Target (" + target.name + ") immune to magic.");
            SetHidden(false);
            return;
        }

        TraceLogger.LogKVtime("spell", getSpellName());
        ProgramLogger.LogKVtime("spell", getSpellName());
        TraceLogger.LogKV("target", target.GetInstanceID().ToString() + ", " + target.name + ", " + target.transform.position);
        TraceLogger.LogKV("player", "" + ObjectManager.FindById("Me").transform.position);

        June june = new June(target, file_name);

        SetHidden(false);

        item_name = "Blank";
        file_name = "";
        animate   = false;


        inventoryTexture = Resources.Load("Textures/Scroll") as Texture2D;


        (target.GetComponent("Enchantable") as Enchantable).enchant(june, delegate(GameObject t){ absorbSpell(t); });
    }
Beispiel #2
0
    void logStart()
    {
        TraceLogger.LogStart();
        ProgramLogger.LogStart();

        // log all the gnomes you can talk to and their positions
        NPCQuestTalk[] gnomes = Object.FindObjectsOfType(typeof(NPCQuestTalk)) as NPCQuestTalk[];
        foreach (NPCQuestTalk gnome in gnomes)
        {
            if (gnome.name.Contains("Gnome"))
            {
                TraceLogger.LogKV("gnome", gnome.name + ", " + gnome.transform.position);
            }
        }
    }
Beispiel #3
0
 public bool MarkAlreadyComplete(string name)
 {
     if (!Contains("complete_" + name))
     {
         if (badgeStore.label(name).Trim() == "")
         {
             Replace(name, "complete_" + name, badgeStore.label(name), badgeStore.path(name).Replace("incomplete", "complete"), false);
         }
         else
         {
             Replace(name, "complete_" + name, badgeStore.label(name) + " (COMPLETED)", badgeStore.path(name).Replace("incomplete", "complete"), false);
         }
         TraceLogger.LogKV("alreadycompleted", name);
         return(true);
     }
     return(false);
 }
Beispiel #4
0
    // log information about each object used in a spell
    public static string logObj(string when, string id, string spellname)
    {
        GameObject g = ObjectManager.FindById(id);

        // Object id, type/name, position, ground height at position, is on fire
        bool flaming = false;

        if (g.GetComponent <Flamable>())
        {
            flaming = g.GetComponent <Flamable>().isIgnited();
        }
        TraceLogger.LogKV("object" + when, spellname + ", " + id + ", " + g.name + ", " + g.transform.position + ", " + Terrain.activeTerrain.SampleHeight(g.transform.position) + ", " + flaming);
        Util util = new Util();

        if (when.Equals("end") && g.name.Equals("Flag(Clone)"))
        {
            util.getWithin(id);
        }

        return(g.name);
    }
Beispiel #5
0
    virtual public void javaCompileAndRun()
    {
        try{
            string class_name = java_file_name.Split('.')[0];

            File.Delete(JuneConfig.java_files_path + "/" + class_name + ".class");
            //ProgramLogger.LogKV("filedeleted", JuneConfig.java_files_path + "/" + class_name + ".class");
            Process compile_process = Shell.shell_no_start("javac", "-classpath \"" + JuneConfig.june_files_path + "\" " + JuneConfig.java_files_path + "/" + java_file_name);
            compile_process.Start();

            var output = compile_process.StandardOutput.ReadToEnd();
            var error  = compile_process.StandardError.ReadToEnd();

            // need to free the resources for the process
            compile_process.WaitForExit();
            compile_process.Close();

            //		Popup.mainPopup.popup(""  + output + " " + error);

            if (!error.Equals(""))
            {
                success = false;
                FileLogger.Log("error launching Java process: " + error);
            }
            //ProgramLogger.LogKV("compile", getSpellName()+", "+success);

            if (!success)
            {
                is_stopped = true;
                TraceLogger.LogKV("failedspell", getSpellName());
                return;
            }


//          Process test = Shell.shell_no_start("java", "-version");
//          test.Start();
//
//          var output2 = test.StandardOutput.ReadToEnd();
//          var error2 = test.StandardError.ReadToEnd();
//
//          UnityEngine.Debug.Log (output2 + " " + error2);


            if (Application.platform == RuntimePlatform.WindowsPlayer || Application.platform == RuntimePlatform.WindowsEditor)
            {
                UnityEngine.Debug.Log("java " + "-classpath \"" + JuneConfig.june_files_path + ";" + JuneConfig.java_files_path + "\" june.Caster " + class_name + " \"" + object_id + "\"");
                java_process = Shell.shell_no_start("java", "-classpath \"" + JuneConfig.june_files_path + ";" + JuneConfig.java_files_path + "\" june.Caster " + class_name + " \"" + object_id + "\"");
            }
            else
            {
                UnityEngine.Debug.Log("java " + "-classpath \"" + JuneConfig.june_files_path + ":" + JuneConfig.java_files_path + "\" june.Caster " + class_name + " \"" + object_id + "\"");
                java_process = Shell.shell_no_start("java", "-classpath \"" + JuneConfig.june_files_path + ":" + JuneConfig.java_files_path + "\" june.Caster " + class_name + " \"" + object_id + "\"");
            }
            java_process.Start();

            var output3 = java_process.StandardOutput.ReadToEnd();
            var error3  = java_process.StandardError.ReadToEnd();

            UnityEngine.Debug.Log(output3 + " " + error3);


            Boolean has_exited = Convert.ToBoolean(java_process.GetType().GetProperty("HasExited").GetValue(java_process, new object[] {}));
            while (!has_exited)
            {
                if (!isPlaying)
                {
                    Stop();
                }

                //UnityEngine.Debug.Log("Waiting for Java process to exit: ");

                Thread.Sleep(500);

                has_exited = Convert.ToBoolean(java_process.GetType().GetProperty("HasExited").GetValue(java_process, new object[] {}));
            }


            if (java_process.ExitCode != 0)
            {
                success = false;
            }

            // free resources for this process
            java_process.WaitForExit();
            java_process.Close();

            TraceLogger.LogKV("endspell", getSpellName());

            is_stopped = true;
        }catch (Exception e) {
            UnityEngine.Debug.Log(e);
        }
    }