コード例 #1
0
    public void onConnectButtonPressed()
    {
        if (NwkSystemBase.isServer())
        {
            NwkServer.nwkServer.disconnect();
        }

        if (!NwkClient.isClient())
        {
            Debug.LogWarning("not on client ? can't react to that button");
            return;
        }

        bool clientConnection = NwkClient.nwkClient.isConnected();

        NwkClient.nwkClient.log("clicked : " + btnConnect.GetComponentInChildren <Text>().text + " / is connected ? " + clientConnection);

        if (clientConnection)
        {
            NwkClient.nwkClient.disconnect();
        }
        else
        {
            NwkClient.nwkClient.connectToIpPort(); // ui view button connect
        }
    }
コード例 #2
0
    public void log(string ct, bool silent = false)
    {
        if (NwkClient.isClient())
        {
            ct = NwkClient.nwkUid + " " + ct;
        }

        Debug.Log(ct);

        NwkUiViewLogs nvLogs = getModule <NwkModViews>()?.getTab <NwkUiViewLogs>();

        if (nvLogs != null)
        {
            if (!silent)
            {
                nvLogs.addLog(ct);
            }
            else
            {
                nvLogs.addRaw(ct);
            }
        }
    }