Example #1
0
 public Notify()
 {
     Param          = "";
     Sign           = "";
     ExtraParam     = new ExtraParam();
     ExtraParamJson = "";
     ExtraSign      = "";
 }
        public ActionResult GetTestData(DataTableSettings model, ExtraParam modelParam)
        {
            var dt       = new PostsData();
            var result   = dt.Post.ToList();
            var jsonData = GetJsonObject(result.Count(), model, result, p => new IComparable[]
            {
                p.Id,
                p.Name,
                p.Description,
                p.Name + p.Description
            });

            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Example #3
0
 public Notify(NameValueCollection param)
 {
     if (param["param"] != null)
     {
         Param = HttpUtility.UrlDecode(param["param"]);
     }
     if (param["sign"] != null)
     {
         Sign = param["sign"];
     }
     if (param["extra_param"] != null)
     {
         ExtraParam     = new ExtraParam().FormJson(HttpUtility.UrlDecode(param["extra_param"]));
         ExtraParamJson = HttpUtility.UrlDecode(param["extra_param"]);
     }
     if (param["extra_sign"] != null)
     {
         ExtraSign = param["extra_sign"];
     }
 }
Example #4
0
    /// <summary>
    /// This method is called from child scripts. It sends a message to the CVE server on the specified channel.
    /// </summary>
    /// <param name="name"></param>
    /// <param name="value"></param>
    /// <param name="channel"></param>
    public void sendExtraParam(String name, float value, String channel)
    {
        FlatBufferBuilder builder = new FlatBufferBuilder(1);

        var channelInt = builder.CreateString(channel);

        var nameInt = builder.CreateString(name);
        var ext     = ExtraParam.CreateExtraParam(builder, nameInt, value);

        Message.StartMessage(builder);
        Message.AddMessageDataType(builder, Data.ExtraParam);
        Message.AddMessageData(builder, ext.Value);
        Message.AddChannel(builder, channelInt);

        var message = Message.EndMessage(builder);

        builder.Finish(message.Value);
        Byte[] byteA = builder.SizedByteArray();
        sendBytes(byteA);
    }
            public void Deserialize(OSDMap map)
            {
                GroupID = map["group-id"].AsUUID();
                Material = (Material)map["material"].AsInteger();
                Name = map["name"].AsString();
                Position = map["pos"].AsVector3();
                Rotation = map["rotation"].AsQuaternion();
                Scale = map["scale"].AsVector3();

                // Extra params
                OSDArray extraParams = map["extra_parameters"] as OSDArray;
                if (extraParams != null)
                {
                    ExtraParams = new ExtraParam[extraParams.Count];
                    for (int i = 0; i < extraParams.Count; i++)
                    {
                        ExtraParam extraParam = new ExtraParam();
                        extraParam.Deserialize(extraParams[i] as OSDMap);
                        ExtraParams[i] = extraParam;
                    }
                }
                else
                {
                    ExtraParams = new ExtraParam[0];
                }

                // Faces
                OSDArray faces = map["facelist"] as OSDArray;
                if (faces != null)
                {
                    Faces = new Face[faces.Count];
                    for (int i = 0; i < faces.Count; i++)
                    {
                        Face face = new Face();
                        face.Deserialize(faces[i] as OSDMap);
                        Faces[i] = face;
                    }
                }
                else
                {
                    Faces = new Face[0];
                }

                // Shape
                OSDMap shape = map["shape"] as OSDMap;
                OSDMap path = shape["path"] as OSDMap;
                PathBegin = (float)path["begin"].AsReal();
                PathCurve = path["curve"].AsInteger();
                PathEnd = (float)path["end"].AsReal();
                RadiusOffset = (float)path["radius_offset"].AsReal();
                Revolutions = (float)path["revolutions"].AsReal();
                ScaleX = (float)path["scale_x"].AsReal();
                ScaleY = (float)path["scale_y"].AsReal();
                ShearX = (float)path["shear_x"].AsReal();
                ShearY = (float)path["shear_y"].AsReal();
                Skew = (float)path["skew"].AsReal();
                TaperX = (float)path["taper_x"].AsReal();
                TaperY = (float)path["taper_y"].AsReal();
                Twist = (float)path["twist"].AsReal();
                TwistBegin = (float)path["twist_begin"].AsReal();

                OSDMap profile = shape["profile"] as OSDMap;
                ProfileBegin = (float)profile["begin"].AsReal();
                ProfileCurve = profile["curve"].AsInteger();
                ProfileEnd = (float)profile["end"].AsReal();
                ProfileHollow = (float)profile["hollow"].AsReal();

                OSDMap sculpt = shape["sculpt"] as OSDMap;
                if (sculpt != null)
                {
                    SculptID = sculpt["id"].AsUUID();
                    SculptType = (SculptType)sculpt["type"].AsInteger();
                }
                else
                {
                    SculptID = UUID.Zero;
                    SculptType = 0;
                }
            }
Example #6
0
    /// <summary>
    /// Called once per frame.
    ///
    /// Currently designed so that if messages are recieved more frequently than Update is called
    /// (i.e. at a rate higher than the framerate) then only the last message received is kept.
    /// This can be changed by extending the OnRecieve method, but for now there is no downside to this approach.
    /// </summary>
    private void Update()
    {
        if (messageReceived == true)
        {
            //Message message = Unity_CVE.Message.GetRootAsMessage(new ByteBuffer(receiveBytes));
            ChildUpdateHolder ObjectToUpdate = null;
            switch (this.lastMessage.Channel)
            {
            case "CH0":
                ObjectToUpdate = this.CH0_ChildUpdateHolder;
                break;

            case "CH1":
                ObjectToUpdate = this.CH1_ChildUpdateHolder;
                break;

            case "CH2":
                ObjectToUpdate = this.CH2_ChildUpdateHolder;
                break;

            case "CH3":
                ObjectToUpdate = this.CH3_ChildUpdateHolder;
                break;

            case "CH4":
                ObjectToUpdate = this.CH4_ChildUpdateHolder;
                break;

            case "CH5":
                ObjectToUpdate = this.CH5_ChildUpdateHolder;
                break;

            case "CH6":
                ObjectToUpdate = this.CH6_ChildUpdateHolder;
                break;

            default:
                //Channel is not one that is monitored.
                UnityEngine.Debug.Log("Received message on unwatched channel. Channel: " + this.lastMessage.Channel);
                break;
            }
            if (ObjectToUpdate != null)
            {
                //This switch is based on message type.
                switch (this.lastMessage.MessageDataType)
                {
                case Data.Location:
                    //this.lastMessage.GetMessageData<>();
                    Location loc = this.lastMessage.GetMessageData <Location>(new Location());
                    ObjectToUpdate.setLocation(loc.X, loc.Y, loc.Z);
                    UnityEngine.Debug.Log("Recieved loc: " + loc.X + loc.Y + loc.Z);
                    break;

                case Data.Position:
                    Position pos = this.lastMessage.GetMessageData <Position>(new Position());
                    ObjectToUpdate.setPosition(pos.X, pos.Y, pos.Z, pos.Roll, pos.Pitch, pos.Yaw);
                    UnityEngine.Debug.Log("Recieved pos: " + pos.X + pos.Y + pos.Z + pos.Roll + pos.Pitch + pos.Yaw);
                    break;

                case Data.Orientation:
                    Orientation ori = this.lastMessage.GetMessageData <Orientation>(new Orientation());
                    ObjectToUpdate.setOrientation(ori.Roll, ori.Pitch, ori.Yaw);
                    UnityEngine.Debug.Log("Recieved ori: " + ori.ToString());
                    break;

                case Data.ExtraParam:
                    ExtraParam ext = this.lastMessage.GetMessageData <ExtraParam>(new ExtraParam());
                    ObjectToUpdate.setExtraParam(ext.Name, ext.Value);
                    UnityEngine.Debug.Log("Recieved ext: " + ext.ToString());
                    break;

                default:
                    //Empty Message or Error.
                    UnityEngine.Debug.Log("Networking Script unable to determine the type of a recieved message.");
                    break;
                }
            }
            messageReceived = false;
        }
    }