Beispiel #1
0
 //方法
 public void OnUnityCall(object sender, AxUnityWebPlayerAXLib._DUnityWebPlayerAXEvents_OnExternalCallEvent e)
 {
     if (UnityCall != null)
     {
         UnityCall(sender, e);
     }
 }
Beispiel #2
0
 void _axUnityWebPlayer_OnExternalCall(object sender, AxUnityWebPlayerAXLib._DUnityWebPlayerAXEvents_OnExternalCallEvent e)
 {
     ///接受到LOAD_COMPLETE说明WEBPLAYER初始化完毕
     if (e.value.StartsWith("LOAD_COMPLETE"))
     {
         this.Visible = true;
         init         = true;
         if (!_axUnityWebPlayer.Visible)
         {
             _axUnityWebPlayer.Width  = this.Width;
             _axUnityWebPlayer.Height = this.Height;
             _axUnityWebPlayer.Show();
         }
     }
     OnUnityCall(sender, e);
 }
Beispiel #3
0
        /// <summary>
        /// 接收unity消息的响应函数
        /// <summary>
        private void axUnityWebPlayerMain_OnExternalCall(object sender, AxUnityWebPlayerAXLib._DUnityWebPlayerAXEvents_OnExternalCallEvent e)
        {
            MessageBox.Show("接收到Unity的消息了" + e.value);
            int    lth    = e.value.Length;
            string subMsg = null;

            if (lth == 9)
            {
                subMsg = e.value.Substring(2, 4);
            }
            if (lth == 18)
            {
                subMsg = e.value.Substring(2, 13);
            }
            HandleUnityMsg(subMsg);
        }
Beispiel #4
0
 private void axUnityWebPlayer1_OnExternalCall(object sender, AxUnityWebPlayerAXLib._DUnityWebPlayerAXEvents_OnExternalCallEvent e)
 {
 }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _u3dPlayerControl_UnityCall(object sender, AxUnityWebPlayerAXLib._DUnityWebPlayerAXEvents_OnExternalCallEvent e)
        {
            try
            {
                string   message = e.value;
                string[] list    = message.Split('"');
                for (int i = 0; i < list.Length; i++)
                {
                    if (list[i].StartsWith("@"))
                    {
                        iS3UnityMessage myMessage = MessageConverter.DeSerializeMessage(list[i]);
                        switch (myMessage.type)
                        {
                        case MessageType.SendUnityLayer:
                            break;

                        case MessageType.SetObjSelectState:
                            SetObjSelectStateMessage _message = myMessage as SetObjSelectStateMessage;
                            string   _path      = _message.path;
                            int      id         = int.Parse(_path.Split('/')[_path.Split('/').Length - 1]);
                            bool     isSelected = _message.iSSelected;
                            DGObject obj        = null;
                            foreach (string key in prj.objsLayerIndex.Keys)
                            {
                                DGObjects objs = prj.objsLayerIndex[key];
                                if ((objs.definition.Has3D) && (_path.StartsWith(objs.definition.Layer3DName)))
                                {
                                    foreach (DGObject _obj in objs.values)
                                    {
                                        if (_obj.fullName == id.ToString())
                                        {
                                            obj = _obj;
                                            break;
                                        }
                                    }
                                }
                            }
                            if (obj != null && objSelectionChangedTrigger != null)
                            {
                                ObjSelectionChangedEventArgs args = new ObjSelectionChangedEventArgs();
                                if (isSelected)
                                {
                                    args.addedObjs = new Dictionary <string, IEnumerable <DGObject> >();
                                    List <DGObject> objs = new List <DGObject>()
                                    {
                                        obj
                                    };
                                    args.addedObjs.Add(obj.parent.definition.GISLayerName, objs);
                                }
                                else
                                {
                                    args.removedObjs = new Dictionary <string, IEnumerable <DGObject> >();
                                    List <DGObject> objs = new List <DGObject>()
                                    {
                                        obj
                                    };
                                    args.removedObjs.Add(obj.parent.definition.GISLayerName, objs);
                                }
                                objSelectionChangedTrigger(this, args);
                            }
                            break;

                        case MessageType.SetObjShowState:
                            break;

                        default: break;
                        }
                    }
                }
            }
            catch { }
        }