private void AddEffectToolstripItem(object sender, EventArgs e) { HideAllDynamicMenus(); HideAllContextMenus(); // action owner of new effect ActionTemplateWrapper ownerWrapper = Data[contextDataNode.Parent.Name]; // new node in tree TreeNode t = contextDataNode.Nodes.Add("NewEffect"); workingDataNode = t; // get id for this new node t.Name = Ids.Get().ToString(); EffectTemplate eff = new EffectTemplate(); EffectTemplateWrapper efp = new EffectTemplateWrapper(); efp.EffectTemplate = eff; // add wrapper to dictionary effects.Add(t.Name, efp); // update owner action List <EffectTemplate> tempList = new List <EffectTemplate>(ownerWrapper.ActionTemplate.Effects); tempList.Add(eff); ownerWrapper.ActionTemplate.Effects = tempList.ToArray(); // update owner wrapper ownerWrapper.effects.Add(efp); ShowEP(efp); }
private void AddRequirementToolstripItem(object sender, EventArgs e) { HideAllDynamicMenus(); HideAllContextMenus(); ActionTemplateWrapper ATW = Data[contextDataNode.Parent.Name]; TreeNode t = contextDataNode.Nodes.Add("NewRequirement"); t.Name = Ids.Get().ToString(); ActionRequirement RQ = new ActionRequirement(); RQ.Requirement = "new requirement"; RQ.amount = 0; RQ.consume = false; ActionRequirementWrapper RQW = new ActionRequirementWrapper(); RQW.ActionRequirement = RQ; Requirements.Add(t.Name, RQW); List <ActionRequirement> tempList = new List <ActionRequirement>(ATW.ActionTemplate.Requirements); tempList.Add(RQ); ATW.ActionTemplate.Requirements = tempList.ToArray(); ShowRQ(RQW); }
private void ShowAO(ActionTemplateWrapper ATW) { AOPanel.Parent = DynamicSpace; AOPanel.Dock = DockStyle.Fill; AOPanel.Populate(ATW); AOPanel.Show(); }
public void Populate(ActionTemplateWrapper ATW) { nameText.Text = ATW.ActionTemplate.Name; descriptionText.Text = ATW.ActionTemplate.Description; targetCombo.SelectedIndex = ATW.ActionTemplate.TargetType; rangeNum.Value = ATW.ActionTemplate.Range; altRangeNum.Value = ATW.ActionTemplate.Range2; workingData = ATW; }
private void exportActionDialog_FileOk(object sender, CancelEventArgs e) { saveActionDialog.DefaultExt = ".ACT"; ActionTemplateWrapper ATW = Data[tv.SelectedNode.Name]; Stream s = exportActionDialog.OpenFile(); BinaryFormatter bn = new BinaryFormatter(); bn.Serialize(s, ATW.ActionTemplate); s.Close(); }
private void DeleteEffectToolstripItem(object sender, EventArgs e) { ActionTemplateWrapper ownerWrapper = Data[contextDataNode.Parent.Parent.Name]; EffectTemplateWrapper toBeDeleted = effects[contextDataNode.Name]; effects.Remove(contextDataNode.Name); List <EffectTemplate> tempList = new List <EffectTemplate>(ownerWrapper.ActionTemplate.Effects); tempList.Remove(toBeDeleted.EffectTemplate); ownerWrapper.ActionTemplate.Effects = tempList.ToArray(); Ids.Free(int.Parse(contextDataNode.Name)); contextDataNode.Parent.Nodes.Remove(contextDataNode); }
private void NewAction(object sender, EventArgs e) { HideAllDynamicMenus(); HideAllContextMenus(); TreeNode t = tv.Nodes.Add("New Action"); t.Name = Ids.Get().ToString(); Console.Out.WriteLine(t.Name); t.Nodes.Add("Requirements").ForeColor = Color.Blue; t.Nodes.Add("Effects").ForeColor = Color.Blue; ActionTemplate AT = new ActionTemplate(); ActionTemplateWrapper ATW = new ActionTemplateWrapper(); ATW.ActionTemplate = AT; AT.Name = "New Action"; AT.Description = "Type here!"; Data.Add(t.Name, ATW); tv.SelectedNode = t; workingDataNode = t; ShowAO(ATW); }
public ActionOverviewPanel() { InitializeComponent(); workingData = new ActionTemplateWrapper(); }