Пример #1
0
 private void UnetClientBase_DataEvent(object sender, UnetClientBase.UnetDataMsg e)
 {
     MsgRevText.text = e.Msg;
     LogString       = $"Msg: {e.Msg} From: {e.ConnectionId}!";
     foreach (var img in GestImages)
     {
         if (MsgRevText.text.Contains(img.gameObject.name))
         {
             img.gameObject.SetActive(true);
         }
         else
         {
             img.gameObject.SetActive(false);
         }
     }
 }
Пример #2
0
    private void UnetClientBase_DataEvent(object sender, UnetClientBase.UnetDataMsg e)
    {
        var command = e.Msg.Split(',');

        int.TryParse(command[0], out _serverCommand);
        if (command.Length > 1)
        {
            var comm = int.TryParse(command[1], out _commCommand);
            Debug.Log(comm);
            if (!comm)
            {
                double.TryParse(command[1], out _serverMavCommand);
                _serverMavCommand = Convert.ToInt32(Mathf.Clamp((float)_serverMavCommand, 1, 5));
//                _serverMavCommand = Convert.ToInt32(Mathf.Clamp((float)_serverMavCommand, 1, 5)*10);
            }
        }
        _serverCommandNew = true;
    }
Пример #3
0
    private void UnetClientBase_DataEvent(object sender, UnetClientBase.UnetDataMsg e)
    {
        var parse = int.TryParse(e.Msg, out _serverCommand);

        _serverCommandNew = parse;
    }
Пример #4
0
    private void UnetClientBase_DataEvent(object sender, UnetClientBase.UnetDataMsg e)
    {
        if (string.IsNullOrEmpty(e.Msg))
        {
            return;
        }
//        if (e.Msg.Equals("0"))
//        {
//            Debug.Log($"0");
//        }
//        else if (e.Msg.Equals("w"))
//        {
//            Debug.Log($"w");
//        }
//        else if (e.Msg.Equals("s"))
//        {
//            Debug.Log($"s");
//        }
//        else
//        {
//            Debug.Log($"default");
//        }
        int commandNum;

        int.TryParse(e.Msg, out commandNum);
        switch (commandNum)
        {
        case 0:
            Mario.transform.parent = Mario.transform.parent == null ? ArImage.transform:null;
            break;

        case 1:
            Mario.transform.Translate(new Vector3(0, 0, 1) * Time.deltaTime * _speed);
            break;

        case 2:
            Mario.transform.Translate(new Vector3(0, 0, -1) * Time.deltaTime * _speed);
            break;

        case 3:
            Mario.transform.Translate(new Vector3(-1, 0, 0) * Time.deltaTime * _speed);
            break;

        case 4:
            Mario.transform.Translate(new Vector3(1, 0, 0) * Time.deltaTime * _speed);
            break;

        case 5:
//                float.TryParse(e.Msg, out _scale);
            Mario.transform.localScale = Mario.transform.localScale * 1.1f;
            break;

        case 6:
//                float.TryParse(e.Msg, out _scale);
            Mario.transform.localScale = Mario.transform.localScale * 0.9f;
            break;

        default:
            float.TryParse(e.Msg, out _speed);
            break;
        }
    }