예제 #1
0
파일: gui.cs 프로젝트: Xangotrick/CYGNUS
    void Start()
    {
        lexicon = new Lexiverse(prettyskinloseend, prettyskin);
        Lexiverse.Tvoid = Tvoid;
        Lexiverse.Twhite = Twhite;
        Lexiverse.Tsquareh = Tsquareh;
        staampcapture = -1;
        thelistofcaptures = new List<string>();
        invsetting = 0;
        inventoryname = "";
        MouseInvHeld = new Inventory.InvItem();
        ischangingname = false;
        isinvopen = false;
        w = Screen.width;
        h = Screen.height;
        initgame = Time.time;

        he = h / 10f;
        we = 10 * he;
        hl = h / 20f;
        wl = 5 * he;

        ToolRect = new Rect((w - we) / 2f, h - he, we, he);
        HealthRect = new Rect((w - we) * 3 / 4f + we, h - he, (w - we) / 4f, he);
        LabelRect = new Rect((w - wl) / 2f,0, wl, hl);
        SmallerRect = new Rect(0,hl,w,h-hl-he);
        start = true;

        listofEnemy = new List<Stats>();
        enemydamagestamp = new List<float>();
    }
예제 #2
0
	// Use this for initialization
	void Start () {
        isonline = false;
        downpressmax = 0.67f;
        buttondown = false;
        aimedpoint = new Vector3();
        seltoolbar = 0;
        toolbar = new Inventory.InvItem[10];
        for (int k = 0; k < toolbar.Length; k++)
        {
            toolbar[k] = new Inventory.InvItem();
        }

        isfightingmode = true;

        isonfloor = false;
		acc = -9.81f;
        blastz = 0;
        lastz = 1;
        isonfloor = false;
	}
예제 #3
0
파일: gui.cs 프로젝트: Xangotrick/CYGNUS
    void DrawM01Crafter(socketIG thesock)
    {
        bool crafting = false;
        float craftlevel = 0;
        if (thesock.asock.getcraft.vfloat != -1)
        {
            if (Time.time - thesock.asock.getcraft.vfloat < thesock.asock.getcraft.vfloat2)
            {
                //currentrecipe = thesock.asock.getcraft.vint;
                craftlevel = (Time.time - thesock.asock.getcraft.vfloat) / (1f * thesock.asock.getcraft.vfloat2);
                crafting = true;
            }
            else
            {
                foreach (Inventory.InvItem item in thesock.asock.getcraft.Result)
                {
                    for (int k = 0; k < 4; k++)
                    {
                        if (thesock.asock.getinvs.aninv.inv[k].socket.asock.name == item.socket.asock.name)
                        {
                            thesock.asock.getinvs.aninv.inv[k].num += item.num;
                            break;
                        }
                        else
                        {
                            if (thesock.asock.getinvs.aninv.inv[k].num == 0)
                            {
                                thesock.asock.getinvs.aninv.inv[k] = new Inventory.InvItem(item.socket, item.num);
                                break;
                            }
                        }
                    }
                }
                foreach (RawInv.rawlibitem item in thesock.asock.getcraft.ResultRaw)
                {
                    thesock.asock.getrawinvs.aninv.add(item.id, item.kg);
                }
                thesock.asock.getcraft.vfloat = -1;
            }
        }


        GUIStyle MenuStyle = new GUIStyle(prettyskinloseend.label);

        guitools.SetStyle(MenuStyle, guitools.RGB(255, 255, 255, 255), Color.black, (int)Math.Round(18f));

        Rect darect = guitools.GRectRelative(0.25f, 0f, 0.5f, 0.5f, SmallerRect);
        darect = guitools.GRectRelative(-0.125f, 0, 1.25f, 1, darect);
        //darect = guitools.GRectRelative(0.9f, darect);
        //darect = guitools.RectFromCenter(new Vector2(darect.x + darect.width/2f, darect.y + darect.height / 2f ), darect.height, darect.height);
        Rect rectA = guitools.GRectRelative(0, 0, 0.2f, 1, darect,0.9f);
        Rect rectB = guitools.GRectRelative(0.2f, 0, 0.4f, 1, darect, 0.9f);
        Rect rectC = guitools.GRectRelative(0.6f, 0.45f, 0.2f, 0.1f, darect, 0.9f);
        rectC = guitools.GRectRelative(0, -0.5f, 1, 1.5f, rectC);
        Rect rectD = guitools.GRectRelative(0.8f, 0, 0.2f, 1, darect, 0.9f);


        GUI.Label(rectA, "", MenuStyle);
        GUI.Label(rectB, "", MenuStyle);
        GUI.Label(guitools.GRectRelative(0,0,1,1.5f,rectC), "", MenuStyle);
        //GUI.Label(darect, "", MenuStyle);

        ///A Recipes
        guitools.SetStyle(MenuStyle, guitools.RGB(200, 200, 200, 255), Color.black, (int)Math.Round(8f));
        List<Recipe> reciplist = thesock.asock.getcraft.Recipes;
        int numofpages = (((reciplist.Count) - (reciplist.Count % 9))/9);
        GUI.Label(guitools.GRectRelative(0.25f,0,0.5f,0.1f,rectA,0.95f), "PAGE "+(page+1)+"/"+(numofpages+1), MenuStyle);
        if (GUI.Button(guitools.GRectRelative(0, 0, 0.25f, 0.1f, rectA, 0.95f), "<<", MenuStyle))
        {
            if (page > 0)
            {
                page--;
            }
        }
        if (GUI.Button(guitools.GRectRelative(0.75f, 0, 0.25f, 0.1f, rectA, 0.95f), ">>", MenuStyle))
        {
            if (page < numofpages)
            {
                page++;
            }
        }
        for (int k = 0; k < 9; k++)
        {
            int rk = k + 9 * page;
            if (rk < reciplist.Count)
            {
                if (GUI.Button(guitools.GRectRelative(0, 0.1f * (k + 1), 0.8f, 0.1f, rectA, 0.95f), reciplist[rk].name, MenuStyle) && !crafting)
                {
                    currentrecipe = rk;
                }
                int res = -1;
                foreach (int anint in thesock.asock.getcraft.autos)
                {
                    if (rk == anint)
                    {
                        res = rk;
                        break;
                    }
                }
                if (res != -1)
                {
                    guitools.SetStyle(MenuStyle, guitools.RGB(150, 250, 150, 255), Color.black, (int)Math.Round(8f));

                    if (GUI.Button(guitools.GRectRelative(0.8f, 0.1f * (k + 1), 0.2f, 0.1f, rectA, 0.95f), "A", MenuStyle) && !crafting)
                    {
                        thesock.asock.getcraft.autos.Remove(rk);
                    }
                }
                else
                {
                    guitools.SetStyle(MenuStyle, guitools.RGB(250, 150, 150, 255), Color.black, (int)Math.Round(8f));
                    if (GUI.Button(guitools.GRectRelative(0.8f, 0.1f * (k + 1), 0.2f, 0.1f, rectA, 0.95f), "A", MenuStyle) && !crafting)
                    {
                        thesock.asock.getcraft.autos.Add(rk);
                    }
                }
                guitools.SetStyle(MenuStyle, guitools.RGB(200, 200, 200, 255), Color.black, (int)Math.Round(8f));
            }
        }


        guitools.SetStyle(MenuStyle, guitools.RGB(200, 200, 200, 255), Color.black, (int)Math.Round(8f));
        ///B
        if (currentrecipe < reciplist.Count)
        {
            GUI.Label(guitools.GRectRelative(0.25f, 0, 0.5f, 0.1f, rectB, 0.95f), reciplist[currentrecipe].name, MenuStyle);
        }
        else
        {
            GUI.Label(guitools.GRectRelative(0, 0, 1, 0.1f, rectB, 0.95f), "RECIPE:", MenuStyle);
        }
        GUI.Label(guitools.GRectRelative(0, 0.1f, 0.5f, 0.1f, rectB, 0.95f), "REQUIRES:", MenuStyle);
        GUI.Label(guitools.GRectRelative(0.5f, 0.1f, 0.5f, 0.1f, rectB, 0.95f), "CRAFTS:", MenuStyle);

        List<string> write = new List<string>();
        foreach (Inventory.InvItem item in reciplist[currentrecipe].Items)
        {
            write.Add(item.socket.asock.disname + ": " + item.num);
        }
        foreach (RawInv.rawlibitem item in reciplist[currentrecipe].RawItems)
        {
            write.Add(item.raw.name + ": " + item.kg+"kg");
        }

        MenuStyle.alignment = TextAnchor.MiddleLeft;
        if (write.Count != 0)
        {
            for (int k = 0; k < write.Count; k++)
            {
                GUI.Label(guitools.GRectRelative(0, 0.2f + (0.8f) / (write.Count * 1f) * k, 0.5f, (0.8f) / (write.Count * 1f), rectB, 0.95f), write[k], MenuStyle);
            }
        }


        write = new List<string>();
        foreach (Inventory.InvItem item in reciplist[currentrecipe].Result)
        {
            write.Add(item.socket.asock.disname + ": " + item.num);
        }
        foreach (RawInv.rawlibitem item in reciplist[currentrecipe].ResultRaw)
        {
            write.Add(item.raw.name + ": " + item.kg + "kg");
        }
        if (write.Count != 0)
        {
            for (int k = 0; k < write.Count; k++)
            {
                GUI.Label(guitools.GRectRelative(0.5f, 0.2f + (0.8f) / (write.Count * 1f) * k, 0.5f, (0.8f) / (write.Count * 1f), rectB, 0.95f), write[k], MenuStyle);
            }
        }

        MenuStyle.alignment = TextAnchor.MiddleCenter;

        ///C
        GUI.Label(guitools.GRectRelative(0, 0, 1, 0.5f, rectC, 0.8f), "COST: " + reciplist[currentrecipe].eleccost + "EU", MenuStyle);
        GUI.Label(guitools.GRectRelative(0, 1, 1, 0.5f, rectC, 0.8f), "TIME: " + reciplist[currentrecipe].time + "", MenuStyle);
        if (crafting)
        {
            guitools.TextureStyle(MenuStyle, Twhite);
            guitools.SetStyle(MenuStyle, guitools.RGB(180, 180, 180, 255), Color.black, (int)Math.Round(8f));
            GUI.Label(guitools.GRectRelative(0, 0.5f, 1, 0.5f, rectC, 0.8f), "", MenuStyle);
            guitools.SetStyle(MenuStyle, guitools.RGB(120, 120, 120, 255), Color.black, (int)Math.Round(8f));
            GUI.Label(guitools.GRectRelative(0, 0.5f, 1* craftlevel, 0.5f, rectC, 0.8f), "", MenuStyle);


            guitools.TextureStyle(MenuStyle, Tvoid);
            GUI.Label(guitools.GRectRelative(0, 0.5f, 1, 0.5f, rectC, 0.8f), "CRAFT", MenuStyle);
            MenuStyle = new GUIStyle(prettyskinloseend.label);
        }
        else
        {
            if (GUI.Button(guitools.GRectRelative(0, 0.5f, 1, 0.5f, rectC, 0.8f), "CRAFT", MenuStyle))
            {
                bool candoit = true;

                if (thesock.asock.getelec.buffer < reciplist[currentrecipe].eleccost)
                {
                    candoit = false;
                }

                foreach (Inventory.InvItem item in reciplist[currentrecipe].Items)
                {
                    if (worldgen.maininfo.inv.getcount(item.socket.asock.name) < item.num)
                    {
                        candoit = false;
                    }
                }
                foreach (RawInv.rawlibitem item in reciplist[currentrecipe].RawItems)
                {
                    if (worldgen.maininfo.rawinv.getcount(item.id) < item.kg)
                    {
                        candoit = false;
                    }
                }
                if (candoit)
                {
                    thesock.asock.getelec.buffer -= reciplist[currentrecipe].eleccost;
                    foreach (Inventory.InvItem item in reciplist[currentrecipe].Items)
                    {
                        worldgen.maininfo.inv.remamount(item.socket.asock.name, item.num);
                    }
                    foreach (RawInv.rawlibitem item in reciplist[currentrecipe].RawItems)
                    {
                        worldgen.maininfo.rawinv.rem(item.id, item.kg);
                    }

                    thesock.asock.getcraft.vfloat = Time.time;
                    thesock.asock.getcraft.vfloat2 = reciplist[currentrecipe].time;
                    thesock.asock.getcraft.Result = reciplist[currentrecipe].Result;
                    thesock.asock.getcraft.ResultRaw = reciplist[currentrecipe].ResultRaw;

                    controls.hissoundsyst.stoaudio("mclang").Play();
                }
            }
        }
         
        
        ///D
        

        Inventory theinv = thesock.asock.getinvs.aninv;
        for (int k = 0; k < theinv.inv.Length; k++)
        {
            Rect therect = guitools.RectFromCenter(new Vector2(rectD.x + rectD.width / 2f, rectD.y + rectD.height / 2f), rectD.height / 4f,rectD.height);
            therect = guitools.GRectRelative(0.9f, therect);
            GUI.Label(therect, "", MenuStyle);



            guitools.SetStyle(MenuStyle, guitools.RGB(150, 150, 150, 255), Color.black, (int)Math.Round(18f));
            guitools.TextureStyle(MenuStyle, Twhite);
            guitools.TextureStyle(MenuStyle, Tvoid);
            int mink = k;
            Rect currect = guitools.GRectRelative(0,mink / 4f, 1, 1 / 4f, therect,0.75f);
            Inventory.InvItem curritem = theinv.inv[k];



            guitools.TextureStyle(MenuStyle, Twhite);
            guitools.SetStyle(MenuStyle, guitools.RGB(220, 220, 220, 255), Color.black, (int)Math.Round(18f));
            GUI.Label(guitools.GRectRelative(0.9f, currect), "", MenuStyle);
            if (curritem.socket.asock.name != "")
            {
                Vector2 mousepos = Converters.MouseToScreen(Input.mousePosition);
                curritem.DrawItem(currect, MenuStyle, Tvoid);
                if (guitools.isinrect(mousepos, currect))
                {
                    inventoryname = curritem.socket.asock.disname;
                }
            }

            guitools.TextureStyle(MenuStyle, Tvoid);
            guitools.SetStyle(MenuStyle, guitools.RGB(255, 255, 255, 255), Color.black, (int)Math.Round(18f));
            if (GUI.Button(guitools.GRectRelative(0.9f, currect), "", MenuStyle))
            {
                MouseInvHeld = curritem.InteractItem(MouseInvHeld, theinv, k);
            }

        }
    }
예제 #4
0
파일: gui.cs 프로젝트: Xangotrick/CYGNUS
    void DrawSingleSloatChest(socketIG thesock)
    {
        GUIStyle MenuStyle = new GUIStyle(prettyskin.label);

        guitools.SetStyle(MenuStyle, guitools.RGB(255, 255, 255, 255), Color.black, (int)Math.Round(18f));

        Rect darect = guitools.GRectRelative(0.25f, 0f, 0.5f, 0.5f, SmallerRect);
        darect = guitools.GRectRelative(0.9f, darect);
        darect = guitools.RectFromCenter(new Vector2(darect.x + darect.width / 2f, darect.y + darect.height / 2f), darect.height, darect.height);


        GUI.Label(darect, "", MenuStyle);

        darect = guitools.GRectRelative(0.25f, darect);
        Rect currect = darect;



        guitools.SetStyle(MenuStyle, guitools.RGB(150, 150, 150, 255), Color.black, (int)Math.Round(18f));
        guitools.TextureStyle(MenuStyle, Twhite);

        guitools.TextureStyle(MenuStyle, Tvoid);
        Inventory theinv = thesock.asock.getinvs.aninv;
        currect = guitools.GRectRelative(0.9f, currect);
        Inventory.InvItem curritem = theinv.inv[0];



        guitools.TextureStyle(MenuStyle, Twhite);
        guitools.SetStyle(MenuStyle, guitools.RGB(220, 220, 220, 255), Color.black, (int)Math.Round(18f));
        GUI.Label(guitools.GRectRelative(0.9f, currect), "", MenuStyle);
        if (curritem.socket.asock.name != "")
        {
            Vector2 mousepos = Converters.MouseToScreen(Input.mousePosition);
            curritem.DrawItem(currect, MenuStyle, Tvoid);
            if (guitools.isinrect(mousepos, currect))
            {
                inventoryname = curritem.socket.asock.disname;
            }
        }

        guitools.TextureStyle(MenuStyle, Tvoid);
        guitools.SetStyle(MenuStyle, guitools.RGB(255, 255, 255, 255), Color.black, (int)Math.Round(18f));
        if (GUI.Button(guitools.GRectRelative(0.9f, currect), "", MenuStyle))
        {
            MouseInvHeld = curritem.InteractItem(MouseInvHeld, theinv, 0);
        }
    }
예제 #5
0
파일: gui.cs 프로젝트: Xangotrick/CYGNUS
    void DrawChest01Menu(socketIG thesock)
    {
        GUIStyle MenuStyle = new GUIStyle(prettyskin.label);

        guitools.SetStyle(MenuStyle, guitools.RGB(255, 255, 255, 255), Color.black, (int)Math.Round(18f));

        Rect darect = guitools.GRectRelative(0.25f, 0f, 0.5f, 0.5f, SmallerRect);
        darect = guitools.GRectRelative(0.9f, darect);
        darect = guitools.RectFromCenter(new Vector2(darect.x + darect.width/2f, darect.y + darect.height / 2f ), darect.height, darect.height);


        GUI.Label(darect, "", MenuStyle);

        darect = guitools.GRectRelative(0.8f, darect);
        Rect line1 = guitools.GRectRelative(0, 0, 1, 0.25f, darect);
        Rect line2 = guitools.GRectRelative(0, 0.25f, 1, 0.25f, darect);
        Rect line3 = guitools.GRectRelative(0, 0.5f, 1, 0.25f, darect);
        Rect line4 = guitools.GRectRelative(0, 0.75f, 1, 0.25f, darect);
        Rect currect = line1;



        guitools.SetStyle(MenuStyle, guitools.RGB(150, 150, 150, 255), Color.black, (int)Math.Round(18f));
        guitools.TextureStyle(MenuStyle, Twhite);

        guitools.TextureStyle(MenuStyle, Tvoid);
        Inventory theinv = thesock.asock.getinvs.aninv;
        for (int k = 0; k < theinv.inv.Length; k++)
        {
            currect = line1;
            if (k > 3)
            {
                currect = line2;
            }
            if (k > 7)
            {
                currect = line3;
            }
            if (k > 11)
            {
                currect = line4;
            }
            int mink = k % 4;
            currect = guitools.GRectRelative(mink / 4f, 0, 1 / 4f, 1, currect);
            Inventory.InvItem curritem = theinv.inv[k];



            guitools.TextureStyle(MenuStyle, Twhite);
            guitools.SetStyle(MenuStyle, guitools.RGB(220, 220, 220, 255), Color.black, (int)Math.Round(18f));
            GUI.Label(guitools.GRectRelative(0.9f, currect), "", MenuStyle);
            if (curritem.socket.asock.name != "")
            {
                Vector2 mousepos = Converters.MouseToScreen(Input.mousePosition);
                curritem.DrawItem(currect, MenuStyle, Tvoid);
                if (guitools.isinrect(mousepos, currect))
                {
                    inventoryname = curritem.socket.asock.disname;
                }
            }

            guitools.TextureStyle(MenuStyle, Tvoid);
            guitools.SetStyle(MenuStyle, guitools.RGB(255, 255, 255, 255), Color.black, (int)Math.Round(18f));
            if (GUI.Button(guitools.GRectRelative(0.9f, currect), "", MenuStyle))
            {
                MouseInvHeld = curritem.InteractItem(MouseInvHeld, theinv, k);
            }

        }
    }
예제 #6
0
파일: gui.cs 프로젝트: Xangotrick/CYGNUS
    void DrawInventory(bool force = false)
    {
        if (isinvopen || force)
        {
            GUIStyle MenuStyle = new GUIStyle(prettyskinloseend.label);
            Rect darect = guitools.GRectRelative(0.25f, 0.5f, 0.5f, 0.5f, SmallerRect);
            Rect line1 = guitools.GRectRelative(0, 0, 1, 0.15f, darect);
            Rect line2 = guitools.GRectRelative(0, 0.15f, 1, 0.2f, darect);
            Rect line3 = guitools.GRectRelative(0, 0.15f + 0.2f, 1, 0.2f, darect);
            Rect line4 = guitools.GRectRelative(0, 0.15f + 0.4f, 1, 0.2f, darect);
            Rect line5 = guitools.GRectRelative(0, 0.15f + 0.6f, 1, 0.05f, darect);
            Rect line6 = guitools.GRectRelative(0, 0.8f, 1, 0.2f, darect);

            Rect selectinv = guitools.GRectRelative(0, 0.1f, 0.25f, 0.8f, line1);



            guitools.SetStyle(MenuStyle, guitools.RGB(255, 255, 255, 255), Color.black, (int)Math.Round(18f));

            GUI.Label(darect, "", MenuStyle);

            if(GUI.Button(guitools.GRectRelative(0,0,1/4f,1,selectinv),"I",MenuStyle))
            {
                invsetting = 0;
            }
            if(GUI.Button(guitools.GRectRelative(1/4f,0,1/4f,1,selectinv),"R",MenuStyle))
            {
                invsetting = 1;
            }

            if (invsetting == 0)
            {
                Rect currect = line2;

                guitools.SetStyle(MenuStyle, guitools.RGB(150, 150, 150, 255), Color.black, (int)Math.Round(18f));
                guitools.TextureStyle(MenuStyle, Twhite);


                GUI.Label(guitools.GRectRelative(0.25f, 0.1f, 0.5f, 0.8f, line1), inventoryname, MenuStyle);
                GUI.Label(guitools.GRectRelative(0.8f, line5), "", MenuStyle);

                guitools.TextureStyle(MenuStyle, Tvoid);
                Inventory theinv = worldgen.maininfo.inv;
                Vector2 mousepos = Converters.MouseToScreen(Input.mousePosition);
                for (int k = 0; k < theinv.inv.Length; k++)
                {
                    currect = line2;
                    if (k > 9)
                    {
                        currect = line3;
                    }
                    if (k > 19)
                    {
                        currect = line4;
                    }
                    if (k > 29)
                    {
                        currect = line6;
                    }
                    int mink = k % 10;
                    currect = guitools.GRectRelative(mink / 10f, 0, 1 / 10f, 1, currect);
                    Inventory.InvItem curritem = theinv.inv[k];
                    if (curritem.num == 0)
                    {
                        theinv.inv[k].socket = new socketIG();
                    }

                    if (k > 29)
                    {
                        controls.toolbar[mink] = theinv.inv[k];
                    }


                    guitools.TextureStyle(MenuStyle, Twhite);
                    guitools.SetStyle(MenuStyle, guitools.RGB(220, 220, 220, 255), Color.black, (int)Math.Round(18f));
                    GUI.Label(guitools.GRectRelative(0.9f, currect), "", MenuStyle);
                    if (curritem.socket.asock.name != "")
                    {
                        curritem.DrawItem(currect, MenuStyle, Tvoid);
                        if (guitools.isinrect(mousepos, currect))
                        {
                            inventoryname = curritem.socket.asock.disname;
                        }
                    }

                    guitools.TextureStyle(MenuStyle, Tvoid);
                    guitools.SetStyle(MenuStyle, guitools.RGB(255, 255, 255, 255), Color.black, (int)Math.Round(18f));
                    if (GUI.Button(guitools.GRectRelative(0.9f, currect), "", MenuStyle))
                    {
                        MouseInvHeld = curritem.InteractItem(MouseInvHeld, theinv, k);

                        controls.toolbar[controls.seltoolbar] = theinv.inv[30 + controls.seltoolbar];

                        if (controls.toolbar[controls.seltoolbar].socket.asock.isgun)
                        {
                            NetworkerPhoton.RPCAnim(false, true, false, false, worldgen.maininfo.photonid);
                        }
                        else
                        {
                            NetworkerPhoton.RPCAnim(false, false, false, false, worldgen.maininfo.photonid);
                        }
                    }
                }
            }

            if (invsetting == 1)
            {
                RawInv theinv = worldgen.maininfo.rawinv;
                Rect lineend = guitools.GRectRelative(0, 0.85f, 1, 0.15f, darect);
                guitools.SetStyle(MenuStyle, guitools.RGB(150, 150, 150, 255), Color.black, (int)Math.Round(18f));
                GUI.Label(guitools.GRectRelative(0.25f, 0.1f, 0.5f, 0.8f, line1), "Raw Ressource", MenuStyle);
                guitools.SetStyle(MenuStyle, guitools.RGB(150, 150, 150, 255), Color.black, (int)Math.Round(12f));
                GUI.Label(guitools.GRectRelative(0, 0.1f, 1/3f, 0.8f, lineend, 0.9f), "MASS: " + theinv.readkg + "kg OF "+theinv.maxmass+"kg", MenuStyle);

                if (theinv.inv.Count < 30)
                {
                    for (int k = 0; k < 30; k++)
                    {
                        Rect workingrect = guitools.GRectRelative(0, 0.15f, 1 / 3f, 0.7f, darect);
                        if (k > 9)
                        {
                            workingrect = guitools.GRectRelative(1 / 3f, 0.15f, 1 / 3f, 0.7f, darect);
                        }
                        if (k > 19)
                        {
                            workingrect = guitools.GRectRelative(2 / 3f, 0.15f, 1 / 3f, 0.7f, darect);
                        }
                        int mink = k % 10;
                        Rect slotrect = guitools.GRectRelative(0, mink / 10f, 1, 1 / 10f, workingrect,0.9f);

                        guitools.SetStyle(MenuStyle, guitools.RGB(230, 230, 230, 255), Color.black, (int)Math.Round(10f));
                        GUI.Label(slotrect, "", MenuStyle);

                        if(k < theinv.inv.Count)
                        {
                            guitools.SetStyle(MenuStyle, guitools.RGB(200, 200, 200, 255), Color.black, (int)Math.Round(8f));
                            GUI.Label(slotrect, "", MenuStyle);
                            guitools.TextureStyle(MenuStyle, Tvoid);
                            MenuStyle.alignment = TextAnchor.MiddleLeft;
                            GUI.Label(guitools.GRectRelative(0, 0, 2 / 3f, 1, slotrect), theinv.inv[k].raw.name + ": ", MenuStyle);
                            MenuStyle.alignment = TextAnchor.MiddleRight;
                            GUI.Label(guitools.GRectRelative(0, 0, 2 / 3f, 1, slotrect),theinv.inv[k].readkg + "kg", MenuStyle);

                            MenuStyle.alignment = TextAnchor.MiddleCenter;
                            guitools.TextureStyle(MenuStyle, TArrowRight);
                            guitools.SetStyle(MenuStyle, guitools.RGB(100, 100, 100, 255), Color.black, (int)Math.Round(10f));
                            GUI.Label(guitools.GRectRelative(0.2f,0,0.6f,1,guitools.GRectRelative(2 / 3f, 0, 1 / 6f, 1, slotrect, 0.9f)), "", MenuStyle);
                            MenuStyle = new GUIStyle(prettyskinloseend.label);
                            guitools.SetStyle(MenuStyle, guitools.RGB(175, 175, 175, 100), Color.black, (int)Math.Round(10f));
                            if (GUI.Button(guitools.GRectRelative(2 / 3f, 0, 1 / 6f, 1, slotrect), "", MenuStyle))
                            {
                                if (isinteracting)
                                {
                                    if (workingon.asock.israwinv)
                                    {
                                        float rest = workingon.asock.getrawinvs.aninv.add(theinv.inv[k].id, theinv.inv[k].kg);
                                        foreach (RawInv.rawlibitem item in theinv.inv)
                                        {
                                            if (item.id == theinv.inv[k].id)
                                            {
                                                item.kg = rest;
                                            }
                                        }
                                    reset:
                                        if (theinv.inv.Count > 0)
                                        {
                                            for (int k2 = 0; k2 < theinv.inv.Count; k2++)
                                            {
                                                if (theinv.inv[k2].kg <= 0)
                                                {
                                                    theinv.inv.RemoveAt(k2);
                                                    goto reset;
                                                }
                                            }
                                        }
                                    }
                                }
                            }



                            MenuStyle.alignment = TextAnchor.MiddleCenter;
                            guitools.TextureStyle(MenuStyle, Twhite);
                        }

                    }
                }
            }

            if (MouseInvHeld.socket.asock.name != "")
            {
                Vector2 mousepos = Converters.MouseToScreen(Input.mousePosition);

                Rect arect = new Rect(mousepos.x, mousepos.y, line2.height, line2.height);

                MouseInvHeld.DrawItem(arect, MenuStyle, Tvoid);
            }

        }
    }
예제 #7
0
	// Update is called once per frame
    void Update()
    {
        if (isonline)
        {
            isonfloor = (Mathf.Abs(blastz - lastz) == 0);
            Vector3 movedir = new Vector3();
            ////Mouse
            if (cam.controlmouse)
            {
                if (Input.GetAxis("Mouse ScrollWheel") != 0)
                {
                    if (Input.GetAxis("Mouse ScrollWheel") > 0)
                    {
                        seltoolbar += 1;
                        seltoolbar = seltoolbar % 10;
                    }
                    else
                    {
                        seltoolbar += 9;
                        seltoolbar = seltoolbar % 10;
                    }
                    if (selsock.isgun)
                    {
                        NetworkerPhoton.RPCAnim(false, true, false, false, worldgen.maininfo.photonid);
                    }
                    else
                    {
                        NetworkerPhoton.RPCAnim(false, false, false, false, worldgen.maininfo.photonid);
                    }
                }

                if (Input.GetMouseButtonDown(0))
                {
                    if (aimedpoint.y > -800)
                    {
                        if (selsock.isobject)
                        {
                        }
                        else
                        {
                            if (selsock.name != "" && toolbar[seltoolbar].num != 0)
                            {
                                Vector3 theangle = hiscam.eulerAngles;
                                theangle = new Vector3(theangle.x / 90f, theangle.y / 90f, theangle.z / 90f);
                                theangle = new Vector3(Mathf.RoundToInt(theangle.x), Mathf.RoundToInt(theangle.y), Mathf.RoundToInt(theangle.z));
                                theangle = 90 * theangle;
                                if (PhotonNetwork.inRoom)
                                {
                                    string thestring = fserial.saveasstring(selsock);
                                    NetworkerPhoton.RPCModTerrain(aimedpoint.x, aimedpoint.y, aimedpoint.z, thestring, theangle);
                                }
                                else
                                {
                                    Environment.MarkBuild(aimedpoint, selsock, theangle);
                                }
                                toolbar[seltoolbar].num--;
                                if (toolbar[seltoolbar].num == 0)
                                {
                                    toolbar[seltoolbar] = new Inventory.InvItem();
                                }
                                hissoundsyst.stoaudio(selsock.sound).Play();
                            }
                            else
                            {
                                buttondown = true;
                                downpresstime = Time.time;
                            }
                        }
                    }
                }
                if (Input.GetMouseButtonUp(0))
                {
                    buttondown = false;
                    hissoundsyst.SWeld.Stop();
                }
                if (Input.GetMouseButton(0))
                {
                    if (selsock.isgun)
                    {
                        if (Time.time - selsock.getgun.stamp > selsock.getgun.reset)
                        {
                            selsock.getgun.stamp = Time.time;
                            NetworkerPhoton.RPCSound("shoot", worldgen.maininfo.photonid);
                            NetworkerPhoton.RPCAnim(false, true, true, false, worldgen.maininfo.photonid);

                            Vector3 pos = worldgen.maininfo.tinstance.transform.FindChild("camhook").FindChild("handskel").transform.position;

                            Vector3 A = pos + worldgen.maininfo.tinstance.transform.FindChild("camhook").forward * 2;
                            Vector3 B = pos + worldgen.maininfo.tinstance.transform.FindChild("camhook").forward * (2 + selsock.getgun.range);

                            NetworkerPhoton.RPCPellet(A.x, A.y, A.z, B, 50, 150, "pellet", worldgen.maininfo.stats);
                        }
                    }
                    if (aimedpoint.y > -800)
                    {
                        if (selsock.name != "")
                        {
                        }
                        else
                        {
                            if (selsock.isobject)
                            {
                            }
                            else
                            {
                                if (!hissoundsyst.SWeld.isPlaying)
                                {
                                    hissoundsyst.SWeld.Play();
                                }
                                if (Time.time - downpresstime > downpressmax)
                                {
                                    ///SOLVE!
                                    if (Environment.getmapwmap(aimedpoint) != null)
                                    {
                                        if (Environment.getmapwmap(aimedpoint).asock.breakable)
                                        {
                                            if (PhotonNetwork.inRoom)
                                            {
                                                NetworkerPhoton.RPCAddDeath(aimedpoint.x, aimedpoint.y, aimedpoint.z);
                                            }
                                            else
                                            {
                                                Environment.MarkDead(aimedpoint);
                                            }
                                            if (Environment.getmapwmap(aimedpoint).asock.mineable)
                                            {
                                                gui.thelistofcaptures.Add("+1 " + Environment.getmapwmap(aimedpoint).asock.disname);
                                                int thenewint = -1;
                                                for (int k = 0; k < worldgen.maininfo.inv.inv.Length; k++)
                                                {
                                                    if (worldgen.maininfo.inv.inv[k].socket.asock.name != "")
                                                    {
                                                        if (worldgen.maininfo.inv.inv[k].socket.asock.name == Environment.getmapwmap(aimedpoint).asock.name)
                                                        {
                                                            worldgen.maininfo.inv.inv[k].num += 1;
                                                            thenewint = -2;
                                                            break;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (thenewint < 0)
                                                        {
                                                            thenewint = k;
                                                        }
                                                        thenewint = k;
                                                    }
                                                }

                                                if (thenewint >= 0)
                                                {
                                                    worldgen.maininfo.inv.inv[thenewint] = new Inventory.InvItem(new socketIG(socket.copysocket(Environment.getmapwmap(aimedpoint).asock), new Vector3(), null), 1);
                                                    if (thenewint > 29)
                                                    {
                                                        controls.toolbar[thenewint % 10] = worldgen.maininfo.inv.inv[thenewint];
                                                    }
                                                }
                                            }
                                            if (Environment.getmapwmap(aimedpoint).asock.isdrop)
                                            {
                                                foreach (RawInv.rawlibitem item in Environment.getmapwmap(aimedpoint).asock.getdrop.aninv.inv)
                                                {
                                                    worldgen.maininfo.rawinv.add(item.id, item.kg);
                                                    gui.thelistofcaptures.Add("+" + item.kg + "kg of " + item.raw.name);

                                                }
                                            }
                                            NetworkerPhoton.RPCDestroyBlock(aimedpoint.x, aimedpoint.y, aimedpoint.z);
                                            downpresstime = Time.time;
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        hissoundsyst.SWeld.Stop();
                    }
                }
            }

            if (cam.controlkeys)
            {
                /// Keyboard
                if (Input.GetKeyDown(KeyCode.V))
                {
                    NetworkerPhoton.RPCLight(worldgen.maininfo.photonid);
                }
                if (Input.GetKeyDown(KeyCode.R) && !isfightingmode)
                {
                    if (!selsock.isgun)
                    {
                        NetworkerPhoton.RPCAnim(true, false, false, false, worldgen.maininfo.photonid);
                    }
                }
                if (Input.GetKeyDown(KeyCode.U))
                {

                    socket[, ,] lib = new socket[16, 128, 16];
                    for (int k2 = lib.GetLength(1) - 1; k2 >= 0; k2--)
                    {
                        for (int k1 = 0; k1 <= 15; k1++)
                        {
                            for (int k3 = 0; k3 <= 15; k3++)
                            {
                                socketIG thenew = Environment.getmapwmap(new Vector3(k1, k2, k3));
                                if (thenew != null)
                                {
                                    lib[k1, k2, k3] = socket.copysocket(thenew.asock);
                                }
                            }
                        }
                    }


                    string astring = fserial.saveasstring(lib);

                    socks = (socket[, ,])fserial.loadasobj(astring);
                }
                if (Input.GetKeyDown(KeyCode.J))
                {


                    StartCoroutine(UpdateChunks());
                ///    
                ///    UpdateChunkss();
                }
                if (Input.GetKeyDown(KeyCode.C))
                {
                    randforcolor = guitools.Colorific();
                }
                if (Input.GetKey(KeyCode.Z) || Input.GetKey(KeyCode.UpArrow))
                {
                    movedir += hiscam.transform.forward * speed;
                }
                if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
                {
                    movedir += hiscam.transform.forward * speed * -1f;
                }

                if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
                {
                    movedir += hiscam.transform.right * speed;
                }

                if (Input.GetKey(KeyCode.Q) || Input.GetKey(KeyCode.LeftArrow))
                {
                    movedir += hiscam.transform.right * speed * -1f;
                }

                bool spellcast = false;

                if (Input.GetKeyDown(KeyCode.A) && isfightingmode)
                {
                    if (worldgen.maininfo.askill.actmembers[0] != -1)
                    {
                        skill askill = worldgen.maininfo.askill.act0;
                        if (Time.time - worldgen.maininfo.askill.actcool[0] > askill.cooldown)
                        {
                            worldgen.maininfo.askill.actcool[0] = Time.time;
                            NetworkerPhoton.RPCAnim(false, false, false, true, worldgen.maininfo.photonid);
                            NetworkerPhoton.RPCSkillSound(askill.dataname, worldgen.maininfo.photonid);
                            askill.runmethod();
                            spellcast = true;
                        }
                    }
                }

                if (Input.GetKeyDown(KeyCode.E) && isfightingmode)
                {
                    if (worldgen.maininfo.askill.actmembers[1] != -1)
                    {
                        skill askill = worldgen.maininfo.askill.act1;
                        if (Time.time - worldgen.maininfo.askill.actcool[1] > askill.cooldown)
                        {
                            worldgen.maininfo.askill.actcool[1] = Time.time;
                            NetworkerPhoton.RPCAnim(false, false, false, true, worldgen.maininfo.photonid);
                            NetworkerPhoton.RPCSkillSound(askill.dataname, worldgen.maininfo.photonid);
                            askill.runmethod();
                            spellcast = true;
                        }
                    }
                }

                if (Input.GetKeyDown(KeyCode.R) && isfightingmode)
                {
                    if (worldgen.maininfo.askill.actmembers[2] != -1)
                    {
                        skill askill = worldgen.maininfo.askill.act2;
                        if (Time.time - worldgen.maininfo.askill.actcool[2] > askill.cooldown)
                        {
                            worldgen.maininfo.askill.actcool[2] = Time.time;
                            NetworkerPhoton.RPCAnim(false, false, false, true, worldgen.maininfo.photonid);
                            NetworkerPhoton.RPCSkillSound(askill.dataname, worldgen.maininfo.photonid);
                            askill.runmethod();
                            spellcast = true;
                        }
                    }
                }

                if (Input.GetKeyDown(KeyCode.F) && isfightingmode)
                {
                    if (worldgen.maininfo.askill.actmembers[3] != -1)
                    {
                        skill askill = worldgen.maininfo.askill.act3;
                        if (Time.time - worldgen.maininfo.askill.actcool[3] > askill.cooldown)
                        {
                            worldgen.maininfo.askill.actcool[3] = Time.time;
                            NetworkerPhoton.RPCAnim(false, false, false, true, worldgen.maininfo.photonid);
                            NetworkerPhoton.RPCSkillSound(askill.dataname, worldgen.maininfo.photonid);
                            askill.runmethod();
                            spellcast = true;
                        }
                    }
                }
                if (spellcast)
                {

                    skill.getpasbystring("arcanemastery").anintval++;
                    for (int k = 0; k < 4; k++)
                    {
                        if (worldgen.maininfo.askill.pasmembers[k] != -1)
                        {
                            if (skill.pas[worldgen.maininfo.askill.pasmembers[k]].dataname == "arcanemastery")
                            {
                                if (skill.getpasbystring("arcanemastery").anintval == 4)
                                {

                                    skill.getpasbystring("arcanemastery").anintval = 0;
                                    worldgen.maininfo.askill.actcool[0] -= 4;
                                    worldgen.maininfo.askill.actcool[1] -= 4;
                                    worldgen.maininfo.askill.actcool[2] -= 4;
                                    worldgen.maininfo.askill.actcool[3] -= 4;
                                }
                                break;
                            }
                        }
                    }
                }

            }

            if (cam.controlmove)
            {
                
                if(worldgen.maininfo.stats.dir != new Vector2(0,0))
                {
                    movedir = new Vector3(worldgen.maininfo.stats.dir.normalized.x,0,worldgen.maininfo.stats.dir.normalized.y) * speed;

                }
                movedir = movedir * Time.deltaTime;
                movedir *= worldgen.maininfo.stats.coefmouv;

                float jumpSpeed = 8.0F;
                float gravity = 10f;
                float max = -9.81f;
                max = -5;

                if (Input.GetKey(KeyCode.Space))
                {
                    if ((worldgen.maininfo.oxg > 1f))
                    {
                        worldgen.maininfo.oxg = worldgen.maininfo.oxg - Time.deltaTime * 0.158f * 40 * 4f;
                        acc = 3 * 3f;
                        if (!hissoundsyst.SJetPack.isPlaying)
                        {
                            hissoundsyst.SJetPack.Play();
                        }
                    }
                    else
                    {
                        if (isonfloor)
                        {
                            acc = 6;
                        }
                        worldgen.maininfo.oxg = 0f;
                    }
                }
                else
                {
                    if (hissoundsyst.SJetPack.isPlaying)
                    {
                        hissoundsyst.SJetPack.Stop();
                    }
                }
                if (isonfloor)
                {
                    movedir.y = 0;

                }
                else
                {
                    if (acc > max)
                    {
                        acc -= 15 * Time.deltaTime;
                    }
                }
                if (Mathf.Abs(acc) < 0.1f)
                {
                    acc = -1;
                }

                movedir.y = acc * Time.deltaTime;

                blastz = lastz;
                cont.Move(movedir);
                lastz = transform.position.y;

            }

            Vector3 mouseDelta = Input.mousePosition - lastMouseCoordinate;
            lastMouseCoordinate = Input.mousePosition;
            RaycastHit thehit = new RaycastHit();
            if (selsock.isgun)
            {
                aimedpoint = new Vector3(0, -1000, 0);
                transcube.position = new Vector3(0, -1000, 0);
            }
            else
            {
                if (Physics.Raycast(new Ray(hiscam.transform.position, hiscam.transform.forward), out thehit, 5))
                {

                    if (selsock.name != "" && !selsock.isobject)
                    {
                        Vector3 pos = thehit.point - hiscam.transform.forward * 0.1f;
                        pos = new Vector3(Mathf.RoundToInt(pos.x), Mathf.RoundToInt(pos.y), Mathf.RoundToInt(pos.z));
                        aimedpoint = pos;
                        transcube.position = pos;
                    }
                    else
                    {
                        Vector3 pos = thehit.point + hiscam.transform.forward * 0.1f;
                        pos = new Vector3(Mathf.RoundToInt(pos.x), Mathf.RoundToInt(pos.y), Mathf.RoundToInt(pos.z));
                        aimedpoint = pos;
                        transcube.position = pos;
                    }
                }
                else
                {
                    aimedpoint = new Vector3(0, -1000, 0);
                    transcube.position = new Vector3(0, -1000, 0);
                }
            }
        }
	}
예제 #8
0
 public InvItem InteractItem(InvItem MouseInvHeld, Inventory theinv, int k)
 {
     if (Event.current.button == 1)
     {
         if (MouseInvHeld.num == 0)
         {
             if (socket.asock.name == "")
             {
                 //nil
             }
             else
             {
                 int taken = num / 2;
                 MouseInvHeld = new Inventory.InvItem(socket, taken);
                 theinv.inv[k] = new Inventory.InvItem(socket, num - taken);
             }
         }
         else
         {
             if (socket.asock.name == "")
             {
                 int taken = MouseInvHeld.num / 2;
                 theinv.inv[k] = new Inventory.InvItem(MouseInvHeld.socket, taken);
                 MouseInvHeld = new Inventory.InvItem(MouseInvHeld.socket, MouseInvHeld.num - taken);
             }
             else
             {
                 if (MouseInvHeld.socket.asock.name == socket.asock.name)
                 {
                     theinv.inv[k] = new Inventory.InvItem(MouseInvHeld.socket, num + MouseInvHeld.num);
                     MouseInvHeld = new Inventory.InvItem();
                 }
                 else
                 {
                     Inventory.InvItem BUFF = new Inventory.InvItem(MouseInvHeld.socket, MouseInvHeld.num);
                     MouseInvHeld = new Inventory.InvItem(socket, num);
                     theinv.inv[k] = new Inventory.InvItem(BUFF.socket, BUFF.num);
                 }
             }
         }
     }
     else
     {
         if (MouseInvHeld.num == 0)
         {
             if (socket.asock.name == "")
             {
                 //nil
             }
             else
             {
                 MouseInvHeld = new Inventory.InvItem(socket, num);
                 theinv.inv[k] = new Inventory.InvItem();
             }
         }
         else
         {
             if (socket.asock.name == "")
             {
                 theinv.inv[k] = new Inventory.InvItem(MouseInvHeld.socket, MouseInvHeld.num);
                 MouseInvHeld = new Inventory.InvItem();
             }
             else
             {
                 if (MouseInvHeld.socket.asock.name == socket.asock.name)
                 {
                     theinv.inv[k] = new Inventory.InvItem(MouseInvHeld.socket, num + MouseInvHeld.num);
                     MouseInvHeld = new Inventory.InvItem();
                 }
                 else
                 {
                     Inventory.InvItem BUFF = new Inventory.InvItem(MouseInvHeld.socket, MouseInvHeld.num);
                     MouseInvHeld = new Inventory.InvItem(socket, num);
                     theinv.inv[k] = new Inventory.InvItem(BUFF.socket, BUFF.num);
                 }
             }
         }
     }
     return MouseInvHeld;
 }