Exemplo n.º 1
0
        //设置构造函数的参数
        private void SetMasterControl(DataSet cDataset, controlType eControlType)
        {
            //1.控件初始化赋值
            this.Controls.Add(childView);
            InitializeComponent();
            _cDataset           = cDataset;
            childView._cDataset = cDataset;
            CellStyle.applyGridTheme(this);
            Dock                    = DockStyle.Fill;
            EControlType            = eControlType;
            this.AllowUserToAddRows = false;

            //2.通过读取DataSet里面的Relations得到表的关联关系
            if (cDataset.Relations.Count <= 0)
            {
                return;
            }
            DataRelation oRelates;

            if (eControlType == controlType.outside)
            {
                oRelates = cDataset.Relations[1];
                childView.Add(oRelates.ParentTable.TableName, oRelates.ParentColumns[0].ColumnName, oRelates.ChildColumns[0].ColumnName);
            }
            else if (eControlType == controlType.middle)
            {
                oRelates = cDataset.Relations[cDataset.Relations.Count - 1];
                childView.Add2(oRelates.ChildTable.TableName);
            }

            //3.设置主外键对应关系
            oRelates = cDataset.Relations[0];
            //主表里面的值,副表里面的过滤字段
            setParentSource(oRelates.ParentTable.TableName, oRelates.ParentColumns[0].ColumnName, oRelates.ChildColumns[0].ColumnName);
        }
Exemplo n.º 2
0
        private void NoSpecificControls(GameTime gt, Vector2 editorCursorPos)
        {
            if (currentType == controlType.None && Mouse.GetState().LeftButton == ButtonState.Pressed && !KeyboardMouseUtility.AnyButtonsPressed())
            {
                var tempList = MapBuilder.loadedMap.allObjectsAtLocation(editorCursorPos);
                if (tempList.Count == 1)
                {
                    currentType             = controlType.ObjectLayerEditing;
                    MapBuilder.objSelection = new Utilities.Sprite.EditorObjectSelection();
                    MapBuilder.objSelection.Assign(tempList.First());
                }
                else if (tempList.Count > 1)
                {
                    int index = tempList.IndexOf(MapBuilder.objSelection.selectedObject);
                    index++;
                    if (index >= tempList.Count)
                    {
                        index = 0;
                    }

                    currentType             = controlType.ObjectLayerEditing;
                    MapBuilder.objSelection = new Utilities.Sprite.EditorObjectSelection();
                    MapBuilder.objSelection.Assign(tempList[index]);
                }
            }
        }
Exemplo n.º 3
0
    public static void SetDefaultControls_XBox360()
    {
        Debug.Log("Set control type: XBox 360");
        curControlType = controlType.XBOX360;

        player_jump    = KeyCode.JoystickButton0;
        player_attack1 = KeyCode.JoystickButton2;
        player_attack2 = KeyCode.JoystickButton1;
        player_dodge   = KeyCode.JoystickButton10;
    }
Exemplo n.º 4
0
    public static void SetDefaultControls_Keyboard()
    {
        Debug.Log("Set control type: Keyboard");
        curControlType = controlType.KEYBOARD;

        player_left  = KeyCode.A;
        player_right = KeyCode.D;
        player_up    = KeyCode.W;
        player_down  = KeyCode.S;

        player_attack1 = KeyCode.J;
        player_attack2 = KeyCode.K;
        player_jump    = KeyCode.I;
        player_dodge   = KeyCode.L;
    }
Exemplo n.º 5
0
        /// <summary>
        /// 第二种使用方法
        /// </summary>
        /// <param name="lstData1">折叠控件第一层的集合</param>
        /// <param name="lstData2">折叠控件第二层的集合</param>
        /// <param name="lstData3">折叠控件第三层的集合</param>
        /// <param name="dicRelateKey1">第一二层之间对应主外键</param>
        /// <param name="dicRelateKey2">第二三层之间对应主外键</param>
        /// <param name="eControlType">枚举类型</param>
        public MasterControl(object lstData1, object lstData2,
                             object lstData3, Dictionary <string, string> dicRelateKey1,
                             Dictionary <string, string> dicRelateKey2, controlType eControlType)
        {
            var oDataSet = new DataSet();

            try
            {
                var oTable1 = new DataTable();
                oTable1           = Fill(lstData1);
                oTable1.TableName = "T1";

                var oTable2 = Fill(lstData2);
                oTable2.TableName = "T2";

                if (lstData3 == null || dicRelateKey2 == null || dicRelateKey2.Keys.Count <= 0)
                {
                    oDataSet.Tables.AddRange(new DataTable[] { oTable1, oTable2 });
                    oDataSet.Relations.Add("1", oDataSet.Tables["T1"].Columns[dicRelateKey1.Keys.FirstOrDefault()], oDataSet.Tables["T2"].Columns[dicRelateKey1.Values.FirstOrDefault()]);
                }
                else
                {
                    var oTable3 = Fill(lstData3);
                    oTable3.TableName = "T3";

                    oDataSet.Tables.AddRange(new DataTable[] { oTable1, oTable2, oTable3 });
                    //这是对应关系的时候主键必须唯一
                    oDataSet.Relations.Add("1", oDataSet.Tables["T1"].Columns[dicRelateKey1.Keys.FirstOrDefault()], oDataSet.Tables["T2"].Columns[dicRelateKey1.Values.FirstOrDefault()]);
                    oDataSet.Relations.Add("2", oDataSet.Tables["T2"].Columns[dicRelateKey2.Keys.FirstOrDefault()], oDataSet.Tables["T3"].Columns[dicRelateKey2.Values.FirstOrDefault()]);
                }
            }
            catch
            {
                oDataSet = new DataSet();
            }
            SetMasterControl(oDataSet, eControlType);
        }
Exemplo n.º 6
0
 Input(
     controlType: ControlType.Button,
Exemplo n.º 7
0
 void UpdateP4ControlType()
 {
     if (p4I == 0)
         p4Type = controlType.Keyboard;
     if (p4I == 2)
         p4Type = controlType.Gamepad1;
     if (p4I == 3)
         p4Type = controlType.Gamepad2;
     if (p4I == 4)
         p4Type = controlType.Gamepad3;
     if (p4I == 5)
         p4Type = controlType.Gamepad4;
     updateNames ();
 }
Exemplo n.º 8
0
 void UpdateP3ControlType()
 {
     if (p3I == 0)
         p3Type = controlType.Keyboard;
     if (p3I == 1)
         p3Type = controlType.Gamepad1;
     if (p3I == 2)
         p3Type = controlType.Gamepad2;
     if (p3I == 3)
         p3Type = controlType.Gamepad3;
     if (p3I == 4)
         p3Type = controlType.Gamepad4;
     updateNames ();
 }
Exemplo n.º 9
0
 /// <summary>
 /// 通过传递过来的枚举判断是两级还是三级展开,表的对应关系通过Relations来读取
 /// 所以调用此构造函数的时候必须要讲Relations设置正确,才能正确显示层级关系。
 ///  oDataSet.Relations.Add("1", oDataSet.Tables["T1"].Columns["Menu_ID"], oDataSet.Tables["T2"].Columns["Menu_ID"]);
 ///  oDataSet.Relations.Add("2", oDataSet.Tables["T2"].Columns["Menu_Name2"], oDataSet.Tables["T3"].Columns["Menu_Name2"]);
 ///  这两次Add的顺序不能颠倒,必须先添加一、二级的表关联,再添加二、三级的表关联
 /// </summary>
 /// <param name="cDataset">数据源DataSet,里面还有各个表的对应关系</param>
 /// <param name="eControlType">枚举类型</param>
 public MasterControl(DataSet cDataset, controlType eControlType)
 {
     SetMasterControl(cDataset, eControlType);
 }
Exemplo n.º 10
0
 internal void startTileSelect(tileSelectFunction tsf)
 {
     previousType = currentType;
     currentType  = controlType.TileSelect;
     this.tsf     = tsf;
 }