コード例 #1
0
    public override void OnInspectorGUI()
    {
        MapLine mapLine = (MapLine)target;

        GUI.enabled = false;
        EditorGUILayout.ObjectField("Script", MonoScript.FromMonoBehaviour((MapLine)target), typeof(MapLine), false);
        GUI.enabled = true;
        SerializedObject serializedObject = new SerializedObject(mapLine);

        serializedObject.Update();
        ShowBool(serializedObject.FindProperty("DisplayHandles"));
        ShowList(serializedObject.FindProperty("mapLocalPositions"));
        serializedObject.ApplyModifiedProperties();
        Repaint();

        mapLine.lineType = (MapData.LineType)EditorGUILayout.EnumPopup("LineType", mapLine.lineType);
        if (mapLine.lineType == MapData.LineType.STOP)
        {
            using (var group = new EditorGUILayout.FadeGroupScope(Convert.ToSingle(mapLine.lineType == MapData.LineType.STOP)))
            {
                if (group.visible == true)
                {
                    EditorGUI.indentLevel++;
                    mapLine.isStopSign   = EditorGUILayout.Toggle("Is Stop Sign", mapLine.isStopSign);
                    mapLine.currentState = (MapData.SignalLightStateType)EditorGUILayout.EnumPopup("Current Signal State", mapLine.currentState);
                    EditorGUI.indentLevel--;
                }
            }
        }
    }
コード例 #2
0
        private void _mapLines()
        {
            mapLines = new List <MapLine>();

            // lat
            int    n   = 36;
            double inc = 360 / n;

            for (int lat = -90; lat <= 90; lat += 10)
            {
                MapLine mp = new MapLine("Lat:" + lat);
                mapLines.Add(mp);
                for (int i = 0; i < n + 1; i++)
                {
                    mp.Add(lat, -180 + i * inc);
                }
            }

            // lon
            n   = 36;
            inc = 180 / 36;
            for (int lon = -180; lon < 180; lon += 10)
            {
                MapLine mp = new MapLine("Lon:" + lon);
                mapLines.Add(mp);
                for (int i = 0; i < n + 1; i++)
                {
                    mp.Add(-90 + i * inc, lon);
                }
            }
        }
コード例 #3
0
        protected void BindExamMapLinesSpinner(Spinner MapSpinner)
        {
            try
            {
                var     mapLines = dataService.ALLMapLines;
                MapLine mapLine  = new MapLine()
                {
                    Id = 0, Name = "无地图"
                };
                lstMapLine = new List <MapLine>();
                lstMapLine.Add(mapLine);
                lstMapLine.AddRange(mapLines);
                List <string> lstMaps = new List <string>();

                string strMapInfo = string.Empty;
                for (int i = 0; i < lstMapLine.Count(); i++)
                {
                    //lstKeyValueMaps.Add(new KeyValuePair<int, MapLine>(i, lstMapLine[i]));
                    lstMaps.Add(lstMapLine[i].Name);
                }
                //加载出来
                //最简单的嘛通过索引的地图名称再去反响查找
                BindSpinner(lstMaps, MapSpinner);
            }
            catch (Exception ex)
            {
                Logger.Error(ex, this.GetType().ToString());
            }
        }
コード例 #4
0
ファイル: MapManager.cs プロジェクト: 08TempestNew/08_Tempest
    // Use this for initialization
    void Start()
    {
        mapLines = new MapLine[mapVertices.Length - 1];
        for (int i = 0; i < mapLines.Length; i++)
        {
            mapLines [i] = new MapLine(mapVertices[i], mapVertices[i + 1]);
            mapLines [i].SetLineNum(i);
        }

        for (int i = 0; i < mapLines.Length; i++)
        {
            if (i > 0)
            {
                mapLines [i].SetLeftMapLine(mapLines [i - 1]);
            }
            if (i < mapLines.Length - 1)
            {
                mapLines [i].SetRightMapLine(mapLines [i + 1]);
            }
        }

        if (isLoop == true)
        {
            mapLines [0].SetLeftMapLine(mapLines [mapLines.Length - 1]);
            mapLines [mapLines.Length - 1].SetRightMapLine(mapLines [0]);
        }
    }
コード例 #5
0
        public void AddPolyLine(MapLine line)
        {
            var pointList      = line.Points.ToArray();
            var cleanPointList = new List <GeoCoordinate>();

            cleanPointList.Add(pointList[0]);
            for (int i = 1; i < pointList.Length - 1; i++)
            {
                if (!(pointList[i - 1] == pointList[i + 1] && pointList[i] != pointList[i - 1]))
                {
                    cleanPointList.Add(pointList[i]);
                }
            }
            cleanPointList.Add(pointList[pointList.Length - 1]);

            var polyLine = new MapControl.MapPolyline
            {
                StrokeThickness = line.Thickness,
                Stroke          = new SolidColorBrush(line.Color),
                Locations       = cleanPointList.Select(x => new MapControl.Location(x.Latitude, x.Longitude)).ToList(),
                Fill            = new SolidColorBrush(line.Color),
                FillRule        = FillRule.Nonzero
            };

            composedControl.Children.Add(polyLine);
            polyLines.Add(polyLine);
        }
コード例 #6
0
        public void UpdateMap()
        {
            try
            {
                MapLine mapLine             = dataService.GetAllMapLines().Where(s => s.Id == MapID).FirstOrDefault();
                IList <MapLinePoint> Points = new List <MapLinePoint>();

                foreach (var item in lstRoadMapExamItem)
                {
                    Points.Add(item.Value);
                }
                mapLine.Points   = Points;
                mapLine.Name     = edtRoadName.Text;
                mapLine.Distance = Points.CalculateDistances();
                mapLine.CreateOn = DateTime.Now;
                mapLine.Remark   = mapLine.Points.ToJson();
                bool Result = dataService.UpdateMap(mapLine);
                if (Result)
                {
                    Toast.MakeText(this, "更新地图成功", ToastLength.Short).Show();
                    Finish();
                }
                else
                {
                    Toast.MakeText(this, "更新地图失败", ToastLength.Short).Show();
                }
            }
            catch (Exception ex)
            {
                Log.Error("SaveMap", ex.Message);
                Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
            }
        }
コード例 #7
0
    void FixedUpdate()
    {
        // Determine where we aim to go
        _playerScript = GameObject.Find("Player").GetComponent <PlayerShip>();
        if (_playerScript != null)
        {
            _targetMapLine = _playerScript.curMapLine;
        }

        // Find shortest path and next step (_nextMapLine)
        int rightDist = curMapLine.getShortestDist(curMapLine.leftLine, _targetMapLine);
        int leftDist  = curMapLine.getShortestDist(curMapLine.rightLine, _targetMapLine);

        if (leftDist < rightDist)
        {
            _nextMapLine = curMapLine.leftLine;
        }
        else if (leftDist >= rightDist && leftDist > 0)
        {
            _nextMapLine = curMapLine.rightLine;
        }
        else
        {
            _nextMapLine = curMapLine;
        }

        Move(_nextMove <= Time.fixedTime);
    }
コード例 #8
0
ファイル: PlayerShip.cs プロジェクト: 08TempestNew/08_Tempest
    void FixedUpdate()
    {
        if (curMapLine == null)
        {
            curMapLine = _mapManager.mapLines [2];
        }


        if (legacyMovement == true)
        {
            _inputValue = Input.GetAxis(inputAxis);
        }
        else
        {
            Vector3 mousePos = Input.mousePosition;
            _targetMapLine = curMapLine;
            foreach (MapLine ml in _mapManager.mapLines)
            {
                Vector3 MLPos    = camera.WorldToScreenPoint(ml.GetMidPoint());
                Vector3 curMLPos = camera.WorldToScreenPoint(_targetMapLine.GetMidPoint());
                if (Vector3.Distance(mousePos, MLPos) < Vector3.Distance(mousePos, curMLPos))
                {
                    _targetMapLine = ml;
                }
            }
            int rightDist = curMapLine.getShortestDist(curMapLine.leftLine, _targetMapLine);
            int leftDist  = curMapLine.getShortestDist(curMapLine.rightLine, _targetMapLine);
            if (leftDist < rightDist)
            {
                _nextMapLine = curMapLine.leftLine;
            }
            else if (leftDist >= rightDist && leftDist > 0)
            {
                _nextMapLine = curMapLine.rightLine;
            }
            else
            {
                _nextMapLine = curMapLine;
            }
            //curMapLine = _targetMapLine;
        }
        //if (_nextMove <= Time.fixedTime) {
        Move();
        //	_nextMove = Time.fixedTime + moveCooldown;
        //}

        if ((Input.GetMouseButton(0) || Input.GetKey(KeyCode.Space)) && _lastFire + fireCooldown < Time.fixedTime && _curBullets < maxBullets)
        {
            Fire();
            _lastFire = Time.fixedTime;
        }

        if ((Input.GetKey(KeyCode.LeftControl) || Input.GetMouseButton(1)) && _zapperReady == true)
        {
            Zapper();
            _zapperReady = false;
        }
    }
コード例 #9
0
    void SpawnFlipper(MapLine newMapLine)
    {
        Vector3    curDirVec = newMapLine.GetDirectionVector();
        Vector3    newDirVec = new Vector3(-curDirVec.y, curDirVec.x, 0);
        GameObject newShip   = Instantiate(flipperPrefab, newMapLine.GetMidPoint() + new Vector3(0, 0, transform.position.z + 1f), Quaternion.LookRotation(new Vector3(0f, 0f, 1f), newDirVec));

        newShip.GetComponent <Flipper>().SetMapLine(newMapLine);
        newShip.GetComponent <Flipper>().movementForce = _gameManager.currentRound * _gameManager.speedMulti;
    }
コード例 #10
0
    public MapLine GetClosestLine(Vector3 position)
    {
        MapLine result       = null;
        float   minDistLeft  = float.PositiveInfinity;
        float   minDistRight = float.PositiveInfinity;
        MapLine Leftline     = new MapLine();
        MapLine RightLine    = new MapLine();

        // TODO: this should be optimized
        foreach (var LL in trafficLinesLeft)
        {
            if (LL.mapWorldPositions.Count >= 2)
            {
                for (int i = 0; i < LL.mapWorldPositions.Count - 1; i++)
                {
                    var p0 = LL.mapWorldPositions[i];
                    var p1 = LL.mapWorldPositions[i + 1];

                    float d = Utility.SqrDistanceToSegment(p0, p1, position);
                    if (d < minDistLeft)
                    {
                        Leftline    = LL;
                        minDistLeft = d;
                        result      = Leftline;
                    }
                }
            }
        }
        foreach (var RL in trafficLinesRight)
        {
            if (RL.mapWorldPositions.Count >= 2)
            {
                for (int i = 0; i < RL.mapWorldPositions.Count - 1; i++)
                {
                    var p0 = RL.mapWorldPositions[i];
                    var p1 = RL.mapWorldPositions[i + 1];

                    float d = Utility.SqrDistanceToSegment(p0, p1, position);
                    if (d < minDistRight)
                    {
                        RightLine    = RL;
                        minDistRight = d;
                        result       = RightLine;
                    }
                }
            }
        }
        if (minDistLeft <= minDistRight)
        {
            result = Leftline;
        }
        else
        {
            result = RightLine;
        }
        return(result);
    }
コード例 #11
0
ファイル: GameManager.cs プロジェクト: Team8Final/08_Tempest
    public void SpawnSpiker()
    {
        int        index      = Random.Range(1, _mapManager.mapLines.Length - 1);
        MapLine    newMapLine = _mapManager.mapLines [index];
        float      _mapDepth  = _mapManager.depth;
        GameObject newShip    = Instantiate(spikerPrefab, newMapLine.GetMidPoint() + new Vector3(0, 0, 1 * _mapDepth), spikerPrefab.transform.rotation);

        newShip.GetComponent <Spiker>().moveSpeed *= currentRound * speedMulti;
    }
コード例 #12
0
ファイル: MapLine.cs プロジェクト: Team8Final/08_Tempest
 public MapLine(Vector3 startpos, Vector3 endpos, MapLine left, MapLine right)
 {
     startPos  = startpos;
     endPos    = endpos;
     leftLine  = left;
     rightLine = right;
     _dir      = GetDirectionVector();
     _length   = GetLength();
 }
コード例 #13
0
ファイル: UIEmojiSelect.cs プロジェクト: gsoec/lm-source
 // Token: 0x06001AEA RID: 6890 RVA: 0x002DABB0 File Offset: 0x002D8DB0
 public void SendPackage()
 {
     if (this.OpenType == 1)
     {
         Door door = this.GM.FindMenu(EGUIWindow.Door) as Door;
         if (door && door.m_GroundInfo != null)
         {
             MessagePacket messagePacket = new MessagePacket(1024);
             messagePacket.Protocol = Protocol._MSG_REQUEST_MAP_EMOTION;
             messagePacket.AddSeqId();
             messagePacket.Add(DataManager.MapDataController.FocusKingdomID);
             if (door.m_GroundInfo.m_TeamPanelGameObject.activeSelf)
             {
                 messagePacket.Add(13);
                 if (door.m_GroundInfo.m_MapPointID >= 0 && door.m_GroundInfo.m_MapPointID < DataManager.MapDataController.MapLineTable.Count)
                 {
                     MapLine mapLine = DataManager.MapDataController.MapLineTable[door.m_GroundInfo.m_MapPointID];
                     messagePacket.Add(mapLine.lineID);
                 }
             }
             else
             {
                 if (door.m_GroundInfo.m_MapPointID >= 0 && door.m_GroundInfo.m_MapPointID < DataManager.MapDataController.LayoutMapInfo.Length)
                 {
                     MapPoint mapPoint = DataManager.MapDataController.LayoutMapInfo[(int)((UIntPtr)door.m_GroundInfo.m_MapPointID)];
                     messagePacket.Add(mapPoint.pointKind);
                 }
                 ushort data;
                 byte   data2;
                 GameConstants.MapIDToPointCode(door.m_GroundInfo.m_MapPointID, out data, out data2);
                 messagePacket.Add(0);
                 messagePacket.Add(data);
                 messagePacket.Add(data2);
             }
             messagePacket.Add(this.GetEmojiKey(this.GM.EmojiNowPackageIndex, (int)this.GM.EmojiNowPicIndex));
             messagePacket.Add(this.DM.TotalShopItemData.Find(this.ItemID));
             messagePacket.Send(false);
             this.SendChangeSave(this.GM.EmojiNowPackageIndex);
             if (this.DM.GetCurItemQuantity(this.ItemID, 0) <= 0)
             {
                 this.DM.SetBuyAndUse(1);
             }
             if (!door.m_GroundInfo.m_TeamPanelGameObject.activeSelf)
             {
                 door.m_GroundInfo.Close();
             }
             this.GM.CloseMenu(EGUIWindow.UIEmojiSelect);
         }
     }
     else if (this.OpenType == 2)
     {
         this.GM.UpdateUI(EGUIWindow.UI_Chat, 15, (int)this.GetEmojiKey(this.GM.EmojiNowPackageIndex, (int)this.GM.EmojiNowPicIndex));
         this.SendChangeSave(this.GM.EmojiNowPackageIndex);
         this.GM.CloseMenu(EGUIWindow.UIEmojiSelect);
     }
 }
        /// <summary>
        /// Add Ellipse to indicate point location
        /// </summary>
        /// <param name="loc">Location lat,lon</param>
        /// <param name="fields">string of attributes for tooltip</param>
        /// <param name="layer">MapLeyer to add to</param>

        /// <summary>
        /// Render simple linestring features
        /// </summary>
        /// <param name="shapegeo">simple point feature</param>
        /// <param name="label">attributes for tooltip</param>
        /// <param name="currentLayer">MapLayer to add to</param>
        private LocationCollection GetLine(MapLine shapegeo)
        {
            LocationCollection p = new LocationCollection();

            foreach (LatLong pt in shapegeo.Locations)
            {
                p.Add(new Location(pt.Latitude, pt.Longitude));
            }
            return(p);
        }
コード例 #15
0
        PointF[] _getLine(MapLine mLine)
        {
            List <PointF> poly = new List <PointF>();

            foreach (BaseCoordinate item in mLine.Collection)
            {
                poly.Add(!double.IsNaN(item.ProjectedX) ? _convertF(item) : new PointF(float.NaN, float.NaN));
            }
            return(poly.ToArray());
        }
コード例 #16
0
ファイル: NpcEditHelper.cs プロジェクト: dongpeng1988/xlj
    private void initLine()
    {
        foreach (KeyValuePair <int, MapLine> kp in lineCollection)
        {
            MapLine npc = kp.Value;


            npcHelper.AddLine(npc);
        }
    }
コード例 #17
0
ファイル: GameManager.cs プロジェクト: Team8Final/08_Tempest
    public void SpawnPowerUp()
    {
        int        index      = Random.Range(1, _mapManager.mapLines.Length - 1);
        MapLine    newMapLine = _mapManager.mapLines[index];
        float      _mapDepth  = _mapManager.depth;
        GameObject powerUp    = Instantiate(powerUpPrefab, newMapLine.GetMidPoint() + new Vector3(0, 0, 1 * _mapDepth), powerUpPrefab.transform.rotation);

        powerUp.GetComponent <PowerUp>().curMapLine = newMapLine;
        powerUp.GetComponent <PowerUp>().moveSpeed *= currentRound * speedMulti;
    }
コード例 #18
0
ファイル: PhoneMapProxy.cs プロジェクト: gyurisb/bpmenetrend
        public void AddPolyLine(MapLine line)
        {
            MapPolyline polyLine = new MapPolyline
            {
                StrokeColor     = line.Color,
                StrokeThickness = line.Thickness,
                Path            = new Geopath(line.Points.Select(x => x.ToBasicGeoposition()))
            };

            composedControl.MapElements.Add(polyLine);
        }
コード例 #19
0
        Vector3 GetStopSignMeshLocation(MapLine stopLine)
        {
            float dist           = 2; // we create stop sign 2 meters to the right of the right end point of the stopline
            var   worldPositions = stopLine.mapWorldPositions;
            var   stopLineLength = (worldPositions.Last() - worldPositions.First()).magnitude;
            var   meshLocation   = stopLine.transform.position + stopLine.transform.right * (dist + stopLineLength / 2);

            meshLocation -= stopLine.transform.forward * 1; // move stop sign 1 meter back

            return(meshLocation);
        }
コード例 #20
0
 // Use this for initialization
 void Start()
 {
     _curBullets    = 0;
     _rigidbody     = GetComponent <Rigidbody> ();
     _mapManager    = GameObject.Find("MapManager").GetComponent <MapManager> ();
     _gameManager   = GameObject.Find("GameManager").GetComponent <GameManager> ();
     _audioSource   = GetComponent <AudioSource> ();
     _playerScript  = GameObject.Find("Player").GetComponent <PlayerShip>();
     _nextMove      = Time.fixedTime;
     _targetMapLine = curMapLine;
 }
コード例 #21
0
ファイル: MapLine.cs プロジェクト: Team8Final/08_Tempest
 // Used to compare another MapLine with this one
 public bool Equals(MapLine otherMapLine)
 {
     if (otherMapLine.startPos == startPos && otherMapLine.endPos == endPos)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #22
0
        private static SegmentedLine3D LaneLineToSegmentedLine(MapLine laneLine)
        {
            var lines = new List <Line3D>();
            var wPos  = laneLine.mapWorldPositions;

            for (var i = 1; i < wPos.Count; ++i)
            {
                lines.Add(new Line3D(wPos[i - 1], wPos[i]));
            }

            return(new SegmentedLine3D(lines));
        }
コード例 #23
0
        void AddLine(string id, LaneBoundary boundary, bool isLeft = false)
        {
            var curveSegments     = boundary.curve.segment;
            var linePoints        = GetPointsFromCurve(curveSegments);
            var linePointsDouble3 = DownSample(linePoints);

            string lineId;

            if (isLeft)
            {
                lineId = "MapLine_Left_" + id;
            }
            else
            {
                lineId = "MapLine_Right_" + id;
            }

            GameObject mapLineObj = new GameObject(lineId);

            mapLineObj.transform.parent = TrafficLanes.transform;

            MapLine mapLine = mapLineObj.AddComponent <MapLine>();

            mapLine.mapWorldPositions = ConvertUTMFromDouble3(linePointsDouble3);
            UpdateObjPosAndLocalPos(mapLineObj.transform, mapLine);

            if (boundary.@virtual)
            {
                mapLine.lineType = MapData.LineType.VIRTUAL;
            }
            else
            {
                mapLine.lineType = BoundaryTypeToLineType(boundary.boundary_type[0].types[0]);
            }

            var warning = "Multiple boundary types for one lane boundary is not"
                          + "supported yet, currently only the 1st type is used.";

            if (boundary.boundary_type.Count > 1)
            {
                Debug.LogWarning(warning);
            }

            if (isLeft)
            {
                Id2LeftLineBoundary[id] = mapLine;
            }
            else
            {
                Id2RightLineBoundary[id] = mapLine;
            }
        }
コード例 #24
0
    /// <summary>
    /// Selecting a point.
    /// </summary>
    /// <param name="_p">the point</param>
    public void SelectPoint(MapPoint _p)
    {
        if (selected != null)
        {
            selected.UnHighlight();
            selected = null;
            //only when selected is not null
            foreach (MapPoint K in adjacent)
            {
                K.UnHighlight();
            }
            adjacent.Clear();
        }

        if (_p != null)
        {
            selected = _p;
            _p.HighlightAsSelected();

            //the four direction. Generalized writing
            float quarter = Mathf.PI / 2;            //90 degrees


            for (float theta = 0; theta < 3 * quarter + 0.01f; theta += quarter)
            {
                int x = _p.posX + (int)Mathf.Round(Mathf.Cos(theta));
                int y = _p.posY + (int)Mathf.Round(Mathf.Sin(theta));
//				Debug.Log("Checking for point(" + x.ToString() + "," + y.ToString() + ")");

                if (MapController.instance.CheckExistPoint(x, y))
                {
                    MapLine line = MapController.instance.GetLineFromPoint(_p.posX, _p.posY, theta);
                    if (null == line || false == line.isVacant)
                    {
                        //	only the points that are able to connect can be
                        //second-highligt as selectable.

                        //Debug.Log(string.Format("The line for ({0}, {1}, {2}) is ivalid", x, y, theta));
                        continue;
                    }

                    //Debug.Log(string.Format("The point({0}, {1}) is recognized as adjacent.", x, y, theta));
                    adjacent.Add(MapController.instance.points[x - 1, y - 1]);
                    MapController.instance.points[x - 1, y - 1].HighlightAsSelectable();
                }
                else
                {
                    Debug.Log(string.Format("No point({0}, {1})", x, y, theta));
                }
            }
        }
    }
コード例 #25
0
ファイル: MapLineMode.cs プロジェクト: gdgkyoto/kyoto-gtug
        public MapData end(MainPage mainPage)
        {
            /* Turn off drawing line mode */
            mainPage.drawALineButton.Content = "Draw a line";

            /* Create a layer and add to the map */
            MapLine mapLine = new MapLine();
            mapLine.setLocationCollection(this.locationCollection);
            //mapLine.draw(mainPage.mainMap);

            Debug.WriteLine("Stopped drawing a line");

            return mapLine;
        }
コード例 #26
0
    // Token: 0x06000ABC RID: 2748 RVA: 0x000E6914 File Offset: 0x000E4B14
    public void recalculateSpeed(LineNode node, MapLine _ml, bool bResetOffset = false)
    {
        uint  exduring = _ml.EXduring;
        ulong begin    = _ml.begin;
        uint  exbegin  = _ml.EXbegin;
        uint  num      = _ml.during;

        if (bResetOffset)
        {
            node.timeOffset = exbegin;
        }
        float num2 = (num - exbegin) / num * node.distance;
        uint  num3 = num - exduring;
        float num4 = num2 / num3;

        if (num4 >= 0.5f && num > 1u && num3 > 2u)
        {
            num -= 1u;
            num2 = (num - exbegin) / num * node.distance;
            num3 = num - exduring;
            num4 = num2 / num3;
        }
        if (_ml.lineFlag >= 23)
        {
            node.inverseMaxTime = 1f / _ml.during;
        }
        ulong serverTime = (ulong)DataManager.Instance.ServerTime;
        ulong num5       = begin + (ulong)exduring;
        long  num6       = (long)(serverTime - num5);
        float num7       = exbegin / num * node.distance;
        float num8       = (num7 + (float)num6 * num4) / node.distance * num;
        float num9       = node.distance / num;

        if (node.timeOffset <= num8)
        {
            node.timeOffset    = num8;
            num4              /= num9;
            node.speedRate     = num4 * 0.05f + num9 / 1.75f;
            node.unitSpeedRate = num4;
        }
        else
        {
            float num10 = (1f - node.timeOffset * node.inverseMaxTime) * node.distance;
            int   num11 = (int)(begin + (ulong)num - serverTime);
            num11 = Mathf.Max(0, num11);
            float num12 = num10 / (float)num11 / num9;
            node.speedRate     = num12 * 0.05f + num9 / 1.75f;
            node.unitSpeedRate = num12;
        }
    }
コード例 #27
0
        public void ClickSaveMenu(object sender, EventArgs e)
        {
            Int32[,] canvasData = new Int32[25, 30];
            MapPalette.GetMapCanvasInfo(ref canvasData);

            WholeStageData wholeStageData = new WholeStageData
            {
                StageLevel = 1,
            };

            for (int i = 0; i < 25; i++)
            {
                WholeStageData.Types.MapLine mapLine = new MapLine();
                for (int j = 0; j < 30; j++)
                {
                    mapLine.Block.Add(canvasData[i, j]);
                }
                wholeStageData.Map.Add(mapLine);
            }



            foreach (MonsterData monData in m_StageMonsters)
            {
                Monster monster = new Monster();
                monster.Type      = (Int32)monData.type;
                monster.StartXPos = monData.startPos.X;
                monster.StartYPos = monData.startPos.Y;

                foreach (MonsterAICommand monDtCmd in monData.Commands)
                {
                    monster.Commands.Add((Int32)monDtCmd);
                }

                wholeStageData.Monsters.Add(monster);
            }

            // wholeStageData.ToString();
            if (m_isNewFile == false)
            {
                m_fileName = "";
                ShowSaveDialogBox(ref wholeStageData);
            }
            else
            {
                m_fileStream = File.Create(m_filePath + m_fileName);
                SaveFile(ref wholeStageData);
            }
        }
コード例 #28
0
ファイル: MapDrawEngine.cs プロジェクト: radtek/LsMap
        internal override void Draw(Graphics g, Datarow row)
        {
            if (row.Data == null)
            {
                return;
            }
            MapLine       mapLine      = (MapLine)row.Data;
            List <PointF> screenpoints = new List <PointF>();

            foreach (MapPoint p in mapLine.Points)
            {
                screenpoints.Add(MapDrawHelper.ToScreenPoint(p, extent, width, height));
            }
            g.DrawLines(new Pen(Color.Orange, 2), screenpoints.ToArray());
        }
コード例 #29
0
ファイル: NpcEditHelper.cs プロジェクト: dongpeng1988/xlj
 public void addMapLine(MapLine line, int addOrDelete)
 {
     if (lineCollection.ContainsKey(line.id) && addOrDelete == OPERATE_ADD)
     {
         Debug.Log("这条路线(" + line.id + ")已经被添加过了");
     }
     else if (lineCollection.ContainsKey(line.id) && addOrDelete == OPERATE_DELETE)
     {
         lineCollection.Remove(line.id);
     }
     else if (!zoneCollection.ContainsKey(line.id) && addOrDelete == OPERATE_ADD)
     {
         lineCollection[line.id] = line;
     }
 }
コード例 #30
0
    /// <summary>
    ///   Core function. Also creates blocks, add score
    /// and check winning condition.
    /// </summary>
    /// <param name="_line">Line.</param>
    public void DrawLine(MapLine _line)
    {
        GameObject g = Instantiate(drawnLinePrefab, drawnLineParent);

        g.transform.position = _line.transform.position;
        g.GetComponent <DrawnLine>().MakeHorizontal(_line.isHorizontal);
        g.GetComponent <DrawnLine>().SetColor(players[turnOwnerID].playerColor);

        _line.ownerID = turnOwnerID;
        _line.BeDrawn();

        //add score
        MapController.instance.Breaking();

        int units = MapController.instance.capturedUnits.Count;

        players[turnOwnerID].AddScore(CalculateScoreByItems(units));        //should be modified by items
        //if (NetPvP)
        //if isHost(ID = 0)
        //	calc all
        //if is non-Host
        //	only listen to effects.
        //  and commands


        ResetScoreModifiers();
        MapController.instance.capturedUnits.Clear();

        if (CheckGameEnd())
        {
            //GameOver
            return;
        }

        //NextTurn
        turnOwnerID++;
        turnOwnerID %= players.Length;

        for (int i = 0; i < players.Length; i++)
        {
            players[i].SetHighlight(i == turnOwnerID);
        }

        SelectPoint(null);
    }
コード例 #31
0
ファイル: GameManager.cs プロジェクト: Team8Final/08_Tempest
    //Spawns new flipper enemy on field, associated with map line
    public void SpawnFlipper()
    {
        int        index      = Random.Range(1, _mapManager.mapLines.Length - 1);
        MapLine    newMapLine = _mapManager.mapLines [index];
        float      _mapDepth  = _mapManager.depth;
        GameObject newShip    = Instantiate(flipperPrefab, newMapLine.GetMidPoint() + new Vector3(0, 0, 1 * _mapDepth), flipperPrefab.transform.rotation);

        if (test == true)
        {
            newShip.GetComponent <Flipper_New>().curMapLine = newMapLine;
            newShip.GetComponent <Flipper_New>().moveSpeed *= currentRound * speedMulti;
        }
        else
        {
            newShip.GetComponent <Flipper>().SetMapLine(newMapLine);
            newShip.GetComponent <Flipper>().movementForce = currentRound * speedMulti;
        }
    }
コード例 #32
0
ファイル: MainWindow.xaml.cs プロジェクト: jigjosh/xaml-sdk
        private void BuildLines(MapPolyline polyline)
        {
            for (int i = 0; i < polyline.Points.Count - 1; i++)
            {
                Location point1 = polyline.Points[i];
                Location point2 = polyline.Points[i + 1];
                MapLine line = new MapLine()
                {
                    Point1 = point1,
                    Point2 = point2
                };

                this.SetDefaultStyle(line);

                line.MouseLeftButtonDown += new MouseButtonEventHandler(line_MouseLeftButtonDown);
                line.Tag = polyline;

                this.lineLayer.Items.Add(line);
            }
        }
コード例 #33
0
ファイル: MainWindow.xaml.cs プロジェクト: jigjosh/xaml-sdk
        private void line_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            MapLine line = sender as MapLine;
            if (line != null)
            {
                if (this.selectedLine != null)
                {
                    this.SetDefaultStyle(this.selectedLine);
                }

                if (this.selectedPolyline != null)
                {
                    this.SetDefaultStyle(this.selectedPolyline);
                }

                this.selectedLine = line;
                this.selectedPolyline = line.Tag as MapPolyline;

                this.SetSelectedStyle(this.selectedLine);
                this.SetSelectedStyle(this.selectedPolyline);
            }
        }
コード例 #34
0
ファイル: MapDot.cs プロジェクト: Diggery/SuperSneak
 public void AddConnection(Transform connectedPoint, MapLine connectedLine)
 {
     connectedPoints.Add(connectedPoint);
     connectedLines.Add(connectedLine);
 }