Пример #1
0
    void OnStationResidenceTimeChange(string text)
    {
        if (mSelectedStation != null && text.Length > 0)
        {
            PETimer time = PETimerUtil.GetTmpTimer();
            time.Minute = Convert.ToDouble(text);
            if (time.Minute > 0)
            {
                Railway.Route route = Railway.Manager.Instance.GetRouteByPointId(mSelectedStation.mRailPointData.id);
                if (route != null)
                {
                    route.SetStayTime(mSelectedStation.mRailPointData.id, Convert.ToSingle(time.Second));
                }
                else
                {
                    Railway.Point point = Railway.Manager.Instance.GetPoint(mSelectedStation.mRailPointData.id);
                    point.stayTime = Convert.ToSingle(time.Second);
                }


                if (null != e_ResetPointTime)
                {
                    e_ResetPointTime(mSelectedStation.mRailPointData.id, Convert.ToSingle(time.Second));
                }
            }
            time.Second          = mSelectedStation.mRailPointData.realStayTime;
            mRedestanceTime.text = ((int)time.Minute).ToString();
        }
    }
Пример #2
0
    public void DropTrain(Grid_N grid)
    {
        if (null == mSelectedStation || null == e_SetTrain)
        {
            return;
        }

        ItemObject itemObj = SelectItem_N.Instance.ItemObj;

        if (null == itemObj)
        {
            return;
        }

        ItemAsset.Train train = itemObj.GetCmpt <ItemAsset.Train>();
        if (null == train)
        {
            return;
        }
        int routeId = mSelectedStation.mRailPointData.routeId;

        Railway.Route route = Railway.Manager.Instance.GetRoute(routeId);
        if (!route.trainRunning)
        {
            mRailIcon.SetItem(itemObj);
            e_SetTrain(routeId, itemObj);
            if (null != e_SetTrainToStation)
            {
                e_SetTrainToStation(mSelectedStation.mRailPointData.routeId, mSelectedStation.mRailPointData.id);
            }
        }
    }
Пример #3
0
 public void DoSyncRunState(int routeId, int moveDir, int nextPoint, float time)
 {
     Railway.Route route = Railway.Manager.Instance.GetRoute(routeId);
     if (route != null)
     {
         route.mRunState.SyncRunState(moveDir, nextPoint, time);
     }
 }
Пример #4
0
 public void DoSetTrainToStation(int routeId, int pointId)
 {
     Railway.Route route = Railway.Manager.Instance.GetRoute(routeId);
     if (null != route)
     {
         route.SetTrainToStation(pointId);
     }
 }
Пример #5
0
 public void DoResetRouteName(int routeID, string name)
 {
     Railway.Route route = Railway.Manager.Instance.GetRoute(routeID);
     if (null != route)
     {
         route.name = name;
     }
 }
Пример #6
0
 public void AddMonoRail(Railway.Route route)
 {
     if (!mRouteList.Contains(route))
     {
         mRouteList.Add(route);
         //Do UI Update
         AddUIRailLine(route);
     }
 }
Пример #7
0
 public void RemoveMonoRail(Railway.Route route)
 {
     if (mRouteList.Contains(route))
     {
         DeleteUIRailLine(route);
         mRouteList.Remove(route);
         mRailIcon.SetItem(null);
     }
 }
Пример #8
0
    public bool DoSetRouteTrain(int routeId, int trainItemObjId)
    {
        Railway.Route route = Railway.Manager.Instance.GetRoute(routeId);

        if (null == route)
        {
            return(false);
        }
        route.SetTrain(trainItemObjId);
        return(true);
    }
Пример #9
0
    public bool DoDeleteRoute(int routeId)
    {
        Railway.Route route = Railway.Manager.Instance.GetRoute(routeId);
        if (null == route)
        {
            return(false);
        }

        route.SetTrain(Pathea.IdGenerator.Invalid);

        return(Railway.Manager.Instance.RemoveRoute(route.id));
    }
Пример #10
0
    void RPC_S2C_Railway_Route(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        int    pointId   = stream.Read <int>();
        string name      = stream.Read <string>();
        int    moveDir   = stream.Read <int>();
        float  leaveTime = stream.Read <float>();

        Railway.Route route = RailwayOperate.Instance.DoCreateRoute(pointId, name);
        if (route != null)
        {
            route.moveDir          = moveDir;
            route.TimeToLeavePoint = leaveTime;
        }
    }
Пример #11
0
    void OnDeleteRoute(Railway.Point point)
    {
        Railway.Route route = Railway.Manager.Instance.GetRoute(point.routeId);
        if (null != route)
        {
            if (route.HasPassenger())
            {
                MessageBox_N.ShowOkBox(UIMsgBoxInfo.RailwayDeleteNotice.GetString());
                return;
            }

            RailwayOperate.Instance.RequestDeleteRoute(point.routeId);
        }
    }
Пример #12
0
    void DeleteUIRailLine(Railway.Route _rail)
    {
        UIRailLine line = mRailLineList.Find(
            delegate(UIRailLine li)
        {
            return(li.mRoute == _rail);
        });

        if (line != null)
        {
            GameObject.Destroy(line.gameObject);
            mRailLineList.Remove(line);
        }
    }
Пример #13
0
    protected override bool CheckPick(Ray camMouseRay, out float dis)
    {
        if (base.CheckPick(camMouseRay, out dis))
        {
            if (dis < MouseOpRange)
            {
                mRoute = Railway.Manager.Instance.GetRoute(mStation.Point.routeId);

                MousePicker.Instance.UpdateTis();
                return(true);
            }
        }

        return(false);
    }
Пример #14
0
 public void PickTrain(Grid_N grid)
 {
     if (null != mSelectedStation)
     {
         Railway.Route route = Railway.Manager.Instance.GetRoute(mSelectedStation.mRailPointData.routeId);
         if (route.trainRunning)
         {
             return;
         }
         if (null != route)
         {
             SelectItem_N.Instance.SetItem(grid.ItemObj, grid.ItemPlace, grid.ItemIndex);
         }
     }
 }
Пример #15
0
    void SetLineInfo(Railway.Route route)
    {
        Railway.Route.Stats stats = route.GetStats();

        mTitleLineName.text  = route.name;
        mLineName.text       = route.name;
        mLbStationCount.text = stats.stationNum.ToString();
        mLbNodeCount.text    = stats.jointNum.ToString();
        mLbRangeAblity.text  = stats.totalIntDis.ToString() + " M";
        PETimer time = PETimerUtil.GetTmpTimer();

        time.Second        = route.singleTripTime;
        mLbOneWaytime.text = time.GetStrHhMmSs();
        mRailIcon.SetItem(route.trainId);
    }
Пример #16
0
    void AddUIRailLine(Railway.Route _rail)
    {
        GameObject line = GameObject.Instantiate(mLinePrefab) as GameObject;

        line.transform.parent        = mLinesContent.transform;
        line.transform.localPosition = new Vector3(0, 0, 0);
        line.transform.localScale    = new Vector3(1, 1, 1);

        UIRailLine uiLine = line.GetComponent <UIRailLine>();

        uiLine.Init(_rail);
        uiLine.CreateLine();
        uiLine.ResetLinePos(mMapCtrl);

        uiLine.mSelectedLine += OnSeletedLine;

        mRailLineList.Add(uiLine);
    }
Пример #17
0
    public void RequestDeleteRoute(int routeId)
    {
        Railway.Route route = Railway.Manager.Instance.GetRoute(routeId);
        if (null == route)
        {
            return;
        }

        if (GameConfig.IsMultiMode)
        {
            if (null != PlayerNetwork.mainPlayer)
            {
                PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_Railway_DeleteRoute, routeId);
            }
        }
        else
        {
            AddItemToPlayerPkg(route.trainId);

            DoDeleteRoute(routeId);
        }
    }
Пример #18
0
    public static bool HasRoute(Vector3 pos1, Vector3 pos2)
    {
        List <Railway.Point> pointList1 = Railway.Manager.Instance.GetNearPoint(pos1, 150f);
        List <Railway.Point> pointList2 = Railway.Manager.Instance.GetNearPoint(pos2, 150f);

        foreach (Railway.Point point1 in pointList1)
        {
            foreach (Railway.Point point2 in pointList2)
            {
                if (point1.pointType != Railway.Point.EType.Joint &&
                    point2.pointType != Railway.Point.EType.Joint &&
                    point1.routeId == point2.routeId &&
                    point1.routeId != Railway.Manager.InvalId)
                {
                    Railway.Route route = Railway.Manager.Instance.GetRoute(point1.routeId);
                    if (null != route)
                    {
                        return(route.trainId != Railway.Manager.InvalId);
                    }
                }
            }
        }
        return(false);
    }
Пример #19
0
 public void Init(Railway.Route _Route)
 {
     mRoute = _Route;
 }