public AsciiArea(AreaGroup ag) : base(ag) { type = "ascii"; dpb = 1; canFocus = true; }
public async Task <BaseResponse <int> > Update(AreaGroupUpdate model) { AreaGroup area = await _db.AreaGroups.Where(x => x.AreaGroupGuid == model.AreaGroupGuid).FirstOrDefaultAsync(); if (!string.IsNullOrEmpty(model.GroupName)) { area.GroupName = model.GroupName; } var result = await _db.SaveChangesAsync(); if (result == 1) { return(new BaseResponse <int> { Code = RsponseCode.Success, Message = "تم تحديث بيانات الإقليم بنجاح ", Data = 0 }); } return(new BaseResponse <int> { Code = RsponseCode.DataBaseError, Message = "حصل خطأ ", Data = 0 }); }
/// <summary> /// Sets the current selection. It makes sure that the selection is sorted. /// </summary> public void SetSelection(long start, long end) { AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; // check whether the selection has really // changed... if (areaGroup.Areas.Count <= 0) { return; } Bless.Util.IRange sel = areaGroup.Selection; // if there is no change, don't do anything if (sel.Start == start && sel.End == end) { return; } Bless.Util.Range newSel = new Bless.Util.Range(start, end); newSel.Sort(); areaGroup.Selection = newSel; if (SelectionChanged != null) { SelectionChanged(this); } }
public void Delete() { AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; if (areaGroup.Areas.Count <= 0) { return; } // if we can't modify the buffer... if (!byteBuffer.ModifyAllowed) { return; } // if nothing is selected, delete the byte at the current offset if (areaGroup.Selection.IsEmpty() == true) { if (areaGroup.CursorOffset < byteBuffer.Size) { byteBuffer.Delete(areaGroup.CursorOffset, areaGroup.CursorOffset); AddUndoCursorState(new CursorState(areaGroup.CursorOffset, areaGroup.CursorDigit, areaGroup.CursorOffset, areaGroup.CursorDigit)); cursorRedoDeque.Clear(); } } else // delete the selection { DeleteSelectionInternal(); } dvDisplay.MakeOffsetVisible(areaGroup.CursorOffset, DataViewDisplay.ShowType.Closest); }
public void DeleteBackspace() { AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; if (areaGroup.Areas.Count <= 0) { return; } if (!byteBuffer.ModifyAllowed) { return; } // if nothing is selected, delete the byte at the previous offset if (areaGroup.Selection.IsEmpty() == true) { long cOffset = areaGroup.CursorOffset; if (cOffset > 0) { this.MoveCursor(cOffset - 1, areaGroup.CursorDigit); byteBuffer.Delete(cOffset - 1, cOffset - 1); AddUndoCursorState(new CursorState(cOffset, areaGroup.CursorDigit, cOffset - 1, areaGroup.CursorDigit)); cursorRedoDeque.Clear(); } } else // delete the selection { DeleteSelectionInternal(); } dvDisplay.MakeOffsetVisible(areaGroup.CursorOffset, DataViewDisplay.ShowType.Closest); }
public async Task <BaseResponse <int> > Create(AreaGroupCreate model) { AreaGroup area = new AreaGroup { GroupName = model.GroupName, AreaGroupGuid = Guid.NewGuid() }; await _db.AreaGroups.AddAsync(area); var result = await _db.SaveChangesAsync(); if (result == 1) { return(new BaseResponse <int> { Code = RsponseCode.Success, Message = "تم إضافة الإقليم بنجاح ", Data = 0 }); } return(new BaseResponse <int> { Code = RsponseCode.DataBaseError, Message = "حصل خطأ ", Data = 0 }); }
public void Copy() { AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; if (areaGroup.Areas.Count <= 0) { return; } if (!byteBuffer.ReadAllowed) { return; } byte[] ba = byteBuffer.RangeToByteArray(areaGroup.Selection); // if no selection, do nothing (keep old clipboard data) if (ba == null) { return; } clipdata = ba; // set clipboard clipboard.SetWithData(clipboardTargets, new ClipboardGetFunc(OnClipboardGet), new ClipboardClearFunc(OnClipboardClear)); dvDisplay.MakeOffsetVisible(areaGroup.CursorOffset, DataViewDisplay.ShowType.Closest); }
public override void LoadContent() { base.LoadContent(); //カメラを生成 this.camera = new Camera(mainGame); this.camera.LoadContent(); this.camera.Position = new Vector3(0, 0, 1500); //地図を描画するためのポリゴンを生成 this.texturePolygon = new TexturePolygon(mainGame, camera, mainGame.Content.Load<Texture2D>("important/japanMap"), new Vector3[4]{ new Vector3(-1920/2f, 1080/2.0f, 0.0f), new Vector3(1920/2.0f, 1080/2.0f, 0.0f), new Vector3(-1920/2.0f, -1080/2.0f, 0.0f), new Vector3(1920/2.0f, -1080/2.0f, 0.0f), }); this.texturePolygon.LoadContent(); //選択されている地域 selectedArea = AreaGroup.北海道; //地域の座標を設定 areaVectors = new Vector3[8]; areaVectors[(int)AreaGroup.北海道] = new Vector3(830, 280, 630); areaVectors[(int)AreaGroup.東北] = new Vector3(670, 60, 630); areaVectors[(int)AreaGroup.関東] = new Vector3(360, -210, 320); areaVectors[(int)AreaGroup.中部] = new Vector3(140, -150, 400); areaVectors[(int)AreaGroup.近畿] = new Vector3(-110, -260, 280); areaVectors[(int)AreaGroup.中国] = new Vector3(-350, -230, 450); areaVectors[(int)AreaGroup.四国] = new Vector3(-250, -230, 450); areaVectors[(int)AreaGroup.九州] = new Vector3(-620, -440, 500); }
public void MoveCursor(long offset, int digit) { AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; areaGroup.SetCursor(offset, digit); if (CursorChanged != null) { CursorChanged(this); } }
/// <summary> /// その偉人に関する事件を地域別に検索する /// </summary> /// <param name="person"></param> /// <param name="area"></param> /// <returns></returns> public static Event[] AreaSelectEvent(Person person, AreaGroup area) { Event[] events; events = new Event[10]; for (int i = 0; i < events.Length; i++) { events[i] = new Event(); events[i].ID = i * person.ID; events[i].name = person.name + "の事件" + i.ToString(); events[i].year = 1989; events[i].description = "ここにはそれぞれの事件の説明を記述します。"; events[i].place = "事件の発生場所を記述します。"; } return events; }
private void CleanupByteBuffer() { if (byteBuffer != null) { byteBuffer.Changed -= OnByteBufferChanged; byteBuffer.FileChanged -= OnByteBufferFileChanged; } AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; areaGroup.Buffer = null; areaGroup.SetCursor(0, 0); areaGroup.Selection.Clear(); byteBuffer = null; }
private void DeleteSelectionInternal() { AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; // // set cursor and selection before deleting so that the view remains in a consistent state // (eg the selection isn't beyond the EOF) // Util.Range prevSelection = this.Selection; AddUndoCursorState(new CursorState(areaGroup.CursorOffset, 0, areaGroup.Selection.Start, 0)); cursorRedoDeque.Clear(); this.MoveCursor(areaGroup.Selection.Start, 0); this.SetSelection(-1, -1); byteBuffer.Delete(prevSelection.Start, prevSelection.End); }
public void Cut() { AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; if (areaGroup.Areas.Count <= 0) { return; } // if we can't modify the buffer... if (!byteBuffer.ModifyAllowed) { return; } // if the buffer isn't resizable... if (!byteBuffer.IsResizable) { return; } byte[] ba = byteBuffer.RangeToByteArray(areaGroup.Selection); // if no selection, do nothing (keep old clipboard data) if (ba == null) { return; } clipdata = ba; // set clipboard clipboard.SetWithData(clipboardTargets, new ClipboardGetFunc(OnClipboardGet), new ClipboardClearFunc(OnClipboardClear)); this.DeleteSelectionInternal(); // Make sure dataView.Redraw() is called before dvDisplay.MakeOffsetVisible() // so that the Scrollbar has the correct range // when calling dataView.Goto(). // dataView.Redraw(); dvDisplay.MakeOffsetVisible(areaGroup.CursorOffset, DataViewDisplay.ShowType.Closest); }
public void executeCommands(AreaGroup group) { foreach (SpawnCommand s in commands) { Point spawnedAt = null; if (s.getSpawnSpecification().Equals(SpawnAreaTypeSpecification.LOCAL)) { spawnedAt = MasterDriver.Instance.CurrentArea.position; MasterDriver.Instance.CurrentArea.executeSpawnCommand(s); } else { spawnedAt = group.executeSpawnCommand(s); } WorldMap.AddStarAt(spawnedAt.x, spawnedAt.y, this.description); spawnLocations.Add(spawnedAt); } }
/// <summary> /// Adds pattern match highlights to an area group before it is rendered /// </summary> protected virtual void BeforeRender(AreaGroup ag) { if (!active) { return; } Util.Range sel = ag.Selection; if (sel.IsEmpty() || sel.Size > 512) { return; } int nrows; Util.Range view = ag.GetViewRange(out nrows); findStrategy.Buffer = ag.Buffer; findStrategy.Position = view.Start; findStrategy.Pattern = ag.Buffer.RangeToByteArray(sel); // Merge overlapping matches Util.Range match; Util.Range currentHighlight = new Util.Range(); while ((match = findStrategy.FindNext(view.End)) != null) { if (currentHighlight.End >= match.Start) { currentHighlight.End = match.End; } else { ag.AddHighlight(currentHighlight.Start, currentHighlight.End, Drawer.HighlightType.PatternMatch); currentHighlight = match; } } ag.AddHighlight(currentHighlight.Start, currentHighlight.End, Drawer.HighlightType.PatternMatch); }
private void SetupByteBuffer(ByteBuffer bb) { byteBuffer = bb; byteBuffer.Changed += OnByteBufferChanged; byteBuffer.FileChanged += OnByteBufferFileChanged; AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; areaGroup.Buffer = byteBuffer; areaGroup.SetCursor(0, 0); areaGroup.Selection = new Util.Range(); dvDisplay.Redraw(); dvDisplay.VScroll.Adjustment.Value = 0; OnPreferencesChanged(Preferences.Instance); if (BufferChanged != null) { BufferChanged(this); } }
/** * Starts this quest by registering the quest with the event invoker * if it is not already started */ public bool startQuestIfMetByAction(IAction act) { if (currentStep != 0) { return(false); } steps [0].updateStatusChecks(act); // Debug.Log ("Check Quest: " + this.name); if (steps [0].isStepFinished()) { register(); group = MasterDriver.Instance.CurrentMap.findNearestBiome(MasterDriver.Instance.CurrentArea, biomeType); stepQuest(); // Debug.Log ("Start Quest: " + this.name); this.isStarted = true; PlayerCanvas.updateQuestUI = true; return(true); } return(false); }
/// <summary> /// Adds pattern match highlights to an area group before it is rendered /// </summary> protected override void BeforeRender(AreaGroup ag) { if (!active) { return; } int nrows; Util.Range view = ag.GetViewRange(out nrows); if (view.Start < 0 || view.End < 0) { return; } findStrategy.Buffer = ag.Buffer; findStrategy.Position = view.Start; // Merge overlapping matches Util.Range match; Util.Range currentHighlight = new Util.Range(); while ((match = findStrategy.FindNext(view.End)) != null) { if (currentHighlight.End >= match.Start) { currentHighlight.End = match.End; } else { ag.AddHighlight(currentHighlight.Start, currentHighlight.End, Drawer.HighlightType.Unfocus); currentHighlight = match; } } ag.AddHighlight(currentHighlight.Start, currentHighlight.End, Drawer.HighlightType.Unfocus); }
public async Task <BaseResponse <bool> > Delete(Guid areaId) { AreaGroup areaGroup = await _db.AreaGroups.Include(x => x.Areas).ThenInclude(x => x.City).FirstOrDefaultAsync(x => x.AreaGroupGuid == areaId); areaGroup.IsActive = false; var result = await _db.SaveChangesAsync(); if (result == 1) { return(new BaseResponse <bool> { Code = RsponseCode.Success, Message = "تم حذف الإقليم بنجاح", Data = true }); } return(new BaseResponse <bool> { Code = RsponseCode.DataBaseError, Message = "حدث خطأ ", Data = false }); }
/// <summary> /// 出身地検索からの人を見つける /// </summary> /// <param name="area"></param> /// <returns></returns> public static Person[] FromSelectPersons(AreaGroup area) { Person[] persons; Person p; switch (area) { case AreaGroup.四国: persons = new Person[2]; persons[0] = new Person(); p = persons[0]; p.name = "坂本竜馬"; p.nameKana = "さかもとりょうま"; p.from = "土佐"; p.fromKana = "とさ"; p.fromAreaGroup = AreaGroup.四国; p.ID = 0; p.job = "武士"; p.birthYear = 1836; p.deathYear = 1867; p.profile = "土佐の武士だぜ"; p.sex = Sex.Male; p.era = Era.江戸; persons[1] = new Person(); p = persons[1]; p.name = "西郷隆盛"; p.nameKana = "さいごうたかもり"; p.from = "薩摩"; p.fromKana = "さつま"; p.fromAreaGroup = AreaGroup.九州; p.ID = 0; p.job = "武士"; p.birthYear = 1828; p.deathYear = 1877; p.profile = "薩摩の武士だぜ"; p.sex = Sex.Male; p.era = Era.江戸; return persons; default: Random r = new Random(); persons = new Person[5]; for (int i = 0; i < 5; i++) { persons[i] = new Person(); p = persons[i]; p.name = "さんぷる" + "第" + r.Next(10, 100).ToString() + "号"; p.nameKana = "さんぷる"; p.from = "香川"; p.fromKana = "かがわ"; p.fromAreaGroup = AreaGroup.四国; p.ID = 2; p.job = "さんぷる"; p.birthYear = 2011; p.deathYear = 2011; p.profile = "さんぷる"; p.sex = Sex.Male; p.era = Era.平成; } return persons; } }
public override Area CreateArea(AreaGroup ag) { return(new HexArea(ag)); }
public HexArea(AreaGroup ag) : base(ag) { type = "hexadecimal"; dpb = 2; }
public DecimalArea(AreaGroup ag) : base(ag) { type = "decimal"; dpb = 3; }
public override Area CreateArea(AreaGroup ag) { return(new DecimalArea(ag)); }
public Layout() { areaGroup = new AreaGroup(); layoutDoc = new XmlDocument(); filePath = null; }
private void AddSlotItems(AreaGroup group) { List <int> slot_ids = new List <int>(); debugMod.Add_SlotItem(slot_ids); }
public GroupedArea(AreaGroup ag) : base(ag) { grouping = 1; canFocus = true; }
public OffsetArea(AreaGroup ag) : base(ag) { type = "offset"; bytes = 4; }
public override Area CreateArea(AreaGroup ag) { return new OffsetArea(ag); }
public void setGroup(AreaGroup g) { group = g; }
//区域信息汇总 public async Task <ActionResult> AreaGroupAsync(string view) { var reslut = await Task.Factory.StartNew(() => { var db = new BaseRepository(); var structures = db.GetEntities <tbStructure>(p => p.typeID == 1); List <AreaGroup> model = new List <AreaGroup>(); DateTime year = new DateTime(DateTime.Today.Year, 1, 1); foreach (var item in structures) { var pig = db.GetEntities <Pig>(p => p.areaID == item.ID && p.grantDate >= year); var livepig = db.GetEntities <LivePig>(p => p.areaID == item.ID); var closedpig = db.GetEntities <ClosedPig>(p => p.areaID == item.ID && p.checkoutDate >= year); var raiser = db.GetEntities <Raiser>(p => p.areaID == item.ID); var checkout = db.GetEntities <Checkout>(p => p.areaID == item.ID && p.referTime >= year); var sales = db.GetEntities <Sales>(p => p.areaID == item.ID && p.salesDate >= year); var death = db.GetEntities <Death>(p => p.areaID == item.ID && p.deathDate >= year); var m = new AreaGroup(); m.areaID = item.ID; m.areaName = item.name; m.raiserNum = raiser.Count(); m.idleRaiserNum = raiser.Where(p => p.statusFlag == 3).Count(); m.contractedRaiserNum = raiser.Where(p => p.statusFlag == 1).Count(); m.liveBatchNum = livepig.Count(); m.liveRateExtant = livepig.Count() == 0? 0: (double)livepig.Average(p => p.liveRate); m.liveRate = closedpig.Count() == 0 ? 0 : (double)closedpig.Average(p => p.liveRate); m.ratio = checkout.Count() == 0 ? 0 : checkout.Average(p => p.ratioAll); m.ratio32 = checkout.Count() == 0 ? 0 : checkout.Average(p => p.ratio); m.ratio35 = checkout.Count() == 0 ? 0 : checkout.Average(p => p.ratio2); m.grantNum = pig.Count() == 0? 0 : pig.Sum(p => p.grantNum); m.salesNum = sales.Count() == 0? 0 : sales.Sum(p => p.salesNum); m.deathNum = death.Count() == 0? 0 : death.Sum(p => p.deathNum); m.extantNum = livepig.Count() == 0? 0 :livepig.Sum(p => p.extantNum); model.Add(m); } return(model); }); var js = new { total = reslut.Count, rows = reslut, footer = new[] { new{ areaName = "合计", raiserNum = reslut.Sum(p => p.raiserNum), idleRaiserNum = reslut.Sum(p => p.idleRaiserNum), contractedRaiserNum = reslut.Sum(p => p.contractedRaiserNum), liveBatchNum = reslut.Sum(p => p.liveBatchNum), liveRateExtant = reslut.Count(p => p.liveRateExtant > 0) == 0 ? 0 : reslut.Where(p => p.liveRateExtant > 0).Average(p => p.liveRateExtant), liveRate = reslut.Count(p => p.liveRate > 0) == 0 ? 0 : reslut.Where(p => p.liveRate > 0).Average(p => p.liveRate), ratio = reslut.Count(p => p.ratio > 0) == 0 ? 0 : reslut.Where(p => p.ratio > 0).Average(p => p.ratio), ratio32 = reslut.Count(p => p.ratio32 > 0) == 0 ? 0 : reslut.Where(p => p.ratio32 > 0).Average(p => p.ratio32), ratio35 = reslut.Count(p => p.ratio35 > 0) == 0 ? 0 : reslut.Where(p => p.ratio35 > 0).Average(p => p.ratio35), grantNum = reslut.Sum(p => p.grantNum), salesNum = reslut.Sum(p => p.salesNum), deathNum = reslut.Sum(p => p.deathNum), extantNum = reslut.Sum(p => p.extantNum) , iconCls = "icon-sum" } } }; return(Json(js, JsonRequestBehavior.AllowGet)); }
public void Paste() { AreaGroup areaGroup = dvDisplay.Layout.AreaGroup; if (areaGroup.Areas.Count <= 0) { return; } // if we can't modify the buffer... if (!byteBuffer.ModifyAllowed) { return; } // if the buffer isn't resizable, ignore non-overwriting paste if (!byteBuffer.IsResizable && !overwrite) { return; } // get data from clipboard byte[] pasteData = GetPasteData(); // if there wasn't any suitable data, return if (pasteData == null || pasteData.Length == 0) { return; } // if no range is selected insert/overtwrite the data and move // cursor to the end of inserted data if (areaGroup.Selection.IsEmpty()) { // if user wants to overwrite and there is something to overwrite... // There is something to overwrite if we are not pasting at the end // of the file. if (overwrite == true && areaGroup.CursorOffset < byteBuffer.Size) { long endPos = areaGroup.CursorOffset + pasteData.Length - 1; if (endPos >= byteBuffer.Size) { endPos = byteBuffer.Size - 1; } byteBuffer.Replace(areaGroup.CursorOffset, endPos, pasteData); } else // if user doesn't want to overwrite or there is nothing to overwrite { byteBuffer.Insert(areaGroup.CursorOffset, pasteData, 0, pasteData.LongLength); } AddUndoCursorState(new CursorState(areaGroup.CursorOffset, 0, areaGroup.CursorOffset + pasteData.Length, 0)); cursorRedoDeque.Clear(); this.MoveCursor(areaGroup.CursorOffset + pasteData.Length, 0); } else { // if a range is selected, replace the range with // the data and move the cursor to the end of // the new data byteBuffer.Replace(areaGroup.Selection.Start, areaGroup.Selection.End, pasteData); AddUndoCursorState(new CursorState(areaGroup.Selection.Start, 0, areaGroup.Selection.Start + pasteData.Length, 0)); cursorRedoDeque.Clear(); this.MoveCursor(areaGroup.Selection.Start + pasteData.Length, 0); this.SetSelection(-1, -1); } // Make sure dataView.Redraw() is called before dvDisplay.MakeOffsetVisible() // so that the Scrollbar has the correct range // when calling dvDisplay.MakeOffsetVisible(). // dataView.Redraw(); dvDisplay.MakeOffsetVisible(areaGroup.CursorOffset, DataViewDisplay.ShowType.Closest); }
public SeparatorArea(AreaGroup ag) : base(ag) { type = "separator"; }