internal static void OpenDocument(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { EntryPointDocument openDocument = GetOpenDocument(entryPoint); if (openDocument == null) { openDocument = new EntryPointDocument(entryPoint); VmcStudioUtil.Application.Documents.Add(openDocument); } VmcStudioUtil.Application.SelectedDocument = openDocument; }
// Update is called once per frame void Update() { timer += Time.deltaTime; if (!firstAnim && timer > firstWait) { firstAnim = true; Unit.StartAnim(); } if (lastAnim && timer > lastWait) { lastAnim = false; //事後処理 Advent.StartAdventure(KEY, win); } }
private void LoadNewGame(string pGame) { Advent.LoadGame(pGame); FormTitle += " " + Advent.GameName; SetColours(); miSaveGame.Enabled = true; txtMessages.DeselectAll(); txtView.DeselectAll(); txtInput.Focus(); txtInput.ReadOnly = false; miOutputXML.Enabled = true; miOutputComment.Enabled = true; }
private void BeginPlayback(string pPath) { if (Recorder != null) { Recorder.eKeystroke -= Recorder_eKeystroke; Recorder.ReplayFinished -= Recorder_ReplayFinished; } Recorder = RecordGame.Load(pPath); Recorder.eKeystroke += Recorder_eKeystroke; Recorder.ReplayFinished += Recorder_ReplayFinished; Recorder.eCarriageReturn += Recorder_eCarriageReturn; Advent.RestoreGame(Recorder.Data); Recorder.StartReplay(); }
private IEnumerator CallAdvent() { Music.PlaySE(Music.Clip.Enter); StartMenu.OnAfterEnter(); yield return(new WaitForSeconds(3)); switch (buttonNum) { case 0: Advent.StartAdventure(-1, 1); break; case 2: SceneManager.LoadScene("Main5"); break; case 4: Application.Quit(); break; } }
public EntryPointPresenter(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { this.isImageAutoGenerated = true; this.isInactiveImageAutoGenerated = true; this.entryPoint = entryPoint; this.entryPoint.IsDirtyChanged += (EventHandler)delegate { this.OnPropertyChanged("IsDirty"); }; this.entryPoint.Saving += new EventHandler(this.EntryPointSaving); List<EntryPointCapabilityPresenter> list = new List<EntryPointCapabilityPresenter>(); this.CapabilitiesRequired = (IEnumerable<EntryPointCapabilityPresenter>)list; foreach (EntryPointCapabilities capability in EntryPointPresenter.PossibleCapabilities) list.Add(new EntryPointCapabilityPresenter(this, capability)); if (entryPoint.AddIn != null) { System.Type type = (System.Type)null; try { type = System.Type.GetType(entryPoint.AddIn, false, false); } catch (Exception ex) { Trace.TraceError(((object)ex).ToString()); } if (type == typeof(VmcExecuteAddIn)) { this.ExecutionType = EntryPointType.VmcExecute; this.vmcExecuteInfo = !string.IsNullOrEmpty(this.entryPoint.Context) ? (ExecutionInfo)new XmlSerializer(typeof(ExecutionInfo)).Deserialize((TextReader)new StringReader(this.entryPoint.Context)) : new ExecutionInfo(); if (this.vmcExecuteInfo.CloseKeys == null) this.vmcExecuteInfo.CloseKeys = new List<Keys>(); if (this.vmcExecuteInfo.KillKeys == null) this.vmcExecuteInfo.KillKeys = new List<Keys>(); ObservableCollection<Keys> observableCollection1 = new ObservableCollection<Keys>(this.vmcExecuteInfo.CloseKeys); observableCollection1.CollectionChanged += (NotifyCollectionChangedEventHandler)delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo<Keys>((INotifyCollectionChanged)observableCollection1, (ICollection<Keys>)this.vmcExecuteInfo.CloseKeys); ObservableCollection<Keys> observableCollection2 = new ObservableCollection<Keys>(this.vmcExecuteInfo.KillKeys); observableCollection2.CollectionChanged += (NotifyCollectionChangedEventHandler)delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo<Keys>((INotifyCollectionChanged)observableCollection2, (ICollection<Keys>)this.vmcExecuteInfo.KillKeys); this.CloseKeys = (IList<Keys>)observableCollection1; this.KillKeys = (IList<Keys>)observableCollection2; if (this.vmcExecuteInfo.Media == null) this.vmcExecuteInfo.Media = new List<MediaInfo>(); ObservableCollection<MediaInfoPresenter> observableCollection3 = new ObservableCollection<MediaInfoPresenter>(Enumerable.Select<MediaInfo, MediaInfoPresenter>((IEnumerable<MediaInfo>)this.vmcExecuteInfo.Media, (Func<MediaInfo, MediaInfoPresenter>)(o => MediaInfoPresenter.Create(o)))); observableCollection3.CollectionChanged += (NotifyCollectionChangedEventHandler)delegate { this.Model.MarkAsDirty(); }; CollectionUtilities.StartReplicatingChangesTo<MediaInfo>((INotifyCollectionChanged)observableCollection3, (ICollection<MediaInfo>)this.vmcExecuteInfo.Media, true, (Func<object, MediaInfo>)(o => ((MediaInfoPresenter)o).MediaInfo)); this.Media = observableCollection3; } else this.ExecutionType = EntryPointType.AddIn; } else if (entryPoint.Run != null) { this.ExecutionType = EntryPointType.Exe; } else { if (entryPoint.Url == null) return; this.ExecutionType = EntryPointType.Url; } }
public static void Initialize(DB db, bool canCreate, bool mustMigrate) { if (canCreate) { db.Database.EnsureDeleted(); db.Database.EnsureCreated(); } if (mustMigrate) { db.Database.Migrate(); } // if(db.Cards.Any() || db.CardLists.Any()) return; // db.Table.Add(...) / SaveChanges() if (db.Advents.Any() || db.Advances.Any() || db.Employees.Any()) { return; } var e1 = new Advent { eventName = "TIY White Elephant", startDate = new DateTime(2016, 12, 12, 13, 45, 00), endDate = new DateTime(2016, 12, 14) }; var e2 = new Advent { eventName = "TIY Presentation Day", startDate = new DateTime(2016, 12, 16, 13, 45, 00), endDate = new DateTime(2016, 12, 18) }; db.Advents.Add(e1); db.Advents.Add(e2); db.SaveChanges(); var a1 = new Advance { advanceName = "TIY Party Advance", isAssigned = false, isComplete = false, employeeId = 1, dueDate = new DateTime(2016, 12, 12) }; var a2 = new Advance { advanceName = "TIY Presentation Day Advance", isAssigned = false, isComplete = false, employeeId = 2, dueDate = new DateTime(2016, 12, 15) }; e2.Advances.Add(a2); e1.Advances.Add(a1); db.SaveChanges(); var emp1 = new Employee { fName = "Shadi", lName = "Jam", department = "Administration", phone = "713-517-5522", email = "*****@*****.**" }; var emp2 = new Employee { fName = "Khalid", lName = "Mohamed", department = "Production", phone = "713-777-7777", email = "*****@*****.**" }; var emp3 = new Employee { fName = "Damien", lName = "Maya", department = "Transportation", phone = "713-111-1111", email = "*****@*****.**" }; (new List <Employee> { emp1, emp2, emp3 }).Select(e => { return((new List <Advent> { e1, e2 }).Select((Advent a) => { a.Employees.Add(e); return true; })); }); db.SaveChanges(); }
internal static extern bool EnumResourceLanguages(IntPtr hModule, int lpType, int lpName, Advent.Common.Interop.NativeMethods.EnumResLangProc lpEnumFunc, int lParam);
public static extern int SetWindowsHookEx(int idHook, Advent.Common.Interop.NativeMethods.HookProc lpfn, IntPtr hMod, int dwThreadId);
internal static EntryPointDocument GetOpenDocument(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { return Enumerable.FirstOrDefault<EntryPointDocument>(VmcStudioUtil.Application.Documents.OfType<EntryPointDocument>(), (Func<EntryPointDocument, bool>)(o => (o.Presenter.Model == entryPoint))); }
internal static bool IsDocumentOpen(Advent.MediaCenter.StartMenu.OEM.EntryPoint entryPoint) { return (GetOpenDocument(entryPoint) == null); }
public static extern bool GetWindowRect(IntPtr hWnd, out Advent.Common.Interop.RECT lpRect);
static void Main(string[] args) { Advent.Day01(); }
public AdventDay07Should() { advent = new Advent(); }
internal static extern bool EnumResourceTypes(IntPtr hModule, Advent.Common.Interop.NativeMethods.EnumResTypeProc lpEnumFunc, IntPtr lParam);
private void miSaveGame_Click_1(object sender, EventArgs e) { Advent.SaveGame(); }
static void Main(string[] args) { //Console.WindowWidth = 70; Console.Clear(); string arg; string arg1; string userInput = null; try { #region Process arguments //no args provided or no recognised args if (args.Length == 0 || args.Select(a => a.Length > 1 ? a.Substring(0, 2) : a).ToArray().Intersect(flags).Count() == 0 || getFlagArg(flags[5], args) != null) { OutputHelp(); return; } else if ((arg = getFlagArg(flags[2], args)) != null) //formatted output of specified game file { var g = GameData.Load(arg); g.SaveAsCommentedXML(); return; } else if ((arg = getFlagArg(flags[5], args)) != null) //formatted output of specified game file { GameData.SaveAsCommentedDat(arg); return; } arg = getFlagArg(flags[1], args); //Game to load arg1 = getFlagArg(flags[0], args); //Save game to restore _TurnCounter = getFlagArg(flags[3], args) != null; if (arg != null) { Advent.RoomView += Advent_RoomView; Advent.GameMessages += Advent_GameMessages; if (arg1 != null) { Advent.RestoreGame(arg, arg1); //restore save game } else { Advent.LoadGame(arg); //just load } } else { Console.WriteLine("ERROR: When using -l must specify game to load with -g"); return; } Console.Title = "Playing: " + Advent.GameName; #endregion do { Console.Write(Advent.PlayerPrompt); Advent.ProcessText(userInput = Console.ReadLine()); } while (!Advent.ISGameOver); Output(); } catch (Exception e) { ErrorBox(6, 6, 60, 10, e.Message); } //write the final bar string exitmsg = "-Press enter to exit-"; Console.SetCursorPosition(0, Console.WindowHeight - 2); Console.BackgroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Black; Console.Write(exitmsg + new string(' ', Console.WindowWidth - exitmsg.Length)); Console.SetCursorPosition(exitmsg.Length + 1, Console.CursorTop - 1); Console.ResetColor(); Console.Read(); Console.Clear(); }
public AdventDay13Should() { advent = new Advent(); reader = new ReadFile(); }
public Event(DateTime ClockStart, DateTime ClockEnd, int ClockRunTime, System.Xml.Linq.XDocument XMLEvents, ref CrashHandler Crash) { ch = Crash; events = new Dictionary<string, List<EventItem>>(); clock = new PartyClock(ClockStart, ClockEnd, ClockRunTime); Util.ShowClock = true; sound = new Sound(true); text = new Text2D(); chess = new Chess(); sf = new Starfield(150); intro = new Intro(ref sound, ref text); outro = new Outro(ref sound); advent = new Advent(ref sound); birthday = new Birthday(ref sound, ref text, ref chess); xmas = new Christmas(ref sound); smurf = new Datasmurf(ref sound, ref text); // random dif = new Dif(ref chess, ref sound); // random fbk = new Fbk(ref sound); // random hw = new Halloween(ref chess, ref sound, 25); lucia = new Lucia(ref chess, ref sound); newyear = new NewYear(); richard = new RMS(ref sound, ref text); // random scroller = new Scroller(ref chess, ref sf, ref text); // random semla = new Semla(); sune = new SuneAnimation(ref sound, ref text); tl = new TurboLogo(ref sound, ref chess, (OpenGL.Util.SpringOrFall.Equals("Spring")? true:false)/*((ClockStart.Month >= 1 && ClockStart.Month <= 8)? false:true)*/ ); // vilken termin är det? jan till början av augusti VT, resten HT... random valentine = new Valentine(ref sound); wl = new WinLinux(ref chess); //random creators = new Self(ref sound); // random bb = new BB(ref sound); // random GM = new GummiBears(ref sound); NDay = new National(ref chess, ref sound); easter = new Easter(ref sound); hajk = new Hajk(ref sound); mid = new Midsummer(ref sound); vaf = new Vaffla(); wp = new Walpurgis(); crayfish = new CrayFish(); ts = new TeknatStyle(ref chess, ref sound, ref text); m = new Matrix(ref text); q = new Quiz(ref text, false, ref sound); talepsin = new Talespin(ref sound); cd = new ChipAndDale(ref sound, ref chess); nerd = new Nerdy(ref chess, ref sound); trex = new Trex(ref sound); sailormoon = new Sailormoon(ref sound,ref chess); gb = new GhostBusters(ref sound); zelda = new Zelda(ref sound, ref chess); tardis = new Tardis(ref sound); f**k = new F**k(ref sound, ref chess); silverFang = new SilverFang(ref sound); mt = new MoraT(ref sound); swine = new Swine(ref chess, ref text); tjall = new Tjall(ref chess, ref text); ronja = new Ronja(ref sound); emil = new Emil(ref sound); djungelboken = new Djungelboken(ref sound); fabbe = new Fabbe(ref sound); drink = new Drink(ref sound); frozen = new Frozen(ref sound); eventCurrent = null; // event item for events to be triggerd in clock_NewDate //randomEvent = new List<string>(new string[] { "starfield", "SuneAnimation", "TurboLogo", "Datasmurf", "WinLinux", "Scroller", "BB", "GummiBears", "TeknatStyle", "Matrix"}); randomEvent = new List<string>(new string[] { "starfield", "Nerdy", "Talespin", "Sailormoon", "GhostBusters", "Zelda", "Tardis", "F**k", "SilverFang", "MoraT" }); //new stuff List<UtilXML.EventData> ed = UtilXML.Loadeffectdata(); // TODO: Make a clean list with all events allowed to be used implement so that it is actaully usable instead of a switch at the bottom of this file. Dictionary<string, Effect> effects = new Dictionary<string, Effect>() { {"SuneAnimation", new Effect(sune, ed.Find(e => e.Name == "SuneAnimation"))}, {"Dif",new Effect(dif, ed.Find(e => e.Name == "Dif"))}, {"Fbk",new Effect(fbk, ed.Find(e => e.Name == "Fbk"))}, {"TurboLogo",new Effect(tl, ed.Find(e => e.Name == "TurboLogo"))}, {"Datasmurf", new Effect(smurf, ed.Find(e => e.Name == "Datasmurf"))}, {"RMS",new Effect(richard, ed.Find(e => e.Name == "RMS"))}, {"WinLinux",new Effect(wl, ed.Find(e => e.Name == "WinLinux"))}, {"Scroller",new Effect(scroller, ed.Find(e => e.Name == "Scroller"))}, {"Self",new Effect(creators, ed.Find(e => e.Name == "Self"))}, {"BB",new Effect(bb, ed.Find(e => e.Name == "BB"))}, {"GummiBears",new Effect(GM, ed.Find(e => e.Name == "GummiBears"))}, {"Hajk",new Effect(hajk, ed.Find(e => e.Name == "Hajk"))}, {"TeknatStyle",new Effect(ts, ed.Find(e => e.Name == "TeknatStyle"))}, {"Matrix",new Effect(m, ed.Find(e => e.Name == "Matrix"))}, {"Quiz",new Effect(q, ed.Find(e => e.Name == "Quiz"))}, {"Talespin",new Effect(talepsin, ed.Find(e => e.Name == "Talespin"))}, {"ChipDale",new Effect(cd, ed.Find(e => e.Name == "ChipDale"))}, {"Nerdy",new Effect(nerd, ed.Find(e => e.Name == "Nerdy"))}, /* {"Trex",new Effect(trex, ed.Find(e => e.Name == "Trex"))},*/ {"Sailormoon",new Effect(sailormoon, ed.Find(e => e.Name == "Sailormoon"))}, {"GhostBusters",new Effect(gb, ed.Find(e => e.Name == "GhostBusters"))}, {"Zelda",new Effect(zelda, ed.Find(e => e.Name == "Zelda"))}, {"Tardis",new Effect(tardis, ed.Find(e => e.Name == "Tardis"))}, {"F**k",new Effect(f**k, ed.Find(e => e.Name == "F**k"))}, {"SilverFang",new Effect(silverFang, ed.Find(e => e.Name == "SilverFang"))}, {"MoraT",new Effect(mt, ed.Find(e => e.Name == "MoraT"))}, {"Ronja",new Effect(ronja, ed.Find(e => e.Name == "Ronja"))}, {"Emil",new Effect(emil, ed.Find(e => e.Name == "Emil"))}, {"Djungelboken",new Effect(djungelboken, ed.Find(e => e.Name == "Djungelboken"))}, {"Fabbe",new Effect(fabbe, ed.Find(e => e.Name == "Fabbe"))}, {"Drink",new Effect(drink, ed.Find(e => e.Name == "Drink"))}, {"Frozen",new Effect(drink, ed.Find(e => e.Name == "Frozen"))} }; runEffectInMonth = new Dictionary<string, List<objdata>>(); string[] months = Util.monthlist(); int counter; foreach (KeyValuePair<string, Effect> pair in effects) { counter = 0; foreach (bool b in pair.Value.RunAllowedlist) { if (b == true) { if (!runEffectInMonth.ContainsKey(months[counter])) { runEffectInMonth.Add(months[counter], new List<objdata>()); } runEffectInMonth[months[counter]].Add(new objdata(pair.Key, pair.Value.Vetolist[counter], pair.Value.Priolist[counter], pair.Value.Runslist[counter])); } counter++; } } clock.NewDate += clock_NewDate; // Event listener if (ch.CrashDialogResult == System.Windows.Forms.DialogResult.Yes) { clock.clock = ch.CrashClock; } string name, date, type; // Event dates setup foreach (var item in XMLEvents.Descendants("event")) { name = item.Element("name").Value; date = item.Element("date").Value; type = item.Element("type").Value.ToLower(); EventItem ei = new EventItem(name, type, date); if (!events.ContainsKey(date)) { List<EventItem> list = new List<EventItem>(); // seems most bad in my eyes... events.Add(date, list); } for (int i = 0; i < events[date].Count; i++) { EventItem e = events[date][i]; if ("birthday".Equals(e.Type) && "birthday".Equals(ei.Type)) { e.Name += "\n\n" + ei.Name; events[date][i] = e; } } events[date].Add(ei); name = date = type = string.Empty; } // this needs to be fixed nicer... if (events.ContainsKey(ClockEnd.ToShortDateString())) { events[ClockEnd.ToShortDateString()].Clear(); // force this to be top.. events[ClockEnd.ToShortDateString()].Add( new EventItem("outro", "outro", ClockEnd.ToShortDateString()) ); } else { events.Add(ClockEnd.ToShortDateString(), new List<EventItem>() { new EventItem("outro", "outro", ClockEnd.ToShortDateString()) }); } // Random effects on dates with no effects and check against new list of allowed things for them... DateTime dt = ClockStart; bool star = (Util.Rnd.Next(0, 1000) < 500 ? true:false); // make this random at the start too? int num = 0; while (dt <= ClockEnd) { date = dt.ToShortDateString(); if (!events.ContainsKey(date)) { EventItem ei; if (num == 0 || num == 1) { ei = new EventItem("starfield", "random", date); } else { //ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); string month = ""; if (dt != null) month = dt.Month.ToString(); switch (month) { case "1": month = "jan"; break; case "2": month = "feb"; break; case "3": month = "mar"; break; case "4": month = "apr"; break; case "5": month = "maj"; break; case "6": month = "jun"; break; case "7": month = "jul"; break; case "8": month = "aug"; break; case "9": month = "sep"; break; case "10": month = "okt"; break; case "11": month = "nov"; break; case "12": month = "dec"; break; }//switch if (runEffectInMonth.ContainsKey(month)) { List<objdata> mobj = runEffectInMonth[month]; List<objdata> vetolist = new List<objdata>(); List<objdata> novetolist = new List<objdata>(); foreach (objdata n in mobj) { if ("Quiz".Equals(n.Name) && eventnum == 4) { n.vetoAgain(); eventnum = 0; } if (n.Veto == true) { if (n.Runs > 0) vetolist.Add(n); } else { if (n.Runs > 0) novetolist.Add(n); } } vetolist.Sort(); novetolist.Sort(); if (vetolist.Count > 0) { ei = new EventItem(vetolist[0].Name, "random", date); vetolist[0].noMoreVeto(); } else if (novetolist.Count > 0) { ei = new EventItem(novetolist[0].Name, "random", date); novetolist[0].decRuns(); if (eventnum < 4) eventnum++; } else { ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); } } else { ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date); } } num++; if (num == 3) { num = 0; } ei = new EventItem("Self", "random", date); // this is for debuging new events events.Add(date, new List<EventItem>()); events[date].Add(ei); } dt = dt.AddDays(1); date = string.Empty; } }
public static extern bool EnumResourceNames(IntPtr hModule, string lpszType, Advent.Common.Interop.NativeMethods.EnumResNameDelegate lpEnumFunc, IntPtr lParam);