當前位置: 首頁>>代碼示例>>C#>>正文


C# BaseCreature.DescribeGene方法代碼示例

本文整理匯總了C#中Server.Mobiles.BaseCreature.DescribeGene方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseCreature.DescribeGene方法的具體用法?C# BaseCreature.DescribeGene怎麽用?C# BaseCreature.DescribeGene使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Mobiles.BaseCreature的用法示例。


在下文中一共展示了BaseCreature.DescribeGene方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: AnimalLoreGump


//.........這裏部分代碼省略.........

					if ((c.PackInstinct & PackInstinct.Canine) != 0)
						packInstinct = 1049570; // Canine
					else if ((c.PackInstinct & PackInstinct.Ostard) != 0)
						packInstinct = 1049571; // Ostard
					else if ((c.PackInstinct & PackInstinct.Feline) != 0)
						packInstinct = 1049572; // Feline
					else if ((c.PackInstinct & PackInstinct.Arachnid) != 0)
						packInstinct = 1049573; // Arachnid
					else if ((c.PackInstinct & PackInstinct.Daemon) != 0)
						packInstinct = 1049574; // Daemon
					else if ((c.PackInstinct & PackInstinct.Bear) != 0)
						packInstinct = 1049575; // Bear
					else if ((c.PackInstinct & PackInstinct.Equine) != 0)
						packInstinct = 1049576; // Equine
					else if ((c.PackInstinct & PackInstinct.Bull) != 0)
						packInstinct = 1049577; // Bull

					AddHtmlLocalized(153, 204, 160, 18, packInstinct, LabelColor, false, false);

					AddImage(128, 224, 2086);
					AddHtmlLocalized(147, 222, 160, 18, 1049594, 200, false, false); // Loyalty Rating

					// loyalty redo
					int loyaltyval = (int)c.Loyalty / 10;
					if (loyaltyval < 0)
						loyaltyval = 0;
					if (loyaltyval > 11)
						loyaltyval = 11;
					AddHtmlLocalized(153, 240, 160, 18, (!c.Controlled || c.Loyalty == PetLoyalty.None) ? 1061643 : 1049594 + loyaltyval, LabelColor, false, false);

					break;
					#endregion
				}
				default: // rest of the pages are filled with genes - be sure to adjust "pg" calc in here when adding pages
				{
                    int nextpage = 3;

                    // idea for later - flesh out custom pages more, a string[] is hackish

                    //List<string[]> custompages = c.GetAnimalLorePages();
                    //if (custompages != null && page >= nextpage && page < (nextpage + custompages.Count))
                    //{
                    //    foreach (string[] s in custompages)
                    //    {
                    //        for (int i = 0; i < s.Length; i++)
                    //        {
                    //            AddHtml(153, 168 + 18 * i, 150, 18, s[i], false, false);
                    //        }
                    //    }

                    //    nextpage += custompages.Count;
                    //}

					#region Genetics
                    if (page >= nextpage)
                    {
                        List<PropertyInfo> genes = new List<PropertyInfo>();

                        foreach (PropertyInfo pi in c.GetType().GetProperties())
                        {
                            GeneAttribute attr = (GeneAttribute)Attribute.GetCustomAttribute(pi, typeof(GeneAttribute), true);
                            if (attr == null)
                                continue;
                            if (m_User.AccessLevel < AccessLevel.Counselor && !Server.Misc.TestCenter.Enabled)
                            {
                                if (attr.Visibility == GeneVisibility.Invisible)
                                    continue;
                                if (attr.Visibility == GeneVisibility.Tame && m_User != c.ControlMaster)
                                    continue;
                            }

                            genes.Add(pi);
                        }

                        int pg = m_Page - nextpage;

                        AddImage(128, 152, 2086);
                        AddHtml(147, 150, 160, 18, "Genetics", false, false);

                        for (int i = 0; i < 9; i++)
                        {
                            if (pg * 9 + i >= genes.Count)
                                break;

                            GeneAttribute attr = (GeneAttribute)Attribute.GetCustomAttribute(genes[pg * 9 + i], typeof(GeneAttribute), true);
                            AddHtml(153, 168 + 18 * i, 120, 18, attr.Name, false, false);
                            AddHtml(240, 168 + 18 * i, 115, 18, String.Format("<div align=right>{0:G3}</div>", c.DescribeGene(genes[pg * 9 + i], attr)), false, false);
                        }
                    }
					break;
					#endregion
				}
			}

			if (m_Page < NumTotalPages - 1)
				AddButton(340, 358, 5601, 5605, (int)ButtonID.NextPage, GumpButtonType.Reply, 0);
			if (m_Page > 0)
				AddButton(317, 358, 5603, 5607, (int)ButtonID.PrevPage, GumpButtonType.Reply, 0);
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:101,代碼來源:AnimalLore.cs


注:本文中的Server.Mobiles.BaseCreature.DescribeGene方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。