public void Call(CameraPathEvent eventPoint)
    {
        if(eventPoint.target == null)
        {
            Debug.LogError("Camera Path Event Error: There is an event call without a specified target. Please check "+eventPoint.displayName, cameraPath);
            return;
        }

        switch(eventPoint.argumentType)
        {
            case CameraPathEvent.ArgumentTypes.None:
                eventPoint.target.SendMessage(eventPoint.methodName, SendMessageOptions.DontRequireReceiver);
                break;
            case CameraPathEvent.ArgumentTypes.Int:
                int intValue;
                if (int.TryParse(eventPoint.methodArgument, out intValue))
                    eventPoint.target.SendMessage(eventPoint.methodName, intValue, SendMessageOptions.DontRequireReceiver);
                else
                    Debug.LogError("Camera Path Aniamtor: The argument specified is not an integer");
                break;
            case CameraPathEvent.ArgumentTypes.Float:
                float floatValue = float.Parse(eventPoint.methodArgument);
                if(float.IsNaN(floatValue))
                    Debug.LogError("Camera Path Aniamtor: The argument specified is not a float");
                eventPoint.target.SendMessage(eventPoint.methodName, floatValue, SendMessageOptions.DontRequireReceiver);
                break;
            case CameraPathEvent.ArgumentTypes.String:
                string sendValue = eventPoint.methodArgument;
                eventPoint.target.SendMessage(eventPoint.methodName, sendValue, SendMessageOptions.DontRequireReceiver);
                break;
        }
    }
Exemplo n.º 2
0
 public void CheckEvents(float percentage)
 {
     if (Mathf.Abs(percentage - this._lastPercentage) > 0.5f)
     {
         this._lastPercentage = percentage;
         return;
     }
     for (int i = 0; i < base.realNumberOfPoints; i++)
     {
         CameraPathEvent cameraPathEvent = this[i];
         bool            flag            = (cameraPathEvent.percent >= this._lastPercentage && cameraPathEvent.percent <= percentage) || (cameraPathEvent.percent >= percentage && cameraPathEvent.percent <= this._lastPercentage);
         if (flag)
         {
             CameraPathEvent.Types type = cameraPathEvent.type;
             if (type != CameraPathEvent.Types.Broadcast)
             {
                 if (type == CameraPathEvent.Types.Call)
                 {
                     this.Call(cameraPathEvent);
                 }
             }
             else
             {
                 this.BroadCast(cameraPathEvent);
             }
         }
     }
     this._lastPercentage = percentage;
 }
Exemplo n.º 3
0
 public void BroadCast(CameraPathEvent eventPoint)
 {
     if (this.CameraPathEventPoint != null)
     {
         this.CameraPathEventPoint(eventPoint.eventName);
     }
 }
Exemplo n.º 4
0
    public void CheckEvents(float percentage)
    {
        if (Mathf.Abs(percentage - _lastPercentage) > 0.5f)
        {
            _lastPercentage = percentage;//probable loop
            return;
        }

        for (int i = 0; i < realNumberOfPoints; i++)
        {
            CameraPathEvent eventPoint = this[i];
            bool            eventBetweenAnimationDelta = (eventPoint.percent >= _lastPercentage && eventPoint.percent <= percentage) || (eventPoint.percent >= percentage && eventPoint.percent <= _lastPercentage);
            if (eventBetweenAnimationDelta)
            {
                switch (eventPoint.type)
                {
                case CameraPathEvent.Types.Broadcast:
                    BroadCast(eventPoint);
                    break;

                case CameraPathEvent.Types.Call:
                    Call(eventPoint);
                    break;
                }
            }
        }

        _lastPercentage = percentage;
    }
 public void BroadCast(CameraPathEvent eventPoint)
 {
     if(CameraPathEventPoint != null)
     {
         CameraPathEventPoint(eventPoint.eventName);
     }
 }
Exemplo n.º 6
0
    public override void FromXML(XmlNodeList nodes)
    {
        Clear();
        foreach (XmlNode node in nodes)
        {
            CameraPathEvent newCameraPathPoint = gameObject.AddComponent <CameraPathEvent>();//CreateInstance<CameraPathEvent>();
            newCameraPathPoint.hideFlags = HideFlags.HideInInspector;
            CameraPathPoint.PositionModes positionModes = (CameraPathPoint.PositionModes)Enum.Parse(typeof(CameraPathPoint.PositionModes), node["positionModes"].FirstChild.Value);
            switch (positionModes)
            {
            case CameraPathPoint.PositionModes.Free:
                CameraPathControlPoint cPointA = cameraPath[int.Parse(node["cpointA"].FirstChild.Value)];
                CameraPathControlPoint cPointB = cameraPath[int.Parse(node["cpointB"].FirstChild.Value)];
                float curvePercentage          = float.Parse(node["curvePercentage"].FirstChild.Value);
                AddPoint(newCameraPathPoint, cPointA, cPointB, curvePercentage);
                break;

            case CameraPathPoint.PositionModes.FixedToPoint:
                CameraPathControlPoint point = cameraPath[int.Parse(node["point"].FirstChild.Value)];
                AddPoint(newCameraPathPoint, point);
                break;
            }
            newCameraPathPoint.FromXML(node, cameraPath);
        }
    }
Exemplo n.º 7
0
    public void AddEvent(CameraPathControlPoint atPoint)
    {
        CameraPathEvent cameraPathEvent = base.get_gameObject().AddComponent <CameraPathEvent>();

        cameraPathEvent.set_hideFlags(2);
        base.AddPoint(cameraPathEvent, atPoint);
        this.RecalculatePoints();
    }
Exemplo n.º 8
0
    public void AddEvent(CameraPathControlPoint atPoint)
    {
        CameraPathEvent point = gameObject.AddComponent <CameraPathEvent>();//CreateInstance<CameraPathEvent>();

        point.hideFlags = HideFlags.HideInInspector;
        AddPoint(point, atPoint);
        RecalculatePoints();
    }
Exemplo n.º 9
0
    public CameraPathEvent AddEvent(CameraPathControlPoint curvePointA, CameraPathControlPoint curvePointB, float curvePercetage)
    {
        CameraPathEvent cameraPathEvent = base.get_gameObject().AddComponent <CameraPathEvent>();

        cameraPathEvent.set_hideFlags(2);
        base.AddPoint(cameraPathEvent, curvePointA, curvePointB, curvePercetage);
        this.RecalculatePoints();
        return(cameraPathEvent);
    }
Exemplo n.º 10
0
    public CameraPathEvent AddEvent(CameraPathControlPoint curvePointA, CameraPathControlPoint curvePointB, float curvePercetage)
    {
        CameraPathEvent eventPoint = gameObject.AddComponent <CameraPathEvent>();//CreateInstance<CameraPathEvent>();

        eventPoint.hideFlags = HideFlags.HideInInspector;
        AddPoint(eventPoint, curvePointA, curvePointB, curvePercetage);
        RecalculatePoints();
        return(eventPoint);
    }
Exemplo n.º 11
0
    public static List <int> GetPreloadNpcs(int plotId)
    {
        List <int> list = new List <int>();

        for (int i = 0; i < 2; i++)
        {
            string path = string.Concat(new object[]
            {
                "CameraPath/jq_",
                plotId,
                "_",
                i + 1
            });
            Object @object = AssetManager.AssetOfNoPool.LoadAssetNowNoAB(path, typeof(Object));
            if (!(@object == null))
            {
                GameObject          gameObject = @object as GameObject;
                CameraPathEventList eventList  = gameObject.GetComponent <CameraPath>().eventList;
                for (int j = 0; j < eventList.realNumberOfPoints; j++)
                {
                    CameraPathEvent cameraPathEvent = eventList[j];
                    string[]        array           = cameraPathEvent.eventName.Split(new char[]
                    {
                        ';'
                    });
                    string[] array2 = array;
                    for (int k = 0; k < array2.Length; k++)
                    {
                        string        text          = array2[k];
                        JuQingShiJian juQingShiJian = DataReader <JuQingShiJian> .Get(int.Parse(text));

                        if (juQingShiJian != null)
                        {
                            if (juQingShiJian.eventType == 2)
                            {
                                list.Add(juQingShiJian.modelId);
                            }
                        }
                    }
                }
            }
        }
        for (int l = 0; l < list.get_Count(); l++)
        {
            Debug.LogError("preload=" + list.get_Item(l));
        }
        return(list);
    }
Exemplo n.º 12
0
    public void Call(CameraPathEvent eventPoint)
    {
        if (eventPoint.target == null)
        {
            Debug.LogError("Camera Path Event Error: There is an event call without a specified target. Please check " + eventPoint.displayName, this.cameraPath);
            return;
        }
        switch (eventPoint.argumentType)
        {
        case CameraPathEvent.ArgumentTypes.None:
            eventPoint.target.SendMessage(eventPoint.methodName, 1);
            break;

        case CameraPathEvent.ArgumentTypes.Float:
        {
            float num = float.Parse(eventPoint.methodArgument);
            if (float.IsNaN(num))
            {
                Debug.LogError("Camera Path Aniamtor: The argument specified is not a float");
            }
            eventPoint.target.SendMessage(eventPoint.methodName, num, 1);
            break;
        }

        case CameraPathEvent.ArgumentTypes.Int:
        {
            int num2;
            if (int.TryParse(eventPoint.methodArgument, ref num2))
            {
                eventPoint.target.SendMessage(eventPoint.methodName, num2, 1);
            }
            else
            {
                Debug.LogError("Camera Path Aniamtor: The argument specified is not an integer");
            }
            break;
        }

        case CameraPathEvent.ArgumentTypes.String:
        {
            string methodArgument = eventPoint.methodArgument;
            eventPoint.target.SendMessage(eventPoint.methodName, methodArgument, 1);
            break;
        }
        }
    }
Exemplo n.º 13
0
    public void Call(CameraPathEvent eventPoint)
    {
        if (eventPoint.target == null)
        {
            Debug.LogError("Camera Path Event Error: There is an event call without a specified target. Please check " + eventPoint.displayName, cameraPath);
            return;
        }

        switch (eventPoint.argumentType)
        {
        case CameraPathEvent.ArgumentTypes.None:
            eventPoint.target.SendMessage(eventPoint.methodName, SendMessageOptions.DontRequireReceiver);
            break;

        case CameraPathEvent.ArgumentTypes.Int:
            int intValue;
            if (int.TryParse(eventPoint.methodArgument, out intValue))
            {
                eventPoint.target.SendMessage(eventPoint.methodName, intValue, SendMessageOptions.DontRequireReceiver);
            }
            else
            {
                Debug.LogError("Camera Path Aniamtor: The argument specified is not an integer");
            }
            break;

        case CameraPathEvent.ArgumentTypes.Float:
            float floatValue = float.Parse(eventPoint.methodArgument);
            if (float.IsNaN(floatValue))
            {
                Debug.LogError("Camera Path Aniamtor: The argument specified is not a float");
            }
            eventPoint.target.SendMessage(eventPoint.methodName, floatValue, SendMessageOptions.DontRequireReceiver);
            break;

        case CameraPathEvent.ArgumentTypes.String:
            string sendValue = eventPoint.methodArgument;
            eventPoint.target.SendMessage(eventPoint.methodName, sendValue, SendMessageOptions.DontRequireReceiver);
            break;
        }
    }
    private static void AddCPathPoints()
    {
        if (SceneView.focusedWindow != null)
        {
            SceneView.focusedWindow.wantsMouseMove = true;
        }

        Handles.color = _cameraPath.selectedPointColour;
        CameraPathPointList pointList = null;

        switch (_pointMode)
        {
        case CameraPath.PointModes.AddOrientations:
            pointList = _cameraPath.orientationList;
            break;

        case CameraPath.PointModes.AddFovs:
            pointList = _cameraPath.fovList;
            break;

        case CameraPath.PointModes.AddTilts:
            pointList = _cameraPath.tiltList;
            break;

        case CameraPath.PointModes.AddEvents:
            pointList = _cameraPath.eventList;
            break;

        case CameraPath.PointModes.AddSpeeds:
            pointList = _cameraPath.speedList;
            break;

        case CameraPath.PointModes.AddDelays:
            pointList = _cameraPath.delayList;
            break;
        }
        int numberOfPoints = pointList.realNumberOfPoints;

        for (int i = 0; i < numberOfPoints; i++)
        {
            CameraPathPoint point           = pointList[i];
            float           pointHandleSize = HandleUtility.GetHandleSize(point.worldPosition) * HANDLE_SCALE * 0.4f;
            Handles.DotCap(0, point.worldPosition, Quaternion.identity, pointHandleSize);
        }

        float   mousePercentage = NearestmMousePercentage();// _track.GetNearestPoint(mousePlanePoint);
        Vector3 mouseTrackPoint = _cameraPath.GetPathPosition(mousePercentage, true);

        Handles.Label(mouseTrackPoint, "Add New Point");
        float      newPointHandleSize = HandleUtility.GetHandleSize(mouseTrackPoint) * HANDLE_SCALE;
        Ray        mouseRay           = Camera.current.ScreenPointToRay(new Vector3(Event.current.mousePosition.x, Screen.height - Event.current.mousePosition.y - 30, 0));
        Quaternion mouseLookDirection = Quaternion.LookRotation(-mouseRay.direction);

        if (Handles.Button(mouseTrackPoint, mouseLookDirection, newPointHandleSize, newPointHandleSize, Handles.DotCap))
        {
            CameraPathControlPoint curvePointA = _cameraPath[_cameraPath.GetLastPointIndex(mousePercentage, false)];
            CameraPathControlPoint curvePointB = _cameraPath[_cameraPath.GetNextPointIndex(mousePercentage, false)];
            float curvePercentage = _cameraPath.GetCurvePercentage(curvePointA, curvePointB, mousePercentage);
            switch (_pointMode)
            {
            case CameraPath.PointModes.AddOrientations:
                Quaternion            pointRotation  = Quaternion.LookRotation(_cameraPath.GetPathDirection(mousePercentage));
                CameraPathOrientation newOrientation = ((CameraPathOrientationList)pointList).AddOrientation(curvePointA, curvePointB, curvePercentage, pointRotation);
                ChangeSelectedPointIndex(pointList.IndexOf(newOrientation));
                break;

            case CameraPath.PointModes.AddFovs:
                float         pointFOV    = _cameraPath.fovList.GetValue(mousePercentage, CameraPathFOVList.ProjectionType.FOV);
                float         pointSize   = _cameraPath.fovList.GetValue(mousePercentage, CameraPathFOVList.ProjectionType.Orthographic);
                CameraPathFOV newFOVPoint = ((CameraPathFOVList)pointList).AddFOV(curvePointA, curvePointB, curvePercentage, pointFOV, pointSize);
                ChangeSelectedPointIndex(pointList.IndexOf(newFOVPoint));
                break;

            case CameraPath.PointModes.AddTilts:
                float          pointTilt    = _cameraPath.GetPathTilt(mousePercentage);
                CameraPathTilt newTiltPoint = ((CameraPathTiltList)pointList).AddTilt(curvePointA, curvePointB, curvePercentage, pointTilt);
                ChangeSelectedPointIndex(pointList.IndexOf(newTiltPoint));
                break;

            case CameraPath.PointModes.AddEvents:
                CameraPathEvent newEventPoint = ((CameraPathEventList)pointList).AddEvent(curvePointA, curvePointB, curvePercentage);
                ChangeSelectedPointIndex(pointList.IndexOf(newEventPoint));
                break;

            case CameraPath.PointModes.AddSpeeds:
                _cameraPath.speedList.listEnabled = true;    //if we're adding speeds then we probable want to enable it
                CameraPathSpeed newSpeedPoint = ((CameraPathSpeedList)pointList).AddSpeedPoint(curvePointA, curvePointB, curvePercentage);
                newSpeedPoint.speed = _animator.pathSpeed;
                ChangeSelectedPointIndex(pointList.IndexOf(newSpeedPoint));
                break;

            case CameraPath.PointModes.AddDelays:
                CameraPathDelay newDelayPoint = ((CameraPathDelayList)pointList).AddDelayPoint(curvePointA, curvePointB, curvePercentage);
                ChangeSelectedPointIndex(pointList.IndexOf(newDelayPoint));
                break;
            }
            GUI.changed = true;
        }
    }
    private static void SceneGUIEventBased()
    {
        DisplayAtPoint();

        CameraPathEventList eventList = _cameraPath.eventList;
        Camera sceneCamera            = Camera.current;
        int    pointCount             = eventList.realNumberOfPoints;

        for (int i = 0; i < pointCount; i++)
        {
            CameraPathEvent eventPoint = eventList[i];
            if (_cameraPath.enableUndo)
            {
                Undo.RecordObject(eventPoint, "Modifying Event Point");
            }
            if (Vector3.Dot(sceneCamera.transform.forward, eventPoint.worldPosition - sceneCamera.transform.position) < 0)
            {
                continue;
            }

            string pointLabel = eventPoint.displayName;
            pointLabel += "\ntype: " + eventPoint.type;
            if (eventPoint.type == CameraPathEvent.Types.Broadcast)
            {
                pointLabel += "\nevent name: " + eventPoint.eventName;
            }
            if (eventPoint.type == CameraPathEvent.Types.Call)
            {
                if (eventPoint.target != null)
                {
                    pointLabel += "\nevent target: " + eventPoint.target.name + " calling: " + eventPoint.methodName;
                }
                else
                {
                    pointLabel += "\nno target assigned";
                }
            }
            if (eventPoint.positionModes == CameraPathPoint.PositionModes.FixedToPoint)
            {
                pointLabel += "\nat point: " + eventPoint.point.displayName;
            }
            else
            {
                pointLabel += "\nat percentage: " + eventPoint.percent.ToString("F3");
            }

            Handles.Label(eventPoint.worldPosition, pointLabel);
            float pointHandleSize = HandleUtility.GetHandleSize(eventPoint.worldPosition) * HANDLE_SCALE;
            Handles.color = (i == selectedPointIndex) ? _cameraPath.selectedPointColour : _cameraPath.unselectedPointColour;
            if (Handles.Button(eventPoint.worldPosition, Quaternion.identity, pointHandleSize, pointHandleSize, Handles.DotCap))
            {
                ChangeSelectedPointIndex(i);
                GUI.changed = true;
            }

            if (i == selectedPointIndex)
            {
                CPPSlider(eventPoint);
            }
        }
    }