Ejemplo n.º 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();
        }
    }
Ejemplo n.º 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);
            }
        }
    }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 4
0
 public void DoSetTrainToStation(int routeId, int pointId)
 {
     Railway.Route route = Railway.Manager.Instance.GetRoute(routeId);
     if (null != route)
     {
         route.SetTrainToStation(pointId);
     }
 }
Ejemplo n.º 5
0
 public void DoResetRouteName(int routeID, string name)
 {
     Railway.Route route = Railway.Manager.Instance.GetRoute(routeID);
     if (null != route)
     {
         route.name = name;
     }
 }
Ejemplo n.º 6
0
 public void AddMonoRail(Railway.Route route)
 {
     if (!mRouteList.Contains(route))
     {
         mRouteList.Add(route);
         //Do UI Update
         AddUIRailLine(route);
     }
 }
Ejemplo n.º 7
0
 public void RemoveMonoRail(Railway.Route route)
 {
     if (mRouteList.Contains(route))
     {
         DeleteUIRailLine(route);
         mRouteList.Remove(route);
         mRailIcon.SetItem(null);
     }
 }
Ejemplo n.º 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);
    }
Ejemplo n.º 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));
    }
Ejemplo n.º 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;
        }
    }
Ejemplo n.º 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);
        }
    }
Ejemplo n.º 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);
        }
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 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);
        }
    }
Ejemplo n.º 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);
    }
Ejemplo n.º 19
0
 public void Init(Railway.Route _Route)
 {
     mRoute = _Route;
 }