Example #1
0
        private void MainApplication_SceneNodeClicked(SceneObjectType sceneObjectType, object sceneObject, bool suppressTreeViewClick)
        {
            //if we get a null sceneObject it indicates a reset of the previously selected node and reset of the font on the previously selected item
            if (sceneObject == null)
            {
                if (_previouslySelectedNode != null && !_previouslySelectedNode.IsDeleted)
                {
                    TreeNode[] previousNode = sceneTreeView.Nodes.Find(_previouslySelectedNode.Name, true); //there should only be one!
                    if (previousNode != null)
                    {
                        foreach (TreeNode node in previousNode)
                        {
                            node.NodeFont = new Font("Arial", 8.0f, FontStyle.Regular);
                        }
                    }
                    _previouslySelectedNode = null;
                }
                return;
            }

            Node sceneNode = (Node)sceneObject;

            TreeNodeCollection childNodes = sceneTreeView.Nodes[0].Nodes;

            var treeNodes = childNodes.Find(sceneNode.Name, false);

            _suppressTreeViewClick = suppressTreeViewClick;

            if (!_suppressTreeViewClick)
            {
                SceneTreeView_NodeMouseClick(sceneObject, new TreeNodeMouseClickEventArgs(treeNodes[0], MouseButtons.Left, 1, 0, 0));
            }
        }
Example #2
0
 public SceneObject(string Name)
 {
     this._Name   = Name;
     this._ID     = Guid.NewGuid().ToString();
     this._Type   = SceneObjectType.Undefined;
     this._Events = new EventsPackage();
     this._Data   = new Dictionary <string, object>();
 }
Example #3
0
 public SceneObject(SceneObject SO, Scene ParentScene)
 {
     this._Name        = SO._Name;
     this._ID          = Guid.NewGuid().ToString();
     this._Type        = SO._Type;
     this._ParentScene = ParentScene;
     this._Events      = new EventsPackage();
     this._Data        = new Dictionary <string, object>(SO._Data);
 }
Example #4
0
        internal SceneObject(string name, SceneObjectType type, InteropTransform transform)
        {
            Name = name;

            data = new InteropSceneObject
            {
                name      = name,
                type      = type,
                transform = transform
            };
        }
Example #5
0
        internal SceneObject(string name, SceneObjectType type)
        {
            Name = name;

            data = new InteropSceneObject
            {
                name     = name,
                type     = type,
                material = "Default"
            };

            uvLayers = new Dictionary <int, InteropVector2[]>();
        }
Example #6
0
        public void OnAckSceneObjInfoChange(SprotoTypeBase result)
        {
            // Debug.Log("synch from net received OnAckSceneObjInfoChange:"+(result!=null).ToString());
            SprotoType.scene_get_objs_info_change.request req = new SprotoType.scene_get_objs_info_change.request();
            NetMsgDispatcher.GetInstance().SendMessage <Protocol.scene_get_objs_info_change>(req, OnAckSceneObjInfoChange);
            SprotoType.scene_get_objs_info_change.response ack = result as SprotoType.scene_get_objs_info_change.response;
            if (ack == null)
            {
                return;
            }
            int len = ack.obj_infos.Count;

            for (int i = 0; i < len; i++)
            {
                long   uid              = ack.obj_infos[i].scene_obj_uid;
                Entity scene_obj        = SceneMgr.Instance.GetSceneObject(uid);
                var    change_info_list = ack.obj_infos[i].info_list;
                int    info_len         = change_info_list.Count;
                // Debug.Log("uid : "+uid.ToString()+ " info_len:"+info_len.ToString());
                for (int info_index = 0; info_index < info_len; info_index++)
                {
                    var cur_change_info = change_info_list[info_index];
                    // Debug.Log("cur_change_info.key : "+cur_change_info.key.ToString()+" scene_obj:"+(scene_obj!=Entity.Null).ToString()+ " ContainsKey:"+changeFuncDic.ContainsKey((SceneInfoKey)cur_change_info.key).ToString()+" uid"+uid.ToString()+" value:"+cur_change_info.value.ToString());
                    if (cur_change_info.key == (int)SceneInfoKey.EnterScene)
                    {
                        if (scene_obj == Entity.Null)
                        {
                            SceneObjectType sceneObjType = (SceneObjectType)Enum.Parse(typeof(SceneObjectType), cur_change_info.value);
                            scene_obj = SceneMgr.Instance.AddSceneObject(uid, sceneObjType);
                        }
                    }
                    else if (cur_change_info.key == (int)SceneInfoKey.LeaveScene)
                    {
                        if (scene_obj != Entity.Null)
                        {
                            SceneMgr.Instance.RemoveSceneObject(uid);
                            scene_obj = Entity.Null;
                        }
                    }
                    else if (scene_obj != Entity.Null && changeFuncDic.ContainsKey((SceneInfoKey)cur_change_info.key))
                    {
                        changeFuncDic[(SceneInfoKey)cur_change_info.key](scene_obj, cur_change_info);
                    }
                }
            }
        }
Example #7
0
        private void MainApplication_SceneNodeClicked(SceneObjectType sceneObjectType, object sceneObject, bool suppressTreeViewClick)
        {
            //if we get a null sceneObject it indicates a reset of the previously selected node and reset of the font on the previously selected item
            if (sceneObject == null)
            {
                if (_previouslySelectedNode != null && !_previouslySelectedNode.IsDeleted)
                {
                    TreeNode[] previousNode = _sceneTreeView.Nodes.Find(_previouslySelectedNode.Name, true); //there should only be one!
                    if (previousNode != null)
                    {
                        foreach (TreeNode node in previousNode)
                        {
                            node.NodeFont = new Font("Arial", 8.0f, FontStyle.Regular);
                        }
                    }
                    _previouslySelectedNode = null;
                }
                return;
            }

            Node sceneNode = (Node)sceneObject;

            TreeNodeCollection childNodes = _sceneTreeView.Nodes[0].Nodes;

            var treeNodes = childNodes.Find(sceneNode.Name, false);

            _suppressTreeViewClick = suppressTreeViewClick;

            if (!_suppressTreeViewClick)
            {
                if (treeNodes.Length > 0)
                {
                    SceneTreeView_NodeMouseClick(sceneObject, new TreeNodeMouseClickEventArgs(treeNodes[0], MouseButtons.Left, 1, 0, 0));
                }
                else
                {
                    //something has gone badly wrong - selection state will not be correct
                    //if there are no treeNodes (e.g. a gizmo is able to be selected when its main node has not)
                    MessageBox.Show("A direct selection of '" + sceneNode.Name + "' will leave selection in an unstable state - you will need to restart the program!!!", "Invalid selection", MessageBoxButtons.OK);
                }
            }
        }
Example #8
0
        private void SendShowObjectPropertiesMessage(SceneObjectType objectType, object sceneObject)
        {
            if (_mainApplication != null)
            {
                PulsarMessage message = new PulsarMessage
                {
                    Type       = PulsarMessage.MessageType.ShowObjectProperties,
                    Iterations = 1
                };

                message.Properties.Add("sceneObjectType", objectType);
                message.Properties.Add("sceneObject", sceneObject);
                message.Properties.Add("externallySet", false);

                if (message != null)
                {
                    _mainApplication.MessageQueue.PushMessage(message);
                }
            }
        }
Example #9
0
    public SceneObject(SceneObjectType obj_type, int id = -1)
    {
        SceneGlobals.physics_objects.Add(this);
        sceneObjectType = obj_type;

        if (id < 0)
        {
            ID = 3;
            // Attention to while loop
            while (TotObjectList.ContainsKey(ID))
            {
                ID++;
            }
            TotObjectList.Add(ID, this);
        }
        else
        {
            ID = id;
            TotObjectList [id] = this;
        }
    }
Example #10
0
        public void SetProperties(SceneObjectType sceneObjectType, object sceneObject, bool externallySet)
        {
            switch (sceneObjectType)
            {
            case SceneObjectType.Light:
                CreateLightProperties(sceneObject, externallySet);
                break;

            case SceneObjectType.Camera:
                CreateCameraProperties(sceneObject, externallySet);
                break;

            case SceneObjectType.Plane:
                CreatePlaneProperties(sceneObject, externallySet);
                break;

            case SceneObjectType.Node:
                CreateNodeProperties(sceneObject, externallySet);
                break;
            }
        }
    private void ObjectTriggered(SceneObjectType objectType)
    {
        switch (objectType)
        {
        case SceneObjectType.SelfRacket:
        case SceneObjectType.EnemyRacket:
            IncreaseMatchPoints();
            break;

        case SceneObjectType.SelfPlayerZone:
            PlayerType playerType = currentGameMode == GameMode.SinglePlayerMode
                    ? PlayerType.Self : PlayerType.Enemy;

            AddScore(playerType);
            break;

        case SceneObjectType.EnemyPlayerZone:
            AddScore(PlayerType.Self);
            break;
        }
    }
Example #12
0
 public SceneObject GetObject(SceneObjectType objectType)
 {
     return(objectsMap[objectType]);
 }