Exemple #1
0
 private void OnGesture(UnturnedPlayer user, UnturnedPlayerEvents.PlayerGesture gesture)
 {
     if (gesture == UnturnedPlayerEvents.PlayerGesture.PunchLeft || gesture == UnturnedPlayerEvents.PlayerGesture.PunchRight)
     {
         Transform trans = RaycastHelper.Raycast(user, 5f);
         if (trans == null)
         {
             return;
         }
         InteractableSign sign = trans.GetComponent <InteractableSign>();
         if (sign == null)
         {
             return;
         }
         string[] info = Utils.GetSignLink(sign.GetInstanceID());
         if (info == null)
         {
             return;
         }
         user.Player.sendBrowserRequest(info[0], info[1]);
     }
 }
Exemple #2
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer user = (UnturnedPlayer)caller;
            SignLink       main = SignLink.Instance;

            Transform trans = RaycastHelper.Raycast(user, 8f);

            if (trans == null)
            {
                UnturnedChat.Say(user, main.Translate("no_sign"), true);
                return;
            }
            InteractableSign sign = trans.GetComponent <InteractableSign>();

            if (sign == null)
            {
                UnturnedChat.Say(user, main.Translate("no_sign"), true);
                return;
            }
            if (command.Length != 2)
            {
                UnturnedChat.Say(user, main.Translate("error_usage"), true);
                return;
            }

            string msg  = command[0];
            string link = command[1];

            if (Utils.GetSignLink(sign.GetInstanceID()) != null)
            {
                UnturnedChat.Say(user, main.Translate("sign_already_exist"), true);
                return;
            }

            Utils.AddSignLink(sign.GetInstanceID(), msg, link);
            UnturnedChat.Say(user, main.Translate("sign_added"), true);
        }