Ejemplo n.º 1
0
    void AddJS(int index, string name, string code)
    {
        GameObject scriptPannelObj = (GameObject)Instantiate(Resources.Load("ScriptPannel"));

        scriptPannelObj.GetComponent <DragHandler>().enabled = false;
        scriptPannelObj.transform.SetParent(teamList.transform.GetChild(index));
        scriptPannelObj.transform.localScale = Vector3.one;

        var scriptPannel = scriptPannelObj.GetComponent <JavascriptPannel>();

        scriptPannel.jsInfo.name   = name;
        scriptPannel.jsInfo.code   = code.Replace(Convert.ToChar(0x0).ToString(), "");;
        scriptPannel.jsInfo.color  = GoodColor.DequeueColor();
        scriptPannel.jsInfo.isMine = false;
        scriptPannel.UpdateInfo();
    }
Ejemplo n.º 2
0
    public void AddTeam(bool sendMessage = true)
    {
        GameObject pannel = (GameObject)Instantiate(Resources.Load("TeamPannel"));

        pannel.transform.SetParent(transform);
        pannel.transform.localScale = Vector3.one;

        pannel.GetComponent <Image>().color = GoodColor.DequeueColor();

        teamPannels.Add(pannel);

        if (NetworkValues.isServer && NetworkValues.isNetwork && sendMessage)
        {
            Client.instance.Send(NetworkDecorator.AttachHeader(NetworkHeader.ADDTEAM));
        }
    }
Ejemplo n.º 3
0
    void AttachPannels()
    {
        string[] javascriptPaths = LoadJavascripts();

        foreach (string path in javascriptPaths)
        {
            GameObject scriptPannelObj = (GameObject)Instantiate(Resources.Load("ScriptPannel"));
            scriptPannelObj.transform.SetParent(transform);
            scriptPannelObj.transform.localScale = Vector3.one;

            var scriptPannel = scriptPannelObj.GetComponent <JavascriptPannel>();
            scriptPannel.jsInfo.name   = Path.GetFileNameWithoutExtension(path);
            scriptPannel.jsInfo.code   = File.ReadAllText(path);
            scriptPannel.jsInfo.color  = GoodColor.DequeueColor();
            scriptPannel.jsInfo.isMine = true;
            scriptPannel.UpdateInfo();
        }
    }