Exemple #1
0
    public void BuildMap()
    {
        //����������
        m_map = new MapData[MapSizeX, MapSizeZ];

        for (int i = 0; i < MapSizeX; i++)
        {
            for (int k = 0; k < MapSizeZ; k++)
                m_map[i, k] = new MapData();
        }

        // �������TagΪgridnode�Ľڵ�
        GameObject[] nodes = (GameObject[])GameObject.FindGameObjectsWithTag("gridnode");

        foreach (GameObject nodeobj in nodes)
        {
            //��ýڵ�
            GridNode node = nodeobj.GetComponent<GridNode>();

            Vector3 pos = nodeobj.transform.position;

            //����ڵ��λ�ó���������Χ�������
            if ((int)pos.x >= MapSizeX || (int)pos.z >= MapSizeZ)
                continue;

            //���ø��ӵ�����
            m_map[(int)pos.x, (int)pos.z].fieldtype = node._mapData.fieldtype;

        }
    }
        public bool TryGetMapData(string signText, string worldOwner, out MapData mapData)
        {
            signText = signText.Trim();
            mapData = null;

            if (!signText.StartsWith(ScanText, StringComparison.OrdinalIgnoreCase))
                return false;

            signText = signText.Substring(ScanText.Length).Trim();
            var lowerText = signText.ToLower();

            // Try to find specified creators in text by searching for special text
            foreach (var byText in new[] {" by ", " by:"})
            {
                if (!lowerText.Contains(byText))
                    continue;

                var splitIndex = lowerText.LastIndexOf(byText, StringComparison.OrdinalIgnoreCase);

                // Name is before 'byText' and creators after
                mapData = new MapData(
                    signText.Substring(splitIndex).Trim(),
                    signText.Substring(splitIndex + byText.Length).Trim());

                return true;
            }

            mapData = new MapData(signText, worldOwner);

            return true;
        }
		internal protected override object GetMapData (object[] attributes, string scope)
		{
			DataType itemDataType = null;
			Type itemType = null;
			
			ItemPropertyAttribute at = FindPropertyAttribute (attributes, scope + "/*");
			if (at != null) {
				itemType = at.ValueType;
				if (itemType == null) itemType = handler.GetItemType ();
				if (at.SerializationDataType != null)
					itemDataType = (DataType) Activator.CreateInstance (at.SerializationDataType, new object[] { itemType });
			}
			
			if (itemType == null) itemType = handler.GetItemType ();
			if (itemDataType == null) itemDataType = Context.GetConfigurationDataType (itemType);

			object itemMapData = itemDataType.GetMapData (attributes, scope + "/*");
			if (at == null && itemMapData == null) return null;

			MapData data = new MapData ();
			data.ItemType = itemDataType;
			data.ItemName = (at != null && at.Name != null) ? at.Name : itemDataType.Name;
			data.ItemMapData = itemMapData;
			return data;
		}
Exemple #4
0
        public Node(Node copie, NodePos direction, MapData map, Vector2 size)
        {
            CanGo = true;
            Start = copie.Start;
            Arrival = copie.Arrival;

            switch (direction)
            {
                case NodePos.U:
                    Position = new Vector2(copie.Position.X, copie.Position.Y - 32);
                    break;
                case NodePos.D:
                    Position = new Vector2(copie.Position.X, copie.Position.Y + 32);
                    break;
                case NodePos.R:
                    Position = new Vector2(copie.Position.X + 32, copie.Position.Y);
                    break;
                case NodePos.L:
                    Position = new Vector2(copie.Position.X - 32, copie.Position.Y);
                    break;
            }

            Update(map);
            if (Id < 0 || Id > map.MapWidth * map.MapHeight || !Can(direction, map, size))
                CanGo = false;
        }
	Position GetRandomPosition(MapData mapData)
	{
		var position = new Position();
		position.column = GetRandomPositionDimension(mapData.Size);
		position.row = GetRandomPositionDimension(mapData.Size);
		return position;
	}
    void GridUpdate(SceneView sceneview)
    {
        e = Event.current;

        //Make sure MapData has been loaded
        _MapData = EditorHelper.CheckMapData(_MapData);

        //If a Grid exists place tiles
        if (EditorHelper.GridExsists())
        {
            if(grid == null)
            {
                grid = GameObject.FindObjectOfType<DrawGrid>();
            }

            if (EditorHelper.InsideGrid(EditorHelper.GetMousePosition(e)))
            {
                //if input is from a mouse and the mouse button was a left click event
                if (e.button == 0 && e.isMouse && e.type == EventType.MouseDown)
                {
                    PaintTile();
                }
            }
        }
    }
Exemple #7
0
        public static World Create(MapData mapData, LevelData newLevel, Game game, Rectangle screenRec)
        {
            var tilesetList = new List<Tileset>();
            foreach (TilesetData data in mapData.Tilesets)
            {
                tilesetList.Add(
                    TilesetFactory.Create(data, game)
                    );
            }

            var mapLayers = mapData.Layers.Select(l => MapLayer.FromMapLayerData(l)).ToList();

            // MUSTDO: modify TileMap to be able to accept multiple tile sets
            var map = new TileMap(tilesetList[0], mapLayers[0]);

            // SHOULDDO: find out why does map need tilesets to?
            for (int i = 1; i < tilesetList.Count; i++)
                map.AddTileset(tilesetList[i]);

            for (int i = 1; i < mapLayers.Count; i++)
                map.AddLayer(mapLayers[i]);

            var level = new Level(map);

            var world = new World(game, screenRec);
            world.Levels.Add(level);
            world.CurrentLevel = 0;

            return world;
        }
Exemple #8
0
        void window_Closed(object sender, EventArgs e)
        {
            String URL = window.getURL();
            Debug.WriteLine("URL: " + URL);

            Location location = new Location();

            if (this.mainPage.mainMap.TryViewportPointToLocation(this.mouseEvent.ViewportPoint, out location))
            {
                /* Success */
                Debug.WriteLine("Point (" + location.Longitude + "," + location.Latitude + ")");

                MapImage image = new MapImage(URL);
                Debug.WriteLine("yabai: " + URL);
                image.setLocation(location);
                image.draw(mainPage.mainMap);

                this.mapData = image;
            }
            else
            {
                /* Fails */
                Debug.WriteLine("Something wrong has happened in converting viewport to location.");
            }
        }
Exemple #9
0
    public static MapData Generate()
    {
        MapData md = new MapData();

        md.Add(new FenceHMI(36,74));
        md.Add(new FenceHMI(112,-65));
        md.Add(new FenceHMI(-22,-98));
        md.Add(new FenceHMI(-237,-33));
        md.Add(new FenceHMI(-182,-93));
        md.Add(new FenceVMI(-189,73));
        md.Add(new FenceVMI(-48,-76));
        md.Add(new FenceVMI(165,-14));
        md.Add(new FenceVMI(84,-96));
        md.Add(new FenceVMI(61,97));
        md.Add(new FenceVMI(273,29));
        md.Add(new House1MI(52,-49));
        md.Add(new House1MI(132,32));
        md.Add(new House1MI(-160,120));
        md.Add(new House1MI(-183,-16));
        md.Add(new StartPosMI(-62,-134));
        md.Add(new StartPosMI(-257,127));
        md.Add(new StartPosMI(-45,132));
        md.Add(new StartPosMI(156,128));
        md.Add(new StartPosMI(189,-115));
        md.Add(new StartPosMI(237,27));
        md.Add(new StartPosMI(-272,32));
        md.Add(new StartPosMI(-228,-124));

        return md;
    }
    public RecordManager(string text)
    {
        string[] frameText = text.Split('\n');
        numFrames = frameText.Length - 1;

        //handle the first row
        string[] first_row_data = frameText[0].Split('|');
        string[] robotAIText = first_row_data[0].Split('*');
        robotAIData = new RobotAIData[robotAIText.Length];
        for(int i = 0; i<robotAIText.Length; i++)
        {
            robotAIData[i] = new RobotAIData(robotAIText[i]);
        }
        mapData = new MapData(first_row_data[1],first_row_data[2],first_row_data[3]);

        string[] achievementText = first_row_data[4].Split('*');
        achievementData = new AchievementData[achievementText.Length];
        for(int i = 0; i<achievementText.Length; i++)
        {
            achievementData[i] = new AchievementData(achievementText[i]);
        }

        winnerID = Convert.ToInt32(first_row_data[5]);

        //handle the following frame rows
        frameData = new FrameData[numFrames];

        for(int i = 1; i < frameText.Length; i++)
        {
            frameData[i-1] = new FrameData(frameText[i]);
        }
    }
	public void ReadCSVMap()
	{
		lstMapData = new List<MapData>();
		List<Dictionary<string, object>> data = CSVReader.Read("csv/" + FILE_CSV_MAP);
		MapData mapData;
		if (data != null)
		{
			for (int i = 0; i < data.Count; i++)
			{
				int id = (int)data[i]["id"];
				int idPattern = (int)data[i]["idPattern"];
				int idModel = (int)data[i]["idModel"];
				float positionX = float.Parse(data[i]["positionX"].ToString());
				float positionY = float.Parse(data[i]["positionY"].ToString());
				float positionZ = float.Parse(data[i]["positionZ"].ToString());
				float rotationX = float.Parse(data[i]["rotationX"].ToString());
				float rotationY = float.Parse(data[i]["rotationY"].ToString());
				float rotationZ = float.Parse(data[i]["rotationZ"].ToString());
				float scaleX = float.Parse(data[i]["scaleX"].ToString());
				float scaleY = float.Parse(data[i]["scaleY"].ToString());
				float scaleZ = float.Parse(data[i]["scaleZ"].ToString());
				mapData = new MapData(id,idPattern,idModel,new Vector3(positionX,positionY,positionZ),new Vector3(rotationX,rotationY,rotationZ),new Vector3(scaleX,scaleY,scaleZ));
				lstMapData.Add(mapData);
			}
		}
	}
Exemple #12
0
    public Arena()
    {
        instance = this;

        mapData = MapGenerator.Generate();

        FSprite bgSprite = new FSprite("Arena/BG_1");
        AddChild(bgSprite);

        AddChild(entityArea = new EntityArea());
        float inset = 13;
        entityArea.bounds.x = -Config.WIDTH/2 + inset;
        entityArea.bounds.y = -Config.HEIGHT/2 + inset;
        entityArea.bounds.width = Config.WIDTH - inset*2;
        entityArea.bounds.height = Config.HEIGHT - inset*2;

        colorOverlay = new FSprite("WhiteBox");
        colorOverlay.color = new Color(1,1,1,0);
        colorOverlay.width = Config.WIDTH;
        colorOverlay.height = Config.HEIGHT;
        entityArea.overlayContainer.AddChild(colorOverlay);

        AddChild(frontContainer = new FContainer());

        dayManager = new DayManager();

        CreateBuildings();
        SetupPlayers();

        ListenForUpdate(Update);
    }
Exemple #13
0
        void Start()
        {
            MapData data = new MapData();
            data.Deserialize(map);

            Json_MasterParam master = LitJson.JsonMapper.ToObject<Json_MasterParam>(json.text);
            Json_CalenderParam d = master.calender;
            CalenderParam cp = new CalenderParam();
            cp.Desrialize(d);
            int year = cp.Year;

            width = data.mMapData.Width;
            height = data.mMapData.Height;
            types = data.mMapData.MapData;
            for (int h = 0; h < height; ++h)
            {
                for (int w = 0; w < width; ++w)
                {
                    //Debug.Log(h * height + w);

                    if (types[h * height + w] == FloorType.Hatake)
                    {
                        GameObject obj = Instantiate<GameObject>(hatake);
                        obj.transform.position = new Vector3((float)w, 0.1f, (float)height - h);
                        obj.transform.rotation = new Quaternion();
                    }
                }
            }
        }
Exemple #14
0
 public static MapData getBoard_RandomContent(int w, int h)
 {
     var d = new MapData(w, h);
     d.setRandomMatches(10);
     d.doUpdateMatches();
     return d;
 }
Exemple #15
0
 public void SetMapData(message.CrashMapData temp)
 {
     if(_map_data == null)
     {
         _map_data = new MapData();
     }
     _map_data.set_info(temp);
 }
    static void Init()
    {
        _MapData = Resources.Load<MapData>("GameData/MapData");

        SpriteSheetEditor _SpriteSheetEditor = (SpriteSheetEditor)EditorWindow.GetWindow(typeof(SpriteSheetEditor));
        _SpriteSheetEditor.title = "Sprite Sheet";
        _SpriteSheetEditor.Show();
    }
		protected virtual MapData GetDefaultData ()
		{
			if (defaultData != null) return defaultData;
			defaultData = new MapData ();
			defaultData.ItemType = Context.GetConfigurationDataType (handler.GetItemType ());
			defaultData.ItemName = defaultData.ItemType.Name;
			return defaultData;
		}
 /// <summary>
 /// Checks if the passed MapData has been initialized
 /// if it has not CheckMapData calls CreateMapData and loads
 /// the resource path to the reference
 /// </summary>
 /// <param name="_MapData"></param>
 /// <returns></returns>
 public static MapData CheckMapData(MapData _MapData)
 {
     if (_MapData == null)
     {
         CreateMapData(out _MapData);
     }
     return _MapData;
 }
 public static void Init()
 {
     EditorHelper.CreateMapData(out _MapData);
     _MapData = Resources.Load<MapData>("GameData/MapData");
     MapToolsEditor window = (MapToolsEditor)EditorWindow.GetWindow(typeof(MapToolsEditor));
     window.title = "Map Tools";
     window.Show();
 }
Exemple #20
0
 public MapRefData(MapData toAdd)
 {
     RepresentationLabel = toAdd.Geometry.RepresentationLabel;
     EntityLabel = toAdd.Product.EntityLabel;
     EntityTypeId = IfcMetaData.IfcTypeId(toAdd.Product);
     SurfaceStyleLabel = toAdd.Geometry.SurfaceStyleLabel;
     Matrix = XbimMatrix3D.Multiply(toAdd.Geometry.Transform, toAdd.Matrix);
 }
Exemple #21
0
 public Node(Vector2 pos, Vector2 start, Vector2 arrival, MapData map)
 {
     DistanceParcourue = 0;
     Position = pos;
     Start = start;
     Arrival = arrival;
     Update(map);
 }
	public TileCollisionGenerator(MapData mapData)
	{
		this.mapData = mapData;

		meshes = new List<Mesh>();

		MakeMesh();
	}
 public void LoadMap(string filePath)
 {
     //TODO LOAD THIS
     mapData = MapData.Load(filePath);
     // copy the map data array
     world = (MapTile[,])mapData.map.Clone();
     // create this mesh
     MapGenerator.singleton.CreateLoadedWorldMesh(new Vector2(mapData.mapSizeX,mapData.mapSizeY));
 }
	void FillWithObstacles(MapData mapData)
	{
		var obstacleCount = //Mathf.Pow(2, mapData.Size - 6);
			mapData.Size - 1;
		for(int i = 0; i < obstacleCount; i++)
		{
			PutRandomObstacle(mapData);
		}
	}
Exemple #25
0
 public void GenerateMap()
 {
     data = new MapData(xSize, ySize);
     mapController.mapData = data;
     if (landGenerator == null) landGenerator = new LandscapeGenerator(xSize, ySize);
     GenerateData();
     GenerateMesh();
     
 }
	public void Save(MapData[] listData){

		// Creating First row of titles manually..
		string[] rowDataTemp = new string[11];
		rowDataTemp[0] = "idPattern";
		rowDataTemp[1] = "idModel";
		rowDataTemp[2] = "positionX";
		rowDataTemp[3] = "positionY";
		rowDataTemp[4] = "positionZ";
		rowDataTemp[5] = "rotationX";
		rowDataTemp[6] = "rotationY";
		rowDataTemp[7] = "rotationZ";
		rowDataTemp[8] = "scaleX";
		rowDataTemp[9] = "scaleY";
		rowDataTemp[10] = "scaleZ";
		rowData.Add(rowDataTemp);

		// You can add up the values in as many cells as you want.
		for(int i = 0; i < listData.Length; i++){
			rowDataTemp = new string[11];
			rowDataTemp[0] = listData[i].idPattern.ToString();
			rowDataTemp[1] = listData[i].idModel.ToString();
			rowDataTemp[2] = listData[i].position.x.ToString();
			rowDataTemp[3] = listData[i].position.y.ToString();
			rowDataTemp[4] = listData[i].position.z.ToString();
			rowDataTemp[5] = listData[i].rotation.x.ToString();
			rowDataTemp[6] = listData[i].rotation.y.ToString();
			rowDataTemp[7] = listData[i].rotation.z.ToString();
			rowDataTemp[8] = listData[i].scale.x.ToString();
			rowDataTemp[9] = listData[i].scale.y.ToString();
			rowDataTemp[10] = listData[i].scale.z.ToString();
			rowData.Add(rowDataTemp);
		}

		string[][] output = new string[rowData.Count][];

		for(int i = 0; i < output.Length; i++){
			output[i] = rowData[i];
		}

		int length = output.GetLength(0);
		string delimiter = ",";

		StringBuilder sb = new StringBuilder();

		for (int index = 0; index < length; index++)
			sb.AppendLine(string.Join(delimiter, output[index]));


		string filePath = getPath();

		StreamWriter outStream = System.IO.File.CreateText(filePath);
		outStream.WriteLine(sb);
		outStream.Close();
	}
    public MapData build()
    {
        map = new MapData (mapWidth, mapHeight, tileSize);

        rooms = new List<Room>();

        // Randomly create the rooms
        for (int i = 0; i < numberOfRooms; i++) {
            /* Add 1 because Random.Range() for ints excludes the max value */
            int roomWidth = Random.Range(roomWidthRange[0], roomWidthRange[1] + 1);
            int roomHeight = Random.Range(roomHeightRange[0], roomHeightRange[1] + 1);

            int roomX;
            if(mirrorMap) {
                roomX = Random.Range(0, (map.width/2) - (roomWidth/2));
            } else {
                roomX = Random.Range(0, map.width - roomWidth + 1);
            }

            int roomY = Random.Range(0, map.height - roomHeight + 1);

            Room r = new Room (roomX, roomY, roomWidth, roomHeight);

            if(overlappingRooms || !roomCollides(r)) {
                createRoom (r);
            }
        }

        // Randomly connect the rooms
        for (int i = 0; i < rooms.Count; i++) {
            int j = i + Random.Range(1, rooms.Count);
            j %= rooms.Count;

            createHallway (rooms [i], rooms [j]);
        }

        // Make sure there are no isolated groups of rooms
        connectAllRooms ();

        verifyBorderWalls ();

        if (mirrorMap) {
            for (int x = 0; x < map.width/2; x++) {
                for (int y = 0; y < map.height; y++) {
                    map.tiles [map.width - 1 - x, y] = map.tiles [x, y];
                }
            }

            if(!map.isConnectedTiles(1)) {
                connectMirroredMap ();
            }
        }

        return map;
    }
 public void FullGenerate()
 {
     mapData = MapController.Instance.mapData;
     busyMap = new bool[xSize, ySize];
     MakeBackGround();
     MakeLake();
     MakeSwamp();
     MakeLake();
     MakeSwamp();
     MakeMountain();
 }
	public ForestGenerator(MapData mapData)
	{
		this.mapData = mapData;
		tileHandler  = TileHandler.tileHandler;
		mapData.Width  = 80;
		mapData.Height = 80;

		FillMapWithEmptyTile();

		MakeFloor();
	}
    void loadMap(MapData mapData)
    {
        if(currentMapGO != null){
            clearCurrentMap();
        }

        currentMapGO = GameObjectExtend.createClone(mapData.gameObject);
        currentMapData = currentMapGO.GetComponent<MapData>();

        levelLoaded = true;
    }
Exemple #31
0
        public void Init(HMCon con, TUC_HMDevXManager.TUC_HMDevXManager hmDevMgr, List <DataRow> rowList, List <IMapLayer> layers)
        {
            _hmCon    = con;
            _hmDevMgr = hmDevMgr;
            _layers   = layers;
            _pop      = new frmPopup(_hmDevMgr);

            _map       = new WpfMapDrawBase(_hmDevMgr);
            host.Child = _map;

            _data = new Dictionary <int, List <IGeoInfo> >();
            DrawTabFactory factory = new DrawTabFactory();

            for (int i = 0; i < layers.Count; i++)
            {
                try
                {
                    _map.RegisterLayer(i, layers[i]);
                    ucDrawBase ucDraw = factory.CreateInstance(con, hmDevMgr, _map, layers[i], i);
                    if (ucDraw != null)
                    {
                        ucDraw.DrawingStatusChanged += SetDrawingMode;
                        if (ucDraw is ucDrawEvents)
                        {
                            ucDraw.ConvertTo <ucDrawEvents>().EventTypeChanged += FrmMapDraw_EventTypeChanged;
                            ucDraw.ConvertTo <ucDrawEvents>().MarkerChanged    += _map.EventMarkerChanged;
                            _map.PointTapped += ucDraw.ConvertTo <ucDrawEvents>().SetPoint;
                        }
                        else if (ucDraw is ucDrawShape)
                        {
                            _map.ItemTapped += ucDraw.ConvertTo <ucDrawShape>().SetItem;
                        }
                        else if (ucDraw is ucDrawLine)
                        {
                            _map.ItemTapped += ucDraw.ConvertTo <ucDrawLine>().SetItem;
                        }

                        var page = tabControl.TabPages.Add(layers[i] is MapEventLayer ? "Event" : layers[i].LayerName);
                        ucDraw.Parent = page;
                        ucDraw.Dock   = DockStyle.Fill;
                    }

                    _data.Add(i, MapData.GetDataList(con, rowList, layers[i]));
                }
                catch (ConstraintException ex)
                {
                    _pop.ShowPopup($"Error in loading {layers[i].LinkTable}: {ex.Message}");
                }
            }

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add(new DataColumn("#"));
            foreach (var layer in layers)
            {
                layer.Attributes.ToList().ForEach(attr => {
                    if (dataTable.Columns.IndexOf(attr.LinkField) == -1)
                    {
                        DataColumn col = new DataColumn(attr.LinkField);
                        col.Caption    = attr.DisplayName;
                        dataTable.Columns.Add(col);
                    }
                });
            }

            foreach (var srcRow in rowList)
            {
                var row = dataTable.NewRow();

                foreach (var layer in layers)
                {
                    row["#"] = srcRow[layer.LinkColumn];
                    layer.Attributes.ToList().ForEach(attr => row[attr.LinkField] = attr.LinkDictionary?[$"{srcRow[attr.LinkField]}"] ?? srcRow[attr.LinkField]);
                }
                dataTable.Rows.Add(row);
            }

            gc.DataSource = dataTable;

            InDrawingStatus(false);
        }
Exemple #32
0
        /// <summary>
        /// 产生一个WorkNode
        /// </summary>
        /// <param name="fk_flow">流程编号</param>
        /// <param name="fk_node">节点ID</param>
        /// <param name="workID">工作ID</param>
        /// <param name="fid">FID</param>
        /// <param name="userNo">用户编号</param>
        /// <returns>返回dataset</returns>
        public static DataSet GenerWorkNode(string fk_flow, int fk_node, Int64 workID, Int64 fid, string userNo, string fromWorkOpt = "0")
        {
            //节点.
            if (fk_node == 0)
            {
                fk_node = int.Parse(fk_flow + "01");
            }

            if (workID == 0)
            {
                workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow, null, null, userNo, null);
            }

            Node nd = new Node(fk_node);

            try
            {
                nd.WorkID = workID; //为获取表单ID提供参数.
                MapData md = new MapData();
                md.No = nd.NodeFrmID;
                if (md.RetrieveFromDBSources() == 0)
                {
                    throw new Exception("装载错误,该表单ID=" + md.No + "丢失,请修复一次流程重新加载一次.");
                }

                Work wk = nd.HisWork;
                wk.OID = workID;

                wk.RetrieveFromDBSources();
                wk.ResetDefaultVal();

                // 第1.2: 调用,处理用户定义的业务逻辑.
                string sendWhen = nd.HisFlow.DoFlowEventEntity(EventListOfNode.FrmLoadBefore, nd,
                                                               wk, null);

                //获得表单模版.
                DataSet myds = BP.Sys.CCFormAPI.GenerHisDataSet(md.No, nd.Name);

                //移除MapAttr
                myds.Tables.Remove("Sys_MapAttr"); //移除.

                //获取表单的mapAttr
                //求出集合.
                MapAttrs mattrs = new MapAttrs(md.No);
                if (fk_node != null)
                {
                    /*处理表单权限控制方案*/
                    FrmNode frmNode = new FrmNode();
                    int     count   = frmNode.Retrieve(FrmNodeAttr.FK_Frm, md.No, FrmNodeAttr.FK_Node, fk_node);
                    if (count != 0 && frmNode.FrmSln != 0)
                    {
                        FrmFields fls = new FrmFields(md.No, frmNode.FK_Node);
                        foreach (FrmField item in fls)
                        {
                            foreach (MapAttr attr in mattrs)
                            {
                                if (attr.KeyOfEn != item.KeyOfEn)
                                {
                                    continue;
                                }

                                if (item.IsSigan)
                                {
                                    item.UIIsEnable = false;
                                }

                                attr.UIIsEnable = item.UIIsEnable;
                                attr.UIVisible  = item.UIVisible;
                                attr.IsSigan    = item.IsSigan;
                                attr.DefValReal = item.DefVal;
                            }
                        }
                    }
                }

                DataTable Sys_MapAttr = mattrs.ToDataTableField("Sys_MapAttr");
                myds.Tables.Add(Sys_MapAttr);

                //把流程信息表发送过去.
                GenerWorkFlow gwf = new GenerWorkFlow();
                gwf.WorkID = workID;
                gwf.RetrieveFromDBSources();

                //加入WF_Node.
                DataTable WF_Node = nd.ToDataTableField("WF_Node");
                myds.Tables.Add(WF_Node);

                #region 加入组件的状态信息, 在解析表单的时候使用.
                BP.WF.Template.FrmNodeComponent fnc = new FrmNodeComponent(nd.NodeID);

                nd.WorkID = workID; //为获取表单ID提供参数.
                if (nd.NodeFrmID != "ND" + nd.NodeID && nd.HisFormType != NodeFormType.RefOneFrmTree)
                {
                    /*说明这是引用到了其他节点的表单,就需要把一些位置元素修改掉.*/
                    int refNodeID = int.Parse(nd.NodeFrmID.Replace("ND", ""));

                    BP.WF.Template.FrmNodeComponent refFnc = new FrmNodeComponent(refNodeID);

                    fnc.SetValByKey(FrmWorkCheckAttr.FWC_H, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_H));
                    fnc.SetValByKey(FrmWorkCheckAttr.FWC_W, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_W));
                    fnc.SetValByKey(FrmWorkCheckAttr.FWC_X, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_X));
                    fnc.SetValByKey(FrmWorkCheckAttr.FWC_Y, refFnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_Y));

                    if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_H) <= 10)
                    {
                        fnc.SetValByKey(FrmWorkCheckAttr.FWC_H, 500);
                    }

                    if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_W) <= 10)
                    {
                        fnc.SetValByKey(FrmWorkCheckAttr.FWC_W, 600);
                    }

                    if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_X) <= 10)
                    {
                        fnc.SetValByKey(FrmWorkCheckAttr.FWC_X, 200);
                    }

                    if (fnc.GetValFloatByKey(FrmWorkCheckAttr.FWC_Y) <= 10)
                    {
                        fnc.SetValByKey(FrmWorkCheckAttr.FWC_Y, 200);
                    }


                    fnc.SetValByKey(FrmSubFlowAttr.SF_H, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_H));
                    fnc.SetValByKey(FrmSubFlowAttr.SF_W, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_W));
                    fnc.SetValByKey(FrmSubFlowAttr.SF_X, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_X));
                    fnc.SetValByKey(FrmSubFlowAttr.SF_Y, refFnc.GetValFloatByKey(FrmSubFlowAttr.SF_Y));

                    fnc.SetValByKey(FrmThreadAttr.FrmThread_H, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_H));
                    fnc.SetValByKey(FrmThreadAttr.FrmThread_W, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_W));
                    fnc.SetValByKey(FrmThreadAttr.FrmThread_X, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_X));
                    fnc.SetValByKey(FrmThreadAttr.FrmThread_Y, refFnc.GetValFloatByKey(FrmThreadAttr.FrmThread_Y));

                    fnc.SetValByKey(FrmTrackAttr.FrmTrack_H, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_H));
                    fnc.SetValByKey(FrmTrackAttr.FrmTrack_W, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_W));
                    fnc.SetValByKey(FrmTrackAttr.FrmTrack_X, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_X));
                    fnc.SetValByKey(FrmTrackAttr.FrmTrack_Y, refFnc.GetValFloatByKey(FrmTrackAttr.FrmTrack_Y));

                    fnc.SetValByKey(FTCAttr.FTC_H, refFnc.GetValFloatByKey(FTCAttr.FTC_H));
                    fnc.SetValByKey(FTCAttr.FTC_W, refFnc.GetValFloatByKey(FTCAttr.FTC_W));
                    fnc.SetValByKey(FTCAttr.FTC_X, refFnc.GetValFloatByKey(FTCAttr.FTC_X));
                    fnc.SetValByKey(FTCAttr.FTC_Y, refFnc.GetValFloatByKey(FTCAttr.FTC_Y));

                    #region 没有审核组件分组就增加上审核组件分组. @杜需要翻译&测试.
                    if (md.HisFrmType == FrmType.FoolForm)
                    {
                        //判断是否是傻瓜表单,如果是,就要判断该傻瓜表单是否有审核组件groupfield ,没有的话就增加上.
                        DataTable gf     = myds.Tables["Sys_GroupField"];
                        bool      isHave = false;
                        foreach (DataRow dr in gf.Rows)
                        {
                            string cType = dr["CtrlType"] as string;
                            if (cType == null)
                            {
                                continue;
                            }

                            if (cType.Equals("FWC") == true)
                            {
                                isHave = true;
                            }
                        }

                        if (isHave == false)
                        {
                            DataRow dr = gf.NewRow();

                            nd.WorkID = workID; //为获取表单ID提供参数.
                            dr[GroupFieldAttr.OID]      = 100;
                            dr[GroupFieldAttr.FrmID]    = nd.NodeFrmID;
                            dr[GroupFieldAttr.CtrlType] = "FWC";
                            dr[GroupFieldAttr.CtrlID]   = "FWCND" + nd.NodeID;
                            dr[GroupFieldAttr.Idx]      = 100;
                            dr[GroupFieldAttr.Lab]      = "审核信息";
                            gf.Rows.Add(dr);

                            myds.Tables.Remove("Sys_GroupField");
                            myds.Tables.Add(gf);

                            //执行更新,就自动生成那个丢失的字段分组.
                            refFnc.Update();

                            /*
                             * //丢失了就插入新的.
                             * BP.Sys.GroupField gfEn = new GroupField();
                             * gfEn.FrmID = nd.NodeFrmID;
                             * gfEn.CtrlType = "FWC";
                             * gfEn.CtrlID = "FWCND" + nd.NodeID;
                             * gfEn.Idx = 100;
                             * gfEn.Lab = "审核信息";
                             * gfEn.Insert(); */
                        }
                    }
                    #endregion 没有审核组件分组就增加上审核组件分组.
                }

                #region 没有审核组件分组就增加上审核组件分组. @杜需要翻译&测试.
                if (nd.NodeFrmID == "ND" + nd.NodeID && nd.HisFormType != NodeFormType.RefOneFrmTree)
                {
                    //   Work wk1 = nd.HisWork;

                    if (nd.FormType == NodeFormType.FoolForm)
                    {
                        //判断是否是傻瓜表单,如果是,就要判断该傻瓜表单是否有审核组件groupfield ,没有的话就增加上.
                        DataTable gf     = myds.Tables["Sys_GroupField"];
                        bool      isHave = false;
                        foreach (DataRow dr in gf.Rows)
                        {
                            string cType = dr["CtrlType"] as string;
                            if (cType == null)
                            {
                                continue;
                            }

                            if (cType.Equals("FWC") == true)
                            {
                                isHave = true;
                            }
                        }

                        if (isHave == false)
                        {
                            DataRow dr = gf.NewRow();

                            nd.WorkID = workID; //为获取表单ID提供参数.
                            dr[GroupFieldAttr.OID]      = 100;
                            dr[GroupFieldAttr.FrmID]    = nd.NodeFrmID;
                            dr[GroupFieldAttr.CtrlType] = "FWC";
                            dr[GroupFieldAttr.CtrlID]   = "FWCND" + nd.NodeID;
                            dr[GroupFieldAttr.Idx]      = 100;
                            dr[GroupFieldAttr.Lab]      = "审核信息";
                            gf.Rows.Add(dr);

                            myds.Tables.Remove("Sys_GroupField");
                            myds.Tables.Add(gf);

                            //更新,为了让其自动增加审核分组.
                            BP.WF.Template.FrmNodeComponent refFnc = new FrmNodeComponent(nd.NodeID);
                            refFnc.Update();
                        }
                    }
                }
                #endregion 没有审核组件分组就增加上审核组件分组.

                myds.Tables.Add(fnc.ToDataTableField("WF_FrmNodeComponent"));

                #endregion 加入组件的状态信息, 在解析表单的时候使用.

                #region 增加 groupfields
                if (nd.FormType == NodeFormType.FoolTruck && nd.IsStartNode == false &&
                    DataType.IsNullOrEmpty(wk.HisPassedFrmIDs) == false)
                {
                    #region 处理字段分组排序.
                    //查询所有的分组, 如果是查看表单的方式,就不应该把当前的表单显示出来.
                    string myFrmIDs = "";
                    if (fromWorkOpt.Equals("1") == true)
                    {
                        if (gwf.WFState == WFState.Complete)
                        {
                            myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'";
                        }
                        else
                        {
                            myFrmIDs = wk.HisPassedFrmIDs; //流程未完成并且是查看表单的情况.
                        }
                    }
                    else
                    {
                        myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'";
                    }

                    GroupFields gfs = new GroupFields();
                    gfs.RetrieveIn(GroupFieldAttr.FrmID, "(" + myFrmIDs + ")");

                    //按照时间的顺序查找出来 ids .
                    string sqlOrder = "SELECT OID FROM  Sys_GroupField WHERE   FrmID IN (" + myFrmIDs + ")";
                    if (BP.Sys.SystemConfig.AppCenterDBType == DBType.Oracle)
                    {
                        myFrmIDs  = myFrmIDs.Replace("'", "");
                        sqlOrder += " ORDER BY INSTR('" + myFrmIDs + "',FrmID) , Idx";
                    }

                    if (BP.Sys.SystemConfig.AppCenterDBType == DBType.MSSQL)
                    {
                        myFrmIDs  = myFrmIDs.Replace("'", "");
                        sqlOrder += " ORDER BY CHARINDEX(FrmID, '" + myFrmIDs + "'), Idx";
                    }

                    if (BP.Sys.SystemConfig.AppCenterDBType == DBType.MySQL)
                    {
                        myFrmIDs  = myFrmIDs.Replace("'", "");
                        sqlOrder += " ORDER BY INSTR('" + myFrmIDs + "', FrmID ), Idx";
                    }
                    DataTable dtOrder = DBAccess.RunSQLReturnTable(sqlOrder);

                    //创建容器,把排序的分组放入这个容器.
                    GroupFields gfsNew = new GroupFields();

                    //遍历查询出来的分组.
                    foreach (DataRow dr in dtOrder.Rows)
                    {
                        string pkOID = dr[0].ToString();
                        var    mygf  = gfs.GetEntityByKey(pkOID);
                        gfsNew.AddEntity(mygf); //把分组字段加入里面去.
                    }

                    DataTable dtGF = gfsNew.ToDataTableField("Sys_GroupField");
                    myds.Tables.Remove("Sys_GroupField");
                    myds.Tables.Add(dtGF);
                    #endregion 处理字段分组排序.

                    #region 处理 mapattrs
                    //求当前表单的字段集合.
                    MapAttrs    attrs = new MapAttrs();
                    QueryObject qo    = new QueryObject(attrs);
                    qo.AddWhere(MapAttrAttr.FK_MapData, "ND" + nd.NodeID);
                    qo.addOrderBy(MapAttrAttr.Idx);
                    qo.DoQuery();

                    //计算累加的字段集合.
                    MapAttrs attrsLeiJia = new MapAttrs();
                    qo = new QueryObject(attrsLeiJia);
                    qo.AddWhere(MapAttrAttr.FK_MapData, " IN ", "(" + wk.HisPassedFrmIDs + ")");
                    qo.addOrderBy(MapAttrAttr.Idx);
                    qo.DoQuery();

                    //把两个集合接起来.
                    foreach (MapAttr item in attrsLeiJia)
                    {
                        item.UIIsEnable = false; //设置为只读的.
                        attrs.AddEntity(item);
                    }

                    //替换掉现有的.
                    myds.Tables.Remove("Sys_MapAttr");                      //移除.
                    myds.Tables.Add(attrs.ToDataTableField("Sys_MapAttr")); //增加.
                    #endregion 处理mapattrs

                    #region 把枚举放入里面去.
                    myds.Tables.Remove("Sys_Enum");

                    myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'";
                    SysEnums enums = new SysEnums();
                    enums.RetrieveInSQL(SysEnumAttr.EnumKey,
                                        "SELECT UIBindKey FROM Sys_MapAttr WHERE FK_MapData in(" + myFrmIDs + ")");

                    // 加入最新的枚举.
                    myds.Tables.Add(enums.ToDataTableField("Sys_Enum"));
                    #endregion 把枚举放入里面去.

                    #region  MapExt .
                    myds.Tables.Remove("Sys_MapExt");

                    // 把扩展放入里面去.
                    myFrmIDs = wk.HisPassedFrmIDs + ",'ND" + fk_node + "'";
                    BP.Sys.MapExts exts = new MapExts();
                    qo = new QueryObject(exts);
                    qo.AddWhere(MapExtAttr.FK_MapData, " IN ", "(" + myFrmIDs + ")");
                    qo.DoQuery();

                    // 加入最新的MapExt.
                    myds.Tables.Add(exts.ToDataTableField("Sys_MapExt"));
                    #endregion  MapExt .
                }
                #endregion 增加 groupfields

                #region 流程设置信息.
                if (nd.IsStartNode == false)
                {
                    BP.WF.Dev2Interface.Node_SetWorkRead(fk_node, workID);

                    // @杜.
                    if (gwf.TodoEmps.Contains(BP.Web.WebUser.Name + ";") == false)
                    {
                        gwf.TodoEmps += BP.Web.WebUser.No + "," + BP.Web.WebUser.Name;
                        gwf.Update();
                    }
                }

                //增加转向下拉框数据.
                if (nd.CondModel == CondModel.SendButtonSileSelect)
                {
                    if (nd.IsStartNode == true || gwf.TodoEmps.Contains(WebUser.No + ",") == true)
                    {
                        /*如果当前不是主持人,如果不是主持人,就不让他显示下拉框了.*/

                        /*如果当前节点,是可以显示下拉框的.*/
                        Nodes nds = nd.HisToNodes;

                        DataTable dtToNDs = new DataTable();
                        dtToNDs.TableName = "ToNodes";
                        dtToNDs.Columns.Add("No", typeof(string));           //节点ID.
                        dtToNDs.Columns.Add("Name", typeof(string));         //到达的节点名称.
                        dtToNDs.Columns.Add("IsSelectEmps", typeof(string)); //是否弹出选择人的对话框?
                        dtToNDs.Columns.Add("IsSelected", typeof(string));   //是否选择?

                        #region 增加到达延续子流程节点。
                        NodeYGFlows ygflows = new NodeYGFlows(fk_node.ToString());
                        if (ygflows.Count > 1 && SystemConfig.CustomerNo.Equals("CZBank") == true)
                        {
                            dtToNDs.Rows.Clear();  //为浙商银行做的特殊判断,如果配置了延续流程,就不让其走分支节点.
                        }
                        foreach (NodeYGFlow item in ygflows)
                        {
                            DataRow dr = dtToNDs.NewRow();
                            dr["No"]   = item.FK_Flow + "01";
                            dr["Name"] = "启动:" + item.FlowName;
                            //if (item.HisDeliveryWay == DeliveryWay.BySelected)
                            dr["IsSelectEmps"] = "1";
                            //else
                            //  dr["IsSelectEmps"] = "0";  //是不是,可以选择接受人.

                            //设置默认选择的节点.
                            //if (defalutSelectedNodeID == item.NodeID)
                            //    dr["IsSelected"] = "1";
                            //else
                            //    dr["IsSelected"] = "0";

                            dr["IsSelected"] = "0";
                            dtToNDs.Rows.Add(dr);
                        }
                        #endregion 增加到达延续子流程节点。

                        #region 到达其他节点.
                        //上一次选择的节点.
                        int defalutSelectedNodeID = 0;
                        if (nds.Count > 1)
                        {
                            string mysql = "";
                            // 找出来上次发送选择的节点.
                            if (SystemConfig.AppCenterDBType == DBType.MSSQL)
                            {
                                mysql = "SELECT  top 1 NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID DESC";
                            }
                            else if (SystemConfig.AppCenterDBType == DBType.Oracle)
                            {
                                mysql = "SELECT * FROM ( SELECT  NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID DESC ) WHERE ROWNUM =1";
                            }
                            else if (SystemConfig.AppCenterDBType == DBType.MySQL)
                            {
                                mysql = "SELECT  NDTo FROM ND" + int.Parse(nd.FK_Flow) + "Track A WHERE A.NDFrom=" + fk_node + " AND ActionType=1 ORDER BY WorkID  DESC limit 1,1";
                            }

                            //获得上一次发送到的节点.
                            defalutSelectedNodeID = DBAccess.RunSQLReturnValInt(mysql, 0);
                        }

                        #region 为天业集团做一个特殊的判断.
                        if (SystemConfig.CustomerNo == "TianYe" && nd.Name.Contains("董事长") == true)
                        {
                            /*如果是董事长节点, 如果是下一个节点默认的是备案. */
                            foreach (Node item in nds)
                            {
                                if (item.Name.Contains("备案") == true && item.Name.Contains("待") == false)
                                {
                                    defalutSelectedNodeID = item.NodeID;
                                    break;
                                }
                            }
                        }
                        #endregion 为天业集团做一个特殊的判断.


                        foreach (Node item in nds)
                        {
                            DataRow dr = dtToNDs.NewRow();
                            dr["No"]   = item.NodeID;
                            dr["Name"] = item.Name;
                            //if (item.hissel

                            if (item.HisDeliveryWay == DeliveryWay.BySelected)
                            {
                                dr["IsSelectEmps"] = "1";
                            }
                            else
                            {
                                dr["IsSelectEmps"] = "0";  //是不是,可以选择接受人.
                            }
                            //设置默认选择的节点.
                            if (defalutSelectedNodeID == item.NodeID)
                            {
                                dr["IsSelected"] = "1";
                            }
                            else
                            {
                                dr["IsSelected"] = "0";
                            }

                            dtToNDs.Rows.Add(dr);
                        }
                        #endregion 到达其他节点。


                        //增加一个下拉框, 对方判断是否有这个数据.
                        myds.Tables.Add(dtToNDs);
                    }
                }

                // 节点数据.
                //string sql = "SELECT * FROM WF_Node WHERE NodeID=" + fk_node;
                //DataTable dt = BP.DA.DBAccess.RunSQLReturnTable(sql);
                //dt.TableName = "WF_NodeBar";
                //myds.Tables.Add(dt);

                //// 流程数据.
                //Flow fl = new Flow(fk_flow);
                //myds.Tables.Add(fl.ToDataTableField("WF_Flow"));
                #endregion 流程设置信息.

                #region 把主从表数据放入里面.
                //.工作数据放里面去, 放进去前执行一次装载前填充事件.

                //重设默认值.
                wk.ResetDefaultVal();

                //@樊雷伟 把这部分代码搬到jflow上去. CCFlowAPI. 114行出.
                if (BP.Sys.SystemConfig.IsBSsystem == true)
                {
                    // 处理传递过来的参数。
                    foreach (string k in System.Web.HttpContext.Current.Request.QueryString.AllKeys)
                    {
                        if (DataType.IsNullOrEmpty(k) == true)
                        {
                            continue;
                        }

                        wk.SetValByKey(k, System.Web.HttpContext.Current.Request.QueryString[k]);
                    }

                    // 处理传递过来的frm参数。
                    foreach (string k in System.Web.HttpContext.Current.Request.Form.AllKeys)
                    {
                        if (DataType.IsNullOrEmpty(k) == true)
                        {
                            continue;
                        }
                        wk.SetValByKey(k, System.Web.HttpContext.Current.Request.Form[k]);
                    }

                    //更新到数据库里.
                    wk.DirectUpdate();
                }

                // 执行表单事件..
                string msg = md.DoEvent(FrmEventList.FrmLoadBefore, wk);
                if (DataType.IsNullOrEmpty(msg) == false)
                {
                    throw new Exception("err@错误:" + msg);
                }

                // 执行FEE事件.
                string msgOfLoad = nd.HisFlow.DoFlowEventEntity(EventListOfNode.FrmLoadBefore, nd,
                                                                wk, null);
                if (msgOfLoad != null)
                {
                    wk.RetrieveFromDBSources();
                }

                //执行装载填充.
                MapExt me = new MapExt();
                if (me.Retrieve(MapExtAttr.ExtType, MapExtXmlList.PageLoadFull, MapExtAttr.FK_MapData, wk.NodeFrmID) == 1)
                {
                    //执行通用的装载方法.
                    MapAttrs attrs = new MapAttrs(wk.NodeFrmID);
                    MapDtls  dtls  = new MapDtls(wk.NodeFrmID);
                    wk = BP.WF.Glo.DealPageLoadFull(wk, me, attrs, dtls) as Work;
                }

                //如果是累加表单,就把整个rpt数据都放入里面去.
                if (nd.FormType == NodeFormType.FoolTruck && nd.IsStartNode == false &&
                    DataType.IsNullOrEmpty(wk.HisPassedFrmIDs) == false)
                {
                    GERpt rpt = new GERpt("ND" + int.Parse(nd.FK_Flow) + "Rpt", workID); // nd.HisFlow.HisGERpt;
                    rpt.ResetDefaultVal();

                    //rpt.Copy(wk); //加入后就出现了错误.

                    myds.Tables.Add(rpt.ToDataTableField("MainTable"));
                    // myds.WriteXml("C:\\XX.xml");
                }
                else
                {
                    DataTable mainTable = wk.ToDataTableField(md.No);
                    mainTable.TableName = "MainTable";
                    myds.Tables.Add(mainTable);
                }
                string    sql = "";
                DataTable dt  = null;
                #endregion

                #region 把外键表加入DataSet
                DataTable dtMapAttr = myds.Tables["Sys_MapAttr"];
                MapExts   mes       = md.MapExts;
                foreach (DataRow dr in dtMapAttr.Rows)
                {
                    string lgType    = dr["LGType"].ToString();
                    string uiBindKey = dr["UIBindKey"].ToString();

                    if (DataType.IsNullOrEmpty(uiBindKey) == true)
                    {
                        continue; //为空就continue.
                    }
                    if (lgType.Equals("1") == true)
                    {
                        continue; //枚举值就continue;
                    }
                    string uiIsEnable = dr["UIIsEnable"].ToString();
                    if (uiIsEnable.Equals("0") == true && lgType.Equals("1") == true)
                    {
                        continue; //如果是外键,并且是不可以编辑的状态.
                    }
                    if (uiIsEnable.Equals("1") == true && lgType.Equals("0") == true)
                    {
                        continue; //如果是外部数据源,并且是不可以编辑的状态.
                    }
                    // 检查是否有下拉框自动填充。
                    string keyOfEn    = dr["KeyOfEn"].ToString();
                    string fk_mapData = dr["FK_MapData"].ToString();


                    #region 处理下拉框数据范围. for 小杨.
                    me = mes.GetEntityByKey(MapExtAttr.ExtType, MapExtXmlList.AutoFullDLL, MapExtAttr.AttrOfOper, keyOfEn) as MapExt;
                    if (me != null)
                    {
                        string fullSQL = me.Doc.Clone() as string;
                        fullSQL = fullSQL.Replace("~", ",");
                        fullSQL = BP.WF.Glo.DealExp(fullSQL, wk, null);
                        dt      = DBAccess.RunSQLReturnTable(fullSQL);
                        //重构新表
                        DataTable dt_FK_Dll = new DataTable();
                        dt_FK_Dll.TableName = keyOfEn;//可能存在隐患,如果多个字段,绑定同一个表,就存在这样的问题.
                        dt_FK_Dll.Columns.Add("No", typeof(string));
                        dt_FK_Dll.Columns.Add("Name", typeof(string));
                        foreach (DataRow dllRow in dt.Rows)
                        {
                            DataRow drDll = dt_FK_Dll.NewRow();
                            drDll["No"]   = dllRow["No"];
                            drDll["Name"] = dllRow["Name"];
                            dt_FK_Dll.Rows.Add(drDll);
                        }
                        myds.Tables.Add(dt_FK_Dll);
                        continue;
                    }
                    #endregion 处理下拉框数据范围.

                    // 判断是否存在.
                    if (myds.Tables.Contains(uiBindKey) == true)
                    {
                        continue;
                    }

                    if (BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey) != null)
                    {
                        myds.Tables.Add(BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey));
                    }
                }
                #endregion End把外键表加入DataSet

                #region 处理流程-消息提示.
                DataTable dtAlert = new DataTable();
                dtAlert.TableName = "AlertMsg";

                dtAlert.Columns.Add("Title", typeof(string));
                dtAlert.Columns.Add("Msg", typeof(string));
                dtAlert.Columns.Add("URL", typeof(string));

                //  string msg = "";
                switch (gwf.WFState)
                {
                case WFState.AskForReplay:     // 返回加签的信息.
                    string mysql = "SELECT * FROM ND" + int.Parse(fk_flow) + "Track WHERE WorkID=" + workID + " AND " + TrackAttr.ActionType + "=" + (int)ActionType.ForwardAskfor;

                    DataTable mydt = BP.DA.DBAccess.RunSQLReturnTable(mysql);
                    foreach (DataRow dr in mydt.Rows)
                    {
                        string msgAskFor  = dr[TrackAttr.Msg].ToString();
                        string worker     = dr[TrackAttr.EmpFrom].ToString();
                        string workerName = dr[TrackAttr.EmpFromT].ToString();
                        string rdt        = dr[TrackAttr.RDT].ToString();

                        DataRow drMsg = dtAlert.NewRow();
                        drMsg["Title"] = worker + "," + workerName + "回复信息:";
                        drMsg["Msg"]   = DataType.ParseText2Html(msgAskFor) + "<br>" + rdt;
                        dtAlert.Rows.Add(drMsg);
                    }
                    break;

                case WFState.Askfor:     //加签.

                    sql = "SELECT * FROM ND" + int.Parse(fk_flow) + "Track WHERE WorkID=" + workID + " AND " + TrackAttr.ActionType + "=" + (int)ActionType.AskforHelp;
                    dt  = BP.DA.DBAccess.RunSQLReturnTable(sql);
                    foreach (DataRow dr in dt.Rows)
                    {
                        string msgAskFor  = dr[TrackAttr.Msg].ToString();
                        string worker     = dr[TrackAttr.EmpFrom].ToString();
                        string workerName = dr[TrackAttr.EmpFromT].ToString();
                        string rdt        = dr[TrackAttr.RDT].ToString();

                        DataRow drMsg = dtAlert.NewRow();
                        drMsg["Title"] = worker + "," + workerName + "请求加签:";
                        drMsg["Msg"]   = DataType.ParseText2Html(msgAskFor) + "<br>" + rdt + "<a href='./WorkOpt/AskForRe.htm?FK_Flow=" + fk_flow + "&FK_Node=" + fk_node + "&WorkID=" + workID + "&FID=" + fid + "' >回复加签意见</a> --";
                        dtAlert.Rows.Add(drMsg);

                        //提示信息.
                        // this.FlowMsg.AlertMsg_Info(worker + "," + workerName + "请求加签:",
                        //   DataType.ParseText2Html(msgAskFor) + "<br>" + rdt + " --<a href='./WorkOpt/AskForRe.aspx?FK_Flow=" + this.FK_Flow + "&FK_Node=" + this.FK_Node + "&WorkID=" + this.WorkID + "&FID=" + this.FID + "' >回复加签意见</a> --");
                    }
                    // isAskFor = true;
                    break;

                case WFState.ReturnSta:
                    /* 如果工作节点退回了*/
                    ReturnWorks rws = new ReturnWorks();
                    rws.Retrieve(ReturnWorkAttr.ReturnToNode, fk_node,
                                 ReturnWorkAttr.WorkID, workID,
                                 ReturnWorkAttr.RDT);

                    if (rws.Count != 0)
                    {
                        //string msgInfo = "";
                        //foreach (BP.WF.ReturnWork rw in rws)
                        //{
                        //    DataRow drMsg = dtAlert.NewRow();
                        //    //drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + "  " + rw.RDT + "&nbsp;<a href='/DataUser/ReturnLog/" + fk_flow + "/" + rw.MyPK + ".htm' target=_blank>工作日志</a>";
                        //    drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + "  " + rw.RDT;
                        //    drMsg["Msg"] = rw.BeiZhuHtml;
                        //    dtAlert.Rows.Add(drMsg);
                        //}

                        string msgInfo = "";
                        foreach (BP.WF.ReturnWork rw in rws)
                        {
                            //drMsg["Title"] = "来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + "  " + rw.RDT + "&nbsp;<a href='/DataUser/ReturnLog/" + fk_flow + "/" + rw.MyPK + ".htm' target=_blank>工作日志</a>";
                            msgInfo += "\t\n来自节点:" + rw.ReturnNodeName + " 退回人:" + rw.ReturnerName + "  " + rw.RDT;
                            msgInfo += rw.BeiZhuHtml;
                        }

                        string str = nd.ReturnAlert;
                        if (str != "")
                        {
                            str = str.Replace("~", "'");
                            str = str.Replace("@PWorkID", workID.ToString());
                            str = str.Replace("@PNodeID", nd.NodeID.ToString());
                            str = str.Replace("@FK_Node", nd.NodeID.ToString());

                            str = str.Replace("@PFlowNo", fk_flow);
                            str = str.Replace("@FK_Flow", fk_flow);
                            str = str.Replace("@PWorkID", workID.ToString());

                            str = str.Replace("@WorkID", workID.ToString());
                            str = str.Replace("@OID", workID.ToString());

                            DataRow drMsg = dtAlert.NewRow();
                            drMsg["Title"] = "退回信息";
                            drMsg["Msg"]   = msgInfo + "\t\n" + str;
                            dtAlert.Rows.Add(drMsg);
                        }
                        else
                        {
                            DataRow drMsg = dtAlert.NewRow();
                            drMsg["Title"] = "退回信息";
                            drMsg["Msg"]   = msgInfo + "\t\n" + str;
                            dtAlert.Rows.Add(drMsg);
                        }
                    }
                    break;

                case WFState.Shift:
                    /* 判断移交过来的。 */
                    ShiftWorks        fws = new ShiftWorks();
                    BP.En.QueryObject qo  = new QueryObject(fws);
                    qo.AddWhere(ShiftWorkAttr.WorkID, workID);
                    qo.addAnd();
                    qo.AddWhere(ShiftWorkAttr.FK_Node, fk_node);
                    qo.addOrderBy(ShiftWorkAttr.RDT);
                    qo.DoQuery();
                    if (fws.Count >= 1)
                    {
                        DataRow drMsg = dtAlert.NewRow();
                        drMsg["Title"] = "移交历史信息";
                        msg            = "";
                        foreach (ShiftWork fw in fws)
                        {
                            string temp = "@移交人[" + fw.FK_Emp + "," + fw.FK_EmpName + "]。@接受人:" + fw.ToEmp + "," + fw.ToEmpName + "。<br>移交原因:-------------" + fw.NoteHtml;
                            if (fw.FK_Emp == WebUser.No)
                            {
                                temp = "<b>" + temp + "</b>";
                            }

                            temp = temp.Replace("@", "<br>@");
                            msg += temp + "<hr/>";
                        }
                        drMsg["Msg"] = msg;
                        dtAlert.Rows.Add(drMsg);
                    }
                    break;

                default:
                    break;
                }
                #endregion

                #region 增加流程节点表单绑定信息.
                if (nd.HisFormType == NodeFormType.RefOneFrmTree)
                {
                    /* 独立流程节点表单. */

                    nd.WorkID = workID; //为获取表单ID ( NodeFrmID )提供参数.

                    FrmNode fn = new FrmNode();
                    fn.MyPK = nd.NodeFrmID + "_" + nd.NodeID + "_" + nd.FK_Flow;
                    fn.Retrieve();
                    myds.Tables.Add(fn.ToDataTableField("FrmNode"));
                }
                #endregion 增加流程节点表单绑定信息.


                myds.Tables.Add(dtAlert);
                return(myds);
            }
            catch (Exception ex)
            {
                Log.DebugWriteError(ex.StackTrace);
                throw new Exception(ex.Message);
            }
        }
Exemple #33
0
 // Use this for initialization
 void Start()
 {
     binaryImage = GetMapData(); //Get the map data and assign it to a variable;
 }
        public override object Do()
        {
            string msg = "";

            #region 检查数据文件是否完整.
            string path = "C:\\CCFlowTemplete";
            if (System.IO.Directory.Exists(path) == false)
            {
                msg += "@错误:约定的目录不存在服务器" + path + ",请把从ccflow备份的文件放入" + path;
            }

            //PortTables.
            string file = path + "\\PortTables.xml";
            if (System.IO.File.Exists(file) == false)
            {
                msg += "@错误:约定的文件不存在," + file;
            }

            //SysTables.
            file = path + "\\SysTables.xml";
            if (System.IO.File.Exists(file) == false)
            {
                msg += "@错误:约定的文件不存在," + file;
            }

            //FlowTables.
            file = path + "\\FlowTables.xml";
            if (System.IO.File.Exists(file) == false)
            {
                msg += "@错误:约定的文件不存在," + file;
            }
            #endregion 检查数据文件是否完整.

            #region 1 装载流程基础表数据.
            DataSet ds = new DataSet();
            ds.ReadXml(path + "\\FlowTables.xml");

            //流程类别.
            FlowSorts sorts = new FlowSorts();
            sorts.ClearTable();
            DataTable dt = ds.Tables["WF_FlowSort"];
            // sorts = QueryObject.InitEntitiesByDataTable(sorts, dt, null) as FlowSorts;
            foreach (FlowSort item in sorts)
            {
                item.DirectInsert(); //插入数据.
            }
            #endregion 1 装载流程基础表数据.

            #region 2 组织结构.
            ds = new DataSet();
            ds.ReadXml(path + "\\PortTables.xml");

            //Port_Emp.
            Emps emps = new Emps();
            emps.ClearTable();
            dt   = ds.Tables["Port_Emp"];
            emps = QueryObject.InitEntitiesByDataTable(emps, dt, null) as Emps;
            foreach (Emp item in emps)
            {
                item.DirectInsert(); //插入数据.
            }

            //Depts.
            Depts depts = new Depts();
            depts.ClearTable();
            dt    = ds.Tables["Port_Dept"];
            depts = QueryObject.InitEntitiesByDataTable(depts, dt, null) as Depts;
            foreach (Dept item in depts)
            {
                item.DirectInsert(); //插入数据.
            }

            //Stations.
            Stations stas = new Stations();
            stas.ClearTable();
            dt   = ds.Tables["Port_Station"];
            stas = QueryObject.InitEntitiesByDataTable(stas, dt, null) as Stations;
            foreach (Station item in stas)
            {
                item.DirectInsert(); //插入数据.
            }


            if (BP.Sys.SystemConfig.OSModel == OSModel.OneMore)
            {
                //EmpDepts.
                BP.GPM.DeptEmps eds = new BP.GPM.DeptEmps();
                eds.ClearTable();
                dt  = ds.Tables["Port_DeptEmp"];
                eds = QueryObject.InitEntitiesByDataTable(eds, dt, null) as BP.GPM.DeptEmps;
                foreach (BP.GPM.DeptEmp item in eds)
                {
                    item.DirectInsert(); //插入数据.
                }
            }
            #endregion 2 组织结构.

            #region 3 恢复系统数据.
            ds = new DataSet();
            ds.ReadXml(path + "\\SysTables.xml");

            //枚举Main.
            SysEnumMains sems = new SysEnumMains();
            sems.ClearTable();
            dt   = ds.Tables["Sys_EnumMain"];
            sems = QueryObject.InitEntitiesByDataTable(sems, dt, null) as SysEnumMains;
            foreach (SysEnumMain item in sems)
            {
                item.DirectInsert(); //插入数据.
            }

            //枚举.
            SysEnums ses = new SysEnums();
            ses.ClearTable();
            dt  = ds.Tables["Sys_Enum"];
            ses = QueryObject.InitEntitiesByDataTable(ses, dt, null) as SysEnums;
            foreach (SysEnum item in ses)
            {
                item.DirectInsert(); //插入数据.
            }

            ////Sys_FormTree.
            //BP.Sys.SysFormTrees sfts = new SysFormTrees();
            //sfts.ClearTable();
            //dt = ds.Tables["Sys_FormTree"];
            //sfts = QueryObject.InitEntitiesByDataTable(sfts, dt, null) as SysFormTrees;
            //foreach (SysFormTree item in sfts)
            //{
            //    try
            //    {
            //       item.DirectInsert(); //插入数据.
            //    }
            //    catch
            //    {
            //    }
            //}
            #endregion 3 恢复系统数据.

            #region 4.备份表单相关数据.
            if (1 == 2)
            {
                string pathOfTables = path + "\\SFTables";
                System.IO.Directory.CreateDirectory(pathOfTables);
                SFTables tabs = new SFTables();
                tabs.RetrieveAll();
                foreach (SFTable item in tabs)
                {
                    if (item.No.Contains("."))
                    {
                        continue;
                    }

                    string sql = "SELECT * FROM " + item.No;
                    ds = new DataSet();
                    ds.Tables.Add(BP.DA.DBAccess.RunSQLReturnTable(sql));
                    ds.WriteXml(pathOfTables + "\\" + item.No + ".xml");
                }
            }
            #endregion 4 备份表单相关数据.

            #region 5.恢复表单数据.
            //删除所有的流程数据.
            MapDatas mds = new MapDatas();
            mds.RetrieveAll();
            foreach (MapData fl in mds)
            {
                //if (fl.FK_FormTree.Length > 1 || fl.FK_FrmSort.Length > 1)
                //    continue;
                fl.Delete(); //删除流程.
            }

            //清除数据.
            SysFormTrees fss = new SysFormTrees();
            fss.ClearTable();

            // 调度表单文件。
            string          frmPath = path + "\\Form";
            DirectoryInfo   dirInfo = new DirectoryInfo(frmPath);
            DirectoryInfo[] dirs    = dirInfo.GetDirectories();
            foreach (DirectoryInfo item in dirs)
            {
                if (item.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(item.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                SysFormTree fs = new SysFormTree();
                fs.No       = item.Name.Substring(0, item.Name.IndexOf('.'));
                fs.Name     = item.Name.Substring(item.Name.IndexOf('.'));
                fs.ParentNo = "0";
                fs.Insert();

                foreach (string f in fls)
                {
                    try
                    {
                        msg += "@开始调度表单模板文件:" + f;
                        System.IO.FileInfo info = new System.IO.FileInfo(f);
                        if (info.Extension != ".xml")
                        {
                            continue;
                        }

                        ds = new DataSet();
                        ds.ReadXml(f);

                        MapData md = MapData.ImpMapData(ds);
                        md.FK_FrmSort = fs.No;
                        md.Update();
                    }
                    catch (Exception ex)
                    {
                        msg += "@调度失败,文件:" + f + ",异常信息:" + ex.Message;
                    }
                }
            }
            #endregion 5.恢复表单数据.

            #region 6.恢复流程数据.
            //删除所有的流程数据.
            Flows flsEns = new Flows();
            flsEns.RetrieveAll();
            foreach (Flow fl in flsEns)
            {
                fl.DoDelete(); //删除流程.
            }

            dirInfo = new DirectoryInfo(path + "\\Flow\\");
            dirs    = dirInfo.GetDirectories();

            //删除数据.
            FlowSorts fsRoots = new FlowSorts();
            fsRoots.ClearTable();

            //生成流程树.
            FlowSort fsRoot = new FlowSort();
            fsRoot.No       = "99";
            fsRoot.Name     = "流程树";
            fsRoot.ParentNo = "0";
            fsRoot.DirectInsert();

            foreach (DirectoryInfo dir in dirs)
            {
                if (dir.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(dir.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                FlowSort fs = new FlowSort();
                fs.No       = dir.Name.Substring(0, dir.Name.IndexOf('.'));
                fs.Name     = dir.Name.Substring(3);
                fs.ParentNo = fsRoot.No;
                fs.Insert();

                foreach (string filePath in fls)
                {
                    msg += "\t\n@开始调度流程模板文件:" + filePath;
                    Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo);
                    msg += "\t\n@流程:" + myflow.Name + "装载成功。";

                    System.IO.FileInfo info = new System.IO.FileInfo(filePath);
                    myflow.Name = info.Name.Replace(".xml", "");
                    if (myflow.Name.Substring(2, 1) == ".")
                    {
                        myflow.Name = myflow.Name.Substring(3);
                    }

                    myflow.DirectUpdate();
                }
            }
            #endregion 6.恢复流程数据.

            BP.DA.Log.DefaultLogWriteLineInfo(msg);

            //删除多余的空格.
            BP.WF.DTS.DeleteBlankGroupField dts = new DeleteBlankGroupField();
            dts.Do();

            //执行生成签名.
            GenerSiganture gs = new GenerSiganture();
            gs.Do();

            return(msg);
        }
 // Token: 0x0600F04D RID: 61517 RVA: 0x0053DEF8 File Offset: 0x0053C0F8
 public HistoryStep(DateTime EHHBHEJBHNG, MapData NOJGGCLPPAM, string MNMCFBBLKPG = null)
 {
     this.time    = EHHBHEJBHNG;
     this.data    = new MapData(NOJGGCLPPAM);
     this.comment = MNMCFBBLKPG;
 }
Exemple #36
0
 public void RequestMesh(MapData mapData)
 {
     hasRequestedMesh = true;
     mapGenerator.RequestMeshData(mapData, lod, OnMeshDataReceived);
 }
Exemple #37
0
        public override void HandleMessage(Message message)
        {
            switch (message.Event)
            {
            case "phx_reply":
            {
                if (!message.Payload["status"].ToString().Equals("ok"))
                {
                    return;
                }

                switch (message.Ref)
                {
                case MAP_CHANGE_REF:
                {
                    var area = (Area)Enum.Parse(typeof(Area), message.Payload["response"].map.ToString());
                    var map  = DefinitionConverter.ToMap(area);

                    // Already say that no spawning can happen
                    if (Game.State == GameState.Playing)
                    {
                        Game.StartMapChange();
                    }

                    Networking.ChangeArea(area, Game.Player.Character.Name);

                    /*Game.ChangeMap(map, zone =>
                     * {
                     *  zone.IsExplorable = !IsOutpost;
                     *
                     *  Entity.Players.ForEach(p => zone.AddAgent(p.Character));
                     * });*/
                    Game.Player.Character.Transformation.Position = MapData.GetDefaultSpawnPoint(map);
                }
                break;
                }
            }
            break;

            case "initial":
            {
                //Guid myId = Entity.Entities.Values.OfType<Player>().First(p => p.Character == Game.Player.Character).Id;

                /*if (Game.State == GameState.CharacterScreen)
                 * {*/
                Game.ChangeMap(DefinitionConverter.ToMap(Area), zone =>
                    {
                        zone.IsExplorable = !IsOutpost;

                        Entity.Players.ForEach(p => zone.AddAgent(p.Character));
                    });
                //}

                foreach (JProperty a in message.Payload["attributes"].Values <JProperty>())
                {
                    Entity.UpdateEntity(PlayerEntityId, a.Name, a.Value);
                }
            }
            break;

            case "add":
            {
                Guid id = Guid.Parse(message.Payload["entity"].ToString());

                foreach (JProperty a in message.Payload["attributes"].Values <JProperty>())
                {
                    Entity.UpdateEntity(id, a.Name, a.Value);
                }
            }
            break;

            case "change":
            {
                Guid id = Guid.Parse(message.Payload["entity"].ToString());

                foreach (JProperty a in message.Payload["added"].Values <JProperty>())
                {
                    Entity.UpdateEntity(id, a.Name, a.Value);
                }

                foreach (JProperty a in message.Payload["changed"].Values <JProperty>())
                {
                    Entity.UpdateEntity(id, a.Name, a.Value);
                }
            }
            break;

            case "remove":
            {
                Entity.RemoveEntity(Guid.Parse(message.Payload["entity"].ToString()));
            }
            break;
            }
        }
Exemple #38
0
        void openLevelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofDialog = new OpenFileDialog();

            ofDialog.Filter          = "Level Files (*.xml)|*.xml";
            ofDialog.CheckFileExists = true;
            ofDialog.CheckPathExists = true;

            DialogResult result = ofDialog.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }

            string path = Path.GetDirectoryName(ofDialog.FileName);

            LevelData newLevel = null;
            MapData   mapData  = null;

            try
            {
                newLevel = XnaSerializer.Deserialize <LevelData>(ofDialog.FileName);
                mapData  = XnaSerializer.Deserialize <MapData>(path + @"\Maps\" + newLevel.MapName +
                                                               ".xml");
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error reading level");
                return;
            }

            tileSetImages.Clear();
            tileSetData.Clear();
            tileSets.Clear();

            layers.Clear();

            lbTileset.Items.Clear();
            clbLayers.Items.Clear();

            levelData = newLevel;

            foreach (TilesetData data in mapData.Tilesets)
            {
                Texture2D texture = null;

                tileSetData.Add(data);
                lbTileset.Items.Add(data.TilesetName);

                GDIImage image = (GDIImage)GDIBitmap.FromFile(data.TilesetImageName);
                tileSetImages.Add(image);
                using (Stream stream = new FileStream(data.TilesetImageName, FileMode.Open,
                                                      FileAccess.Read))
                {
                    texture = Texture2D.FromStream(GraphicsDevice, stream);

                    tileSets.Add(
                        new Tileset(
                            texture,
                            data.TilesWide,
                            data.TilesHigh,
                            data.TileWidthInPixels,
                            data.TileHeightInPixels));
                }
            }

            Stream textureStream = new FileStream(mapData.AnimatedTileset.TilesetImageName,
                                                  FileMode.Open, FileAccess.Read);

            Texture2D aniamtedTexture = Texture2D.FromStream(GraphicsDevice, textureStream);

            animatedSet = new AnimatedTileset(aniamtedTexture, 8, 1, 64, 64);

            foreach (MapLayerData data in mapData.Layers)
            {
                clbLayers.Items.Add(data.MapLayerName, true);
                layers.Add(MapLayer.FromMapLayerData(data));
            }

            lbTileset.SelectedIndex = 0;
            clbLayers.SelectedIndex = 0;
            nudCurrentTile.Value    = 0;

            map = new TileMap(tileSets[0], animatedSet, (MapLayer)layers[0]);

            for (int i = 1; i < tileSets.Count; i++)
            {
                map.AddTileset(tileSets[i]);
            }

            for (int i = 1; i < layers.Count; i++)
            {
                map.AddLayer(layers[i]);
            }

            tilesetToolStripMenuItem.Enabled    = true;
            mapLayerToolStripMenuItem.Enabled   = true;
            charactersToolStripMenuItem.Enabled = true;
            chestsToolStripMenuItem.Enabled     = true;
            keysToolStripMenuItem.Enabled       = true;
        }
        /// <summary>
        /// 打开工作处理器,仅仅查看,不能修改。
        /// </summary>
        public void BindTrack_ViewWorkForm()
        {
            string appPath = this.Request.ApplicationPath;
            Node   nd      = null;
            Track  tk      = new Track();

            tk.FK_Flow = this.FK_Flow;
            tk.NDFrom  = this.FK_Node;

            tk.WorkID = this.WorkID;
            if (this.MyPK != null)
            {
                tk = new Track(this.FK_Flow, this.MyPK);
                nd = new Node(tk.NDFrom);
            }
            else
            {
                nd = new Node(this.FK_Node);
            }

            Flow  fl     = new Flow(this.FK_Flow);
            Int64 workid = 0;

            if (nd.HisRunModel == RunModel.SubThread)
            {
                workid = tk.FID;
            }
            else
            {
                workid = tk.WorkID;
            }

            Int64 fid = this.FID;

            if (this.FID == 0)
            {
                fid = tk.FID;
            }

            DataTable ndrpt = DBAccess.RunSQLReturnTable("SELECT PFlowNo,PWorkID FROM " + fl.PTable + " WHERE OID=" + workid);

            string urlExt = "&PFlowNo=" + ndrpt.Rows[0]["PFlowNo"] + "&PWorkID=" + ndrpt.Rows[0]["PWorkID"] + "&IsToobar=0&IsHidden=true";

            urlExt += "&From=CCFlow&TruckKey=" + tk.GetValStrByKey("MyPK");

            if (nd.HisFormType == NodeFormType.SDKForm || nd.HisFormType == NodeFormType.SelfForm)
            {
                if (nd.FormUrl.Contains("?"))
                {
                    this.Response.Redirect(nd.FormUrl + "&WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                }
                else
                {
                    this.Response.Redirect(nd.FormUrl + "?WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                }

                if (nd.HisFormType == NodeFormType.SDKForm)
                {
                    if (nd.FormUrl.Contains("?"))
                    {
                        this.Response.Redirect(nd.FormUrl + "&WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                    }
                    else
                    {
                        this.Response.Redirect(nd.FormUrl + "?WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                    }
                    return;
                }

                this.Response.Redirect(nd.FormUrl + "&WorkID=" + tk.WorkID + "&FK_Node=" + nd.NodeID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + urlExt, true);
                return;
            }

            Work wk = nd.HisWork;

            wk.OID = tk.WorkID;
            if (wk.RetrieveFromDBSources() == 0)
            {
                GERpt rtp = nd.HisFlow.HisGERpt;
                rtp.OID = this.WorkID;
                if (rtp.RetrieveFromDBSources() == 0)
                {
                    this.UCEn1.AddFieldSet("打开(" + nd.Name + ")错误");
                    this.UCEn1.AddH1("当前的节点数据已经被删除!!!<br> 造成此问题出现的原因如下。");
                    this.UCEn1.AddBR("1、当前节点数据被非法删除。");
                    this.UCEn1.AddBR("2、节点数据是退回人与被退回人中间的节点,这部分节点数据查看不支持。");
                    this.UCEn1.AddH1("技术信息:表" + wk.EnMap.PhysicsTable + " WorkID=" + this.WorkID);
                    this.UCEn1.AddFieldSetEnd();
                    return;
                }
                wk.Row = rtp.Row;
            }

            GenerWorkFlow gwf = new GenerWorkFlow();

            gwf.WorkID = wk.OID;

            if (nd.HisFlow.IsMD5 && wk.IsPassCheckMD5() == false)
            {
                this.UCEn1.AddFieldSet("打开(" + nd.Name + ")错误");
                this.UCEn1.AddH1("当前的节点数据已经被篡改,请报告管理员。");
                this.UCEn1.AddFieldSetEnd();
                return;
            }
            this.InitToolbar(false, appPath);
            this.UCEn1.IsReadonly = true;
            Frms frms = nd.HisFrms;

            if (frms.Count == 0)
            {
                if (nd.HisFormType == NodeFormType.FreeForm)
                {
                    MapData map = new MapData(nd.NodeFrmID);
                    /* 自由表单 */
                    Width = map.MaxRight + map.MaxLeft * 2 + 10 + "";
                    if (float.Parse(Width) < 500)
                    {
                        Width = "900";
                    }
                    Height = map.MaxEnd + "";
                    BtnLab btnLab = new BtnLab(FK_Node);

                    BtnWord = btnLab.WebOfficeEnable + "";

                    this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + Height + "px' >");
                    this.UCEn1.BindCCForm(wk, nd.NodeFrmID, true, 0, false); //, false, false, null);
                    this.UCEn1.Add("</div>");
                }

                if (nd.HisFormType == NodeFormType.FixForm)
                {
                    MapData map = new MapData(nd.NodeFrmID);
                    if (map.TableWidth.Contains("px"))
                    {
                        Width = map.TableWidth.Replace("px", "");
                    }
                    else
                    {
                        Width = map.TableWidth + "";
                    }
                    if (map.TableWidth.Equals("100%"))
                    {
                        Width = "900";
                    }

                    this.UCEn1.Add("<div id=divCCForm style='width:" + Width + "px;height:" + map.FrmH + "px;overflow-x:scroll;' >");
                    /*傻瓜表单*/
                    this.UCEn1.IsReadonly = true;
                    this.UCEn1.BindColumn4(wk, nd.NodeFrmID); //, false, false, null);
                    //if (wk.WorkEndInfo.Length > 2)
                    //    this.UCEn1.Add(wk.WorkEndInfo);
                    this.UCEn1.Add("</div>");
                }



                BillTemplates bills = new BillTemplates();
                bills.Retrieve(BillTemplateAttr.NodeID, nd.NodeID);
                if (bills.Count >= 1)
                {
                    string title = "";
                    foreach (BillTemplate item in bills)
                    {
                        title += "<img src='/WF/Img/Btn/Word.gif' border=0/>" + item.Name + "</a>";
                    }

                    string urlr = appPath + "WF/WorkOpt/PrintDoc.aspx?FK_Node=" + nd.NodeID + "&FID=" + fid + "&WorkID=" + tk.WorkID + "&FK_Flow=" + nd.FK_Flow;
                    this.UCEn1.Add("<p><a  href=\"javascript:WinOpen('" + urlr + "','dsdd');\"  />" + title + "</a></p>");
                    //this.UCEn1.Add("<a href='' target=_blank><img src='/WF/Img/Btn/Word.gif' border=0/>" + bt.Name + "</a>");
                }
            }
            else
            {
                /* 涉及到多个表单的情况...*/
                if (nd.HisFormType == NodeFormType.SheetTree)
                {
                    Response.Redirect(appPath + "WF/FlowFormTree/FlowFormTreeView.aspx?WorkID=" + tk.WorkID + "&FK_Flow=" + nd.FK_Flow + "&FID=" + fid + "&FK_Node=" + nd.NodeID + "&CWorkID=" + this.CWorkID);
                }
                else if (nd.HisFormType != NodeFormType.DisableIt)
                {
                    Frm myfrm = new Frm();
                    myfrm.No             = "ND" + nd.NodeID;
                    myfrm.Name           = wk.EnDesc;
                    myfrm.HisFormRunType = (FormRunType)(int)nd.HisFormType;

                    FrmNode fnNode = new FrmNode();
                    fnNode.FK_Frm  = myfrm.No;
                    fnNode.IsEdit  = true;
                    fnNode.IsPrint = false;
                    switch (nd.HisFormType)
                    {
                    case NodeFormType.FixForm:
                        fnNode.HisFrmType = FrmType.Column4Frm;
                        break;

                    case NodeFormType.FreeForm:
                        fnNode.HisFrmType = FrmType.FreeFrm;
                        break;

                    case NodeFormType.SelfForm:
                        fnNode.HisFrmType = FrmType.Url;
                        break;

                    default:
                        throw new Exception("出现了未判断的异常。");
                    }
                    myfrm.HisFrmNode = fnNode;
                    frms.AddEntity(myfrm, 0);
                }
                if (frms.Count == 1)
                {
                    /* 如果禁用了节点表单,并且只有一个表单的情况。*/
                    Frm     frm = (Frm)frms[0];
                    FrmNode fn  = frm.HisFrmNode;
                    string  src = "";
                    src = fn.FrmUrl + ".aspx?FK_MapData=" + frm.No + "&FID=" + fid + "&IsEdit=0&IsPrint=0&FK_Node=" + nd.NodeID + "&WorkID=" + tk.WorkID + "&CWorkID=" + this.CWorkID;
                    this.UCEn1.Add("\t\n <DIV id='" + frm.No + "' style='width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left; background-color:white;margin:0;padding:0;' >");
                    this.UCEn1.Add("\t\n <iframe ID='F" + frm.No + "' src='" + src + "' frameborder=0  style='margin:0;padding:0;width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;'  leftMargin='0'  topMargin='0'  /></iframe>");
                    this.UCEn1.Add("\t\n </DIV>");
                }
                else
                {
                    Frm frmFirst = null;
                    foreach (Frm frm in frms)
                    {
                        if (frmFirst == null)
                        {
                            frmFirst = frm;
                        }

                        if (frmFirst.FrmW < frm.FrmW)
                        {
                            frmFirst = frm;
                        }
                    }

                    #region 载入相关文件.
                    this.Page.RegisterClientScriptBlock("sg",
                                                        "<link href='./Style/Frm/Tab.css' rel='stylesheet' type='text/css' />");

                    this.Page.RegisterClientScriptBlock("s2g4",
                                                        "<script language='JavaScript' src='./Style/Frm/jquery.min.js' ></script>");

                    this.Page.RegisterClientScriptBlock("sdf24j",
                                                        "<script language='JavaScript' src='./Style/Frm/jquery.idTabs.min.js' ></script>");

                    this.Page.RegisterClientScriptBlock("sdsdf24j",
                                                        "<script language='JavaScript' src='./Style/Frm/TabClick.js' ></script>");
                    #endregion 载入相关文件.

                    this.UCEn1.Clear();
                    this.UCEn1.Add("<div  style='clear:both' ></div>");                                                                                             //
                    this.UCEn1.Add("\t\n<div  id='usual2' class='usual' style='width:" + frmFirst.FrmW + "px;height:auto;margin:0 auto;background-color:white;'>"); //begain.

                    #region 输出标签.
                    this.UCEn1.Add("\t\n <ul  class='abc' style='background:red;border-color: #800000;border-width: 10px;' >");
                    foreach (Frm frm in frms)
                    {
                        FrmNode fn  = frm.HisFrmNode;
                        string  src = "";
                        src = fn.FrmUrl + ".aspx?FK_MapData=" + frm.No + "&FID=" + fid + "&IsEdit=0&IsPrint=0&FK_Node=" + nd.NodeID + "&WorkID=" + tk.WorkID + "&CWorkID=" + this.CWorkID + "&FK_Flow=" + this.FK_Flow;//edited by liuxc,2015-6-17
                        this.UCEn1.Add("\t\n<li><a href=\"#" + frm.No + "\" onclick=\"TabClick('" + frm.No + "','" + src + "');\" >" + frm.Name + "</a></li>");
                    }
                    this.UCEn1.Add("\t\n </ul>");
                    #endregion 输出标签.


                    #region 输出表单 iframe 内容.
                    foreach (Frm frm in frms)
                    {
                        FrmNode fn = frm.HisFrmNode;
                        this.UCEn1.Add("\t\n <DIV id='" + frm.No + "' style='width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;margin:0px;padding:0px;' >");
                        string src = "loading.htm";
                        this.UCEn1.Add("\t\n <iframe ID='F" + frm.No + "' src='" + src + "' frameborder=0  style='margin:0px;padding:0px;width:" + frm.FrmW + "px; height:" + frm.FrmH + "px;text-align: left;'  leftMargin='0'  topMargin='0'   /></iframe>");
                        this.UCEn1.Add("\t\n </DIV>");
                    }
                    #endregion 输出表单 iframe 内容.

                    this.UCEn1.Add("\t\n</div>"); // end  usual2

                    // 设置选择的默认值.
                    this.UCEn1.Add("\t\n<script type='text/javascript'>");
                    this.UCEn1.Add("\t\n  $(\"#usual2 ul\").idTabs(\"" + frms[0].No + "\");");
                    this.UCEn1.Add("\t\n</script>");
                }
            }
        }
Exemple #40
0
        void saveLevelToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (map == null)
            {
                return;
            }

            List <MapLayerData> mapLayerData = new List <MapLayerData>();

            for (int i = 0; i < clbLayers.Items.Count; i++)
            {
                if (layers[i] is MapLayer)
                {
                    MapLayerData data = new MapLayerData(
                        clbLayers.Items[i].ToString(),
                        ((MapLayer)layers[i]).Width,
                        ((MapLayer)layers[i]).Height);

                    for (int y = 0; y < ((MapLayer)layers[i]).Height; y++)
                    {
                        for (int x = 0; x < ((MapLayer)layers[i]).Width; x++)
                        {
                            data.SetTile(
                                x,
                                y,
                                ((MapLayer)layers[i]).GetTile(x, y).TileIndex,
                                ((MapLayer)layers[i]).GetTile(x, y).Tileset);
                        }
                    }

                    mapLayerData.Add(data);
                }
            }

            MapData mapData = new MapData(
                levelData.MapName,
                tileSetData,
                animatedSetData,
                mapLayerData,
                new CollisionLayer(),
                new AnimatedTileLayer());

            FolderBrowserDialog fbDialog = new FolderBrowserDialog
            {
                Description  = "Select Game Folder",
                SelectedPath = Application.StartupPath
            };

            DialogResult result = fbDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (!File.Exists(fbDialog.SelectedPath + @"\Game.xml"))
                {
                    MessageBox.Show("Game not found", "Error");
                    return;
                }

                string LevelPath = Path.Combine(fbDialog.SelectedPath, @"Levels\");
                string MapPath   = Path.Combine(LevelPath, @"Maps\");

                if (!Directory.Exists(LevelPath))
                {
                    Directory.CreateDirectory(LevelPath);
                }

                if (!Directory.Exists(MapPath))
                {
                    Directory.CreateDirectory(MapPath);
                }

                XnaSerializer.Serialize <LevelData>(LevelPath + levelData.LevelName + ".xml", levelData);
                XnaSerializer.Serialize <MapData>(MapPath + mapData.MapName + ".xml", mapData);
            }
        }
 public void Append(string name, MapData map)
 {
     Append(new Marker(name));
     Append(new UdmfLump("TEXTMAP", map));
     Append(new Marker("ENDMAP"));
 }
    void FixedUpdate()
    {
        if (target == null)
        {
            return;
        }
        switch (LevelManager.State)
        {
        case LevelManager.lvlState.Menu:
            MapData     = target.GetComponent <MapData>();
            viewAngel   = transform.eulerAngles.x;
            loopCounter = 0;
            if (MapData != null)
            {
                loopRadius          = MapData.MapHeight > MapData.MapWidth ? MapData.MapHeight : MapData.MapWidth;
                rotationStartRadius = 0.5f * loopRadius;
                if (loopRadius > 9)
                {
                    MenuCamHeight = DefaultMenuCamHeight - (loopRadius - 9);
                }
                else
                {
                    MenuCamHeight = DefaultMenuCamHeight;
                }

                floatPos = Vector3.zero;
                transform.localPosition = new Vector3(0, -loopRadius, 0);

                CameraAlign.position    = target.position + floatPos + new Vector3(0, 0, MenuCamHeight);
                CameraAlign.eulerAngles = Vector3.zero;
            }
            ScaleWithFactor(0.8f);
            transform.LookAt(target.position + floatPos);
            break;

        case LevelManager.lvlState.Play:
            transform.position = Vector3.Lerp(transform.position, CameraAlign.position, Time.deltaTime * zoomSpeed);
            // LerpDovodchik(transform.position,CameraAlign.position);
            HeightChange(PlayCamHeight);
            ScaleWithFactor(1);
            transform.LookAt(target.position + floatPos);
            break;

        case LevelManager.lvlState.Fin:
            radius = Mathf.Lerp(radius, loopRadius, Time.deltaTime * zoomSpeed);
            transform.localPosition = Vector3.Lerp(transform.localPosition, new Vector3(0, -radius, 0), Time.deltaTime * zoomSpeed);

            HeightChange(MenuCamHeight);
            // makeLoop(radius);
            if (radius < rotationStartRadius)
            {
                transform.LookAt(target.position + floatPos);
            }
            else
            {
                if (loopCounter < fastLoopNum)
                {
                    SmoothlChangeSpeed(0);
                }
                else
                {
                    SmoothlChangeSpeed(1);
                }

                makeLoop(radius);
            }
            ScaleWithFactor(0.8f);
            break;
        }
    }
Exemple #43
0
 public void ChangeMapView(MapData mapData)
 {
     Clear();
     CreateMap(mapData);
 }
Exemple #44
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                switch (this.DoType)
                {
                case "EditSFTable":
                    BP.Sys.SFTable mysf1 = new SFTable(this.RefNo);
                    if (mysf1.SrcType == SrcType.TableOrView)
                    {
                        this.Response.Redirect("SFTable.aspx?RefNo=" + mysf1.No + "&FromApp=SL", true);
                        return;
                    }
                    if (mysf1.SrcType == SrcType.SQL)
                    {
                        this.Response.Redirect("SFSQL.aspx?RefNo=" + mysf1.No + "&FromApp=SL", true);
                        return;
                    }
                    if (mysf1.SrcType == SrcType.WebServices)
                    {
                        this.Response.Redirect("SFWS.aspx?RefNo=" + mysf1.No + "&FromApp=SL", true);
                        return;
                    }
                    return;

                case "DownTempFrm":
                    MapData md   = new MapData(this.FK_MapData);
                    DataSet ds   = md.GenerHisDataSet();
                    string  name = "ccflow表单模板." + md.Name + "." + md.No + ".xml";
                    string  file = this.Request.PhysicalApplicationPath + "\\Temp\\" + this.FK_MapData + ".xml";
                    ds.WriteXml(file);
                    this.Response.Redirect("../../Temp/" + this.FK_MapData + ".xml", true);
                    this.WinClose();
                    break;

                case "CCForm":
                    this.Application.Clear();
                    if (WebUser.NoOfRel != "admin")
                    {
                        BP.Port.Emp emp = new BP.Port.Emp("admin");
                        BP.Web.WebUser.SignInOfGener(emp);
                    }

                    MapAttr mattr = new MapAttr();
                    mattr.MyPK = this.Request.QueryString["MyPK"];
                    int i = mattr.RetrieveFromDBSources();
                    mattr.KeyOfEn    = this.Request.QueryString["KeyOfEn"];
                    mattr.FK_MapData = this.Request.QueryString["FK_MapData"];
                    mattr.MyDataType = int.Parse(this.Request.QueryString["DataType"]);

                    if (!string.IsNullOrEmpty(this.Request.QueryString["UIBindKey"] + ""))
                    {
                        mattr.UIBindKey = this.Request.QueryString["UIBindKey"];
                    }
                    mattr.UIContralType = (UIContralType)int.Parse(this.Request.QueryString["UIContralType"]);
                    mattr.LGType        = (BP.En.FieldTypeS) int.Parse(this.Request.QueryString["LGType"]);
                    if (i == 0)
                    {
                        mattr.Name       = System.Web.HttpUtility.UrlDecode(this.Request.QueryString["KeyName"], System.Text.Encoding.GetEncoding("GB2312"));
                        mattr.UIIsEnable = true;
                        mattr.UIVisible  = true;
                        if (mattr.LGType == FieldTypeS.Enum)
                        {
                            mattr.DefVal = "0";
                        }
                        mattr.Insert();
                    }
                    else
                    {
                        mattr.Update();
                    }

                    switch (mattr.LGType)
                    {
                    case BP.En.FieldTypeS.Enum:
                        this.Response.Redirect("EditEnum.aspx?MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK, true);
                        return;

                    case BP.En.FieldTypeS.Normal:
                        this.Response.Redirect("EditF.aspx?DoType=Edit&MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK + "&FType=" + mattr.MyDataType + "&GroupField=0", true);
                        return;

                    case BP.En.FieldTypeS.FK:
                        this.Response.Redirect("EditTable.aspx?DoType=Edit&MyPK=" + mattr.FK_MapData + "&RefNo=" + mattr.MyPK + "&FType=" + mattr.MyDataType + "&GroupField=0", true);
                        return;

                    default:
                        break;
                    }
                    break;

                case "DobackToF":
                    MapAttr ma = new MapAttr(this.RefNo);
                    switch (ma.LGType)
                    {
                    case FieldTypeS.Normal:
                        this.Response.Redirect("EditF.aspx?RefNo=" + this.RefNo, true);
                        return;

                    case FieldTypeS.FK:
                        this.Response.Redirect("EditTable.aspx?RefNo=" + this.RefNo, true);
                        return;

                    case FieldTypeS.Enum:
                        this.Response.Redirect("EditEnum.aspx?RefNo=" + this.RefNo, true);
                        return;

                    default:
                        return;
                    }

                case "AddEnum":
                    SysEnumMain sem1    = new SysEnumMain(this.Request.QueryString["EnumKey"]);
                    MapAttr     attrAdd = new MapAttr();
                    attrAdd.KeyOfEn = sem1.No;
                    if (attrAdd.IsExit(MapAttrAttr.FK_MapData, this.MyPK, MapAttrAttr.KeyOfEn, sem1.No))
                    {
                        BP.Sys.PubClass.Alert("字段已经存在 [" + sem1.No + "]。");
                        BP.Sys.PubClass.WinClose();
                        return;
                    }

                    attrAdd.FK_MapData    = this.MyPK;
                    attrAdd.Name          = sem1.Name;
                    attrAdd.UIContralType = UIContralType.DDL;
                    attrAdd.UIBindKey     = sem1.No;
                    attrAdd.MyDataType    = BP.DA.DataType.AppInt;
                    attrAdd.LGType        = FieldTypeS.Enum;
                    attrAdd.DefVal        = "0";
                    attrAdd.UIIsEnable    = true;
                    if (this.Idx == null || this.Idx == "")
                    {
                        MapAttrs attrs1 = new MapAttrs(this.MyPK);
                        attrAdd.Idx = 0;
                    }
                    else
                    {
                        attrAdd.Idx = int.Parse(this.Idx);
                    }
                    attrAdd.Insert();
                    this.Response.Redirect("EditEnum.aspx?MyPK=" + this.MyPK + "&RefNo=" + attrAdd.MyPK, true);
                    this.WinClose();
                    return;

                case "DelEnum":
                    string      eKey = this.Request.QueryString["EnumKey"];
                    SysEnumMain sem  = new SysEnumMain();
                    sem.No = eKey;
                    sem.Delete();
                    this.WinClose();
                    return;

                case "AddSysEnum":
                    this.AddFEnum();
                    break;

                case "AddSFTable":
                    this.AddSFTable();
                    break;

                case "AddSFSQL":
                    this.AddSFSQL();
                    break;

                case "AddSFWS":
                    this.AddSFWS();
                    break;

                case "AddSFTableAttr":
                    SFTable sf = new SFTable(this.Request.QueryString["RefNo"]);
                    this.Response.Redirect("EditTable.aspx?MyPK=" + this.MyPK + "&SFKey=" + sf.No, true);
                    this.WinClose();
                    return;

                case "AddSFSQLAttr":
                    SFTable mysf = new SFTable(this.Request.QueryString["RefNo"]);
                    this.Response.Redirect("EditSQL.aspx?MyPK=" + this.MyPK + "&SFKey=" + mysf.No, true);
                    this.WinClose();
                    return;

                case "AddFG":     /*执行一个插入列组的命令.*/
                    switch (this.RefNo)
                    {
                    case "IsPass":
                        MapDtl dtl = new MapDtl(this.FK_MapData);
                        dtl.IsEnablePass = true;         /*更新是否启动审核分组字段.*/
                        MapAttr attr = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "Check_Note";
                        attr.Name          = "审核意见";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.DefVal        = "同意";
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = true;
                        attr.MaxLen        = 4000;
                        attr.ColSpan       = 4;   // 默认为4列。
                        attr.Idx           = 1;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "Checker";
                        attr.Name          = "审核人";// "审核人";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.DefVal        = "@WebUser.No";
                        attr.UIIsEnable    = false;
                        attr.IsSigan       = true;
                        attr.Idx           = 2;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "IsPass";
                        attr.Name          = "通过否?";// "审核人";
                        attr.MyDataType    = DataType.AppBoolean;
                        attr.UIContralType = UIContralType.CheckBok;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.UIIsEnable    = false;
                        attr.IsSigan       = true;
                        attr.DefVal        = "1";
                        attr.Idx           = 2;
                        attr.DefVal        = "0";
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "Check_RDT";
                        attr.Name          = "审核日期"; // "审核日期";
                        attr.MyDataType    = DataType.AppDateTime;
                        attr.UIContralType = UIContralType.TB;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.DefVal        = "@RDT";
                        attr.UIIsEnable    = false;
                        attr.Idx           = 3;
                        attr.Insert();

                        /* 处理批次ID*/
                        attr            = new MapAttr();
                        attr.FK_MapData = this.FK_MapData;
                        attr.KeyOfEn    = "BatchID";
                        attr.Name       = "BatchID";  // this.ToE("IsPass", "是否通过");// "审核人";
                        attr.MyDataType = DataType.AppInt;
                        attr.UIIsEnable = false;
                        attr.UIIsLine   = false;
                        attr.UIIsEnable = false;
                        attr.UIVisible  = false;
                        attr.Idx        = 2;
                        attr.DefVal     = "0";
                        attr.Insert();

                        dtl.Update();
                        this.WinClose();
                        return;

                    case "Eval":         /* 质量评价 */
                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "EvalEmpNo";
                        attr.Name          = "被评价人员编号";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.UIIsEnable    = false;
                        attr.IsSigan       = true;
                        attr.Idx           = 1;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "EvalEmpName";
                        attr.Name          = "被评价人员名称";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.UIIsEnable    = false;
                        attr.IsSigan       = true;
                        attr.Idx           = 2;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "EvalCent";
                        attr.Name          = "工作得分";
                        attr.MyDataType    = DataType.AppFloat;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsLine      = false;
                        attr.UIIsEnable    = true;
                        attr.Idx           = 3;
                        attr.Insert();

                        attr               = new MapAttr();
                        attr.FK_MapData    = this.FK_MapData;
                        attr.KeyOfEn       = "EvalNote";
                        attr.Name          = "评价信息";
                        attr.MyDataType    = DataType.AppString;
                        attr.UIContralType = UIContralType.TB;
                        attr.MaxLen        = 50;
                        attr.MinLen        = 0;
                        attr.UIIsEnable    = true;
                        attr.UIIsEnable    = true;
                        attr.Idx           = 4;
                        attr.Insert();
                        this.WinClose();
                        return;

                    default:
                        break;
                    }
                    break;

                case "AddFGroup":
                    this.AddFGroup();
                    return;

                case "AddF":
                case "ChoseFType":
                    this.AddF();
                    break;

                case "Up":
                    MapAttr attrU = new MapAttr(this.RefNo);
                    if (this.Request.QueryString["IsDtl"] != null)
                    {
                        attrU.DoDtlUp();
                    }
                    else
                    {
                        attrU.DoUp();
                    }

                    this.WinClose();
                    break;

                case "Down":     //让一个字段下移动.
                    MapAttr attrD = new MapAttr(this.RefNo);
                    attrD.DoDown();
                    this.WinClose();
                    break;

                case "DownAttr":     //让一个字段下移动.
                    MapAttr attrAttr = new MapAttr(this.RefNo);
                    attrAttr.DoDtlDown();
                    this.WinClose();
                    break;

                case "Jump":
                    MapAttr attrFrom = new MapAttr(this.Request.QueryString["FromID"]);
                    MapAttr attrTo   = new MapAttr(this.Request.QueryString["ToID"]);
                    attrFrom.DoJump(attrTo);
                    this.WinClose();
                    break;

                case "MoveTo":
                    string  toID     = this.Request.QueryString["ToID"];
                    int     toGFID   = int.Parse(this.Request.QueryString["ToGID"]);
                    int     fromGID  = int.Parse(this.Request.QueryString["FromGID"]);
                    string  fromID   = this.Request.QueryString["FromID"];
                    MapAttr fromAttr = new MapAttr();
                    fromAttr.MyPK = fromID;
                    fromAttr.Retrieve();
                    if (toGFID == fromAttr.GroupID && fromAttr.MyPK == toID)
                    {
                        /* 如果没有移动. */
                        this.WinClose();
                        return;
                    }
                    if (toGFID != fromAttr.GroupID && fromAttr.MyPK == toID)
                    {
                        MapAttr toAttr = new MapAttr(toID);
                        fromAttr.Update(MapAttrAttr.GroupID, toAttr.GroupID, MapAttrAttr.Idx, toAttr.Idx);
                        this.WinClose();
                        return;
                    }
                    this.Response.Redirect(this.Request.RawUrl.Replace("MoveTo", "Jump"), true);
                    return;

                case "Edit":
                    Edit();
                    break;

                case "Del":
                    MapAttr attrDel = new MapAttr();
                    attrDel.MyPK = this.RefNo;
                    attrDel.Delete();
                    this.WinClose();
                    break;

                case "GFDoUp":
                    GroupField gf = new GroupField(this.RefOID);
                    gf.DoUp();
                    gf.Retrieve();
                    if (gf.Idx == 0)
                    {
                        this.WinClose();
                        return;
                    }
                    int oidIdx = gf.Idx;
                    gf.Idx = gf.Idx - 1;
                    GroupField gfUp = new GroupField();
                    if (gfUp.Retrieve(GroupFieldAttr.EnName, gf.EnName, GroupFieldAttr.Idx, gf.Idx) == 1)
                    {
                        gfUp.Idx = oidIdx;
                        gfUp.Update();
                    }
                    gf.Update();
                    this.WinClose();
                    break;

                case "GFDoDown":
                    GroupField mygf = new GroupField(this.RefOID);
                    mygf.DoDown();
                    mygf.Retrieve();
                    int oidIdx1 = mygf.Idx;
                    mygf.Idx = mygf.Idx + 1;
                    GroupField gfDown = new GroupField();
                    if (gfDown.Retrieve(GroupFieldAttr.EnName, mygf.EnName, GroupFieldAttr.Idx, mygf.Idx) == 1)
                    {
                        gfDown.Idx = oidIdx1;
                        gfDown.Update();
                    }
                    mygf.Update();
                    this.WinClose();
                    break;

                case "AthDoUp":
                    FrmAttachment frmAth = new FrmAttachment(this.MyPK);
                    if (frmAth.RowIdx > 0)
                    {
                        frmAth.RowIdx = frmAth.RowIdx - 1;
                        frmAth.Update();
                    }
                    this.WinClose();
                    break;

                case "AthDoDown":
                    FrmAttachment frmAthD = new FrmAttachment(this.MyPK);
                    if (frmAthD.RowIdx < 10)
                    {
                        frmAthD.RowIdx = frmAthD.RowIdx + 1;
                        frmAthD.Update();
                    }
                    this.WinClose();
                    break;

                case "DtlDoUp":
                    MapDtl dtl1 = new MapDtl(this.MyPK);
                    if (dtl1.RowIdx > 0)
                    {
                        dtl1.RowIdx = dtl1.RowIdx - 1;
                        dtl1.Update();
                    }
                    this.WinClose();
                    break;

                case "DtlDoDown":
                    MapDtl dtl2 = new MapDtl(this.MyPK);
                    if (dtl2.RowIdx < 10)
                    {
                        dtl2.RowIdx = dtl2.RowIdx + 1;
                        dtl2.Update();
                    }
                    this.WinClose();
                    break;

                case "M2MDoUp":
                    MapM2M ddtl1 = new MapM2M(this.MyPK);
                    if (ddtl1.RowIdx > 0)
                    {
                        ddtl1.RowIdx = ddtl1.RowIdx - 1;
                        ddtl1.Update();
                    }
                    this.WinClose();
                    break;

                case "M2MDoDown":
                    MapM2M ddtl2 = new MapM2M(this.MyPK);
                    if (ddtl2.RowIdx < 10)
                    {
                        ddtl2.RowIdx = ddtl2.RowIdx + 1;
                        ddtl2.Update();
                    }
                    this.WinClose();
                    break;

                case "FrameDoUp":
                    MapFrame frame1 = new MapFrame(this.MyPK);
                    if (frame1.RowIdx > 0)
                    {
                        frame1.RowIdx = frame1.RowIdx - 1;
                        frame1.Update();
                    }
                    this.WinClose();
                    break;

                case "FrameDoDown":
                    MapFrame frame2 = new MapFrame(this.MyPK);
                    if (frame2.RowIdx < 10)
                    {
                        frame2.RowIdx = frame2.RowIdx + 1;
                        frame2.Update();
                    }
                    this.WinClose();
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                this.Pub1.AddMsgOfWarning("错误:", ex.Message + " <br>" + this.Request.RawUrl);
            }
        }
Exemple #45
0
        public override object Do()
        {
            string msg = "";

            #region 处理表单.
            // 调度表单文件。
            SysFormTrees fss = new SysFormTrees();
            fss.ClearTable();

            //创建root.
            SysFormTree root = new SysFormTree();
            root.No       = "1";
            root.Name     = "表单库";
            root.ParentNo = "0";
            root.Insert();

            string          frmPath = SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Form\\";
            DirectoryInfo   dirInfo = new DirectoryInfo(frmPath);
            DirectoryInfo[] dirs    = dirInfo.GetDirectories();
            int             i       = 0;
            foreach (DirectoryInfo item in dirs)
            {
                if (item.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(item.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                SysFormTree fs = new SysFormTree();
                fs.No       = item.Name.Substring(0, 2);
                fs.Name     = item.Name.Substring(3);
                fs.ParentNo = "1";
                fs.Idx      = i++;
                fs.Insert();

                foreach (string f in fls)
                {
                    System.IO.FileInfo info = new System.IO.FileInfo(f);
                    if (info.Extension != ".xml")
                    {
                        continue;
                    }

                    msg += "@开始调度表单模板文件:" + f;
                    BP.DA.Log.DefaultLogWriteLineInfo("@开始调度表单模板文件:" + f);

                    DataSet ds = new DataSet();
                    ds.ReadXml(f);

                    try
                    {
                        MapData md = MapData.ImpMapData(ds);
                        md.FK_FrmSort  = fs.No;
                        md.FK_FormTree = fs.No;
                        md.AppType     = "0";
                        md.Update();
                    }
                    catch (Exception ex)
                    {
                        BP.DA.Log.DefaultLogWriteLineInfo("@装载表单模版文件:" + f + "出现错误," + ex.Message + " <br> " + ex.StackTrace);

                        throw new Exception("@装载模版文件:" + f + "出现错误," + ex.Message + " <br> " + ex.StackTrace);
                    }
                }
            }
            #endregion 处理表单.

            #region 处理流程.
            FlowSorts sorts = new FlowSorts();
            sorts.ClearTable();
            dirInfo = new DirectoryInfo(SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Flow\\");
            dirs    = dirInfo.GetDirectories();

            FlowSort fsRoot = new FlowSort();
            fsRoot.No       = "99";
            fsRoot.Name     = "流程树";
            fsRoot.ParentNo = "0";
            fsRoot.DirectInsert();

            foreach (DirectoryInfo dir in dirs)
            {
                if (dir.FullName.Contains(".svn"))
                {
                    continue;
                }

                string[] fls = System.IO.Directory.GetFiles(dir.FullName);
                if (fls.Length == 0)
                {
                    continue;
                }

                FlowSort fs = new FlowSort();
                fs.No       = dir.Name.Substring(0, 3);
                fs.Name     = dir.Name.Substring(3);
                fs.ParentNo = fsRoot.No;
                fs.Insert();

                foreach (string filePath in fls)
                {
                    msg += "\t\n@开始调度流程模板文件:" + filePath;
                    BP.DA.Log.DefaultLogWriteLineInfo("@开始调度流程模板文件:" + filePath);

                    Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(fs.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo);
                    msg += "\t\n@流程:[" + myflow.Name + "]装载成功。";

                    System.IO.FileInfo info = new System.IO.FileInfo(filePath);
                    myflow.Name = info.Name.Replace(".xml", "");
                    if (myflow.Name.Substring(2, 1) == ".")
                    {
                        myflow.Name = myflow.Name.Substring(3);
                    }
                    myflow.DirectUpdate();
                }


                //调度它的下一级目录.
                DirectoryInfo   dirSubInfo = new DirectoryInfo(SystemConfig.PathOfWebApp + "\\SDKFlowDemo\\FlowDemo\\Flow\\" + dir.Name);
                DirectoryInfo[] myDirs     = dirSubInfo.GetDirectories();
                foreach (DirectoryInfo mydir in myDirs)
                {
                    if (mydir.FullName.Contains(".svn"))
                    {
                        continue;
                    }

                    string[] myfls = System.IO.Directory.GetFiles(mydir.FullName);
                    if (myfls.Length == 0)
                    {
                        continue;
                    }

                    // 流程类别.
                    FlowSort subFlowSort = fs.DoCreateSubNode() as FlowSort;
                    subFlowSort.Name = mydir.Name.Substring(3);
                    subFlowSort.Update();

                    foreach (string filePath in myfls)
                    {
                        msg += "\t\n@开始调度流程模板文件:" + filePath;
                        BP.DA.Log.DefaultLogWriteLineInfo("@开始调度流程模板文件:" + filePath);

                        Flow myflow = BP.WF.Flow.DoLoadFlowTemplate(subFlowSort.No, filePath, ImpFlowTempleteModel.AsTempleteFlowNo);
                        msg += "\t\n@流程:" + myflow.Name + "装载成功。";

                        System.IO.FileInfo info = new System.IO.FileInfo(filePath);
                        myflow.Name = info.Name.Replace(".xml", "");
                        if (myflow.Name.Substring(2, 1) == ".")
                        {
                            myflow.Name = myflow.Name.Substring(3);
                        }
                        myflow.DirectUpdate();
                    }
                }
            }

            //执行流程检查.
            Flows flsEns = new Flows();
            flsEns.RetrieveAll();
            foreach (Flow fl in flsEns)
            {
                fl.DoCheck();
            }
            #endregion 处理流程.



            BP.DA.Log.DefaultLogWriteLineInfo(msg);

            //删除多余的空格.
            BP.WF.DTS.DeleteBlankGroupField dts = new DeleteBlankGroupField();
            dts.Do();

            return(msg);
        }
 private void ReadMap()
 {
     m_MapName = m_Maps[m_MapNumber];
     m_MapData = m_MapReaderMono.ReadMap(m_MapName);
 }
    void LoadTiles()
    {
        //Seeds
        SeedPlant = Random.Range(0, int.MaxValue);
        //Noises
        ImplicitFractal plantNoise = new ImplicitFractal(FractalType.MULTI,
                                                         BasisType.SIMPLEX,
                                                         InterpolationType.QUINTIC,
                                                         plantOctaves,
                                                         plantFrequency,
                                                         SeedPlant);
        MapData plantData = new MapData(width, length);

        plantData.GetData(plantNoise);
        for (int x = 0; x < width; x++)
        {
            for (int y = 0; y < length; y++)
            {
                float val  = (plantData.val[x, y] - plantData.Min) / (plantData.Max - plantData.Min);
                Tile  tile = gen[x, y];
                if (tile.TreeT != TreeType.NULL)
                {
                    tile.AgePlant = 0;
                    continue;
                }
                if (tile.Type == TileType.GRASS)
                {
                    if (val < grass)
                    {
                        tile.PlantT = PlantType.GRASS;
                    }
                }
                else if (tile.Type == TileType.SAVANA)
                {
                    if (val < savanna)
                    {
                        tile.PlantT = PlantType.SAVANNA;
                    }
                }
                else if (tile.Type == TileType.SWAMP)
                {
                    if (val < swamp)
                    {
                        tile.PlantT = PlantType.SWAMP;
                    }
                }
                else if (tile.Type == TileType.DESERT)
                {
                    if (val < desert)
                    {
                        tile.PlantT = PlantType.DESERT;
                    }
                }
                else if (tile.Type == TileType.COLDDESERT)
                {
                    if (val < cold)
                    {
                        tile.PlantT = PlantType.COLD;
                    }
                }
                tile.AgePlant = Random.Range(0.5f, 1);
                plants.Add(tile);
            }
        }
    }
        void btn_Copy_Click(object sender, EventArgs e)
        {
            BP.WF.Node nd  = new BP.WF.Node(this.FK_Node);
            Node       sNd = new Node(this.NodeOfSelect);

            BP.En.Attrs attrs     = sNd.HisWork.EnMap.Attrs;
            BP.En.Attrs attrsCopy = nd.HisWork.EnMap.Attrs;

            // 开始copy 分组的节点。
            GroupFields gfs  = new GroupFields(this.NodeOfSelect);
            MapDtls     dtls = new MapDtls(this.NodeOfSelect);
            MapM2Ms     m2ms = new MapM2Ms(this.NodeOfSelect);
            MapFrames   frms = new MapFrames(this.NodeOfSelect);

            foreach (GroupField gf in gfs)
            {
                CheckBox cb = this.Pub2.GetCBByID("CB" + gf.OID);
                if (cb.Checked == false)
                {
                    continue;
                }

                // 生成一个分组实体.
                GroupField mygf = new GroupField();
                mygf.Lab    = gf.Lab;
                mygf.EnName = this.FK_Node;
                mygf.Idx    = gf.Idx;
                mygf.Insert();

                foreach (MapM2M m2m in m2ms)
                {
                    if (m2m.GroupID != gf.OID)
                    {
                        continue;
                    }

                    MapM2M mym2m = new MapM2M();
                    mym2m.MyPK = m2m.MyPK.Replace(this.NodeOfSelect, this.FK_Node);
                    //  mym2m.FK_MapData =this
                    if (mym2m.IsExits)
                    {
                        continue;
                    }

                    mym2m.Copy(m2m);
                    mym2m.FK_MapData = this.FK_Node;
                    mym2m.GroupID    = mygf.OID;
                    mym2m.MyPK       = m2m.MyPK.Replace(this.NodeOfSelect, this.FK_Node);
                    mym2m.Insert();
                }

                foreach (MapFrame frm in frms)
                {
                    if (frm.GroupID != gf.OID)
                    {
                        continue;
                    }

                    MapFrame myen = new MapFrame();
                    myen.MyPK = frm.MyPK.Replace(this.NodeOfSelect, this.FK_Node);
                    if (myen.IsExits)
                    {
                        continue;
                    }

                    myen.Copy(frm);
                    myen.FK_MapData = this.FK_Node;
                    myen.GroupID    = mygf.OID;
                    myen.MyPK       = frm.MyPK.Replace(this.NodeOfSelect, this.FK_Node);
                    myen.Insert();
                }

                // 复制从表.
                foreach (MapDtl dtl in dtls)
                {
                    cb = this.Pub2.GetCBByID("CB_" + dtl.No + gf.OID);
                    MapDtl dtlNew = new MapDtl();
                    dtlNew.No = dtl.No.Replace(this.NodeOfSelect, this.FK_Node);
                    if (dtlNew.IsExits)
                    {
                        continue;
                    }

                    dtlNew.Copy(dtl);
                    dtlNew.FK_MapData = this.FK_Node;
                    dtlNew.No         = dtl.No.Replace(this.NodeOfSelect, this.FK_Node);

                    //  dtlNew.No = this.FK_Node + "Dtl";
                    // dtlNew.No = dtl.No.Replace(this.FK_Node, this.NodeOfSelect);

                    dtlNew.IsInsert = false;
                    dtlNew.IsUpdate = false;
                    dtlNew.IsDelete = false;

                    dtlNew.GroupID = mygf.OID;
                    dtlNew.PTable  = dtlNew.No;

                    dtlNew.Insert();

                    // 复制从表里面的明细。
                    int      idx    = 0;
                    MapAttrs mattrs = new MapAttrs(dtl.No);
                    foreach (MapAttr attr in mattrs)
                    {
                        MapAttr attrNew = new MapAttr();
                        attrNew.Copy(attr);
                        attrNew.FK_MapData = dtlNew.No;
                        attrNew.UIIsEnable = false;
                        if (attrNew.DefVal.Contains("@"))
                        {
                            attrNew.DefVal = "";
                        }

                        dtlNew.RowIdx       = idx;
                        attrNew.HisEditType = EditType.Edit;
                        attrNew.Insert();
                    }
                }

                // copy his fields.
                MapAttrs willCopyAttrs = new MapAttrs();
                willCopyAttrs.Retrieve(MapAttrAttr.GroupID, gf.OID, MapAttrAttr.Idx);
                int idx1 = 0;
                foreach (MapAttr attr in willCopyAttrs)
                {
                    MapAttr attrNew = new MapAttr();
                    if (attrNew.IsExit(MapAttrAttr.FK_MapData, this.FK_Node,
                                       MapAttrAttr.KeyOfEn, attr.KeyOfEn) == true)
                    {
                        continue;
                    }

                    if (attr.UIVisible == false)
                    {
                        continue;
                    }

                    idx1++;
                    attrNew.Copy(attr);
                    attrNew.GroupID    = mygf.OID;
                    attrNew.FK_MapData = this.FK_Node;
                    attrNew.UIIsEnable = false;
                    attrNew.Idx        = idx1;
                    if (attrNew.KeyOfEn == "Title")
                    {
                        attrNew.HisEditType = EditType.Edit;
                    }

                    attrNew.HisEditType = EditType.Edit;
                    attrNew.DefVal      = "";
                    attrNew.Insert();
                }
            }


            int GroupField = this.Pub2.GetDDLByID("DDL_GroupField").SelectedItemIntVal;

            foreach (Attr attr in attrs)
            {
                if (this.Pub2.IsExit(attr.Key) == false)
                {
                    continue;
                }
                CheckBox cb = this.Pub2.GetCBByID(attr.Key);
                if (cb.Checked == false)
                {
                    continue;
                }

                BP.Sys.MapAttr ma = new BP.Sys.MapAttr();
                int            i  = ma.Retrieve(BP.Sys.MapAttrAttr.KeyOfEn, attr.Key,
                                                BP.Sys.MapAttrAttr.FK_MapData, this.NodeOfSelect);

                BP.Sys.MapAttr ma1     = new BP.Sys.MapAttr();
                bool           ishavle = ma1.IsExit(BP.Sys.MapAttrAttr.KeyOfEn, attr.Key,
                                                    BP.Sys.MapAttrAttr.FK_MapData, this.FK_Node);

                if (ishavle)
                {
                    continue;
                }


                ma1.Copy(ma);

                ma1.FK_MapData = this.FK_Node;
                ma1.KeyOfEn    = ma.KeyOfEn;
                ma1.Name       = ma.Name;
                ma1.GroupID    = GroupField;
                ma1.UIIsEnable = false;

                ma1.HisEditType = EditType.Edit;

                if (ma1.DefVal != null && ma1.DefVal.Contains("@"))
                {
                    ma1.DefVal = "";
                }
                ma1.Insert();
            }

            if (this.Pub2.IsExit("CB_Table"))
            {
                if (this.Pub2.GetCBByID("CB_Table").Checked)
                {
                    MapData md1 = new MapData(this.NodeOfSelect);
                    MapData md2 = new MapData(this.FK_Node);
                    //md2.CellsX = md1.CellsX;
                    //md2.CellsY = md1.CellsY;
                    md2.Update();

                    //MapAttrs ma1 = md1.GenerHisTableCells;
                    // 删除历史数据。

                    //ma1.Delete(MapAttrAttr.FK_MapData, this.FK_Node + "T");
                    //foreach (MapAttr attr in ma1)
                    //{
                    //    MapAttr attr2 = new MapAttr();
                    //    attr2.Copy(attr);
                    //    // attr2.OID = 0;
                    //    attr2.GroupID = 0;
                    //    attr2.Idx = 0;
                    //    attr2.FK_MapData = this.FK_Node + "T";
                    //    attr2.UIIsEnable = false;
                    //    attr2.Insert();
                    //}
                }
            }

            this.WinClose();
            //this.WinCloseWithMsg("复制成功");
            //this.Response.Redirect("MapDef.aspx?PK=" + this.FK_Node + "&NodeOfSelect=" + this.NodeOfSelect);
        }
Exemple #49
0
    protected override void GetData()
    {
        HeightData   = new MapData(Width, Height);
        HeatData     = new MapData(Width, Height);
        MoistureData = new MapData(Width, Height);
        Clouds1      = new MapData(Width, Height);
        Clouds2      = new MapData(Width, Height);

        // Define our map area in latitude/longitude
        float southLatBound = -180;
        float northLatBound = 180;
        float westLonBound  = -90;
        float eastLonBound  = 90;

        float lonExtent = eastLonBound - westLonBound;
        float latExtent = northLatBound - southLatBound;

        float xDelta = lonExtent / (float)Width;
        float yDelta = latExtent / (float)Height;

        float curLon = westLonBound;
        float curLat = southLatBound;

        // Loop through each tile using its lat/long coordinates
        for (var x = 0; x < Width; x++)
        {
            curLon = westLonBound;

            for (var y = 0; y < Height; y++)
            {
                float x1 = 0, y1 = 0, z1 = 0;

                // Convert this lat/lon to x/y/z
                LatLonToXYZ(curLat, curLon, ref x1, ref y1, ref z1);

                // Heat data
                float sphereValue = (float)HeatMap.Get(x1, y1, z1);
                if (sphereValue > HeatData.Max)
                {
                    HeatData.Max = sphereValue;
                }
                if (sphereValue < HeatData.Min)
                {
                    HeatData.Min = sphereValue;
                }
                HeatData.Data [x, y] = sphereValue;

                float coldness = Mathf.Abs(curLon) / 90f;
                float heat     = 1 - Mathf.Abs(curLon) / 90f;
                HeatData.Data [x, y] += heat;
                HeatData.Data [x, y] -= coldness;

                // Height Data
                float heightValue = (float)HeightMap.Get(x1, y1, z1);
                if (heightValue > HeightData.Max)
                {
                    HeightData.Max = heightValue;
                }
                if (heightValue < HeightData.Min)
                {
                    HeightData.Min = heightValue;
                }
                HeightData.Data [x, y] = heightValue;

                // Moisture Data
                float moistureValue = (float)MoistureMap.Get(x1, y1, z1);
                if (moistureValue > MoistureData.Max)
                {
                    MoistureData.Max = moistureValue;
                }
                if (moistureValue < MoistureData.Min)
                {
                    MoistureData.Min = moistureValue;
                }
                MoistureData.Data [x, y] = moistureValue;

                // Cloud Data
                Clouds1.Data[x, y] = (float)Cloud1Map.Get(x1, y1, z1);
                if (Clouds1.Data[x, y] > Clouds1.Max)
                {
                    Clouds1.Max = Clouds1.Data[x, y];
                }
                if (Clouds1.Data[x, y] < Clouds1.Min)
                {
                    Clouds1.Min = Clouds1.Data[x, y];
                }

                Clouds2.Data[x, y] = (float)Cloud2Map.Get(x1, y1, z1);
                if (Clouds2.Data[x, y] > Clouds2.Max)
                {
                    Clouds2.Max = Clouds2.Data[x, y];
                }
                if (Clouds2.Data[x, y] < Clouds2.Min)
                {
                    Clouds2.Min = Clouds2.Data[x, y];
                }

                curLon += xDelta;
            }
            curLat += yDelta;
        }
    }
    // takes as parameters map data, an LOD, and an action
    void MeshDataThread(MapData mapData, int lod, Action <MeshData> callback)
    {
        MeshData meshData = MeshGenerator.GenerateTerrainMesh(mapData.heightMap, meshHeightMultiplier, lod);

        lock (meshDataQueue) { meshDataQueue.Enqueue(new ThreadInfo <MeshData> (callback, meshData)); }
    }
Exemple #51
0
        /// <summary>
        /// 产生一个WorkNode
        /// </summary>
        /// <param name="fk_flow">流程编号</param>
        /// <param name="fk_node">节点ID</param>
        /// <param name="workID">工作ID</param>
        /// <param name="fid">FID</param>
        /// <param name="userNo">用户编号</param>
        /// <returns>返回dataset</returns>
        public static DataSet GenerWorkNodeForAndroid(string fk_flow, int fk_node, Int64 workID, Int64 fid, string userNo)
        {
            if (fk_node == 0)
            {
                fk_node = int.Parse(fk_flow + "01");
            }

            if (workID == 0)
            {
                workID = BP.WF.Dev2Interface.Node_CreateBlankWork(fk_flow, null, null, userNo, null);
            }

            try
            {
                Emp emp = new Emp(userNo);
                BP.Web.WebUser.SignInOfGener(emp);

                MapData md = new MapData();
                md.No = "ND" + fk_node;
                if (md.RetrieveFromDBSources() == 0)
                {
                    throw new Exception("装载错误,该表单ID=" + md.No + "丢失,请修复一次流程重新加载一次.");
                }



                //表单模版.
                DataSet myds = BP.Sys.CCFormAPI.GenerHisDataSet(md.No);
                return(myds);

                #region 流程设置信息.
                Node nd = new Node(fk_node);

                if (nd.IsStartNode == false)
                {
                    BP.WF.Dev2Interface.Node_SetWorkRead(fk_node, workID);
                }

                // 节点数据.
                string    sql = "SELECT * FROM WF_Node WHERE NodeID=" + fk_node;
                DataTable dt  = BP.DA.DBAccess.RunSQLReturnTable(sql);
                dt.TableName = "WF_NodeBar";
                myds.Tables.Add(dt);

                // 流程数据.
                Flow fl = new Flow(fk_flow);
                myds.Tables.Add(fl.ToDataTableField("WF_Flow"));
                #endregion 流程设置信息.

                #region 把主从表数据放入里面.
                //.工作数据放里面去, 放进去前执行一次装载前填充事件.
                BP.WF.Work wk = nd.HisWork;
                wk.OID = workID;
                wk.RetrieveFromDBSources();

                // 处理传递过来的参数。
                foreach (string k in System.Web.HttpContext.Current.Request.QueryString.AllKeys)
                {
                    wk.SetValByKey(k, System.Web.HttpContext.Current.Request.QueryString[k]);
                }

                // 执行一次装载前填充.
                string msg = md.DoEvent(FrmEventList.FrmLoadBefore, wk);
                if (DataType.IsNullOrEmpty(msg) == false)
                {
                    throw new Exception("错误:" + msg);
                }

                wk.ResetDefaultVal();
                myds.Tables.Add(wk.ToDataTableField(md.No));

                //把附件的数据放入.
                if (md.FrmAttachments.Count > 0)
                {
                    sql          = "SELECT * FROM Sys_FrmAttachmentDB where RefPKVal=" + workID + " AND FK_MapData='ND" + fk_node + "'";
                    dt           = BP.DA.DBAccess.RunSQLReturnTable(sql);
                    dt.TableName = "Sys_FrmAttachmentDB";
                    myds.Tables.Add(dt);
                }
                // 图片附件数据放入
                if (md.FrmImgAths.Count > 0)
                {
                    sql          = "SELECT * FROM Sys_FrmImgAthDB where RefPKVal=" + workID + " AND FK_MapData='ND" + fk_node + "'";
                    dt           = BP.DA.DBAccess.RunSQLReturnTable(sql);
                    dt.TableName = "Sys_FrmImgAthDB";
                    myds.Tables.Add(dt);
                }

                //把从表的数据放入.
                if (md.MapDtls.Count > 0)
                {
                    foreach (MapDtl dtl in md.MapDtls)
                    {
                        GEDtls      dtls = new GEDtls(dtl.No);
                        QueryObject qo   = null;
                        try
                        {
                            qo = new QueryObject(dtls);
                            switch (dtl.DtlOpenType)
                            {
                            case DtlOpenType.ForEmp:      // 按人员来控制.
                                qo.AddWhere(GEDtlAttr.RefPK, workID);
                                qo.addAnd();
                                qo.AddWhere(GEDtlAttr.Rec, WebUser.No);
                                break;

                            case DtlOpenType.ForWorkID:     // 按工作ID来控制
                                qo.AddWhere(GEDtlAttr.RefPK, workID);
                                break;

                            case DtlOpenType.ForFID:     // 按流程ID来控制.
                                qo.AddWhere(GEDtlAttr.FID, workID);
                                break;
                            }
                        }
                        catch
                        {
                            dtls.GetNewEntity.CheckPhysicsTable();
                        }
                        DataTable dtDtl = qo.DoQueryToTable();

                        // 为明细表设置默认值.
                        MapAttrs dtlAttrs = new MapAttrs(dtl.No);
                        foreach (MapAttr attr in dtlAttrs)
                        {
                            //处理它的默认值.
                            if (attr.DefValReal.Contains("@") == false)
                            {
                                continue;
                            }

                            foreach (DataRow dr in dtDtl.Rows)
                            {
                                dr[attr.KeyOfEn] = attr.DefVal;
                            }
                        }

                        dtDtl.TableName = dtl.No; //修改明细表的名称.
                        myds.Tables.Add(dtDtl);   //加入这个明细表, 如果没有数据,xml体现为空.
                    }
                }
                #endregion

                #region 把外键表加入DataSet
                DataTable dtMapAttr = myds.Tables["Sys_MapAttr"];
                foreach (DataRow dr in dtMapAttr.Rows)
                {
                    string lgType = dr["LGType"].ToString();
                    if (lgType.Equals("2") == false)
                    {
                        continue;
                    }

                    string UIIsEnable = dr["UIIsEnable"].ToString();
                    if (UIIsEnable.Equals("0") == true)
                    {
                        continue;
                    }

                    string uiBindKey = dr["UIBindKey"].ToString();
                    if (DataType.IsNullOrEmpty(uiBindKey) == true)
                    {
                        string myPK = dr["MyPK"].ToString();
                        /*如果是空的*/
                        throw new Exception("@属性字段数据不完整,流程:" + fl.No + fl.Name + ",节点:" + nd.NodeID + nd.Name + ",属性:" + myPK + ",的UIBindKey IsNull ");
                    }

                    // 判断是否存在.
                    if (myds.Tables.Contains(uiBindKey) == true)
                    {
                        continue;
                    }

                    myds.Tables.Add(BP.Sys.PubClass.GetDataTableByUIBineKey(uiBindKey));
                }
                #endregion End把外键表加入DataSet

                #region 把流程信息放入里面.
                //把流程信息表发送过去.
                GenerWorkFlow gwf = new GenerWorkFlow();
                gwf.WorkID = workID;
                gwf.RetrieveFromDBSources();

                myds.Tables.Add(gwf.ToDataTableField("WF_GenerWorkFlow"));

                if (gwf.WFState == WFState.Shift)
                {
                    //如果是转发.
                    BP.WF.ShiftWorks fws = new ShiftWorks();
                    fws.Retrieve(ShiftWorkAttr.WorkID, workID, ShiftWorkAttr.FK_Node, fk_node);
                    myds.Tables.Add(fws.ToDataTableField("WF_ShiftWork"));
                }

                if (gwf.WFState == WFState.ReturnSta)
                {
                    //如果是退回.
                    ReturnWorks rts = new ReturnWorks();
                    rts.Retrieve(ReturnWorkAttr.WorkID, workID,
                                 ReturnWorkAttr.ReturnToNode, fk_node,
                                 ReturnWorkAttr.RDT);
                    myds.Tables.Add(rts.ToDataTableField("WF_ReturnWork"));
                }

                if (gwf.WFState == WFState.HungUp)
                {
                    //如果是挂起.
                    HungUps hups = new HungUps();
                    hups.Retrieve(HungUpAttr.WorkID, workID, HungUpAttr.FK_Node, fk_node);
                    myds.Tables.Add(hups.ToDataTableField("WF_HungUp"));
                }

                //if (gwf.WFState == WFState.Askfor)
                //{
                //    //如果是加签.
                //    BP.WF.ShiftWorks fws = new ShiftWorks();
                //    fws.Retrieve(ShiftWorkAttr.WorkID, workID, ShiftWorkAttr.FK_Node, fk_node);
                //    myds.Tables.Add(fws.ToDataTableField("WF_ShiftWork"));
                //}

                Int64 wfid = workID;
                if (fid != 0)
                {
                    wfid = fid;
                }


                //放入track信息.
                Paras ps = new Paras();
                ps.SQL = "SELECT * FROM ND" + int.Parse(fk_flow) + "Track WHERE WorkID=" + BP.Sys.SystemConfig.AppCenterDBVarStr + "WorkID";
                ps.Add("WorkID", wfid);
                DataTable dtNode = DBAccess.RunSQLReturnTable(ps);
                dtNode.TableName = "Track";
                myds.Tables.Add(dtNode);

                //工作人员列表,用于审核组件.
                ps     = new Paras();
                ps.SQL = "SELECT * FROM  WF_GenerWorkerlist WHERE WorkID=" + BP.Sys.SystemConfig.AppCenterDBVarStr + "WorkID";
                ps.Add("WorkID", wfid);
                DataTable dtGenerWorkerlist = DBAccess.RunSQLReturnTable(ps);
                dtGenerWorkerlist.TableName = "WF_GenerWorkerlist";
                myds.Tables.Add(dtGenerWorkerlist);

                //放入CCList信息. 用于审核组件.
                ps     = new Paras();
                ps.SQL = "SELECT * FROM WF_CCList WHERE WorkID=" + BP.Sys.SystemConfig.AppCenterDBVarStr + "WorkID";
                ps.Add("WorkID", wfid);
                DataTable dtCCList = DBAccess.RunSQLReturnTable(ps);
                dtCCList.TableName = "WF_CCList";
                myds.Tables.Add(dtCCList);

                //放入WF_SelectAccper信息. 用于审核组件.
                ps     = new Paras();
                ps.SQL = "SELECT * FROM WF_SelectAccper WHERE WorkID=" + BP.Sys.SystemConfig.AppCenterDBVarStr + "WorkID";
                ps.Add("WorkID", wfid);
                DataTable dtSelectAccper = DBAccess.RunSQLReturnTable(ps);
                dtSelectAccper.TableName = "WF_SelectAccper";
                myds.Tables.Add(dtSelectAccper);

                //放入所有的节点信息. 用于审核组件.
                ps     = new Paras();
                ps.SQL = "SELECT * FROM WF_Node WHERE FK_Flow=" + BP.Sys.SystemConfig.AppCenterDBVarStr + "FK_Flow ORDER BY " + NodeAttr.Step;
                ps.Add("FK_Flow", fk_flow);
                DataTable dtNodes = DBAccess.RunSQLReturnTable(ps);
                dtNodes.TableName = "Nodes";
                myds.Tables.Add(dtNodes);

                #endregion 把流程信息放入里面.

                return(myds);
            }
            catch (Exception ex)
            {
                Log.DebugWriteError(ex.StackTrace);
                throw new Exception(ex.Message);
            }
        }
Exemple #52
0
        public void BindEdit(MapData md, MapFrame dtl)
        {
            this.Pub1.AddTable();
            //  this.Pub1.AddCaptionLeftTX("<a href='MapDef.aspx?MyPK=" + md.No + "'>" + "返回" + ":" + md.Name + "</a> -  " + this.ToE("DtlTable", "从表") + ":(" + dtl.Name + ")");
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("ID");
            this.Pub1.AddTDTitle("项目");
            this.Pub1.AddTDTitle("采集");
            this.Pub1.AddTDTitle("备注");
            this.Pub1.AddTREnd();

            int idx = 1;

            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("编号");
            TB tb = new TB();

            tb.ID   = "TB_" + MapFrameAttr.NoOfObj;
            tb.Text = dtl.NoOfObj;
            if (this.DoType == "Edit")
            {
                tb.Enabled = false;
            }
            this.Pub1.AddTD(tb);
            this.Pub1.AddTD();
            this.Pub1.AddTREnd();


            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("描述");
            tb         = new TB();
            tb.ID      = "TB_Name";
            tb.Text    = dtl.Name;
            tb.Columns = 50;
            this.Pub1.AddTD("colspan=2", tb);
            this.Pub1.AddTREnd();
            this.Pub1.AddTREnd();


            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("框架连接");
            tb         = new TB();
            tb.ID      = "TB_URL";
            tb.Text    = dtl.URL;
            tb.Columns = 50;
            this.Pub1.AddTD("colspan=2", tb);
            this.Pub1.AddTREnd();

            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("框架宽度");
            tb          = new TB();
            tb.ID       = "TB_W";
            tb.Text     = dtl.W;
            tb.ShowType = TBType.TB;
            this.Pub1.AddTD(tb);
            this.Pub1.AddTD();
            this.Pub1.AddTREnd();

            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("框架高度");
            tb          = new TB();
            tb.ID       = "TB_H";
            tb.ShowType = TBType.TB;
            tb.Text     = dtl.H;
            this.Pub1.AddTD(tb);
            this.Pub1.AddTD();
            this.Pub1.AddTREnd();

            this.Pub1.AddTR1();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTDBegin("colspan=3");

            RadioBtn rb = new RadioBtn();

            rb.Text      = "指定框架宽度高度";
            rb.ID        = "RB_IsAutoSize_0";
            rb.GroupName = "s";
            if (dtl.IsAutoSize)
            {
                rb.Checked = false;
            }
            else
            {
                rb.Checked = true;
            }

            this.Pub1.Add(rb);


            rb           = new RadioBtn();
            rb.Text      = "让框架自适应大小";
            rb.ID        = "RB_IsAutoSize_1";
            rb.GroupName = "s";

            if (dtl.IsAutoSize)
            {
                rb.Checked = true;
            }
            else
            {
                rb.Checked = false;
            }

            this.Pub1.Add(rb);
            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();

            GroupFields gfs = new GroupFields(md.No);

            this.Pub1.AddTR();
            this.Pub1.AddTDIdx(idx++);
            this.Pub1.AddTD("显示在分组");
            DDL ddl = new DDL();

            ddl.ID = "DDL_GroupField";
            ddl.BindEntities(gfs, GroupFieldAttr.OID, GroupFieldAttr.Lab, false, AddAllLocation.None);
            ddl.SetSelectItem(dtl.GroupID);
            this.Pub1.AddTD("colspan=2", ddl);
            this.Pub1.AddTREnd();


            this.Pub1.AddTRSum();
            this.Pub1.AddTDBegin("colspan=4 align=center");

            Button btn = new Button();

            btn.ID       = "Btn_Save";
            btn.CssClass = "Btn";
            btn.Text     = " 保存 ";
            btn.Click   += new EventHandler(btn_Click);
            this.Pub1.Add(btn);

            btn          = new Button();
            btn.ID       = "Btn_SaveAndClose";
            btn.CssClass = "Btn";
            btn.Text     = " 保存并关闭 ";
            btn.Click   += new EventHandler(btn_Click);
            this.Pub1.Add(btn);

            if (this.FK_MapFrame != null)
            {
                btn          = new Button();
                btn.ID       = "Btn_Del";
                btn.CssClass = "Btn";
                btn.Text     = "删除"; // "删除";
                btn.Attributes["onclick"] = " return confirm('您确认吗?');";
                btn.Click += new EventHandler(btn_Del_Click);
                this.Pub1.Add(btn);

                btn          = new Button();
                btn.ID       = "Btn_New";
                btn.CssClass = "Btn";
                btn.Text     = "新建"; // "删除";
                btn.Click   += new EventHandler(btn_New_Click);
                this.Pub1.Add(btn);
            }

            this.Pub1.AddTDEnd();
            this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }
Exemple #53
0
        /// <summary>
        /// Creates a sample Map Data for the tests.
        /// </summary>
        /// <returns>A sample MapData instance</returns>
        internal static MapData GetSampleMapData()
        {
            MapData md = new MapData();

            //Create some nodes and add them to the mapdata
            MapNode nodeA = new MapNode();

            SetMockIdAndName(nodeA, 123, "nodeA");
            AddMockPort(nodeA, null);

            MapNode nodeB = new MapNode();

            SetMockIdAndName(nodeB, 234, "nodeB");
            AddMockPort(nodeB, null);

            MapNode nodeC = new MapNode();

            SetMockIdAndName(nodeC, 012, "nodeC");

            MapNode nodeX = new MapNode();

            SetMockIdAndName(nodeX, 666, "nodeX");
            AddMockPort(nodeX, null);

            MapNode nodeY = new MapNode();

            SetMockIdAndName(nodeY, 667, "nodeY");
            AddMockPort(nodeY, null);

            MapNode nodeZ = new MapNode();

            SetMockIdAndName(nodeZ, 668, "nodeZ");
            AddMockPort(nodeZ, null);

            md.Nodes.Add(nodeA);
            md.Nodes.Add(nodeB);
            md.Nodes.Add(nodeX);
            md.Nodes.Add(nodeY);
            md.Nodes.Add(nodeZ);

            //Create a link (from A to B) and add it to the mapData
            MapLink linkA = new MapLink();

            SetMockIdAndName(linkA, 1001, "linkA");
            linkA.AddNode(nodeA);
            linkA.AddNode(nodeB);
            //Note ports do not have to be in the same order as the links
            linkA.AddPort((MapPort)nodeB.Ports[0]);
            linkA.AddPort((MapPort)nodeA.Ports[0]);

            //Create a link (from B to C) and add it to the mapData
            MapLink linkB = new MapLink();

            SetMockIdAndName(linkB, 1000, "linkB");
            linkA.AddNode(nodeB);
            linkA.AddNode(nodeC);

            md.Links.Add(linkA);
            md.Links.Add(linkB);

            //Create a linked port
            nodeB.Ports[0].Links.Add(linkA);

            //Set header
            md.Header = new MapHeader();

            //Create linkedport for NodeC
            AddMockPort(nodeC, linkB);


            //path with 3 nodes for LinkA
            MapAttribute ma1 = new MapAttribute();

            ma1.IntValue = 666;
            ma1.Type     = "int";
            ma1.Name     = "path";
            MapAttribute ma2 = new MapAttribute();

            ma2.IntValue = 667;
            ma2.Type     = "int";
            ma2.Name     = "path";
            MapAttribute ma3 = new MapAttribute();

            ma3.StringValue = "nodeZ";
            ma3.Type        = "string";
            ma3.Name        = "path";
            linkA.AddAttribute(ma1);
            linkA.AddAttribute(ma2);
            linkA.AddAttribute(ma3);

            return(md);
        }
Exemple #54
0
        public void BindList(MapData md)
        {
            MapFrames dtls = new MapFrames(md.No);

            if (dtls.Count == 0)
            {
                this.Response.Redirect("MapFrame.aspx?DoType=New&FK_MapData=" + this.FK_MapData + "&sd=sd", true);
                return;
            }

            if (dtls.Count == 1)
            {
                MapFrame d = (MapFrame)dtls[0];
                this.Response.Redirect("MapFrame.aspx?DoType=Edit&FK_MapData=" + this.FK_MapData + "&FK_MapFrame=" + d.MyPK, true);
                return;
            }

            this.Pub1.AddTable();
            this.Pub1.AddCaptionLeft("<a href='MapDef.aspx?MyPK=" + this.MyPK + "'>返回:" + md.Name + "</a> - <a href='MapFrame.aspx?DoType=New&FK_MapData=" + this.FK_MapData + "&sd=sd'><img src='../Img/Btn/New.gif' border=0/>新建</a>");
            this.Pub1.AddTR();
            this.Pub1.AddTDTitle("IDX");
            this.Pub1.AddTDTitle("编号");
            this.Pub1.AddTDTitle("名称");
            this.Pub1.AddTDTitle("操作");
            this.Pub1.AddTREnd();

            TB  tb = new TB();
            int i  = 0;

            foreach (MapFrame dtl in dtls)
            {
                i++;
                this.Pub1.AddTR();
                this.Pub1.AddTDIdx(i);
                this.Pub1.AddTD(dtl.MyPK);
                this.Pub1.AddTD(dtl.Name);
                this.Pub1.AddTD("<a href='MapFrame.aspx?FK_MapData=" + this.FK_MapData + "&DoType=Edit&FK_MapFrame=" + dtl.MyPK + "'>编辑</a>");
                this.Pub1.AddTREnd();
                //continue;

                //tb = new TB();
                //tb.ID = "TB_No_" + dtl.MyPK;
                //tb.Text = dtl.MyPK;
                //this.Pub1.AddTD(tb);

                //tb = new TB();
                //tb.ID = "TB_Name_" + dtl.MyPK;
                //tb.Text = dtl.Name;
                //this.Pub1.AddTD(tb);

                //this.Pub1.AddTD("<a href='MapFrame.aspx?FK_MapData=" + this.FK_MapData + "&DoType=Edit&FK_MapFrame=" + dtl.MyPK + "'>编辑</a>");
                //this.Pub1.AddTREnd();
            }

            //this.Pub1.AddTRSum();
            //Button btn = new Button();
            //btn.ID = "Btn_Save";
            //btn.Text = "保存";
            //btn.Click += new EventHandler(btn_Click);
            //this.Pub1.AddTD("colspan=5", btn);
            //this.Pub1.AddTREnd();
            this.Pub1.AddTableEnd();
        }
 // Use this for initialization
 void Start()
 {
     mapdata = GetComponent <MapData>();
     archer  = GameObject.Find("archer").GetComponent <Archer>();
 }
Exemple #56
0
 public UwmfLump(LumpName name, MapData mapData)
 {
     Name     = name;
     _mapData = mapData;
 }
Exemple #57
0
 public void SetMap(MapData map)
 {
     this.map = map;
 }
 void OnMapDataReceived(MapData mapData)
 {
     mapGenerator.RequestMeshData(mapData, OnMeshDataReceived);
 }
Exemple #59
0
        protected void Page_Load(object sender, EventArgs e)
        {
#warning 没有缓存经常预览与设计不一致
            if (this.Request.QueryString["IsTest"] == "1")
            {
                BP.SystemConfig.DoClearCash_del();
            }

            if (this.Request.QueryString["IsLoadData"] == "1")
            {
                this.UCEn1.IsLoadData = true;
            }

            MapData md = new MapData();
            md.No = this.FK_MapData;
            if (md.RetrieveFromDBSources() == 0 && md.Name.Length > 3)
            {
                if (md.HisFrmType == FrmType.Url)
                {
                    this.Response.Redirect(md.PTable, true);
                    return;
                }

                /* 没有找到此map. */
                MapDtl dtl   = new MapDtl(this.FK_MapData);
                GEDtl  dtlEn = dtl.HisGEDtl;
                dtlEn.SetValByKey("OID", this.FID);


                if (dtlEn.EnMap.Attrs.Count < 2)
                {
                    md.RepairMap();
                    this.Response.Redirect(this.Request.RawUrl, true);
                    return;
                }

                int i = dtlEn.RetrieveFromDBSources();

                string[] paras = this.RequestParas.Split('&');
                foreach (string str in paras)
                {
                    if (string.IsNullOrEmpty(str) || str.Contains("=") == false)
                    {
                        continue;
                    }

                    string[] kvs = str.Split('=');
                    dtlEn.SetValByKey(kvs[0], kvs[1]);
                }

                if (md.HisFrmType == FrmType.CCForm)
                {
                    this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, !this.IsEdit);
                }

                if (md.HisFrmType == FrmType.Column4Frm)
                {
                    this.UCEn1.BindCCForm(dtlEn, this.FK_MapData, !this.IsEdit);
                }



                this.AddJSEvent(dtlEn);
            }
            else
            {
                GEEntity en = md.HisGEEn;
                int      pk = this.OID;
                if (this.Request.QueryString["NodeID"] != null)
                {
                    /*说明是流程调用它.*/
                    Node nd = new Node(int.Parse(this.Request.QueryString["NodeID"]));
                    if (nd.HisRunModel == RunModel.SubThread &&
                        nd.HisSubThreadType == SubThreadType.UnSameSheet &&
                        this.FK_MapData != "ND" + nd.NodeID)
                    {
                        /*如果是子线程, 并且是异表单节点.*/
                        pk = this.FID; // 是子线程,并且是异表单的子线程,并且不是节点表单。这样设置是为了到合流点上能够按FID进行表单数据汇总.
                    }
                }
                en.SetValByKey("OID", pk);
                if (en.EnMap.Attrs.Count < 2)
                {
                    md.RepairMap();
                    this.Response.Redirect(this.Request.RawUrl, true);
                    return;
                }

                int i = en.RetrieveFromDBSources();
                if (i == 0)
                {
                    en.DirectInsert();
                }

                string[] paras = this.RequestParas.Split('&');
                foreach (string str in paras)
                {
                    if (string.IsNullOrEmpty(str) || str.Contains("=") == false)
                    {
                        continue;
                    }

                    string[] kvs = str.Split('=');
                    en.SetValByKey(kvs[0], kvs[1]);
                }
                en.ResetDefaultVal();

                if (en.ToString() == "0")
                {
                    en.SetValByKey("OID", pk);
                }
                this.OIDPKVal = pk;

                this.UCEn1.BindCCForm(en, this.FK_MapData, !this.IsEdit);
                this.AddJSEvent(en);
            }

            Session["Count"]        = null;
            this.Btn_Save.Click    += new EventHandler(Btn_Save_Click);
            this.Btn_Save.Visible   = this.IsEdit;
            this.Btn_Save.Enabled   = this.IsEdit;
            this.Btn_Save.BackColor = System.Drawing.Color.White;

            this.Btn_Print.Visible = this.IsPrint;
            this.Btn_Print.Enabled = this.IsPrint;
            this.Btn_Print.Attributes["onclick"] = "window.showModalDialog('./CCForm/Print.aspx?FK_Node=" + this.FK_Node + "&FID=" + this.FID + "&FK_MapData=" + this.FK_MapData + "&WorkID=" + this.OID + "', '', 'dialogHeight: 350px; dialogWidth:450px; center: yes; help: no'); return false;";
        }
Exemple #60
0
    public void CreateBoard(MapData data)
    {
        _width  = (int)data.BoardSize.x;
        _height = (int)data.BoardSize.y;
        _map    = new Tile[Width, Height];

        List <Vector2> allPumpLocations = new List <Vector2>();

        allPumpLocations.AddRange(data.PumpLocationsCyan);
        allPumpLocations.AddRange(data.PumpLocationsMagenta);
        allPumpLocations.AddRange(data.PumpLocationsYellow);



        _emptyTileCount = (Width * Height) - (allPumpLocations.Count + data.ImpassableMapCoords.Count);

        bool canTraverse;

        for (int x = 0; x < Width; x++)
        {
            for (int y = 0; y < Height; y++)
            {
                Vector2 candidateCoord = new Vector2(x, y);
                canTraverse = data.ImpassableMapCoords.Contains(candidateCoord) ? false : true;


                Tile newTile = Instantiate(Services.Prefabs.Tile, candidateCoord, Quaternion.identity);

                newTile.name             = "Tile: [X: " + x + ", Y: " + y + "]";
                newTile.transform.parent = transform;



                if (allPumpLocations.Contains(candidateCoord))
                {
                    Destroy(newTile.gameObject.GetComponent <Tile>());
                    newTile.gameObject.AddComponent <PumpTile>();
                    PumpTile pumpTile = newTile.GetComponent <PumpTile>();
                    Ink      pumpInk;
                    if (data.PumpLocationsCyan.Contains(candidateCoord))
                    {
                        pumpInk = new Ink(Services.ColorManager.Cyan[0], ColorMode.CYAN, int.MaxValue);
                    }
                    else if (data.PumpLocationsMagenta.Contains(candidateCoord))
                    {
                        pumpInk = new Ink(Services.ColorManager.Magenta[0], ColorMode.MAGENTA, int.MaxValue);
                    }
                    else if (data.PumpLocationsYellow.Contains(candidateCoord))
                    {
                        pumpInk = new Ink(Services.ColorManager.Yellow[0], ColorMode.YELLOW, int.MaxValue);
                    }
                    else
                    {
                        pumpInk = new Ink(Services.ColorManager.ErrorColor, ColorMode.BLACK, int.MaxValue);
                    }

                    pumpTile.Init(new MapCoord(x, y), pumpInk, canTraverse);
                    newTile.name = newTile.name + " PUMP: " + pumpInk.colorMode;
                    _map[x, y]   = pumpTile;
                }
                else
                {
                    newTile.Init(new MapCoord(x, y), new Ink(canTraverse), canTraverse);
                    _map[x, y] = newTile;
                }
            }
        }
    }