// Create frame from scratch public Frame(FrameMeta.FrameIDs id, FrameFlags flags, String data) { bFrameId = (new UTF8Encoding()).GetBytes(id.ToString()); bFlags = flags.GetBytes(); sData = data; iSize = data.Length; }
public UseItemAction(GameObject _repObject) : base("Use Item", "Utilize a selected item.", _repObject, null) { //TODO: Move this shit into EnviromentAction as methods to modify PushedFrames. // --- [ Select an Item ] --- // EnviromentSelect_FrameMeta getItem = new EnviromentSelect_FrameMeta( SelectionType.FromGiven, RepObject.GetGameObjects <GameObject>() ); //TODO: Make an ItemObject GameObject getItem.SelectionMade += () => { SelectedObject = getItem.GetSelectedAs <GameObject>(); //TODO: Above ^ }; // --- [ Get Action ] --- // EnviromentSelect_FrameMeta getAction = new EnviromentSelect_FrameMeta( SelectionType.FromGiven, RepObject.GetActions <GameAction>() ); //TODO: Make an PossessibleAction GameAction getAction.SelectionMade += () => { SelectedAction = getAction.GetSelectedAs <GameAction>(); //TODO: Above ^ }; PushedFrames = new FrameMeta[] { getItem, getAction }; }
public AttackWithAction(GameObject _repObject) : base("Attack", "Attack with a selected means at a selected target.", _repObject, null) { // --- [ Select Attack Method ] --- // EnviromentSelect_FrameMeta getAttackMethod = new EnviromentSelect_FrameMeta( SelectionType.FromGiven, RepObject.GetActions <GameAction>() ); //TODO: Make AttackAction action. getAttackMethod.SelectionMade += () => { AttackMethod = getAttackMethod.GetSelectedAs <GameAction>(); }; // --- [ Select a Target ] --- // EnviromentSelect_FrameMeta getTarget = new EnviromentSelect_FrameMeta(SelectionType.FromEnviroment); getTarget.SelectionMade += () => { Victim = getTarget.GetSelectedAs <GameObject>(); }; // --- [ Finish Init ] --- // PushedFrames = new FrameMeta[] { getAttackMethod, getTarget }; }
public override void InvokeAction(GameEventArgument args) { base.InvokeAction(args); for (PushedFrameIndex = 0; PushedFrameIndex < PushedFrames.Length; PushedFrameIndex++) { FrameMeta f = PushedFrames[PushedFrameIndex]; f.GameArgs = args; do { args.Focuser.PushFrame(f); args.Focuser.PopFrame(); }while (f.Frame.FrameRepeating && f.Frame.RepeatCondition()); } }
/// <summary> /// Handle when a Focus is popped. /// </summary> /// <param name="arg1"></param> /// <param name="arg2"></param> protected override async Task FocusPop(FrameMeta arg1, Focuser arg2) { await Task.Delay(1); }
public NewGameAction(GameInstance instance, ulong playerId) : base("New Game", "Welcome to Discordia, please choose an option. " + "You may restart a menu with the restart button. " + "Once you have selected all options you will be given the continue button.", null, null) { GameObject playerBody = new GameObject("", "", new PhysicalMeta(), newCharacter, playerId); string[] attribNames = new string[] { "Strength", "Dexterity", "Constitution", "Intelligence", "Wisdom", "Charisma" }; // --- [ Class selection frame ] --- setClass.Frame = new Frame ( "Pick a class.", "Pick one of the following classes:", new List <GameAction>() { new CreateSpecificClassAction <ClassFighter>("Fighter", "The path of Might", null), //TODO: Make an IDescribible which has GetName(), and GetDesc() new CreateSpecificClassAction <ClassMage>("Mage", "The path of Knowledge", null), // this will clear up significant save bloat among other things. new CreateSpecificClassAction <ClassRogue>("Rogue", "The path of Shadows", null) } ); setClass.PreFramePopped += () => { foreach (CreateClassAction a in setClass.Frame.Actions) { if (a.Class != null) { newCharacter.Class = a.Class; break; } } int[] vals = GetAttributeAmounts(); for (int i = 0; i < attribNames.Length; i++) { setAttributes.Frame.Actions[i].Name = String.Format("{0} : [{1}]", attribNames[i], vals[i]); } }; // --- [ Attribute allocation frame ] --- setAttributes.PreFramePushed += () => { setAttributes.Frame.Desc = GetAttributeCountString(); int[] vals = GetAttributeAmounts(); for (int i = 0; i < attribNames.Length; i++) { setAttributes.Frame.Actions[i].Name = String.Format("{0} : [{1}]", attribNames[i], vals[i]); } }; setAttributes.Frame = new Frame ( "Distribute Attributes", "", new List <GameAction>() { new ImproveSpecificAttributeAction <StrengthAttribute>( attribNames[0], "The physical manifestation of will.", null, () => newCharacter.Class ), new ImproveSpecificAttributeAction <DexterityAttribute>( attribNames[1], "The nible control of flesh.", null, () => newCharacter.Class ), new ImproveSpecificAttributeAction <ConstitutionAttribute>( attribNames[2], "The endurance of the shell.", null, () => newCharacter.Class ), new ImproveSpecificAttributeAction <IntelligenceAttribute>( attribNames[3], "The fortress of thought", null, () => newCharacter.Class ), new ImproveSpecificAttributeAction <WisdomAttribute>( attribNames[4], "The accumulative experience of life.", null, () => newCharacter.Class ), new ImproveSpecificAttributeAction <CharismaAttribute>( attribNames[5], "The connection to other minds.", null, () => newCharacter.Class ) }, true, () => newCharacter.Class.AttributePoints > 0 ); // Grab all cities from the first planet, first continent CityLocation[] cities = instance.GetLocations <CityLocation>(instance.GetFromIndexAtTopLevel <LocationConceptual>(0).SubLocations[0]); List <SelectSpecificLocationAction <CityLocation> > selectCityActions = new List <SelectSpecificLocationAction <CityLocation> >(); selectedCity = null; foreach (CityLocation c in cities) { selectCityActions.Add(new SelectSpecificLocationAction <CityLocation>(c.Name, c.Desc, null, c, (l) => selectedCity = l as CityLocation)); } // --- [ Background Frame ] --- setBackground.Frame = new Frame( "Background", "Select a place of origin.", new List <GameAction>(selectCityActions) ); bool restart = false; // --- [ Restart Frame ] --- restartProcess.Frame = new Frame( "Restart?", "Would you like to restart? You will lose all progress.", new List <GameAction>(new AcceptDeclineActionPair( (b) => restart = b, (b) => restart = b ).ActionPair) ); restartProcess.PreFramePopped += () => { if (restart) { RestartPushing(); } else { instance.AddGameObject(playerBody); newCharacter.PossessGameObject(playerBody); } }; // --- [ Init pushed frame array ] --- PushedFrames = new FrameMeta[] { //setClass, //setAttributes, setBackground, restartProcess }; }