Exemple #1
0
    public void Start()
    {
        userID = Constants.PERSON_ID;
        string modifiedURL = baseURL + "equip/?person_id=" + userID + "&format=json/";
        WWW    request     = new WWW(modifiedURL);

        StartCoroutine(OnResponse(request));
        Equip equipped = JsonUtility.FromJson <Equip> (dataAsJson);

        pairID = equipped.gear;

        modifiedURL = baseURL + "paired/" + equipped.gear.ToString() + "/&format=json/";
        request     = new WWW(modifiedURL);
        StartCoroutine(OnResponse(request));
        Paired pair = JsonUtility.FromJson <Paired> (dataAsJson);

        modifiedURL = baseURL + "weapon/" + pair.weapon_id.ToString() + "/&format=json/";
        request     = new WWW(modifiedURL);
        StartCoroutine(OnResponse(request));
        equippedWeapon = JsonUtility.FromJson <Weapon> (dataAsJson);

        modifiedURL = baseURL + "weapon/" + pair.armor_id.ToString() + "/&format=json/";
        request     = new WWW(modifiedURL);
        StartCoroutine(OnResponse(request));
        equippedArmor = JsonUtility.FromJson <Armor> (dataAsJson);
    }
    // Update is called once per frame
    void Update()
    {
        if (master.state == 5 && master.pstate == master.state)
        {
            stopwatch += Time.deltaTime;
        }
        else
        {
            stopwatch = 0;
        }
        if (holdingView)
        {
            if (holdtime > 0)
            {
                holdtime -= Time.deltaTime;
            }
        }
        else
        {
            holdtime = .2f;
        }
        if (holdingSystem)
        {
            if (systemholdtime > 0)
            {
                systemholdtime -= Time.deltaTime;
            }
        }
        else
        {
            systemholdtime = .2f;
        }
        if (scrollcooldown > 0)
        {
            scrollcooldown -= Time.deltaTime;
        }
        if (!holdingView)
        {
            vindex = 0;
        }
        if (!holdingSystem)
        {
            sysindex = 0;
        }
        //on level start code
        if (master.pstate != master.state)
        {
            strtIndex     = 0;
            master.pstate = master.state;
            if (master.state == 3)
            {
                master.answerPart = null;
            }
            else if (master.state == 4)
            {
                master.answerPart = null;
                mistakes          = 0;
                answerSelection   = 0;
            }
            else if (master.state == 5)
            {
                for (int i = 0; i < master.allparts.Count; i++)
                {
                    master.inventory.Add(master.allparts [i]);
                }
                int r = Random.Range(0, master.inventory.Count);
                master.answerPart = master.inventory [r];
                mistakes          = 0;
            }
        }         //end state start check

        //show or hide inventory
        if (master.state == 5)
        {
            offsetInventory = Mathf.MoveTowards(offsetInventory, 0, Time.deltaTime * 10);
        }
        else if (master.MO.dragging)
        {
            if (master.MO.cpos.y > h * .8125f)
            {
                offsetInventory = Mathf.MoveTowards(offsetInventory, 0, Time.deltaTime * 10);
            }
            else
            {
                offsetInventory = Mathf.MoveTowards(offsetInventory, 1, Time.deltaTime * 10);
            }
        }
        else
        {
            if (mp.y > h * .8125f)
            {
                offsetInventory = Mathf.MoveTowards(offsetInventory, 0, Time.deltaTime * 10);
            }
            else
            {
                offsetInventory = Mathf.MoveTowards(offsetInventory, 1, Time.deltaTime * 10);
            }             //end show or hide inventory
        }
        if (master.state == 3 && master.dragpart != null)
        {
            if (master.MO.stopdrag)
            {
                if (master.MO.cpos.y > h * .8125f)
                {
                    master.inventory.Add(master.dragpart);
                }
                master.dragpart = null;
            }
            else
            {
                if (!Input.GetMouseButton(0) && !master.MO.dragging)
                {
                    if (mp.y > h * .8125f && !master.MO.tapped)
                    {
                        master.inventory.Add(master.dragpart);
                    }
                    master.dragpart = null;
                }
            }
        }
        //update completion status when finished and return to menu
        if (master.state == 3 || master.state == 4)
        {
            if (master.selectedpart != null)
            {
                if (master.inventory.Contains(master.selectedpart))
                {
                    master.selectedpart = null;
                }
            }
            if (master.inventory.Count == master.allparts.Count)
            {
                if (_title.completion [_title.loadindex] < master.state - 2)
                {
                    _title.completion [_title.loadindex] = master.state - 2;
                }
                master.state = 2;
            }
        }
        else if (master.state == 5)
        {
            if (master.inventory.Count == 0)
            {
                if (_title.completion [_title.loadindex] < master.state - 2)
                {
                    _title.completion [_title.loadindex] = master.state - 2;
                }
                if (stopwatch < master.specimenTimes [_title.loadindex] || master.specimenTimes [_title.loadindex] == 0)
                {
                    master.specimenTimes [_title.loadindex] = stopwatch;
                    PlayerPrefs.SetFloat(master.specimenNames [_title.loadindex] + "Time", stopwatch);
                }
                master.state = 2;
                stopwatch    = 0;
            }
            else
            {
                if (master.answerPart == null)
                {
                    int r = Random.Range(0, master.inventory.Count);
                    master.answerPart = master.inventory [r];
                }
                //mouse version
                if (Input.GetMouseButtonUp(0) && master.selectedpart != null && mp.y < h * .8125f)
                {
                    if (master.hoverparts.Contains(master.selectedpart) && master.answerPart == master.selectedpart)
                    {
                        master.inventory.Remove(master.selectedpart);
                        master.selectedpart = null;
                        if (master.inventory.Count > 0)
                        {
                            int r = Random.Range(0, master.inventory.Count);
                            master.answerPart = master.inventory [r];
                        }
                    }
                    else if (master.hoverparts.Count > 0)
                    {
                        mistakes++;
                        master.selectedpart = null;
                        if (mistakes >= 6)
                        {
                            master.state      = 2;
                            menu.MoveToLevel1 = true;
                        }
                    }
                }
                //touch version
                if (master.MO.stopdrag && master.selectedpart != null && master.MO.cpos.y < h * .8125f && !master.MO.dragging)
                {
                    if (master.hoverparts.Contains(master.selectedpart) && master.answerPart == master.selectedpart)
                    {
                        master.inventory.Remove(master.selectedpart);
                        master.selectedpart = null;
                        if (master.inventory.Count > 0)
                        {
                            int r = Random.Range(0, master.inventory.Count);
                            master.answerPart = master.inventory [r];
                        }
                    }
                    else if (master.hoverparts.Count > 0)
                    {
                        mistakes++;
                        master.selectedpart = null;
                        if (mistakes >= 6)
                        {
                            master.state      = 2;
                            menu.MoveToLevel1 = true;
                        }
                    }
                }

                // mouse version of get hover parts
                if (master.selectedpart != null && mp.y <= Screen.height * .8125f && Input.GetMouseButton(0))
                {
                    Ray          ray  = Camera.main.ScreenPointToRay(Input.mousePosition);
                    RaycastHit[] hits = Physics.RaycastAll(ray);
                    List <Part>  p    = new List <Part> ();
                    for (int i = 0; i < hits.Length; i++)
                    {
                        Part temp = hits [i].transform.GetComponent <Part> ();
                        if (temp != null)
                        {
                            if (master.inventory.Contains(temp) && !p.Contains(temp))
                            {
                                p.Add(temp);
                            }
                        }
                        else
                        {
                            Paired tpair = hits [i].transform.GetComponent <Paired> ();
                            if (tpair != null)
                            {
                                temp = tpair.pairedPart;
                                if (master.inventory.Contains(temp) && !p.Contains(temp))
                                {
                                    p.Add(temp);
                                }
                            }
                        }
                    }
                    master.hoverparts = p;
                }
                //touch version
                else if (master.selectedpart != null && master.MO.cpos.y <= Screen.height * .8125f && master.MO.dragging)
                {
                    Ray          ray  = Camera.main.ScreenPointToRay(new Vector3(master.MO.cpos.x, Screen.height - master.MO.cpos.y));
                    RaycastHit[] hits = Physics.RaycastAll(ray);
                    List <Part>  p    = new List <Part> ();
                    for (int i = 0; i < hits.Length; i++)
                    {
                        Part temp = hits [i].transform.GetComponent <Part> ();
                        if (temp != null)
                        {
                            if (master.inventory.Contains(temp) && !p.Contains(temp))
                            {
                                p.Add(temp);
                            }
                        }
                        else
                        {
                            Paired tpair = hits [i].transform.GetComponent <Paired> ();
                            if (tpair != null)
                            {
                                temp = tpair.pairedPart;
                                if (master.inventory.Contains(temp) && !p.Contains(temp))
                                {
                                    p.Add(temp);
                                }
                            }
                        }
                    }
                    master.hoverparts = p;
                }
                else
                {
                    master.hoverparts = new List <Part>();
                }

                if (!Input.GetMouseButton(0) && !master.MO.dragging)
                {
                    master.selectedpart = null;
                }
            }
        } //end update state 5
    }     // end update
    IEnumerator _Import()
    {
        List <List <Info_Container> > bodyinfo = null;

        master.sviews = null;
        string path = new Uri(_baseurl + master.specimenNames [title.loadindex] + "/" + master.specimenNames [title.loadindex] + ".obj").AbsoluteUri;

        if (useIP)
        {
            path = "45.79.72.138" + path.Substring(22);
        }
        ObjReader1.ObjData objdata = new ObjReader1.ObjData();

        objdata = ObjReader1.use.ConvertFileAsync(path, true, opaque);
        while (!objdata.isDone)
        {
            upStatus(objdata);
            yield return(null);
        }
        upStatus(objdata);
        yield return(null);

        if (objdata.gameObjects == null)
        {
            status = master.specimenNames [title.loadindex] + ".obj or the mtl was not found in the " + master.specimenNames[title.loadindex] + " folder";
            yield break;
        }
        if (objdata.gameObjects.Length <= 0)
        {
            status = master.specimenNames [title.loadindex] + ".obj or the mtl was not found in the " + master.specimenNames[title.loadindex] + " folder";
            yield break;
        }
        for (int i = 0; i < objdata.gameObjects.Length; i++)
        {
            Material[] cm = objdata.gameObjects [i].GetComponent <Renderer> ().materials;
            for (int j = 0; j < cm.Length; j++)
            {
                if (cm [j].shader == VertexLit)
                {
                    Material temp = new Material(opaque);
                    temp.mainTexture = cm [j].mainTexture;
                    temp.color       = cm [j].color;
                    temp.name        = cm [j].name;
                    cm [j]           = temp;
                }
                else if (cm [j].shader == TransparentVertexLit)
                {
                    Material temp = new Material(transparent);
                    temp.mainTexture = cm [j].mainTexture;
                    temp.color       = cm [j].color;
                    temp.name        = cm [j].name;
                    cm [j]           = temp;
                }
            }
            objdata.gameObjects [i].GetComponent <Renderer> ().materials = cm;
        }

        status = "Parenting meshes to empty root object.";
        yield return(null);

        master.model = new GameObject();
        master.model.transform.position = new Vector3(0, -.8f, 0);
        master.model.name = master.specimenNames [title.loadindex];
        GameObject[] pivots = new GameObject[objdata.gameObjects.Length];
        for (int i = 0; i < objdata.gameObjects.Length; i++)
        {
            objdata.gameObjects [i].transform.parent = master.model.transform;
            objdata.gameObjects [i].transform.name   = i.ToString();
            pivots [i] = new GameObject();
            pivots [i].transform.position = objdata.gameObjects [i].transform.position;
            pivots [i].transform.rotation = objdata.gameObjects [i].transform.rotation;
            pivots [i].transform.parent   = objdata.gameObjects [i].transform;
            pivots [i].name = "Pivot";
        }

        //now search for name list
        path = new Uri(_baseurl + master.specimenNames [title.loadindex] + "/Name%20List.txt").AbsoluteUri;
        if (useIP)
        {
            path = "45.79.72.138" + path.Substring(22);
        }
        WWW www = new WWW(path);

        yield return(www);

        if (www.error != null)
        {
            status = "Name List.txt not found in " + master.specimenNames [title.loadindex] + " folder. Files are case and space sensitive";
            yield break;
        }
        string[] lines = getlines(www);
        status = "Setting pivots.";
        yield return(null);

        int     s      = 0;
        Vector3 v      = new Vector3(0, 0, 0);
        int     oindex = 0;

        for (int i = 0; i < lines.Length; i++)
        {
            if (IsNullOrWhiteSpace(lines [i]))
            {
                continue;
            }
            if (s == 0)
            {
                //
            }
            if (s == 1)
            {
                if (lines [i].Length <= 3)
                {
                    status = "float.parse(Substring(3)) error in Name List.txt at line " + lines [i];
                    yield break;
                }
                if (!float.TryParse(lines[i].Substring(3), out v.x))
                {
                    status = "float.parse(Substring(3)) error in Name List.txt at line " + lines [i];
                    yield break;
                }
            }
            else if (s == 2)
            {
                if (lines[i].Length <= 3)
                {
                    status = "float.parse(Substring(3)) error in Name List.txt at line " + lines [i];
                    yield break;
                }
                if (!float.TryParse(lines[i].Substring(3), out v.y))
                {
                    status = "float.parse(Substring(3)) error in Name List.txt at line " + lines [i];
                    yield break;
                }
            }
            else if (s == 3)
            {
                if (lines[i].Length <= 3)
                {
                    status = "float.parse(Substring(3)) error in Name List.txt at line " + lines [i];
                    yield break;
                }
                if (!float.TryParse(lines[i].Substring(3), out v.z))
                {
                    status = "float.parse(Substring(3)) error in Name List.txt at line " + lines [i];
                    yield break;
                }
                if (oindex >= pivots.Length)
                {
                    break;
                }
                pivots [oindex].transform.position = v;
            }
            s++;
            if (s > 3)
            {
                oindex++;
                s = 0;
            }
            yield return(null);
        }

        path = new Uri(_baseurl + master.specimenNames[title.loadindex] + "/getDirectoryList.php").AbsoluteUri;
        if (useIP)
        {
            path = "45.79.72.138" + path.Substring(22);
        }
        www = new WWW(path);
        yield return(www);

        if (www.error != null)
        {
            status = "getDirectoryList.php not found in " + master.specimenNames [title.loadindex] + " folder";
            yield break;
        }
        lines = getfolders(www);
        int           iterator = 0;
        int           views    = 0;
        List <string> ls       = new List <string> ();

        for (int i = 0; i < lines.Length; i++)
        {
            ls.Add(lines [i]);
        }
        for (int i = 0; i < ls.Count; i++)
        {
            if (ls.Contains(iterator.ToString()))
            {
                views++;
                iterator++;
            }
        }
        bodyinfo        = new List <List <Info_Container> >();
        master.allparts = new List <Part>();

        MatFlasher[] mf = new MatFlasher[objdata.gameObjects.Length];
        master.maxViews = views;
        for (int j = 0; j < objdata.gameObjects.Length; j++)
        {
            //j is object index
            mf[j]          = objdata.gameObjects[j].AddComponent <MatFlasher>();
            mf[j].master   = master;
            mf[j].wildcard = master.mempty;
            mf [j].marray  = new List <Material[]> ();
            for (int k = 0; k < views; k++)
            {
                Material[] mtemp = new Material[objdata.gameObjects [j].GetComponent <Renderer> ().materials.Length + 1];
                for (int l = 0; l < objdata.gameObjects [j].GetComponent <Renderer> ().materials.Length; l++)
                {
                    mtemp [l] = new Material(objdata.gameObjects [j].GetComponent <Renderer> ().materials [l]);
                }
                mtemp [mtemp.Length - 1] = mf [j].wildcard;
                mf [j].marray.Add(mtemp);
                if (k == 0)
                {
                    objdata.gameObjects [j].GetComponent <Renderer> ().materials = mtemp;
                }

                yield return(null);
            }
        }

        for (int i = 0; i < views; i++)
        {
            string temppath = _baseurl + master.specimenNames [title.loadindex] + "/" + i.ToString() + "/";
            path = new Uri(temppath + "Info.txt").AbsoluteUri;
            if (useIP)
            {
                path = "45.79.72.138" + path.Substring(22);
            }
            www = new WWW(path);
            yield return(www);

            if (www.error != null)
            {
                status = "Info.txt missing from " + master.specimenNames [title.loadindex] + "'s " + i.ToString() + " folder";
                yield break;
            }
            lines = getlines(www);
            //retrieve body part info
            bodyinfo.Add(new List <Info_Container>());
            s        = 0;
            iterator = 0;


            for (int j = 0; j < lines.Length; j++)
            {
                //i is view#
                //j is line#
                if (IsNullOrWhiteSpace(lines [j]))
                {
                    continue;
                }
                if (s == 0)
                {
                    status = "Loading body part info: " + "view " + i.ToString() + " body part# " + iterator.ToString();
                    yield return(null);

                    //print ("view " + i.ToString () + " container " + iterator.ToString () + " bodyinfo.count " + bodyinfo.Count);
                    bodyinfo [i].Add(new Info_Container());
                    if (lines [j].Length <= 6)
                    {
                        status  = "Error at line " + j.ToString() + " of Info.txt for view " + i.ToString() + " of specimen " + master.specimenNames [title.loadindex];
                        status += "\n" + lines [j];
                        yield break;
                    }
                    bodyinfo [i] [iterator].part = lines [j].Substring(6);
                    path = new Uri(temppath + bodyinfo [i] [iterator].part + ".png").AbsoluteUri;
                    if (useIP)
                    {
                        path = "45.79.72.138" + path.Substring(22);
                    }
                    www = new WWW(path);
                    yield return(www);

                    if (www.error != null)
                    {
                        status = bodyinfo [i] [iterator].part + ".png missing from view folder " + i.ToString();
                        yield break;
                    }
                    bodyinfo [i] [iterator].icon = www.texture;
                }
                else if (s == 1)
                {
                    if (lines [j].Length <= 8)
                    {
                        status  = "Error at line " + j.ToString() + " of Info.txt for view " + i.ToString() + " of specimen " + master.specimenNames [title.loadindex];
                        status += "\n" + lines [j];
                        yield break;
                    }
                    bodyinfo [i] [iterator].system = lines [j].Substring(8);
                }
                else if (s == 2)
                {
                    if (lines [j].Length <= 8)
                    {
                        status  = "Error at line " + j.ToString() + " of Info.txt for view " + i.ToString() + " of specimen " + master.specimenNames [title.loadindex];
                        status += "\n" + lines [j];
                        yield break;
                    }
                    if (lines [j].Contains("Object: "))
                    {
                        int num = 0;
                        if (!Int32.TryParse(lines[j].Substring(8), out num))
                        {
                            status  = "Error at line " + j.ToString() + " of Info.txt for view " + i.ToString() + " of specimen " + master.specimenNames [title.loadindex] + ": Older format, use object index instead of object name.";
                            status += "\n" + lines [j];
                            yield break;
                        }
                        bodyinfo [i] [iterator].oindex.Add(num);
                    }
                    else
                    {
                        s++;
                    }
                }
                if (s == 3)
                {
                    if (lines [j].Length <= 13)
                    {
                        status = "Error at line " + j.ToString() + " of Info.txt for view " + i.ToString() + " of specimen " + master.specimenNames [title.loadindex];
                        yield break;
                    }
                    bodyinfo [i] [iterator].description = lines [j].Substring(13);
                    for (int k = 0; k < bodyinfo [i] [iterator].oindex.Count; k++)
                    {
                        //k is oindex[k]
                        if (k == 0)
                        {
                            Part _part = objdata.gameObjects [bodyinfo [i] [iterator].oindex [k]].AddComponent <Part> ();
                            _part.mc    = objdata.gameObjects [bodyinfo [i] [iterator].oindex [k]].AddComponent <MeshCollider> ();
                            _part.pname = bodyinfo [i] [iterator].part;
                            string[] syslist = getsystems(bodyinfo [i] [iterator].system);
                            _part.systems     = syslist;
                            _part.description = bodyinfo [i] [iterator].description;
                            _part.icon        = bodyinfo [i] [iterator].icon;
                            _part.type        = i;
                            _part.pivot       = pivots [bodyinfo [i] [iterator].oindex [k]];
                            _part.master      = master;
                            if (master.slist == null)
                            {
                                master.slist = new List <string> ();
                            }
                            for (int d = 0; d < _part.systems.Length; d++)
                            {
                                if (!master.slist.Contains(_part.systems[d]))
                                {
                                    master.slist.Add(_part.systems[d]);
                                }
                            }

                            master.allparts.Add(_part);
                        }
                        else
                        {
                            Paired pair = objdata.gameObjects [bodyinfo [i] [iterator].oindex [k]].AddComponent <Paired> ();
                            pair.mc         = objdata.gameObjects [bodyinfo [i] [iterator].oindex [k]].AddComponent <MeshCollider> ();
                            pair.pairedPart = objdata.gameObjects [bodyinfo [i] [iterator].oindex [0]].GetComponent <Part> ();
                        }
                    }
                    //bodyinfo [i] [iterator].display ();
                    iterator++;
                    yield return(null);
                }
                if (s != 2)
                {
                    s++;
                }
                if (s >= 4)
                {
                    s = 0;
                }
                yield return(null);
            }             // end body part info loop
            status = "Loading Mat Edit data";
            yield return(null);

            path = new Uri(temppath + "Mat Edit.txt").AbsoluteUri;
            if (useIP)
            {
                path = "45.79.72.138" + path.Substring(22);
            }
            www = new WWW(path);
            yield return(www);

            if (www.error != null)
            {
                status = "Mat Edit.txt not found in " + master.specimenNames [title.loadindex] + "'s view " + i.ToString() + " folder";
                yield break;
            }
            lines    = getlines(www);
            s        = 0;
            iterator = 0;
            Mat_Container mc = new Mat_Container();
            for (int j = 0; j < lines.Length; j++)
            {
                //j is lines iterator
                if (IsNullOrWhiteSpace(lines [j]))
                {
                    continue;
                }
                if (s == 0)
                {
                    mc = new Mat_Container();
                    int num = 0;
                    if (lines [j].Length <= 8)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    if (Int32.TryParse(lines [j].Substring(8), out num))
                    {
                        mc.oindex = num;
                    }
                    else
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                }
                else if (s == 1)
                {
                    int num = 0;
                    if (lines [j].Length <= 16)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    if (Int32.TryParse(lines [j].Substring(16), out num))
                    {
                        mc.matindex = num;
                    }
                    else
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                }
                else if (s == 2)
                {
                    if (lines [j].Length <= 13)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    if (lines [j].Substring(13) == "Opaque" || lines [j].Substring(13) == "Transparent")
                    {
                        mc.shadertype = lines [j].Substring(13);
                    }
                    else
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                }
                else if (s == 3)
                {
                    float value = 0;
                    if (lines [j].Length <= 5)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    if (float.TryParse(lines [j].Substring(5), out value))
                    {
                        mc.color.r = value;
                    }
                    else
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                }
                else if (s == 4)
                {
                    float value = 0;
                    if (lines [j].Length <= 7)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    if (float.TryParse(lines [j].Substring(7), out value))
                    {
                        mc.color.g = value;
                    }
                    else
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                }
                else if (s == 5)
                {
                    float value = 0;
                    if (lines [j].Length <= 6)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    if (float.TryParse(lines [j].Substring(6), out value))
                    {
                        mc.color.b = value;
                    }
                    else
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                }
                else if (s == 6)
                {
                    float value = 0;
                    if (lines [j].Length <= 7)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    if (float.TryParse(lines [j].Substring(7), out value))
                    {
                        mc.color.a = value;
                    }
                    else
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    Material mtemp = new Material(opaque);
                    if (mc.shadertype == "Transparent")
                    {
                        mtemp = new Material(transparent);
                    }
                    mtemp.color       = mc.color;
                    mtemp.mainTexture = mf [mc.oindex].marray [i] [mc.matindex].mainTexture;
                    if (mc.oindex >= mf.Length)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    if (mc.matindex >= mf [mc.oindex].marray [i].Length - 1)
                    {
                        status = "Error at line " + j.ToString() + " in Mat Edit.txt of view " + i.ToString();
                        yield break;
                    }
                    mf [mc.oindex].marray [i] [mc.matindex] = mtemp;
                }
                s++;
                if (s > 6)
                {
                    s = 0;
                }
                yield return(null);
            }

            path = new Uri(temppath + "ViewName.txt").AbsoluteUri;
            if (useIP)
            {
                path = "45.79.72.138" + path.Substring(22);
            }
            //print (path);
            www = new WWW(path);
            yield return(www);

            if (www.error != null)
            {
                status = "ViewName.txt missing from view " + i.ToString() + " of " + master.specimenNames [title.loadindex];
                yield break;
            }
            if (master.sviews == null)
            {
                master.sviews     = new string[1];
                master.sviews [0] = www.text;
            }
            else
            {
                string[] stemp = new string[master.sviews.Length + 1];
                for (int x = 0; x < master.sviews.Length; x++)
                {
                    stemp [x] = master.sviews [x];
                }
                stemp [stemp.Length - 1] = www.text;
                master.sviews            = stemp;
            }
            yield return(null);
        }         //end view folders loop

        master.objects = objdata.gameObjects;
        master.state++;
        yield break;
    }