Esempio n. 1
0
 virtual public void onStart(Variant conf)
 {
     if (started)
     {
         return;
     }
     started       = true;
     instance      = this;
     dDropItem     = new Dictionary <uint, DropItem>();
     dDropItem_own = new Dictionary <uint, DropItem>();
     dDropFakeItem = new Dictionary <uint, DropItem>();
     dPickItem     = new Dictionary <uint, DropItem>();
     clearlist();
     svrConf     = conf;
     fakeItemIdx = 0;
     SceneCamera.refreshMiniMapCanvas();
     process = new TickItem(onTick);
     TickMgr.instance.addTick(process);
     initRoomObj();
     if (a1_gamejoy.inst_skillbar)
     {
         a1_gamejoy.inst_skillbar.clearCD();
     }
     goldnum           = 0;
     expnum            = PlayerModel.getInstance().exp;
     lvl               = PlayerModel.getInstance().lvl;
     zhuan             = PlayerModel.getInstance().up_lvl;
     a3_fb_finish.room = this;
 }
Esempio n. 2
0
    public void HitAndStop(int ani = -1, bool shake = false)
    {
        bool flag = this.m_aniTrack != null;

        if (flag)
        {
            this.m_aniTrack.speed = 0f;
        }
        bool flag2 = this.m_aniFx != null;

        if (flag2)
        {
            bool flag3 = ani == -1;
            if (flag3)
            {
                this.m_aniFx.SetTrigger(EnumAni.ANI_T_FXDEAD);
            }
            else
            {
                this.m_aniFx.SetTrigger(ani);
            }
        }
        if (shake)
        {
            SceneCamera.cameraShake(0.4f, 20, 0.5f);
        }
    }
Esempio n. 3
0
        void onMapClick(GameObject go, Vector2 mappos)
        {
            Vector2 pos2;

            if (RectTransformUtility.ScreenPointToLocalPointInRectangle(worldmap.instance.m_goMapcon.GetComponent <RectTransform>(), mappos, InterfaceMgr.ui_Camera_cam, out pos2))
            {
                pos2 = Quaternion.Inverse(mapRotation) * pos2;
                Vector3 pos = SceneCamera.getPosByMiniMap(pos2, mapScale);
                if (pos.x == Mathf.Infinity)
                {
                    return;
                }

                if (SelfRole.fsm.Autofighting)
                {
                    SelfRole.fsm.Stop();
                }
                SelfRole.moveto(pos, null);
            }


            //Vector3 offset = go.transform.position;


            //mappos.x = mappos.x - offset.x;
            //mappos.y = mappos.y - offset.y;
            //Vector3 pos = SceneCamera.getPosByMiniMap(mappos, mapScale);
            //if (pos.x == Mathf.Infinity)
            //    return;

            //SelfRole.moveto(pos, null);
        }
        public void initm_minimap_camara()
        {
            camGo = GameObject.Find("camera_camera_minimap(Clone)");
            if (m_minimap_camara == null)
            {
                GameObject temogo = GAMEAPI.ABUI_LoadPrefab("camera_camera_minimap");
                camGo = GameObject.Instantiate(temogo) as GameObject;
                Application.DontDestroyOnLoad(camGo);
                SceneCamera.refreshMiniMapCanvas();  //临时
            }
            m_minimap_camara = camGo.transform.FindChild("camera").GetComponent <Camera>();

            RectTransform trans = GameObject.Find("camcon").GetComponent <RectTransform>();

            Vector3 pos0 = trans.position;

            camGo.transform.SetParent(this.transform);
            camGo.transform.SetAsFirstSibling();
            float   w    = (Baselayer.uiWidth + trans.anchoredPosition.x - trans.rect.width) / Baselayer.uiWidth;
            float   h    = (Baselayer.uiHeight + trans.anchoredPosition.y - trans.rect.height) / Baselayer.uiHeight;
            Vector3 pos1 = InterfaceMgr.ui_Camera_cam.WorldToScreenPoint(pos0);

            m_minimap_camara.rect = new UnityEngine.Rect(w, h, trans.sizeDelta.x / Baselayer.uiWidth, trans.sizeDelta.y / Baselayer.uiHeight);

            refreshMiniCam();
        }
Esempio n. 5
0
    private void Awake()
    {
        if (CameraController.Instance != null && CameraController.Instance.gameObject.activeInHierarchy)
        {
            gameObject.SetActive(false);
        }

        if (NetworkServer.active)
        {
            if (directionalLight != null)
            {
                Destroy(directionalLight);
            }
            Destroy(gameObject);
            return;
        }

        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
Esempio n. 6
0
        private static Camera FindOrCreateCamera()
        {
            _sceneCamera = SceneUtils.GetObjectsInScene <SceneCamera>(true).FirstOrDefault();

            if (_sceneCamera == null)
            {
                GameObject cameraPreview = new GameObject("[Camera Preview]");
                cameraPreview.transform.SetParent(_worldDescriptor.transform, true);
                cameraPreview.transform.position = new Vector3(0, 1, 0);

                _sceneCamera        = cameraPreview.AddComponent <SceneCamera>();
                _sceneCamera.Width  = PreviewSize;
                _sceneCamera.Height = PreviewSize;
                _sceneCamera.GetComponent <Camera>().targetTexture = new RenderTexture(512, 512, 16);
            }
            else
            {
                _sceneCamera.gameObject.name = "[Camera Preview]";
                _sceneCamera.transform.SetParent(_worldDescriptor.transform, true);
            }

            _sceneCamera.gameObject.SetActive(true);

            _camera         = _sceneCamera.GetComponent <Camera>();
            _camera.enabled = true;

            return(_camera);
        }
        private int Hit(Vector2 pointer, Vector3[] vertices, Vector3[] normals)
        {
            float minMag = float.MaxValue;
            int   index  = -1;

            for (int i = 0; i < vertices.Length; ++i)
            {
                Vector3 normal = normals[i];
                normal = HandlesTransform.MultiplyVector(normal);
                Vector3 vertex      = vertices[i];
                Vector3 vertexWorld = HandlesTransform.MultiplyPoint(vertices[i]);

                if (Mathf.Abs(Vector3.Dot((SceneCamera.transform.position - vertexWorld).normalized, normal.normalized)) > 0.999f)
                {
                    continue;
                }

                if (!HitOverride(i, vertex, normal))
                {
                    continue;
                }

                Vector2 vertexScreen = SceneCamera.WorldToScreenPoint(vertexWorld);
                float   distance     = (vertexScreen - pointer).magnitude;
                if (distance < minMag && distance <= SelectionMargin)
                {
                    minMag = distance;
                    index  = i;
                }
            }

            return(index);
        }
        private RuntimeHandleAxis Hit()
        {
            float hit1Distance;
            float hit2Distance;
            Ray   ray   = SceneCamera.ScreenPointToRay(InputController._MousePosition);
            float scale = RuntimeHandles.GetScreenScale(Target.position, SceneCamera) * RuntimeHandles.HandleScale;

            if (Intersect(ray, Target.position, outerRadius * scale, out hit1Distance, out hit2Distance))
            {
                Vector3 dpHitPoint;
                GetPointOnDragPlane(GetDragPlane(), InputController._MousePosition, out dpHitPoint);

                RuntimeHandleAxis axis = HitAxis();
                if (axis != RuntimeHandleAxis.None)
                {
                    return(axis);
                }

                bool isInside = (dpHitPoint - Target.position).magnitude <= innerRadius * scale;

                if (isInside)
                {
                    return(RuntimeHandleAxis.Free);
                }
                else
                {
                    return(RuntimeHandleAxis.Screen);
                }
            }

            return(RuntimeHandleAxis.None);
        }
Esempio n. 9
0
        public virtual void onStart(Variant conf)
        {
            bool flag = this.started;

            if (!flag)
            {
                this.started          = true;
                BaseRoomItem.instance = this;
                this.dDropItem        = new Dictionary <uint, DropItem>();
                this.dDropItem_own    = new Dictionary <uint, DropItem>();
                this.dDropFakeItem    = new Dictionary <uint, DropItem>();
                this.svrConf          = conf;
                this.fakeItemIdx      = 0u;
                SceneCamera.refreshMiniMapCanvas();
                this.process = new TickItem(new Action <float>(this.onTick));
                TickMgr.instance.addTick(this.process);
                this.initRoomObj();
                this.goldnum = 0u;
                this.expnum  = ModelBase <PlayerModel> .getInstance().exp;

                this.lvl = ModelBase <PlayerModel> .getInstance().lvl;

                this.zhuan = ModelBase <PlayerModel> .getInstance().up_lvl;

                a3_fb_finish.room = this;
            }
        }
Esempio n. 10
0
    private void Start()
    {
        Debug.Log("开始Demo");
        Debug.Log("开始....加载xml数据...............");
        new URLReqImpl
        {
            dataFormat = "binary",
            url        = "staticdata/staticdata.dat"
        }.load(delegate(IURLReq url_req, object ret)
        {
            Debug.Log("demo 加载数据xml...............");
            byte[] d            = ret as byte[];
            ByteArray byteArray = new ByteArray(d);
            byteArray.uncompress();
            XMLMgr.instance.init(byteArray);
        }, null, delegate(IURLReq url_req, string err)
        {
            Debug.Log("加载staticdata 失败。。。。。。。。。。。。" + url_req.url);
        });
        Globle.Init_DEFAULT();
        Globle.A3_DEMO = true;
        Application.targetFrameRate = 60;
        new CrossApp(true);
        CrossApp.singleton.regPlugin(new gameEventDelegate());
        CrossApp.singleton.regPlugin(new processManager());
        Screen.SetResolution(Screen.width, Screen.height, true);
        SceneCamera.Init();
        SelfRole.Init();
        Variant variant = new Variant();

        variant["id"]         = 1;
        GRMap.changeMapTimeSt = 7;
        GRMap.loading         = false;
        GameRoomMgr.getInstance().onChangeLevel(variant, null);
    }
Esempio n. 11
0
        public override SceneComponent GetObjectData()
        {
            var sceneData = new SceneCamera();

            sceneData.type = "Camera";
            return(sceneData);
        }
Esempio n. 12
0
        protected void LoadCamera(XElement xmlScene = null)
        {
            if (xmlScene != null && xmlScene.Elements("camera").Any())
            {
                XElement xmlCamera = xmlScene.Elements("camera").First();

                SceneCamera.FOV      = LoadFloat(xmlCamera, "fieldOfView");
                SceneCamera.NearClip = LoadFloat(xmlCamera, "nearClip");
                SceneCamera.FarClip  = LoadFloat(xmlCamera, "farClip");

                Vector Target   = LoadXYZFloat(xmlCamera.Elements("target").First());
                Vector Position = LoadXYZFloat(xmlCamera.Elements("position").First());
                SceneCamera.Target = Target;
                SceneCamera.Radius = (Target - Position).Magnitude3();
                SceneCamera.Up     = LoadXYZFloat(xmlCamera.Elements("up").First());
                SceneCamera.CalculatePosition();
            }
            else
            {
                SceneCamera.FOV      = 45.0f;
                SceneCamera.NearClip = 0.1f;
                SceneCamera.FarClip  = 200.0f;
                Vector Target = new Vector();
                SceneCamera.Target = Target;
                Vector Position = new Vector(25, 0, 0);
                SceneCamera.Radius = (Target - Position).Magnitude3();
                SceneCamera.Up     = new Vector(0, 1, 0);
                SceneCamera.CalculatePosition();
            }
        }
Esempio n. 13
0
        public TraceOutput trace(Vector3 start, Vector3 end, SceneCamera camera, float radius = 0.0f)
        {
            TraceOutput output = new TraceOutput()
            {
                allSolid   = false,
                startSolid = false,
                fraction   = 1.0f,
                endPos     = end,
                plane      = null
            };

            if (this.bsp == null)
            {
                return(output);
            }

            output = this.traceNode(0, 0.0f, 1.0f, start, end, radius, output, camera);

            if (output.fraction != 1.0f)
            {
                // collided with something

                output.endPos = start + output.fraction * (end - start); // interpolate to determine the end position
            }

            return(output);
        }
Esempio n. 14
0
        public void Save(string fileName)
        {
            XDocument xmlDoc = new XDocument();

            xmlDoc.Declaration = new XDeclaration("1.0", "UTF-8", "yes");

            XElement xmlScene = new XElement("scene");

            xmlScene.SetAttributeValue("desc", "Scene generated by kEditor");
            xmlScene.SetAttributeValue("author", "Lukas Jech");

            XElement background = new XElement("background");

            background.Add(MathUtils.GetRGBElement("color", new Vector()));
            background.Add(MathUtils.GetRGBElement("ambientLight", new Vector(0.1, 0.1, 0.1)));
            xmlScene.Add(background);

            SceneCamera.Save(xmlScene);

            SaveLights(xmlScene);

            SaveMaterials(xmlScene);

            SaveFigures(xmlScene);

            xmlDoc.Add(xmlScene);
            xmlDoc.Save(fileName);
        }
Esempio n. 15
0
        private void get_associate_lvls_res(Variant msgData)
        {
            int res = msgData["res"];

            switch (res)
            {
            case 3:
                int camid = msgData["trig_id"];
                //检测是否有摄像机动画
                SceneCamera.CheckTrrigerCam(camid);
                //检测是否有剧情对白
                if (a3_trrigerDialog.instance != null)
                {
                    a3_trrigerDialog.instance.CheckDialog(camid);
                }
                break;
            }


            if (GameRoomMgr.getInstance().onLevelStatusChanges(msgData))
            {
                return;
            }
            NetClient.instance.dispatchEvent(
                GameEvent.Create(PKG_NAME.S2C_GET_ASSOCIATE_LVLS_RES, this, GameTools.CreateSwitchData("get_associate_lvls_res", msgData))
                );
            //GameSession(this.session).logicClient.logicInGame.lgGD_levels.get_associate_lvls_res(msgData);
        }
        public override void init()
        {
            alain();
            inText();
            this.transform.SetAsFirstSibling();

            goMapcon = getGameObjectByPath("panel_map");
            goP      = getGameObjectByPath("panel_map/p");


            TeammateCon = this.transform.FindChild("panel_map/icon_Teammate");
            enemyCon    = this.transform.FindChild("panel_map/icon_enemy");
            TeamObj     = this.transform.FindChild("panel_map/signal1").gameObject;
            EnemyObj    = this.transform.FindChild("panel_map/signal0").gameObject;
            BaseButton btn_close = new BaseButton(transform.FindChild("close"));

            btn_close.onClick = onCloseMap;
            btns = this.transform.FindChild("panel_map/btns");

            for (int i = 0; i < btns.childCount; i++)
            {
                new BaseButton(btns.GetChild(i)).onClick = (GameObject go) => {
                    Vector3 vec = SceneCamera.getPosOnMiniMap(curMiniMap.mapScale);
                    vec = mapRotation * vec;
                    int x = (int)vec.x;
                    int y = (int)vec.y;

                    A3_cityOfWarProxy.getInstance().send_signal(uint.Parse(go.name), x, y);
                };
            }
            mapRotation = Quaternion.Euler(0f, 0f, 0f);
        }
Esempio n. 17
0
        void Awake()
        {
            sceneMap = new SceneMap();

            sceneCamera = this.gameObject.AddComponent <SceneCamera>();
            clickScene  = MouseClickScene.Create(this);
            CursorManager.GetInstance().SetCursor(CursorType.ctNormal);
        }
Esempio n. 18
0
        protected override void Init()
        {
            UIEventListener.Get(FindGameObject("PlotBackground")).onClick += OnClickBtnHandler;
            UIEventListener.Get(SkipButton.gameObject).onClick            += OnSkipBtnHandler;
            camera = SceneView.GetInstance().GetSceneCamera();

            RenderInfo();
        }
Esempio n. 19
0
        public Q3Movement(SceneCamera camera, q3bsptree bsp)
        {
            this.bsp = bsp;

            this.groundTrace = null;

            this.camera = camera;
        }
Esempio n. 20
0
 public void shake(string pram)
 {
     string[] arr = pram.Split(new char[] { ',' });
     if (arr.Length < 3)
     {
         return;
     }
     SceneCamera.cameraShake(float.Parse(arr[0]), int.Parse(arr[1]), float.Parse(arr[2]));
 }
            void onScrbMusicEffectValueChange(float f)
            {
                SceneCamera.Set_Sound_Effect(f);
                MediaClient.instance.setSoundVolume(f);
                int value = (int)(float.Parse(f.ToString("F2")) * 100);

                txtMusicEffectValue.text = value.ToString();
                musicEffect = value;
            }
Esempio n. 22
0
            private void onScrbMusicEffectValueChange(float f)
            {
                SceneCamera.Set_Sound_Effect(f);
                MediaClient.getInstance().setSoundVolume(f);
                int num = (int)(float.Parse(f.ToString("F2")) * 100f);

                this.txtMusicEffectValue.text = num.ToString();
                this.musicEffect = num;
            }
Esempio n. 23
0
        private bool HitSnapHandle()
        {
            Vector3 sp = SceneCamera.WorldToScreenPoint(HandlePosition);
            Vector3 mp = Input.mousePosition;

            const float pixelSize = 10;

            return(sp.x - pixelSize <= mp.x && mp.x <= sp.x + pixelSize &&
                   sp.y - pixelSize <= mp.y && mp.y <= sp.y + pixelSize);
        }
Esempio n. 24
0
    private void Update()
    {
        float deltaTime = Time.deltaTime;

        SceneCamera.FrameMove();
        MonsterMgr._inst.FrameMove(deltaTime);
        SelfRole.FrameMove(deltaTime);
        TickMgr.instance.update(deltaTime);
        (CrossApp.singleton.getPlugin("gameEventDelegate") as gameEventDelegate).onProcess(deltaTime);
    }
 private void OnSceneCameraPreRender(SceneCamera _)
 {
     for (int i = 0; i < renderers.Length; i++)
     {
         Renderer renderer = renderers[i];
         Color    color    = originalColors[i];
         ChangeColor(renderer, color);
         ChangeFade(renderer);
     }
 }
 // Token: 0x06002967 RID: 10599 RVA: 0x000AE488 File Offset: 0x000AC688
 private void OnPreRenderSceneCam(SceneCamera sceneCam)
 {
     if (this.arcVisualizerLineRenderer)
     {
         this.arcVisualizerLineRenderer.renderingLayerMask = ((sceneCam.cameraRigController.target == base.gameObject) ? 1U : 0U);
     }
     if (this.endpointVisualizerTransform)
     {
         this.endpointVisualizerTransform.gameObject.layer = ((sceneCam.cameraRigController.target == base.gameObject) ? LayerIndex.defaultLayer.intVal : LayerIndex.noDraw.intVal);
     }
 }
Esempio n. 27
0
        public AlethaApplication() : base(ResWidth, ResHeight, GraphicsMode)
        {
            this.VSync             = VSyncMode.On;
            this.Keyboard.KeyUp   += Keyboard_KeyUp;
            this.Keyboard.KeyDown += Keyboard_KeyDown;

            camera = new SceneCamera(ResWidth, ResHeight);


            NativeWindowContext = this;
            CurrentApplication  = this;
        }
Esempio n. 28
0
    private void OnEnable()
    {
        SceneCamera sceneCamera = (SceneCamera)target;

        if (sceneCamera != null)
        {
            _gameObject = sceneCamera.gameObject;
        }

        _widthProperty  = serializedObject.FindProperty("Width");
        _heightProperty = serializedObject.FindProperty("Height");
    }
        private bool HitAxis(Matrix4x4 transform, Matrix4x4 objToWorld, out float minDistance)
        {
            bool hit = false;

            minDistance = float.PositiveInfinity;

            const float radius          = 1.0f;
            const int   pointsPerCircle = 32;
            float       angle           = 0.0f;
            float       z = 0.0f;

            Vector3 zeroCamPoint = transform.MultiplyPoint(Vector3.zero);

            zeroCamPoint = objToWorld.MultiplyPoint(zeroCamPoint);
            zeroCamPoint = SceneCamera.worldToCameraMatrix.MultiplyPoint(zeroCamPoint);

            Vector3 prevPoint = transform.MultiplyPoint(new Vector3(radius, 0, z));

            prevPoint = objToWorld.MultiplyPoint(prevPoint);
            for (int i = 0; i < pointsPerCircle; i++)
            {
                angle += 2 * Mathf.PI / pointsPerCircle;
                float   x     = radius * Mathf.Cos(angle);
                float   y     = radius * Mathf.Sin(angle);
                Vector3 point = transform.MultiplyPoint(new Vector3(x, y, z));
                point = objToWorld.MultiplyPoint(point);

                Vector3 camPoint = SceneCamera.worldToCameraMatrix.MultiplyPoint(point);

                if (camPoint.z > zeroCamPoint.z)
                {
                    Vector3 screenVector    = SceneCamera.WorldToScreenPoint(point) - SceneCamera.WorldToScreenPoint(prevPoint);
                    float   screenVectorMag = screenVector.magnitude;
                    screenVector.Normalize();
                    if (screenVector != Vector3.zero)
                    {
                        float distance;
                        if (HitScreenAxis(out distance, SceneCamera.WorldToScreenPoint(prevPoint), screenVector, screenVectorMag))
                        {
                            if (distance < minDistance)
                            {
                                minDistance = distance;
                                hit         = true;
                            }
                        }
                    }
                }

                prevPoint = point;
            }
            return(hit);
        }
Esempio n. 30
0
        /// <param name="window">
        /// A window or display which is used to render the X3D application
        /// </param>
        public X3DApplication(INativeWindow window, SceneGraph cachedGraph = null)
        {
            this.window       = window;
            this._cachedGraph = cachedGraph;

            // Set up a Construction Set for the current instance
            SceneManager.ConstructionSet = X3DConsructionSet.GetConstructionSetProvider();


            //this.window.KeyPress+=new EventHandler<KeyPressEventArgs>(X3DApplication_KeyPress);
            //this.Keyboard.KeyDown+=new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyDown);
            this.Keyboard.KeyUp += new EventHandler <OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyUp);

            this.window.FocusedChanged += (object sender, EventArgs e) =>
            {
                if (this.window.WindowState == WindowState.Fullscreen)
                {
                    window.WindowState = WindowState.Normal;
                    lockMouseCursor    = false;

                    isFullscreen = !isFullscreen;

                    ToggleCursor();
                }
            };

            ActiveCamera = new SceneCamera(this.window.Width, this.window.Height);

            if (NavigationInfo.NavigationType == NavigationType.Examine)
            {
                this.Mouse.WheelChanged += Mouse_WheelChanged;
                this.window.MouseLeave  += Window_MouseLeave;
                this.Mouse.ButtonDown   += (object sender, MouseButtonEventArgs e) =>
                {
                    if (e.IsPressed && e.Button == MouseButton.Left)
                    {
                        iszooming = true;
                        ispanning = false;
                    }
                    else if (e.IsPressed && e.Button == MouseButton.Right)
                    {
                        ispanning = true;
                        iszooming = false;
                    }
                    mouseDragging = true;
                };
                this.Mouse.ButtonUp += (object sender, MouseButtonEventArgs e) =>
                {
                    mouseDragging = false;
                };
            }
        }