public override bool OnDragging(Ray cameraRay)
    {
        PEStationCtrl mousePickedStation = GetStation();

        if (null != mousePickedStation &&
            !mousePickedStation.isJoint &&
            PERailwayCtrl.CheckRoute(mousePickedStation.point))
        {
            rootGameObject.transform.position = mousePickedStation.station.mJointPoint.position;
            rootGameObject.transform.rotation = mousePickedStation.station.mJointPoint.rotation;
            return(true);
        }

        base.OnDragging(cameraRay);

        return(false);
    }
示例#2
0
    void OnSeletedLine(bool isConnect, int routeID, int stationID)
    {
        isConnectLine = isConnect;

        ChangeUILineInfo(isConnect);

        if (mSelectedLineId != -1)
        {
            UIRailLine lineOld = mRailLineList.Find(
                delegate(UIRailLine li)
            {
                return(li.mRoute.id == mSelectedLineId);
            });
            if (lineOld != null)
            {
                lineOld.SetSelected(false);
            }

            UIDisconnectionLine disLineOld = mDisRailLineList.Find(
                delegate(UIDisconnectionLine li)
            {
                return(li.mIndex == mSelectedLineId);
            });
            if (disLineOld != null)
            {
                disLineOld.SetSelected(false);
            }
        }


        if (isConnect)
        {
            UIRailLine line = mRailLineList.Find(
                delegate(UIRailLine li)
            {
                return(li.mRoute.id == routeID);
            });
            if (line == null)
            {
                ClearLineInfo();
                return;
            }

            mSelectedLineIndex = mRailLineList.FindIndex(
                delegate(UIRailLine li)
            {
                return(li == line);
            });


            line.SetSelected(true);
            mSelectedLineId = routeID;
            SetLineInfo(line.mRoute);

            if (mSelectedStation != null)
            {
                mSelectedStation.SetSelected(false);
            }

            UIRailStation station = line.FindStation(stationID);
            if (station != null)
            {
                station.SetSelected(true);
                mSelectedStation = station;
            }
            SetSatationInfo(station.mRailPointData);
            EnableBtn(mBtnStop, true);
        }

        else
        {
            int index = routeID;

            UIDisconnectionLine disLine = mDisRailLineList.Find(
                delegate(UIDisconnectionLine li)
            {
                return(li.mIndex == index);
            });

            if (disLine == null)
            {
                ClearLineInfo();
                return;
            }

            disLine.SetSelected(true);
            mSelectedLineId = index;

            if (mSelectedStation != null)
            {
                mSelectedStation.SetSelected(false);
            }

            UIRailStation station = disLine.FindStation(stationID);
            if (station != null)
            {
                station.SetSelected(true);
                mSelectedStation = station;
            }
            SetSatationInfo(station.mRailPointData);
            bool ok = PERailwayCtrl.CheckRoute(station.mRailPointData);
            EnableBtn(mBtnStop, ok);
        }
    }