protected void Page_Load(object sender, EventArgs e) { if (Session["username"] == null) { Response.Redirect("~/Login.aspx"); } else { if (!Page.IsPostBack) { Logic lo = new Logic(); Label lb = Page.Master.FindControl("lbTitle") as Label; lb.Text = "Welcome, to Task Manager Web App"; lb.ForeColor = Color.Black; Label user = Page.Master.FindControl("lbUsername") as Label; string u = Session["username"].ToString(); Person pp = lo.GetPerson(u); user.Text = pp.Username; int pend, complete, total; TaskManagerModelContainer db = new TaskManagerModelContainer(); pend = lo.GetAllPendingTasks(pp.Id).Count; complete = lo.GetAllCompletedTasks(pp.Id).Count; total = lo.GetAllTasks(pp.Id).Count; Label1.Text = pend.ToString() + " Task(s) Pending"; Label2.Text = complete.ToString() + " Task(s) Completed"; Label3.Text = total.ToString() + " Task(s) in Total"; } } }
public Spel(Logic.Spel logicSpel, IView game, Dictionary<Logic.Speler, ISpeler> spelers) { _logicSpel = logicSpel; _random = _logicSpel.Random; _game = game; _spelers = spelers; }
public HomeMovieItem(Logic.Models.Movie movie) { this.Image = new BitmapImage(new Uri(movie.MediumCoverImage)); this.Name = movie.Title; this.Year = movie.Year; this.Id = movie.Id; }
public ItemIcon(UIElement parent, Vector2 position, Logic.ICollectible item) : base(parent, position, new Vector2(32, 32), item != null ? item.Texture : null) { oldPos = position; _item = item; backgroundPanel = new Panel(this, new Vector2(-2, -2), new Vector2(40, 40), Content.ContentInterface.LoadTexture("UITest")); }
private Droid(Guid id, Pose pose, Guid inventoryID, Logic logic) : base(id) { _pose = pose; _inventoryID = inventoryID; _logic = logic; }
internal void Initialize(Logic.OCR.NOcrDb _nOcrDb) { if (_nOcrDb != null) { } }
public void Load() { try { TaskManagerModelContainer db = new TaskManagerModelContainer(); Logic lo = new Logic(); Pendin p = new Pendin(); List<Taskk> ts = lo.GetAllTasks(1); List<Pendin> pen = new List<Pendin>(); List<string> fr = new List<string>(); for (int i = 0; i < ts.Count; i++) { fr.Add(ts[i].Title); } drpTitles.DataSource = fr; drpTitles.DataBind(); } catch { Label lb = new Label(); lb.Text = "Loading Failed. Please Try Again"; Panel1.CssClass = "divError"; icon.CssClass = "img"; icon.ImageUrl = "~/assets/icons/error3.png"; icon.Visible = true; PlaceHolder1.Controls.Add(lb); } }
public static void UpdateInfo(Logic.Player player) { if (!_clientInfos.ContainsKey(player.Name)) _clientInfos.Add(player.Name, new ClientInfo(player)); else _clientInfos[player.Name].UpdateInfo(player); }
public BoardUI(Logic.Board board, double width, double height, double x, double y) : base((int)width, (int)height, (int)x, (int)y) { Width = (int)width; Height = (int)height; Board = board; }
internal void Initialize(Logic.Networking.NikseWebServiceSession _networkSession) { textBoxSessionKey.Text = _networkSession.SessionId; textBoxUserName.Text = _networkSession.CurrentUser.UserName; textBoxWebServiceUrl.Text = _networkSession.WebServiceUrl; textBoxLog.Text = _networkSession.GetLog(); }
public GoalLogic(Data.GoalRepo goalRepository, Data.DimensionRepo dimensionRepo, Logic.TeamLogic teamLogic, System.Security.Principal.IPrincipal principal) : base(principal) { _goalRepository = goalRepository; _teamLogic = teamLogic; _dimensionRepo = dimensionRepo; }
public ProcessStopContentDialog(MainPage mainPage, Logic logic) { this.mainPage = mainPage; this.logic = logic; this.InitializeComponent(); }
public ApiMetaData(Logic.MetaData metaData) { Title = metaData.Title; Description = metaData.Description; Keywords = metaData.Keywords; ExtendedMetaTags = metaData.ExtendedMetaTags.ToArray(); }
public void Move(Logic.EventArgs args) { //TODO ADD MOVE LOGIC MoveButtonPressedEventArgs inargs = (MoveButtonPressedEventArgs)args; MoveEventArgs eventargs = new MoveEventArgs (); LogicRunner<Events>.GetInstance ().TriggerEvent (Events.PlayerMove, eventargs); }
public Program() { mServiceManager = new ServiceManager(); mDeviceManager = new DeviceManager(); string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\Automation"; Settings settings = new Settings(path, "settings.xml"); var config = settings.GetConfig(); if (config.ContainsKey("port")) mPort = UInt16.Parse(config["port"]); CreateSystemService(); // Create services var serviceConfigs = settings.GetServiceConfigs(); CreateServices(serviceConfigs); // Create devices var deviceConfigs = settings.GetDeviceConfigs(); CreateDevices(deviceConfigs); Log.Info("Number of services: " + mServiceManager.Services.Count); Log.Info("Number of devices: " + mDeviceManager.Devices.Count); mLogic = new Logic(mDeviceManager, mServiceManager); InitSpeechCommands(); // createStatusWindow startWebEndpoint(); StartUIThread(); }
public static Logic Singleton() { if(_singleton == null) _singleton = Transform.FindObjectOfType<Logic>(); return _singleton; }
internal void Initialize(Logic.Subtitle subtitle, int firstSelectedIndex) { StringBuilder sb = new StringBuilder(); foreach (Paragraph p in subtitle.Paragraphs) sb.AppendLine(p.Text); string watermark = ReadWaterMark(sb.ToString().Trim()); LabelWatermark.Text = string.Format("Watermark: {0}", watermark); if (watermark.Length == 0) { buttonRemove.Enabled = false; textBoxWatermark.Focus(); } else { groupBoxGenerate.Enabled = false; buttonOK.Focus(); } _firstSelectedIndex = firstSelectedIndex; Paragraph current = subtitle.GetParagraphOrDefault(_firstSelectedIndex); if (current != null) radioButtonCurrentLine.Text = radioButtonCurrentLine.Text + " " + current.Text.Replace(Environment.NewLine, Configuration.Settings.General.ListViewLineSeparatorString); else radioButtonCurrentLine.Enabled = false; }
internal void Initialize(Logic.Subtitle subtitle, string fileName) { _subtitle = subtitle; _fileName = fileName; textBoxText.ReadOnly = true; comboBoxTimeCodeSeperator.SelectedIndex = 0; GeneratePreview(); comboBoxEncoding.Items.Clear(); int encodingSelectedIndex = 0; comboBoxEncoding.Items.Add(Encoding.UTF8.EncodingName); foreach (EncodingInfo ei in Encoding.GetEncodings()) { if (ei.Name != Encoding.UTF8.BodyName) { if (ei.Name != Encoding.UTF8.BodyName && ei.CodePage >= 949 && !ei.DisplayName.Contains("EBCDIC") && ei.CodePage != 1047) { comboBoxEncoding.Items.Add(ei.CodePage + ": " + ei.DisplayName); if (ei.Name == Configuration.Settings.General.DefaultEncoding) encodingSelectedIndex = comboBoxEncoding.Items.Count - 1; } } } comboBoxEncoding.SelectedIndex = encodingSelectedIndex; }
public LogicPanel(Logic aLogic) { mLogic = aLogic; InitializeComponent(); BackColor = SystemColors.Control; comboBox_Operator.Items.AddRange(Logic.Operators); }
public Pion(Logic.Pion pion) { Stuk = pion; InitializeComponent(); //Icon.Content = pion.Speler.Name; Icon.Fill = new SolidColorBrush(pion.Speler.Kleur); BorderBrush = new SolidColorBrush(Color.FromRgb(111, 0, 111)); }
/// <summary> /// BoardUI setup. Details in the param descriptions. /// </summary> /// <param name="board">Used to calculate the width of the BoardUI</param> /// <param name="width">This is the space permitted for this board to take up</param> /// <param name="height">Same as width but for this dimension</param> /// <param name="x">The x coord for the top left location of this view on the screen</param> /// <param name="y">The same as x but for the vertical location</param> public BoardUI(Logic.Board board, double width, double height, double x, double y) : base((int)width, (int)height, (int)x, (int)y) { Width = (int)width+1; Height = (int)height; Board = board; this.squareSize = (int)Math.Min(Width/board.Width, Height/board.Height); }
public override void ApplyOnSkip(Logic.Battles.ICreaturesInBattle skipCreature) { if (skipCreature == null) { throw new ArgumentNullException("skipCreature"); } skipCreature.PermanentAttack += this.attackToAdd; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Logic lo = new Logic(); Label lb = Page.Master.FindControl("lbTitle") as Label; lb.Text = "Task Manager Web App"; lb.ForeColor = Color.Black; } }
public override void AddCard(Logic.Cards.Card card) { base.AddCard(card); Console.SetCursorPosition(this.col, this.row); foreach (var item in this.cards) { Console.Write("{0} " , item.ToString()); } Thread.Sleep(150); }
public static bool IsOnCity(Logic.Tower tower) { bool onCity = false; Rectangle towerBox = new Rectangle((int)tower.Position.X, (int)tower.Position.Y, tower.Texture.Width, tower.Texture.Height); if (City.Intersects(towerBox)) { onCity = true; } return onCity; }
private void button_Click(object sender, RoutedEventArgs e) { Logic core = new Logic(); core.DI(); Dictionary<IFactor, int> configFactors = new Dictionary<IFactor, int>(); //Значения берутся откуда-то с формы configFactors.Add(core.Factors[0], 50); core.ConfigFactors(configFactors); core.Start(); }
internal void Initialize(Logic.TransportStream.TransportStreamParser tsParser, string fileName) { _tsParser = tsParser; Text = string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.Title, fileName); foreach (int id in tsParser.SubtitlePacketIds) { listBoxTracks.Items.Add(string.Format(Configuration.Settings.Language.TransportStreamSubtitleChooser.PidLine, id, tsParser.GetDvbSubtitles(id).Count)); } listBoxTracks.SelectedIndex = 0; }
public static string GetWordFromPointer(TextPointer pointer, Logic.TextInLanguage textInLanguage) { string word; int firstIndex; int lastIndex; bool inWord = GetWordFromPointer(pointer, textInLanguage, out word, out firstIndex, out lastIndex); if (inWord) return word; else return null; }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } Setup(); }
internal void Initialize(Logic.Networking.NikseWebServiceSession networkSession) { _networkSession = networkSession; textBoxSessionKey.Text = Configuration.Settings.NetworkSettings.SessionKey; if (textBoxSessionKey.Text.Trim().Length < 2) textBoxSessionKey.Text = Guid.NewGuid().ToString().Replace("-", string.Empty); comboBoxWebServiceUrl.Text = Configuration.Settings.NetworkSettings.WebServiceUrl; textBoxUserName.Text = Configuration.Settings.NetworkSettings.UserName; if (textBoxUserName.Text.Trim().Length < 2) textBoxUserName.Text = Dns.GetHostName(); }
public void Do(Db db) { bool dispose = false; if (db == null) { db = new Db("DATA"); dispose = true; } #if (SERVER) db._db_internal.CallServer = (byte[] f) => { return(SocketTesting.CallServer(f)); }; #endif #if (SOCKETS) db._db_internal.CallServer = (byte[] f) => { return(SocketTesting.CallServer(f, db)); }; #endif #if (SOCKETS || SAMEDB || INDEXES || SERVER) db.Table <SomeData>().Delete(new HashSet <int>(db.Table <SomeData>().Select(f => new { f.Id }).Select(f => f.Id).ToList())); #endif try { db.Table <SomeData>().Search(f => f.NotSearchable, "test").SelectEntity(); throw new Exception("Assert failure"); } catch (Exception ex) { if (!ex.Message.Contains("only string properties named ...Search")) { throw new Exception("Assert failure"); } } try { db.Table <SomeData>().SearchPartial(f => f.NotSearchable, "test").SelectEntity(); throw new Exception("Assert failure"); } catch (Exception ex) { if (!ex.Message.Contains("only string properties named ...Search")) { throw new Exception("Assert failure"); } } #if (SERVER || SOCKETS) if (dispose) { Logic.Dispose(); } #else if (dispose) { db.Dispose(); } #endif #if (!SOCKETS && !SAMEDB && !INDEXES && !SERVER) if (dispose) { ServerSharedData.SharedUtils.DeleteFilesAndFoldersRecursively("DATA"); } #endif }
void Start() { logic = _object.GetComponent <Logic>(); }
/// <summary> /// TBD /// </summary> /// <param name="inheritedAttributes">TBD</param> /// <returns>TBD</returns> public override ILogicAndMaterializedValue <Task <TIn> > CreateLogicAndMaterializedValue(Attributes inheritedAttributes) { var logic = new Logic(this); return(new LogicAndMaterializedValue <Task <TIn> >(logic, logic.Task)); }
//第二次摇色子消息 void IMGameView.OnSiceTwo() { nextState = Logic.turn_dice; //摇色子 StartCoroutine(LogicCprocessor()); }
/// <summary> /// Implements the ability to handle a logic passed through the system. /// </summary> /// <param name="logic">The logic to be processed.</param> /// <returns>A LogicResult that describes the result..</returns> public async Task <LogicResult> Logic(Logic logic) { return(LogicResult.Unprovided); }
public object Get(GetMdcAttachmentFileWhere request) => WithDb(db => Logic.GetSingleWhere(request.Property, request.Value));
public object Get(GetAllMdcAttachmentFiles request) => WithDb(db => Logic.GetAll());
private async Task Handle_LeaveLobby(IConnection connection, Message message) { await Logic.LeaveLobby(Data.Connections[connection.Id]); }
private Task Handle_ConfirmUpdate(IConnection connection, Message message) { return(Logic.ConfirmPendingUpdate(Data.Connections[connection.Id])); }
public void Do(Db db) { bool dispose = false; if (db == null) { db = new Db("DATA"); dispose = true; } #if (SERVER) db._db_internal.CallServer = (byte[] f) => { return(SocketTesting.CallServer(f)); }; #endif #if (SOCKETS) db._db_internal.CallServer = (byte[] f) => { return(SocketTesting.CallServer(f, db)); }; #endif #if (SOCKETS || SAMEDB || INDEXES || SERVER) db.Table <BinaryData>().Delete(new HashSet <int>(db.Table <BinaryData>().Select(f => new { f.Id }).Select(f => f.Id).ToList())); db.Table <SomeData>().Delete(new HashSet <int>(db.Table <SomeData>().Select(f => new { f.Id }).Select(f => f.Id).ToList())); #endif var job1 = new ParallelWorkload(); var job2 = new ParallelWorkload2(); var t1 = Task.Run(() => { try { job1.Do2(db); } catch (Exception e) { ParallelWorkload3.errors++; } }); var t2 = Task.Run(() => { try { job2.Do2(db); } catch (Exception e) { ParallelWorkload3.errors++; } }); t1.Wait(); t2.Wait(); if (ParallelWorkload3.errors > 0) { throw new Exception("Assert failure"); } #if (SERVER || SOCKETS) if (dispose) { Logic.Dispose(); } #else if (dispose) { db.Dispose(); } #endif #if (!SOCKETS && !SAMEDB && !INDEXES && !SERVER) if (dispose) { ServerSharedData.SharedUtils.DeleteFilesAndFoldersRecursively("DATA"); } #endif }
protected void Page_Load(object sender, EventArgs e) { string check; check = Convert.ToString(Session["loginAdmin"]); if (check != "admin") { Response.Redirect("~/Login.aspx"); } int Id = Convert.ToInt32(Request.QueryString["EventId"]); EventsModel eventList = Logic.ListViewEvents(Id); lblTitle.Text = eventList.Title; lblDiscription.Text = eventList.Discription; lblEventDate.Text = Convert.ToString(eventList.EventDate); lblPostedby.Text = eventList.PosterName; ImageEvent.ImageUrl = eventList.ImageLink; //////////////////////////////////// List <EventsModel> list = Logic.ListEventsComments(Id); if (list.Count > 0) { this.Panel1.Controls.Clear(); lblCommentTitle.Text = list.Count + " Comments: "; Label[] labelName = new Label[list.Count]; Label[] labelComment = new Label[list.Count]; Label[] labelString = new Label[list.Count]; Label[] labelString2 = new Label[list.Count]; Label[] labelStringLine = new Label[list.Count]; Label[] labelStringSpace = new Label[list.Count]; for (int i = 0; i < list.Count; i++) { labelName[i] = new Label(); labelName[i].Text = list[i].Name; labelComment[i] = new Label(); labelComment[i].Text = list[i].Comment; // Here you can modify the value of the label which is at labels[i] } for (int i = 0; i < list.Count; i++) { labelString[i] = new Label(); labelString[i].Text = "<br/>"; labelString2[i] = new Label(); labelString2[i].Text = "<br/>"; labelStringSpace[i] = new Label(); labelStringSpace[i].Text = " "; labelStringLine[i] = new Label(); labelStringLine[i].Text = "<hr> <br/>"; labelName[i].Font.Bold = true; this.Panel1.Controls.Add(labelName[i]); this.Panel1.Controls.Add(labelString[i]); this.Panel1.Controls.Add(labelStringSpace[i]); this.Panel1.Controls.Add(labelComment[i]); this.Panel1.Controls.Add(labelString2[i]); this.Panel1.Controls.Add(labelStringLine[i]); } } else { lblCommentTitle.Text = "There are No Comments"; } }
public override ILogicAndMaterializedValue <ISourceQueue <TOut> > CreateLogicAndMaterializedValue(Attributes inheritedAttributes) { var logic = new Logic(this); return(new LogicAndMaterializedValue <ISourceQueue <TOut> >(logic, new Materialized(this, t => logic.Invoke(t)))); }
public void Do(Db db) { bool dispose = false; if (db == null) { db = new Db("DATA"); dispose = true; } #if (SERVER) db._db_internal.CallServer = (byte[] f) => { return(SocketTesting.CallServer(f)); }; #endif #if (SOCKETS) db._db_internal.CallServer = (byte[] f) => { return(SocketTesting.CallServer(f, db)); }; #endif #if (SOCKETS || SAMEDB || INDEXES || SERVER) db.Table <SomeData>().Delete(new HashSet <int>(db.Table <SomeData>().Select(f => new { f.Id }).Select(f => f.Id).ToList())); #endif var d = new SomeData() { Id = 1, Normalized = 1.2, PeriodId = 5 }; db.Table <SomeData>().Save(d);; d = new SomeData() { Id = 2, Normalized = 2.3, PeriodId = 10 }; db.Table <SomeData>().Save(d);; d = new SomeData() { Id = 3, Normalized = 4.5, PeriodId = 15 }; db.Table <SomeData>().Save(d);; var res = db.Table <SomeData>() .Where(f => f.Normalized < 3) .Select(f => new { PeriodId = f.PeriodId }); if (res.Count() != 2) { throw new Exception("Assert failure"); } #if (SERVER || SOCKETS) if (dispose) { if (dispose) { Logic.Dispose(); } } #else if (dispose) { if (dispose) { db.Dispose(); } } #endif #if (!SOCKETS && !SAMEDB && !INDEXES && !SERVER) if (dispose) { if (dispose) { ServerSharedData.SharedUtils.DeleteFilesAndFoldersRecursively("DATA"); } } #endif }
public static void CreateSources() { int scancount = 1; if (Scanning == 1) { scancount = 0; int pointsThetaCount = Convert.ToInt32((ThetaScanEFinish - ThetaScanEStart) / ThetaScanEStep) + 1; int pointsPhiCount = Convert.ToInt32((PhiScanEFinish - PhiScanEStart) / PhiScanEStep) + 1; for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++) { for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++) { scancount++; } } } else if (Scanning == 2) { scancount = 0; int pointsThetaCount = 1; int pointsPhiCount = 1; if (Axis1Include) { pointsThetaCount = Convert.ToInt32((ThetaScanMFinish - ThetaScanMStart) / ThetaScanMStep) + 1; } if (Axis2Include) { pointsPhiCount = Convert.ToInt32((PhiScanMFinish - PhiScanMStart) / PhiScanMStep) + 1; } for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++) { for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++) { scancount++; } } } int polcount = 0; foreach (var item in Polarization) { if (item.Value) { polcount++; } } int countSorces = scancount * polcount; Sources = new SourceTemplate2[countSorces]; int indexSources = 0; if (Scanning == 0) { foreach (var pol in Polarization) { if (pol.Value) { int key = DictionaryLibrary.PolarizationNames.FirstOrDefault(x => x.Value == pol.Key).Key; string sourceName = String.Concat(Lable, "_", DictionaryLibrary.PolarizationNamesShort[key]); Sources[indexSources] = new SourceTemplate2(sourceName, pol.Key, Distribution, DifferenceChanel, DifferenceAxis, Scanning, 0, 0, false, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 0, 0, 0, 0, I0[key], M0[key]); indexSources++; } } } else if (Scanning == 1) { int pointsThetaCount = Convert.ToInt32((ThetaScanEFinish - ThetaScanEStart) / ThetaScanEStep) + 1; int pointsPhiCount = Convert.ToInt32((PhiScanEFinish - PhiScanEStart) / PhiScanEStep) + 1; int index = 0; foreach (var pol in Polarization) { if (pol.Value) { int key = DictionaryLibrary.PolarizationNames.FirstOrDefault(x => x.Value == pol.Key).Key; for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++) { for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++) { double scanThetaLocal = ThetaScanEStart + iTheta * ThetaScanEStep; double scanPhiLocal = PhiScanEStart + iPhi * PhiScanEStep; string sourceName = String.Concat(Lable, "_E", "_T", scanThetaLocal.ToString("0.##"), "_P", scanPhiLocal.ToString("0.##"), "_", DictionaryLibrary.PolarizationNamesShort[key]); double scanTheta = Logic.GetThetaGlobal(scanPhiLocal, scanThetaLocal, SystemOfCoordinatesScan); double scanPhi = Logic.GetPhiGlobal(scanPhiLocal, scanThetaLocal, SystemOfCoordinatesScan); Sources[index] = new SourceTemplate2(sourceName, pol.Key, Distribution, DifferenceChanel, DifferenceAxis, Scanning, scanTheta, scanPhi, false, 0, 0, 0, 0, 0, 0, false, 0, 0, 0, 0, 0, 0, 0, 0, I0[key], M0[key]); index++; } } } } } else if (Scanning == 2) { //Механическое сканирование int pointsThetaCount = Convert.ToInt32((ThetaScanMFinish - ThetaScanMStart) / ThetaScanMStep) + 1; int pointsPhiCount = Convert.ToInt32((PhiScanMFinish - PhiScanMStart) / PhiScanMStep) + 1; if (!Axis1Include) { pointsThetaCount = 1; ThetaScanMStart = 0; } if (!Axis2Include) { pointsPhiCount = 1; PhiScanMStart = 0; } int index = 0; foreach (var pol in Polarization) { if (pol.Value) { int key = DictionaryLibrary.PolarizationNames.FirstOrDefault(x => x.Value == pol.Key).Key; for (int iTheta = 0; iTheta < pointsThetaCount; iTheta++) { for (int iPhi = 0; iPhi < pointsPhiCount; iPhi++) { double scanThetaLocal = ThetaScanMStart + iTheta * ThetaScanMStep; double scanPhiLocal = PhiScanMStart + iPhi * PhiScanMStep; string sourceName = String.Concat(Lable, "_M", "_T", scanThetaLocal.ToString("0.##"), "_P", scanPhiLocal.ToString("0.##"), "_", DictionaryLibrary.PolarizationNamesShort[key]); Sources[index] = new SourceTemplate2(sourceName, pol.Key, Distribution, DifferenceChanel, DifferenceAxis, Scanning, 0, 0, Axis1Include, Axis1x1, Axis1y1, Axis1z1, Axis1x2, Axis1y2, Axis1z2, Axis2Include, Axis2x1, Axis2y1, Axis2z1, Axis2x2, Axis2y2, Axis2z2, scanThetaLocal, scanPhiLocal, I0[key], M0[key]); index++; } } } } } }
public void Do(Db db) { bool dispose = false; if (db == null) { db = new Db("DATA"); dispose = true; } #if (SERVER) db._db_internal.CallServer = (byte[] f) => { return(SocketTesting.CallServer(f)); }; #endif #if (SOCKETS) db._db_internal.CallServer = (byte[] f) => { return(SocketTesting.CallServer(f, db)); }; #endif #if (SOCKETS || SAMEDB || INDEXES || SERVER) db.Table <BinaryData>().Delete(new HashSet <int>(db.Table <BinaryData>().Select(f => new { f.Id }).Select(f => f.Id).ToList())); #endif var d = new BinaryData() { Id = 2, Data = new List <byte>() { 4, 5, 6 }.ToArray() }; db.Table <BinaryData>().Save(d); var res = db.Table <BinaryData>() .Select(f => new { Id = f.Id, MyData = f.Data }); if (res.Count() != 1 || res[0].MyData.Length != 3 || res[0].MyData[0] != (byte)4) { throw new Exception("Assert failure"); } db.Table <BinaryData>().Update(f => f.Data, new Dictionary <int, byte[]>() { { 2, (new List <byte>() { 1, 2, 3 }).ToArray() } }); res = db.Table <BinaryData>() .Select(f => new { Id = f.Id, MyData = f.Data }); if (res.Count() != 1 || res[0].MyData.Length != 3 || res[0].MyData[0] != (byte)1) { throw new Exception("Assert failure"); } #if (SERVER || SOCKETS) if (dispose) { Logic.Dispose(); } #else if (dispose) { db.Dispose(); } #endif #if (!SOCKETS && !SAMEDB && !INDEXES && !SERVER) if (dispose) { ServerSharedData.SharedUtils.DeleteFilesAndFoldersRecursively("DATA"); } #endif }
private Task Handle_Ready(IConnection connection, Message message) { var lc = Data.Connections[connection.Id]; return(Logic.SetConnectionReady(lc, !lc.Ready)); }
public object Get(CurrentDataToDBSeedMdcAttachmentFiles request) { WithDb(db => Logic.CurrentDataToDBSeed()); return(new CommonResponse().Success()); }
///<summary>ctor</summary> ///<param name="chain">The chain of filters</param> ///<param name="logic">Logical operation to apply to ALL filters</param> public ChainedFilter(Filter[] chain, Logic logic) { this.chain = chain; this.logic = logic; }
public object Get(GetMdcAttachmentFileById request) => WithDb(db => Logic.GetById(request.Id));
private void DoChain(OpenBitSetDISI result, Logic logic, DocIdSet dis) { if (dis is OpenBitSet) { // optimized case for OpenBitSets switch (logic) { case Logic.OR: result.Or((OpenBitSet)dis); break; case Logic.AND: result.And((OpenBitSet)dis); break; case Logic.ANDNOT: result.AndNot((OpenBitSet)dis); break; case Logic.XOR: result.Xor((OpenBitSet)dis); break; default: DoChain(result, DEFAULT, dis); break; } } else { DocIdSetIterator disi; if (dis == null) { disi = DocIdSet.EMPTY_DOCIDSET.Iterator(); } else { disi = dis.Iterator(); if (disi == null) { disi = DocIdSet.EMPTY_DOCIDSET.Iterator(); } } switch (logic) { case Logic.OR: result.InPlaceOr(disi); break; case Logic.AND: result.InPlaceAnd(disi); break; case Logic.ANDNOT: result.InPlaceNot(disi); break; case Logic.XOR: result.InPlaceXor(disi); break; default: DoChain(result, DEFAULT, dis); break; } } }
//玩家操作 void IMGameView.OnUserAction(int userID, UserAction action, params List <int>[] arg) { switch (action) { //发牌标志 case UserAction.send_card_flag: //获取手牌 this.handCard = arg[0]; nextState = Logic.add_hand_card; StartCoroutine(LogicCprocessor()); break; //摸牌 case UserAction.get_card: gameTig.Clear(); //摸牌 this.handleCard = arg[0][0]; //如果长度大于1则有后序操作 if (arg[1].Count > 1) { for (int i = 1; i < arg[1].Count; ++i) { gameTig.Add((PlayerAct)arg[1][i]); } } gangBuffer = new List <List <int> >(arg); //获取能杠的牌 gangBuffer.RemoveRange(0, 2); nextState = Logic.get_handlecard; StartCoroutine(LogicCprocessor(userID)); break; case UserAction.put_card: userPriority[userID].operateFlag = false; if (userID == currentUserID) { StartCoroutine(UserPutCard(userID, arg[0][0], arg[0][1])); } else { StartCoroutine(UserPutCard(userID, arg[0][0], arg[0][1], arg[0][2])); } break; case UserAction.insert_card: break; //arg[0][0]被吃玩家id arg[1].... 吃牌index //arg[1][0] arg[1][1] arg[[1]2] or arg[1][3] case UserAction.chi: case UserAction.peng: userPriority[userID].operateFlag = true; StartCoroutine(UserChiCard(userID, arg[0][0], action, arg[1], arg[2])); break; case UserAction.ming_gang: StartCoroutine(UserChiCard(userID, arg[0][0], action, arg[1], arg[2])); break; case UserAction.an_gang: StartCoroutine(UserAnGangCard(userID, arg[0][0], arg[1], arg[2])); break; case UserAction.add_gang: StartCoroutine(UserAddCangCard(userID, arg[0][0], arg[0][1], arg[0][2])); break; case UserAction.chi_hu: cardData = new List <List <int> >(arg); cardData.RemoveAt(0); StartCoroutine(UserChiHuCard(userID, arg[0][0])); break; case UserAction.hu: //要获取所有玩家的牌型 cardData = new List <List <int> >(arg); nextState = Logic.hu; StartCoroutine(LogicCprocessor()); break; case UserAction.ting: break; case UserAction.ting_cancel: break; case UserAction.trustee: break; case UserAction.AI_cancel: break; case UserAction.chi_card_flag: this.supID = arg[0][0]; vChi = true; vPass = true; chiBuffer = new List <List <int> >(arg); chiBuffer.RemoveAt(0); break; case UserAction.peng_card_flag: this.supID = arg[0][0]; vPeng = true; vPass = true; pengBuffer = arg[1]; break; case UserAction.gang_flag: this.supID = arg[0][0]; vGang = true; vPass = true; gangBuffer = new List <List <int> >(arg); gangBuffer.RemoveAt(0); break; case UserAction.chi_hu_flag: this.supID = arg[0][0]; vHu = true; break; case UserAction.ting_flag: break; //可从新开始 case UserAction.end: vReady = true; break; } }
public SubstreamHandler(Logic logic) { _logic = logic; }
//手动逻辑 IEnumerator LogicCprocessor(int userID = 0, MahjongPrefab mahjong = new MahjongPrefab()) { switch (nextState) { //掷色子 case Logic.turn_dice: previousState = nextState; nextState = Logic.empty; //显示色子 yield return(gameAct.DisplayDice()); //掷色子 yield return(gameAct.TurnDice(gameData.dice_num[0], gameData.dice_num[1])); //设置发牌起始位置 index = 2 * Mathf.Min(gameData.dice_num[0], gameData.dice_num[1]); control.EndStatusFlag(userID, UserAction.turn_dice); break; //发牌 case Logic.add_hand_card: previousState = nextState; nextState = Logic.add_hand_card_end; //2秒后色子消失 StartCoroutine(gameAct.DisapperDice(2f)); //确定取牌次序 int prio; //如果当前玩家不是庄家 if (currentUserID != 0) { prio = (gameData.dice_num[0] + gameData.dice_num[1]) % gameData.player_priority; } else { //如果是庄家则除4 prio = (gameData.dice_num[0] + gameData.dice_num[1]) % 4; } gameAct.CardDirection(prio); //临时牌 保存乱序后的手牌 List <int> cardTemp = RandCard(handCard); //每个玩家抽取三轮 for (int i = 0; i < 3; ++i) { //每轮玩家抽取四张 for (int j = 0; j < 4; ++j) { for (int k = 0; k < 4; ++k) { if (userPriority[j].handCard.IsNotFull) { yield return(gameAct.AddHandCard(userPriority[j], gameAct.group_H.GetMahjongCard(index))); } else { Debug.LogError("<MGameClient::LogicCprocessor>:玩家手牌已满." + userPriority[j].ToString()); } } //翻牌 if (j == currentUserID) { yield return(gameAct.DisplayCard(userPriority[j], cardTemp)); } else { yield return(gameAct.DisplayCard(userPriority[j])); } //每次抽完牌稍微停滞一下 yield return(new WaitForSeconds(0.1f)); } } //再各多发一张 for (int i = 0; i < 4; ++i) { if (userPriority[i].handCard.IsNotFull) { //使用函数内部延迟 yield return(gameAct.AddHandCard(userPriority[i], gameAct.group_H.GetMahjongCard(index))); } else { Debug.LogError("<MGameClient::LogicCprocessor>:玩家手牌已满." + userPriority[i].ToString()); } //翻牌 如果是当前用户 则替换成需要的牌 if (i == currentUserID) { yield return(gameAct.DisplayCard(userPriority[i], cardTemp)); } else { yield return(gameAct.DisplayCard(userPriority[i])); } //每次抽完牌稍微停滞一下 yield return(new WaitForSeconds(0.1f)); } //整理手牌 yield return(new WaitForSeconds(0.5f)); yield return(gameAct.SortCard(userPriority[currentUserID], handCard)); control.EndStatusFlag(userID, UserAction.send_card); break; //摸牌 case Logic.get_handlecard: previousState = nextState; nextState = Logic.empty; //获取手牌 if (currentUserID != userID && userPriority[userID].handleCard.IsNotFull) { yield return(gameAct.AddHandleCard(userPriority[userID], gameAct.group_H.GetMahjongCard(index))); } else if (userPriority[userID].handleCard.IsNotFull) { MahjongPrefab cardtemp = gameAct.group_H.GetMahjongCard(index); //替换模型 cardtemp.mesh.mesh = ResoucreMtr.Instance.GetMesh(handleCard); yield return(gameAct.AddHandleCard(userPriority[userID], cardtemp)); } //可以界面操作 globalOperateFlag = true; //允许玩家操作 userPriority[userID].operateFlag = true; //如果是当前用户 则判断是否有操作提示 if (currentUserID == userID) { GameTipAnalys(); } control.EndStatusFlag(userID, UserAction.get_card); break; //出牌 case Logic.out_card: previousState = nextState; nextState = Logic.empty; //出牌 yield return(gameAct.AddOutCard(userPriority[userID], mahjong)); break; //胡 case Logic.hu: previousState = nextState; nextState = Logic.empty; //全局控制关闭 globalOperateFlag = false; //玩家控制关闭并摊开玩家手牌 for (int i = 0; i < 4; ++i) { userPriority[i].operateFlag = false; yield return(gameAct.SortCard(userPriority[i], cardData[i])); //如果手牌不为空 if (!userPriority[i].handleCard.IsEmpty) { userPriority[i].handleCard[0].mesh.mesh = ResoucreMtr.Instance.GetMesh(cardData[4][0]); } yield return(gameAct.TurnOverCard(userPriority[i])); } control.EndStatusFlag(userID, UserAction.hu); break; case Logic.chi_hu: previousState = nextState; nextState = Logic.empty; //全局控制关闭 globalOperateFlag = false; //玩家控制关闭并摊开玩家手牌 for (int i = 0; i < 4; ++i) { userPriority[i].operateFlag = false; yield return(gameAct.SortCard(userPriority[i], cardData[i])); yield return(gameAct.TurnOverCard(userPriority[i])); } control.EndStatusFlag(userID, UserAction.hu); break; } yield return(0); }
/// <summary> Получить текущий объект состояния сети </summary> public static ModelConnectState GetCurrentModelConnectState() { var test = Logic.GetNetworkState(); return(ConvertModelConnectStateFromNetworkStateModelManaged(test)); }
private static void TryToEvade(List <Skillshot> HitBy, Vector2 Pos) { var dangerLevel = 0; foreach (var skillshot in HitBy) { dangerLevel = Math.Max(dangerLevel, skillshot.GetValue <Slider>("DangerLevel").Value); } foreach (var evadeSpell in EvadeSpellDatabase.Spells) { if (evadeSpell.Enabled && evadeSpell.DangerLevel <= dangerLevel && evadeSpell.IsReady()) { if (evadeSpell.Slot == SpellSlot.E) { var dodgeList = GetEvadeTargets(evadeSpell) .Where( x => IsSafe(Logic.PosAfterE(x).To2D()).IsSafe&& (!Logic.UnderTower(Logic.PosAfterE(x)) || Menu.Item("ETower", true).GetValue <bool>())); if (dodgeList.Any()) { var dodgeTarget = dodgeList.Where(x => !x.HasBuff("YasuoDashWrapper")) .MinOrDefault(i => Logic.PosAfterE(i).Distance(Pos.To3D())); if (dodgeTarget != null && dodgeTarget.DistanceToPlayer() <= Logic.E.Range && SpellManager.CanCastE(dodgeTarget)) { Logic.E.CastOnUnit(dodgeTarget, true); } } } if (evadeSpell.Slot == SpellSlot.W) { var skillShotList = HitBy.Where( x => x.SpellData.CollisionObjects.Contains(CollisionObjectTypes.YasuoWall)); if (skillShotList.Any()) { var willHitList = skillShotList.Where( x => x.IsAboutToHit( 150 + evadeSpell.Delay, ObjectManager.Player)); if (willHitList.Any()) { if ( willHitList.OrderByDescending( x => dangerLevel) .Any( x => Logic.W.Cast( ObjectManager.Player.ServerPosition.Extend(x.Start.To3D(), 300)))) { return; } } } } } } }
/// <summary> Получить версию приложения </summary> public static string GetVersionApp() { var buildConfiguration = String.Empty; var version = Assembly.GetExecutingAssembly().GetName().Version; return($"{version.Major}.{version.Minor}.{version.Build}.{version.Revision} - {Logic.GetLibVersion()}" + buildConfiguration); }
private async Task LoadData() { MenuItemsListView.ItemsSource = await Logic.SetCategories(); }
private void SaveEntity(Usuario usuario) { Logic.Save(usuario); }
private void DeleteEntity(int id) { Logic.Delete(id); }
public IActionResult IOrderNum() { Logic buis = new Logic(); return(Ok(buis.GetMaxOrderID())); }