Ejemplo n.º 1
0
    private void CreateStationsByData()
    {
        DebugLog("CreateStationsByData() start.");

        DestroyStationDisplayObjects();

        Texture2D stationTexture = (Texture2D)Resources.Load(m_StationIconTexturePath,
                                                             typeof(Texture2D));

        if (null == stationTexture)
        {
            Debug.LogError("CreateStationsByData() stationTexture load failed=" + m_StationIconTexturePath);
            return;
        }

        foreach (StationData sd in m_Stations.Values)
        {
            string         objName        = "Station_" + sd.DisplayName;
            GameObject     stationObj     = new GameObject(objName);
            StationDisplay stationDisplay = null;
            GUITexture     guiTexture     = stationObj.AddComponent <GUITexture>();
            if (null != guiTexture)
            {
                stationObj.transform.localScale = new Vector3(0, 0, 1);

                stationObj.transform.Translate(sd.Position.x, sd.Position.y, m_StationLayerZShift);
                guiTexture.texture    = stationTexture;
                guiTexture.pixelInset = new Rect(-1 * 32 / 2,
                                                 -1 * 32 / 2,
                                                 32,
                                                 32);
                stationDisplay          = new StationDisplay();
                stationDisplay.Position = new Vector3(sd.Position.x, sd.Position.y, m_StationLayerZShift);
                stationDisplay.ID       = sd.ID;
                stationDisplay.Obj      = stationObj;
            }

            GameObject textObj = new GameObject(objName + "_Text");
            GUIText    guiText = textObj.AddComponent <GUIText>();
            if (null != guiText)
            {
                guiText.fontSize       = 16;
                guiText.material.color = Color.black;
                guiText.text           = sd.DisplayName;
                guiText.pixelOffset    = new Vector2(
                    1 * 32 / 2,
                    0);
            }
            textObj.transform.parent        = stationObj.transform;
            textObj.transform.localPosition = new Vector3(0, 0, m_StationLayerZShift + 1);

            if (null != stationDisplay)
            {
                m_StationDisplay.Add(sd.ID, stationDisplay);
            }
        }

        DebugLog("CreateStationsByData() ended.");
    }
Ejemplo n.º 2
0
    private void CreateStationsByData()
    {
        Debug.Log("CreateStationsByData() start.");

        DestroyStationDisplayObjects();

        Object prefab = Resources.Load("StationPrefab");

        if (null == prefab)
        {
            Debug.LogError("CreateStationsByData() CubePrefab load failed");
            return;
        }
        Object textMeshPrefab = Resources.Load("TextMeshPrefab");

        if (null == textMeshPrefab)
        {
            Debug.LogError("CreateStationsByData() textMeshPrefab load failed");
            return;
        }

        foreach (StationData sd in m_Stations.Values)
        {
            string     objName    = "Station_" + sd.DisplayName;
            GameObject stationObj = (GameObject)GameObject.Instantiate(prefab);
            stationObj.name = objName;

            StationDisplay stationDisplay = null;
            Renderer       renderer       = stationObj.GetComponent <Renderer>();
            if (null != renderer)
            {
                stationObj.transform.position = new Vector3(sd.Position.x,
                                                            sd.Position.y,
                                                            m_StationLayerZShift);

                stationDisplay          = new StationDisplay();
                stationDisplay.Position = new Vector3(sd.Position.x,
                                                      sd.Position.y,
                                                      m_StationLayerZShift);
                stationDisplay.ID  = sd.ID;
                stationDisplay.Obj = stationObj;

                GameObject textObj = (GameObject)GameObject.Instantiate(textMeshPrefab);
                textObj.name = objName + "_Text";
                TextMesh textMesh = textObj.GetComponent <TextMesh>();
                if (null != textMesh)
                {
                    textMesh.text = sd.DisplayName;
                }
                textObj.transform.parent        = stationObj.transform;
                textObj.transform.localPosition = Vector3.zero;
                textObj.transform.localScale    = new Vector3(-0.5f, -0.5f, 1);

                m_StationDisplay.Add(sd.ID, stationDisplay);
            }
        }
        Debug.Log("CreateStationsByData() ended.");
    }    // end of CreateStationsByData()
Ejemplo n.º 3
0
        public static void LayoutDisplay()
        {
            var infos = MyZoneInfo;

            for (int i = 0; i < Project.CcdCount; i++)
            {
                infos[i].Show();
                var display = StationDisplay.GetStation(i);
            }
        }
Ejemplo n.º 4
0
        public GlobalItem EditItem(GlobalItem item)
        {
            GlobalItem edited = null;

            if (item.IsEditable() && (typeof(StationAreaItem) == item.GetType()))
            {
                ((StationAreaItem)item).setInterfaceConfigured();
                StationInterface interface2 = new StationInterface(((StationAreaItem)item).getStationConnector());
                interface2.ShowDialog();
                if (interface2.ToRemove)
                {
                    return(null);
                }
                item.Edit();
                edited = ((StationAreaItem)item).parent;
            }
            else if (item.IsEditable() && (typeof(StationItem) == item.GetType()))
            {
                StationDisplay interface2 = new StationDisplay((StationItem)item);
                interface2.ShowDialog();
                edited = item;
            }
            else if (item.IsEditable() && (typeof(AEBufferItem) == item.GetType()))
            {
                ((AEBufferItem)item).Configured = true;
                BufferInterface interface2 = new BufferInterface(((AEBufferItem)item));
                interface2.ShowDialog();
                if (interface2.ToRemove)
                {
                    return(null);
                }
                item.Edit();
                edited = ((AEBufferItem)item).parentStation;
            }
            else if (item.IsEditable() && (typeof(TrackSegment) == item.GetType()))
            {
                List <string> destination = new List <string>();
                destination.Add("All");
                ((TrackSegment)item).Configured = true;
                TrackSegmentInterface interface2 = new TrackSegmentInterface(((TrackSegment)item), destination);
                interface2.ShowDialog();
                item.Edit();
                edited = ((TrackSegment)item).parentStation;
            }
            return(edited);
        }
        public const int Interval = 10; // group loadings into 10 minute time intervals

        //Constructor

        public MetroNetworkLoading(LineDictionary lineDiction, StationDictionary stationDiction, Canvas c)
        {
            // assigning static variables
            C = c;
            StationDiction = stationDiction;
            LineDiction    = lineDiction;

            // instantiating variables
            LineRecords = new List <LineRecord>();
            RecLocs     = new List <RecordLocation>();

            for (int i = 0; i < LineDiction.N; i++)
            {
                LineRecords.Add(new LineRecord(i)); // intialise record setup
            }

            NodeNumber = StationDiction.N;

            // displays stations
            StatDisplay = new StationDisplay(C);
        }
Ejemplo n.º 6
0
    private void CreateStationsByData()
    {
        DebugLog( "CreateStationsByData() start." ) ;

        DestroyStationDisplayObjects() ;

        Texture2D stationTexture = (Texture2D)Resources.Load( m_StationIconTexturePath ,
                                                       typeof(Texture2D) ) ;
        if( null == stationTexture )
        {
            Debug.LogError( "CreateStationsByData() stationTexture load failed=" + m_StationIconTexturePath ) ;
            return ;
        }

        foreach( StationData sd in m_Stations.Values )
        {
            string objName = "Station_" + sd.DisplayName ;
            GameObject stationObj = new GameObject( objName ) ;
            StationDisplay stationDisplay = null ;
            GUITexture guiTexture = stationObj.AddComponent<GUITexture>() ;
            if( null != guiTexture )
            {
                stationObj.transform.localScale = new Vector3( 0 , 0 , 1 ) ;

                stationObj.transform.Translate( sd.Position.x , sd.Position.y , m_StationLayerZShift ) ;
                guiTexture.texture = stationTexture ;
                guiTexture.pixelInset = new Rect( -1 * 32 / 2 ,
                                                 -1 * 32 / 2 ,
                                                 32 ,
                                                 32 ) ;
                stationDisplay = new StationDisplay() ;
                stationDisplay.Position = new Vector3( sd.Position.x , sd.Position.y , m_StationLayerZShift ) ;
                stationDisplay.ID = sd.ID ;
                stationDisplay.Obj = stationObj ;

            }

            GameObject textObj = new GameObject( objName + "_Text"  ) ;
            GUIText guiText = textObj.AddComponent<GUIText>() ;
            if( null != guiText )
            {
                guiText.fontSize = 16 ;
                guiText.material.color = Color.black ;
                guiText.text = sd.DisplayName ;
                guiText.pixelOffset = new Vector2 (
                    1 * 32 / 2 ,
                    0 ) ;
            }
            textObj.transform.parent = stationObj.transform ;
            textObj.transform.localPosition = new Vector3( 0 , 0 , m_StationLayerZShift + 1 ) ;

            if( null != stationDisplay )
            {
                m_StationDisplay.Add( sd.ID , stationDisplay ) ;
            }
        }

        DebugLog( "CreateStationsByData() ended." ) ;
    }
Ejemplo n.º 7
0
    private void CreateStationsByData()
    {
        Debug.Log( "CreateStationsByData() start." ) ;

        DestroyStationDisplayObjects() ;

        Object prefab = Resources.Load ("StationPrefab");
        if (null == prefab)
        {
            Debug.LogError( "CreateStationsByData() CubePrefab load failed" ) ;
            return ;
        }
        Object textMeshPrefab = Resources.Load ("TextMeshPrefab");
        if (null == textMeshPrefab)
        {
            Debug.LogError( "CreateStationsByData() textMeshPrefab load failed" ) ;
            return ;
        }

        foreach( StationData sd in m_Stations.Values )
        {
            string objName = "Station_" + sd.DisplayName ;
            GameObject stationObj =(GameObject) GameObject.Instantiate( prefab ) ;
            stationObj.name = objName ;

            StationDisplay stationDisplay = null ;
            Renderer renderer = stationObj.GetComponent<Renderer>() ;
            if( null != renderer )
            {
                stationObj.transform.position = new Vector3( sd.Position.x ,
                                               sd.Position.y ,
                                               m_StationLayerZShift ) ;

                stationDisplay = new StationDisplay() ;
                stationDisplay.Position = new Vector3( sd.Position.x ,
                                                      sd.Position.y ,
                                                      m_StationLayerZShift ) ;
                stationDisplay.ID = sd.ID ;
                stationDisplay.Obj = stationObj ;

                GameObject textObj = (GameObject) GameObject.Instantiate( textMeshPrefab ) ;
                textObj.name = objName + "_Text" ;
                TextMesh textMesh = textObj.GetComponent<TextMesh>() ;
                if( null != textMesh )
                {
                    textMesh.text = sd.DisplayName ;
                }
                textObj.transform.parent = stationObj.transform ;
                textObj.transform.localPosition = Vector3.zero ;
                textObj.transform.localScale = new Vector3( -0.5f , -0.5f , 1 ) ;

                m_StationDisplay.Add( sd.ID , stationDisplay ) ;
            }
        }
        Debug.Log( "CreateStationsByData() ended." ) ;
    }