Exemplo n.º 1
0
        public List <GREntity3D> rayCastAll(Vec3 vec)
        {
            List <GREntity3D>     list  = new List <GREntity3D>();
            List <IGraphObject3D> list2 = this.m_cam.rayCastAll(vec);

            foreach (IGraphObject3D current in list2)
            {
                bool flag = current.helper.ContainsKey("$graphObj");
                if (flag)
                {
                    GREntity3D gREntity3D = current.helper["$graphObj"] as GREntity3D;
                    gREntity3D.dispathEvent(Define.EventType.RAYCASTED, null);
                    list.Add(gREntity3D);
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        public GREntity3D rayCast(Vec3 vec)
        {
            IGraphObject3D graphObject3D = this.m_cam.rayCast(vec);
            bool           flag          = graphObject3D != null && graphObject3D.helper.ContainsKey("$graphObj");
            GREntity3D     result;

            if (flag)
            {
                GREntity3D gREntity3D = graphObject3D.helper["$graphObj"] as GREntity3D;
                gREntity3D.dispathEvent(Define.EventType.RAYCASTED, null);
                result = gREntity3D;
            }
            else
            {
                result = null;
            }
            return(result);
        }
Exemplo n.º 3
0
        public void load(Variant conf)
        {
            bool flag = conf == null;

            if (!flag)
            {
                bool flag2 = conf.ContainsKey("part");
                if (flag2)
                {
                    this.m_part = conf["part"]._str;
                }
                bool flag3 = conf.ContainsKey("attachto");
                if (flag3)
                {
                    this.m_attachTo = conf["attachto"]._str;
                    string text  = null;
                    bool   flag4 = conf.ContainsKey("customMtrl");
                    if (flag4)
                    {
                        text = conf["customMtrl"]._str;
                    }
                    else
                    {
                        bool flag5 = conf.ContainsKey("mtrl");
                        if (flag5)
                        {
                            text = conf["mtrl"]._str;
                        }
                    }
                    bool flag6 = text != null;
                    if (flag6)
                    {
                        Variant materialConf = GraphManager.singleton.getMaterialConf(text);
                        bool    flag7        = materialConf != null;
                        if (flag7)
                        {
                            this.m_mtrl = new GRShader();
                            this.m_mtrl.load(materialConf);
                        }
                        else
                        {
                            DebugTrace.add(Define.DebugTrace.DTT_ERR, "Material [" + conf["mtrl"]._str + "] is missed!");
                        }
                    }
                    bool flag8 = conf.ContainsKey("cid");
                    if (flag8)
                    {
                        Variant characterConf = GraphManager.singleton.getCharacterConf(conf["cid"]._str);
                        bool    flag9         = characterConf == null;
                        if (flag9)
                        {
                            DebugTrace.add(Define.DebugTrace.DTT_ERR, "applyAvatar attachto cid[" + conf["cid"]._str + "] config not exist");
                        }
                        else
                        {
                            this.m_entity = (this.m_world.createEntity(Define.GREntityType.CHARACTER) as GREntity3D);
                            bool flag10 = this.m_mtrl != null;
                            if (flag10)
                            {
                                this.m_entity.load(characterConf, this.m_mtrl.graphMaterial, null);
                            }
                            else
                            {
                                this.m_entity.load(characterConf, null, null);
                            }
                        }
                    }
                    else
                    {
                        bool flag11 = conf.ContainsKey("eid");
                        if (flag11)
                        {
                            Variant entityConf = GraphManager.singleton.getEntityConf(conf["eid"]._str);
                            bool    flag12     = entityConf == null;
                            if (flag12)
                            {
                                DebugTrace.add(Define.DebugTrace.DTT_ERR, "applyAvatar attachto entid[" + conf["eid"]._str + "] config not exist");
                            }
                            else
                            {
                                this.m_entity = (this.m_world.createEntity(Define.GREntityType.STATIC_MESH) as GREntity3D);
                                bool flag13 = this.m_mtrl != null;
                                if (flag13)
                                {
                                    this.m_entity.load(entityConf, this.m_mtrl.graphMaterial, null);
                                }
                                else
                                {
                                    this.m_entity.load(entityConf, null, null);
                                }
                            }
                        }
                    }
                }
                else
                {
                    bool flag14 = conf.ContainsKey("mountto");
                    if (flag14)
                    {
                        this.m_mountTo = conf["mountto"];
                        Variant characterConf2 = GraphManager.singleton.getCharacterConf(conf["cid"]);
                        bool    flag15         = characterConf2 == null;
                        if (flag15)
                        {
                            DebugTrace.add(Define.DebugTrace.DTT_ERR, "applyAvatar mountto cid[" + conf["cid"]._str + "] config not exist");
                        }
                        else
                        {
                            this.m_entity = (this.m_world.createEntity(Define.GREntityType.CHARACTER) as GREntity3D);
                            this.m_entity.load(characterConf2, null, null);
                        }
                    }
                    else
                    {
                        bool flag16 = conf.ContainsKey("file");
                        if (flag16)
                        {
                            this.m_asset = os.asset.getAsset <IAssetSkAniMesh>(conf["file"]._str);
                        }
                        else
                        {
                            this.m_asset = null;
                        }
                        bool flag17 = conf.ContainsKey("obj");
                        if (flag17)
                        {
                            this.m_obj = conf["obj"]._str;
                        }
                        else
                        {
                            this.m_obj = conf["part"]._str;
                        }
                        string text2  = null;
                        bool   flag18 = conf.ContainsKey("customMtrl");
                        if (flag18)
                        {
                            text2 = conf["customMtrl"]._str;
                        }
                        else
                        {
                            bool flag19 = conf.ContainsKey("mtrl");
                            if (flag19)
                            {
                                text2 = conf["mtrl"]._str;
                            }
                        }
                        bool flag20 = text2 != null;
                        if (flag20)
                        {
                            Variant materialConf2 = GraphManager.singleton.getMaterialConf(text2);
                            bool    flag21        = materialConf2 != null;
                            if (flag21)
                            {
                                this.m_mtrl = new GRShader();
                                this.m_mtrl.load(materialConf2);
                            }
                            else
                            {
                                DebugTrace.add(Define.DebugTrace.DTT_ERR, "Material [" + conf["mtrl"]._str + "] is missed!");
                            }
                        }
                    }
                }
            }
        }