private void AddSkillPoint(CommandArgs args) { try { SkillPlayer ply = PlayerManager.GetPlayer(args.Player.Index); SkillInformation info = ply.GetSkillInformation(Name); SkillInformation newInfo; if (info == null) { newInfo = new SkillInformation() { Name = this.Name, Value = 0 } } ; else { newInfo = new SkillInformation() { Name = this.Name, Value = info.Value + 1 } }; ply.SetSkillInformation(newInfo); } catch (Exception e) { //player is not logged in Console.WriteLine(e.Message); } }
private void OnPlayerTakesDamage(PlayerDamageEvent args) { try { SkillPlayer player = PlayerManager.GetPlayer(args.HurtPlayerIndex); SkillInformation info = player.GetSkillInformation(Name); if (info == null) { info = new SkillInformation() { Name = this.Name, Value = 0 }; player.SetSkillInformation(info); return; } if (info.Value > 0 && !args.PVP) { FireRocket(player, args.Damage, 1); } } catch (Exception e) { Console.WriteLine(e.Message); } }
public override void Initialize() { base.Initialize(); List <Player> players = ((RhythmGame)Game).CurrentBand.BandMembers; foreach (RPGPlayer player in players) { Dictionary <string, Skill> skills = player.SkillManager.Skills; Dictionary <string, Skill> allSkills = player.SkillManager.AllSkills; int i = 0; MenuItem parent = null; foreach (KeyValuePair <string, Skill> pair in allSkills) { bool owned = skills.ContainsKey(pair.Key); SkillInformation info = new SkillInformation(pair.Key); info.Explanation = ""; if (player.SkillManager.SkillTextures.ContainsKey(pair.Key)) { info.Image = player.SkillManager.SkillTextures[pair.Key]; } info.CostToNext = allSkills[pair.Key].Cost; if (owned) { info.Level = skills[pair.Key].Level; } else { info.Level = 0; } parent = AddMenuItem(parent, OtherKeyType.Down, pair.Key, RhythmGame.GameStateType.None, i, info); i++; } } MenuHelper.ConnectEdges(Selected); }
private void OnPlayerDamagesNPC(NpcDamageEvent args) { try { SkillPlayer player = PlayerManager.GetPlayer(args.PlayerIndex); SkillInformation info = player.GetSkillInformation(Name); if (info == null) { info = new SkillInformation() { Name = this.Name, Value = 0 }; player.SetSkillInformation(info); return; } if (info.Value > 0) { double ratio = Math.Min(info.Value / 20.0, 1.0); int health = (int)Math.Ceiling(ratio * args.Damage); player.Player.Heal(health); } } catch (Exception e) { Console.WriteLine(e.Message); } }
void BuySkill(RhythmGame.GameStateType state) { List <Player> players = ((RhythmGame)Game).CurrentBand.BandMembers; foreach (RPGPlayer player in players) { SkillInformation info = skillInformation[Selected.ChildId]; if (player.XpManager.SkillPoints >= info.CostToNext) { // Consider it bought. string name = skillInformation[Selected.ChildId].Title; Dictionary <string, Skill> skills = player.SkillManager.Skills; Dictionary <string, Skill> allSkills = player.SkillManager.AllSkills; if (!skills.ContainsKey(name)) { player.SkillManager.gainSkill(name); } if (allSkills[name].AdvanceSkillLevel()) { info.Level = allSkills[name].Level; skillInformation[Selected.ChildId] = info; player.XpManager.SkillPoints -= info.CostToNext; } } else { // Play the failed sound. } } }
// Constructor public FaceSentimentAnalyzerDescriptor() { Information = SkillInformation.Create( "FaceSentimentAnalyzer", // Name "Finds a face in the image and infers its predominant sentiment from a set of 8 possible labels", // Description new Guid(0xf8d275ce, 0xc244, 0x4e71, 0x8a, 0x39, 0x57, 0x33, 0x5d, 0x29, 0x13, 0x88), // Id new Windows.ApplicationModel.PackageVersion() { Major = 0, Minor = 0, Build = 0, Revision = 8 }, // Version "JT7-SKU Developer", // Author "JT7-SKU Publishing" // Publisher ); // Describe input feature m_inputSkillDesc = new List <ISkillFeatureDescriptor>(); m_inputSkillDesc.Add( new SkillFeatureImageDescriptor( "InputImage", // skill input feature name "the input image onto which the sentiment analysis runs", true, // isRequired (since this is an input, it is required to be bound before the evaluation occurs) -1, // width -1, // height -1, // maxDimension BitmapPixelFormat.Nv12, BitmapAlphaMode.Ignore) ); // Describe first output feature m_outputSkillDesc = new List <ISkillFeatureDescriptor>(); m_outputSkillDesc.Add( new SkillFeatureTensorDescriptor( "FaceRectangle", // skill output feature name "a face bounding box in relative coordinates (left, top, right, bottom)", false, // isRequired (since this is an output, it automatically get populated after the evaluation occurs) new List <long>() { 4 }, // tensor shape SkillElementKind.Float) ); // Describe second output feature m_outputSkillDesc.Add( new SkillFeatureTensorDescriptor( FaceSentimentAnalyzerConst.SKILL_OUTPUTNAME_FACESENTIMENTSCORES, // skill output feature name "the prediction score for each class", false, // isRequired (since this is an output, it automatically get populated after the evaluation occurs) new List <long>() { 1, 8 }, // tensor shape SkillElementKind.Float) ); }
public MenuItem AddMenuItem(MenuItem parent, OtherKeyType key, String text, RhythmGame.GameStateType nextState, int childId, SkillInformation info) { VerticalTextItem newItem = new VerticalTextItem(Game, this); bool owns = (info.Level <= 0); if (owns) { newItem.FontColor = Color.Gray; } newItem.ChildId = childId; newItem.ItemText = text; if (owns) { newItem.NextState = nextState; } else { newItem.NextState = RhythmGame.GameStateType.None; } //newItem.DriftRateX = -2.0f; //newItem.DriftRateY = -0.25f; //newItem.ScaleRate = 0.9f; newItem.DefaultX = 120; newItem.StartY = 175; MenuItem.ScreenInfo screenInfo = newItem.CurrentInfo; //info.pos.Y -= 220; //info.pos.X += 30; newItem.CurrentInfo = screenInfo; newItem.LargeFont = true; MenuItem inside = (MenuItem)newItem; if (parent != null) { if (!parent.AddLink(ref inside, key)) { parent = null; } } if (parent == null) { newItem.ItemSetup(); Selected = newItem; } skillInformation.Add(childId, info); Items.Add(newItem); Shift += new Action <int, int>(newItem.Shift); newItem.PreSelected += new Action <RhythmGame.GameStateType>(BuySkill); //newItem.PreSelected += new Action<RhythmGame.GameStateType>(LeavingMenu); return(newItem); }
private void SkillDashboardControl_Load_1(object sender, EventArgs e) { skillInformation = new SkillInformation(); Connection = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\Users\anik\Documents\anik.mdf;Integrated Security=True;Connect Timeout=30"); SkillDataShow(); }
private void SkillAddEditForm_Load(object sender, EventArgs e) { skillInformation = new SkillInformation(); }
/// <summary> /// Get a list of information strings extracted from the ISkillDescriptor /// </summary> /// <param name="desc"></param> /// <returns></returns> public static List <KeyValuePair <string, string> > GetSkillInformationStrings(SkillInformation info) { if (info == null) { return(new List <KeyValuePair <string, string> >()); } return(new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("Description", $"{info.Description}"), new KeyValuePair <string, string>("Author", $"{info.Author}"), new KeyValuePair <string, string>("Publisher", $"{info.Publisher}"), new KeyValuePair <string, string>("Version", $"{info.Version.Major}.{info.Version.Minor}.{info.Version.Build}.{info.Version.Revision}"), new KeyValuePair <string, string>("Unique ID", $"{ info.Id}") }); }