示例#1
0
    public static void doInit(pipeBehavior ps, string home)
    {
        //pipe1 = pipe1In;
        currentFunction = null;
        lineVector      = new Vector3[10000];
        zeroLine();
        GameObject memoryObject = GameObject.Find("Memory1");

        memoryScript  = (memory)memoryObject.GetComponent(typeof(memory));
        memoryRegions = new List <memory> ();
        memoryRegions.Add(memoryScript);
        //camera = GameObject.Find ("Main Camera");
        if (controlLine != null)
        {
            VectorLine.Destroy(ref controlLine);
        }
        controlLine = new VectorLine("myLines", lineVector, flowColor, null, 0.5f, LineType.Continuous);
        controlLine.maxDrawIndex = 0;
        lineElement = 0;
        pipeScript  = ps;
        if (pipeScript == null)
        {
            Debug.Log("pipeScript is null");
        }
        pipe1       = pipeScript.getPipe("pipe");
        breakpoints = new List <long> ();
        StreamReader reader = null;

        if (System.IO.File.Exists(home + "/breakpoints.txt"))
        {
            reader = new StreamReader(home + "/breakpoints.txt");
            Debug.Log("Found breakpoints");
        }
        else
        {
            Debug.Log("No breakpoint file in " + home);
        }
        if (reader != null)
        {
            string line;
            using (reader)
            {
                while ((line = reader.ReadLine()) != null)
                {
                    long value = long.Parse(line, System.Globalization.NumberStyles.HexNumber);
                    Debug.Log("add breakpoint at " + value.ToString("x"));
                    breakpoints.Add(value);
                }
            }
        }
        clockLabelString   = "0";
        currentCycleString = "0";
        numInstructions    = 0;
        currentClock       = 0;
        startClock         = 0;
        updateClock(0);
    }
    /*
     * Instantiate network and memory objects and initialize project
     */
    void Awake()
    {
        //camera = GameObject.Find ("Main Camera");
        color1.a     = 0.4f;
        color2.a     = 0.4f;
        shader2      = Shader.Find("Transparent/VertexLit");
        cameraScript = (maxCamera)Camera.main.GetComponent(typeof(maxCamera));
        Debug.Log("i am awake\n");

        //pipe1 = Instantiate (Resources.Load ("networkPrefab")) as GameObject;
        pipe1      = Instantiate(Resources.Load("spherePrefab")) as GameObject;
        pipe1.name = "theNetwork";

        pipeScript = (pipeBehavior)pipe1.GetComponent(typeof(pipeBehavior));
        GameObject mem = GameObject.Find("Memory1");

        memoryScript           = (memory)mem.GetComponent(typeof(memory));
        mem.transform.position = memoryStart;
        mem.transform.rotation = Quaternion.Euler(memoryRotation);
        initProject(project);
    }
    public static void doInit(string homePath, startup.instructions ins, pipeBehavior ps, memory ms)
    {
        home         = homePath;
        instructs    = ins;
        pipeScript   = ps;
        memoryScript = ms;
        bookmarkList = new List <string> ();
        string path = home + "/bookmarks/";

        System.IO.Directory.CreateDirectory(path);

        DirectoryInfo di = new DirectoryInfo(home + "/bookmarks/");

        FileInfo[] oldmarks = di.GetFiles();

        Array.Sort(oldmarks, (x, y) => StringComparer.OrdinalIgnoreCase.Compare(x.LastWriteTime, y.LastWriteTime));
        Debug.Log("num files in " + home + "/bookmarks/ is " + oldmarks.Length);
        for (int i = 0; i < oldmarks.Length; i++)
        {
            bookmarkList.Add(Path.GetFileNameWithoutExtension(oldmarks[i].Name));
        }
    }