public bool Get_Exists_Main(ComEntity currentNode) { bool is_Exists_main = false; DeaEntity _deaNode = new DeaEntity(); ComEntity _comNodes = new ComEntity(); _comNodes = (ComEntity)currentNode; _deaNode = (DeaEntity)_comNodes.Parent; foreach (var item in _deaNode.Children) { if (item.IS_MAIN) { is_Exists_main = true; } } return(is_Exists_main); }
public Window_DeviceSet(DeviceEntity deviceNode) { InitializeComponent(); _deviceNode = deviceNode; _comNode = _deviceNode.Parent as ComEntity; /// <summary> /// 设置站号列表 /// </summary> ComboBoxItem item = new ComboBoxItem(); item.Content = _deviceNode.SITE_NUMBER; cob_site_number.Items.Add(item); cob_site_number.SelectedIndex = 0; /// <summary> /// 设置协议列表 /// </summary> ComboBoxItem item1 = new ComboBoxItem(); item1.Content = _deviceNode.PROTOCOL; cob_protocol.Items.Add(item1); cob_protocol.SelectedIndex = 0; if (_comNode.IS_MAIN) { check_copyNum.IsEnabled = false; group_box_add.IsEnabled = false; } else { if (_deviceNode.CURRENT_STAT != BaseEntity.CurrentOpCType.Modify) { check_copyNum.IsEnabled = true; } else { check_copyNum.IsEnabled = false; } group_box_add.IsEnabled = true; } //根据协议内容,填充设备列表 InitDeviceInfoList(_deviceNode.PROTOCOL); }
public ComEntityFlip(ComEntity comEntity) : base(comEntity) { }
public ComEntityChangeColor(ComEntity comEntity, string newColor) : base(comEntity) { color = newColor; }
public ComEntityAttack(ComEntity comEntity) : base(comEntity) { }
public void DoJoinGame(object[] args) { string userName = (string)args[0]; string displayName = (string)args[1]; string emoteName = (string)args[2]; bool isAvatar = (bool)args[3]; string userColor = (string)args[4]; //string pathName = "./" + Utility.SAVE_DIR + "/" + Utility.TWITCH_SAVE_DIR + "/" + userName + JsonLoader.RESOURCE_EXT; TwitchUserComEntityData userData; int dX; int dY; do { dX = FP.Random.Int(0, FP.Width); dY = FP.Random.Int(0, FP.Height); } while (FP.World.CollidePoint("ClickMap", dX, dY) != null); //if (!File.Exists(pathName)) //{ //JsonWriter.Save(userData, pathName, false); //new ComEntity() //} //else //{ // userData = JsonLoader.Load<TwitchUserComEntityData>(pathName, false); // userData.ComEmoteHead = emoteName; // userData.ComEntityPosition = new Point(dX, dY); //} ComEntity newPlayer; if (!Utility.SessionPlayers.ContainsKey(userName)) { userData = new TwitchUserComEntityData { TwitchUserName = userName, TwitchDisplayName = displayName, TwitchUserColor = string.IsNullOrWhiteSpace(userColor) ? String.Format("{0:X6}", FP.Random.Int(16777216)) : userColor, ComEmoteHead = emoteName, ComEmoteHeadIsAvatar = isAvatar, ComEntityName = ChooseBody(), ComEntityPosition = new Point(dX, dY), CommandQueue = new Queue <ComEntityCommand>() }; newPlayer = new ComEntity(userData); Utility.SessionPlayers.Add(userName, newPlayer); } else { newPlayer = Utility.SessionPlayers[userName]; newPlayer.ChangeHead(emoteName, isAvatar); newPlayer.TwitchUserComEntityData.ComEntityPosition = new Point(dX, dY); newPlayer.X = dX; newPlayer.Y = dY; } Utility.GamePlayers.Add(userName, newPlayer); Add(newPlayer); BroadcastMessage(WorldMessages.UpdateLeaderBoard); }
public ComEntityChangeHead(ComEntity comEntity, string headToChangeTo, bool isAvatar) : base(comEntity) { this.headToChangeTo = headToChangeTo; this.isAvatar = isAvatar; }
private void is_ok_Click(object sender, RoutedEventArgs e) { ComEntity _comNode = new ComEntity(); _comNode = _deviceNode.Parent as ComEntity; if (!_comNode.IS_MAIN || _comNode.ChildrenCount < 1) { if (_comNode.ChildrenCount + Convert.ToInt32(txt_copyNum.Text) < 18) { if (cob_device.SelectedItem != null) { List <ChangeDataClass> _list_chg_data = new List <ChangeDataClass>(); _deviceNode.DEVICE_ID_INFO = Convert.ToInt32(cob_device.SelectedValue); _deviceNode.DEVICE_NAME_INFO = cob_device.Text; if (_deviceNode.CURRENT_STAT != BaseEntity.CurrentOpCType.Modify) { _deviceNode.NAME = _deviceNode.NAME + " " + cob_device.Text; } //存储任务 for (int i = 0; i < 2; i++) { ChangeDataClass _chg_data_class = new ChangeDataClass(); foreach (UIElement element in this.Grid_Chg.Children) {//遍历任务控件 if (element is System.Windows.Controls.ComboBox) { if (((ComboBox)element).Name.IndexOf("chg_device_add_" + i) > 0) { _chg_data_class._divece_Add = ((ComboBox)element).Text; } if (((ComboBox)element).Name.IndexOf("chg_device_direction_" + i) > 0) { _chg_data_class._chg_Type = (string)((ComboBox)element).SelectedValue; } if (((ComboBox)element).Name.IndexOf("chg_plc_add_" + i) > 0) { _chg_data_class._plc_Add = ((ComboBox)element).Text; } } } _list_chg_data.Add(_chg_data_class); } _deviceNode.CHG_DATA_ARRY = _list_chg_data; if (_comNode.IS_MAIN) { (_comNode.Parent as DeaEntity).MAIN_DEVICE_ID = _device_id; } if (txt_copyNum.Text != null && check_copyNum.IsChecked == true) { this.COPY_NUM = Convert.ToInt32(txt_copyNum.Text); } this.Close(); } else { MessageBox.Show("设备信息不完整!", "提示"); } } else { MessageBox.Show("同一个COM口下最多只能设置18台设备!", "提示"); } } else { MessageBox.Show("一个主站COM端口只能设置一台设备!", "提示"); } }
public ComEntitySpin(ComEntity comEntity) : base(comEntity) { }
public ComEntityMoveD(ComEntity comEntity, Point moveDelta, bool moveWithDeathInMind, string moverUserName = null) : base(comEntity, moveDelta, moveWithDeathInMind, moverUserName) { }
public Window_ComSet(ComEntity comNode) { InitializeComponent(); _comNode = comNode; is_main = _comNode.IS_MAIN; List <DEA3.Data.GetInfoService.ProductInfo> _p_list = new List <DEA3.Data.GetInfoService.ProductInfo>(); List <string> _result = new List <string>(); Dictionary <int, String> a = new Dictionary <int, string>(); ComboBoxItem item = new ComboBoxItem(); item.Content = _comNode.NAME; grid_com_name.Items.Add(item); grid_com_name.SelectedIndex = 0; if (_comNode.CURRENT_STAT == CurrentOpCType.Modify) { grid_fault_site.Text = _comNode.SITE_ADD; grid_fault_stop.Text = _comNode.STOP_ADD; grid_spd.SelectedIndex = getDeviceInfo.GetSpdList().IndexOf(_comNode.SPD.ToString()); //_comNode.SPD.ToString(); grid_bit.SelectedIndex = getDeviceInfo.GetBitList().IndexOf(_comNode.BIT.ToString()); //_comNode.BIT.ToString(); grid_sync_bit.SelectedIndex = getDeviceInfo.GetSyncBitList().Keys.ToList <int>().IndexOf(_comNode.SYNC_BIT); //_comNode.SYNC_BIT.ToString(); grid_stop_bit.SelectedIndex = getDeviceInfo.GetStopBitList().IndexOf(_comNode.STOP_BIT.ToString()); //_comNode.STOP_BIT.ToString(); //填充产品列表 DataTable _dtt2 = new DataTable(); _dtt2 = getDeviceInfo.GetProductListForDt(1); string str = ""; foreach (var _var in _dtt2.AsEnumerable()) { str += _var.Field <string>("NAME"); } //MessageBox.Show("填充产品列表TB内容:"+str); InitProdcutInfo(_dtt2); //MessageBox.Show("grid_protocol:"+_dt.Rows.Count); List <string> _list1 = new List <string>(); if (is_main) { foreach (var i in _dtt2.AsEnumerable()) { if (i.Field <int>("IS_MAIN") == 1) { _list1.Add(i.Field <string>("NAME")); } } } else { foreach (var i in _dtt2.AsEnumerable()) { if (i.Field <int>("IS_MAIN") != 1) { _list1.Add(i.Field <string>("NAME")); } } } grid_protocol.SelectedIndex = _list1.IndexOf(_comNode.PRODUCTNAME); //MessageBox.Show("product_Id:"+grid_protocol.SelectedValue.ToString()); //MessageBox.Show(((ComboBoxItem)grid_protocol.SelectedItem).Content.ToString()); _list1.Clear(); ////填充协议列表 DataTable _dtt3 = new DataTable(); int _i = Convert.ToInt32(grid_protocol.SelectedValue); _dtt3 = getDeviceInfo.GetProductProtocolList(1); //MessageBox.Show("grid_protocol_device:" + _dt.Rows.Count); this.grid_protocol_device.ItemsSource = from dr in _dtt3.AsEnumerable() where dr.Field <int>("PRODUCT_ID") == _i select new ProtocolClass() { ID = int.Parse(dr["ID"].ToString()), PRODUCT_ID = int.Parse(dr["PRODUCT_ID"].ToString()), NAME = dr["NAME"].ToString() }; foreach (var i in _dtt3.AsEnumerable()) { if (i.Field <int>("PRODUCT_ID") == _i) { _list1.Add(i.Field <string>("NAME")); } } grid_protocol_device.SelectedIndex = _list1.IndexOf(_comNode.PROTOCOL); _list1.Clear(); //grid_protocol_device.SelectedValue = _comNode.PROTOCOL_ID; //MessageBox.Show("grid_protocol_device_id:" + grid_protocol_device.SelectedValue.ToString()); if (_comNode.IS_MAIN) { grid_is_main.SelectedIndex = 0; } } }
public ComEntityLoop(ComEntity comEntity, List <Command> commands, string[] args) : base(comEntity) { this.commands = commands; this.args = args; }