本文整理汇总了C#中GTAVBETrainerDotNet.Menu.MenuItem类的典型用法代码示例。如果您正苦于以下问题:C# MenuItem类的具体用法?C# MenuItem怎么用?C# MenuItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MenuItem类属于GTAVBETrainerDotNet.Menu命名空间,在下文中一共展示了MenuItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ChangeCash
/// <summary>
/// Change player's cash
/// </summary>
/// <param name="sender">Source menu item</param>
public static void ChangeCash(MenuItem sender)
{
if (sender != null && sender.Data != null && sender.Data.GetType() == typeof(int))
{
int amount = (int)sender.Data;
if (amount < 0)
{
if (Math.Abs(amount) >= Game.Player.Money)
{
Game.Player.Money = 0;
}
else
{
Game.Player.Money += amount;
}
}
else
{
if (amount >= int.MaxValue - Game.Player.Money)
{
Game.Player.Money = int.MaxValue;
}
else
{
Game.Player.Money += amount;
}
}
}
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:33,代码来源:PlayerFeature.cs
示例2: SetFreeze
/// <summary>
/// Sets freeze
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetFreeze(MenuItem sender)
{
Freeze = sender.On;
Config.DoAutoSave();
Function.Call(Hash.CLEAR_OVERRIDE_WEATHER);
Function.Call(Hash.CLEAR_WEATHER_TYPE_PERSIST);
Function.Call(Hash.CLEAR_TIMECYCLE_MODIFIER);
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:12,代码来源:WeatherFeature.cs
示例3: Clean
/// <summary>
/// Cleans current vehicle
/// </summary>
/// <param name="sender">Source menu item</param>
public static void Clean(MenuItem sender)
{
if (!CheckInVehicle()) return;
Function.Call(Hash.SET_VEHICLE_DIRT_LEVEL, Game.Player.Character.CurrentVehicle.Handle, 0);
Utils.ShowNotificationAboveMap(GlobalConst.Message.VEHICLE_CLEANED);
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:12,代码来源:VehicleFeature.cs
示例4: SetWeather
/// <summary>
/// Sets weather
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetWeather(MenuItem sender)
{
WeatherData wd = (sender.Data as WeatherData);
Function.Call(Hash.CLEAR_OVERRIDE_WEATHER);
Function.Call(Hash.CLEAR_WEATHER_TYPE_PERSIST);
Function.Call(Hash.CLEAR_TIMECYCLE_MODIFIER);
Function.Call(Hash.SET_WEATHER_TYPE_NOW, wd.InternalName);
Function.Call(Hash.CLEAR_TIMECYCLE_MODIFIER);
_weather = wd.InternalName;
Utils.ShowNotificationAboveMap(string.Format(GlobalConst.Message.WEATHER_SET, wd.Name));
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:15,代码来源:WeatherFeature.cs
示例5: AddMenuItem
/// <summary>
/// Adds a menu item into menu
/// </summary>
/// <param name="parent">Parent menu</param>
/// <param name="text">Text</param>
/// <param name="toggle">Is toggle</param>
/// <param name="on">Is on</param>
/// <param name="subMenu">Sub menu</param>
/// <param name="activateEventHandler">Activated event handler</param>
/// <param name="highlightedEventHandler">Highlighted event handler</param>
/// <param name="preActivateEventHandler">Pre-activated event handler</param>
public static MenuItem AddMenuItem(Menu parent, string text, bool toggle = false, bool on = false, Menu subMenu = null, MenuItemEventHandler activateEventHandler = null, MenuItemEventHandler preActivateEventHandler = null, MenuItemEventHandler highlightedEventHandler = null, object data = null)
{
MenuItem mi = new MenuItem()
{
Text = text,
IsToggle = toggle,
On = on,
SubMenu = subMenu
};
if (activateEventHandler != null) mi.Activated += activateEventHandler;
if (preActivateEventHandler != null) mi.PreActivated += preActivateEventHandler;
if (highlightedEventHandler != null) mi.Highlighted += highlightedEventHandler;
mi.Data = data;
parent.Add(mi);
return mi;
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:28,代码来源:MenuStorage.cs
示例6: Menu
/// <summary>
/// Creates an instance of a menu and adds initial items.
/// </summary>
/// <param name="title">Title of menu</param>
/// <param name="location">Location of the menu</param>
/// <param name="items">Menu items</param>
public Menu(string title, Point location, MenuItem[] items)
{
_items = new List<MenuItem>(items);
Title = title;
Location = location;
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:12,代码来源:Menu.cs
示例7: RandomSkin
/// <summary>
/// Set skin to random drawable and texture
/// </summary>
/// <param name="sender">Source menu item</param>
public static void RandomSkin(MenuItem sender)
{
MenuStorage.Menus.Players.MSPs.Skin.Clear();
for (int category = 0; category < SkinPropUtils.SKIN_CATEGORY_COUNT; category++)
{
List<SkinPropDetail> list = new List<SkinPropDetail>();
int drawableCount = Function.Call<int>(Hash.GET_NUMBER_OF_PED_DRAWABLE_VARIATIONS, Game.Player.Character.Handle, category);
int textureCount = 0;
if (drawableCount == 1)
{
textureCount = Function.Call<int>(Hash.GET_NUMBER_OF_PED_TEXTURE_VARIATIONS, Game.Player.Character.Handle, category, 0);
}
if (drawableCount > 1 || textureCount > 1)
{
for (int drawableIndex = 0; drawableIndex < drawableCount; drawableIndex++)
{
textureCount = Function.Call<int>(Hash.GET_NUMBER_OF_PED_TEXTURE_VARIATIONS, Game.Player.Character.Handle, category, drawableIndex);
for (int textureIndex = 0; textureIndex < textureCount; textureIndex++)
{
list.Add(new SkinPropDetail() { Category = category, Drawable = drawableIndex, Texture = textureIndex });
}
}
if (list.Count > 0)
{
SkinPropDetail detail = list[(new Random()).Next(list.Count)];
Function.Call(Hash.SET_PED_COMPONENT_VARIATION, Game.Player.Character.Handle, detail.Category, detail.Drawable, detail.Texture, 0);
ChosenDrawables[detail.Category] = detail.Drawable;
ChosenTextures[detail.Category][detail.Drawable] = detail.Texture;
}
}
}
Script.Wait(SET_SKIN_WAIT_TIME);
Utils.ShowNotificationAboveMap(GlobalConst.Message.PLAYER_RANDOM_SKIN);
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:38,代码来源:PlayerFeature.cs
示例8: SetToTrevor
/// <summary>
/// Set to Trevor
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetToTrevor(MenuItem sender)
{
SetModel(ModelStorage.MODEL_TREVOR);
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:8,代码来源:PlayerFeature.cs
示例9: SetToMichael
/// <summary>
/// Set to Michael
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetToMichael(MenuItem sender)
{
SetModel(ModelStorage.MODEL_MICHAEL);
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:8,代码来源:PlayerFeature.cs
示例10: SetRandomCops
/// <summary>
/// Sets random cops
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetRandomCops(MenuItem sender)
{
RandomCops = sender.On;
Config.DoAutoSave();
}
开发者ID:betenner,项目名称:betrainer,代码行数:9,代码来源:WorldFeature.cs
示例11: Remove
/// <summary>
/// Removes the specified menu item
/// </summary>
/// <param name="menuItem">Menu item object</param>
public void Remove(MenuItem menuItem)
{
if (_items.Contains(menuItem))
{
_items.Remove(menuItem);
EnsurePage();
EnsureSelectedIndexInCurrentPage();
}
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:13,代码来源:Menu.cs
示例12: RandomProps
/// <summary>
/// Set skin to random drawable and texture
/// </summary>
/// <param name="sender">Source menu item</param>
public static void RandomProps(MenuItem sender)
{
MenuStorage.Menus.Players.MSPs.Prop.Clear();
for (int category = 0; category < SkinPropUtils.PROP_CATEGORY_COUNT; category++)
{
List<SkinPropDetail> list = new List<SkinPropDetail>();
int drawableCount = Function.Call<int>(Hash.GET_NUMBER_OF_PED_PROP_DRAWABLE_VARIATIONS, Game.Player.Character.Handle, category);
if (drawableCount > 0)
{
list.Add(new SkinPropDetail() { Category = category, Drawable = -1 });
for (int drawableIndex = 0; drawableIndex < drawableCount; drawableIndex++)
{
int textureCount = Function.Call<int>((Hash)0xA6E7F1CEB523E171, Game.Player.Character.Handle, category, drawableIndex);
for (int textureIndex = 0; textureIndex < textureCount; textureIndex++)
{
list.Add(new SkinPropDetail() { Category = category, Drawable = drawableIndex, Texture = textureIndex });
}
}
if (list.Count > 0)
{
SkinPropDetail detailRandom = list[(new Random()).Next(list.Count)];
Function.Call(Hash.SET_PED_PROP_INDEX, Game.Player.Character.Handle, detailRandom.Category, detailRandom.Drawable, detailRandom.Texture, 0);
}
}
}
Script.Wait(SET_PROP_WAIT_TIME);
Utils.ShowNotificationAboveMap(GlobalConst.Message.PLAYER_RANDOM_PROPS);
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:32,代码来源:PlayerFeature.cs
示例13: SetPropDrawable
/// <summary>
/// Set prop drawable
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetPropDrawable(MenuItem sender)
{
SkinPropDetail detail = (SkinPropDetail)sender.Data;
int currentProp = Function.Call<int>(Hash.GET_PED_PROP_INDEX, Game.Player.Character.Handle, detail.Category);
if (currentProp != detail.Drawable)
{
Function.Call(Hash.CLEAR_PED_PROP, Game.Player.Character.Handle, detail.Category);
if (detail.Drawable != -1)
{
Function.Call(Hash.SET_PED_PROP_INDEX, Game.Player.Character.Handle, detail.Category, detail.Drawable, ChosenTextures[detail.Category][detail.Drawable], 0);
Script.Wait(SET_PROP_WAIT_TIME);
}
ChosenDrawables[detail.Category] = detail.Drawable + 1;
}
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:19,代码来源:PlayerFeature.cs
示例14: GeneratePropSelectorMenu
/// <summary>
/// Generates the prop selector menu
/// </summary>
/// <param name="sender">Source menu item</param>
public static void GeneratePropSelectorMenu(MenuItem sender)
{
SkinPropDetail detail = (SkinPropDetail)sender.Data;
MenuStorage.Menus.Players.MSPs.Props.Drawable.Clear();
for (int i = -1; i < detail.DrawableCount; i++)
{
MenuItem mi = null;
int textureCount = 0;
if (i == -1)
{
mi = MenuStorage.AddMenuItem(MenuStorage.Menus.Players.MSPs.Props.Drawable, string.Format(MenuText.Player.ModelSkinProps.PropCategories.PropsSelector.I01_NOTHING));
}
else
{
textureCount = Function.Call<int>((Hash)0xA6E7F1CEB523E171, Game.Player.Character.Handle, detail.Category, i);
mi = MenuStorage.AddMenuItem(MenuStorage.Menus.Players.MSPs.Props.Drawable, string.Format(MenuText.Player.ModelSkinProps.PropCategories.PropsSelector.I02_PROP, i, textureCount),
false, false, (textureCount > 1 ? MenuStorage.Menus.Players.MSPs.Props.Texture : null), GeneratePropTextureSelectorMenu);
}
mi.Data = new SkinPropDetail() { Drawable = i, Category = detail.Category, TextureCount = textureCount };
mi.Highlighted += SetPropDrawable;
}
MenuStorage.Menus.Players.MSPs.Props.Drawable.SelectedIndex = ChosenDrawables[detail.Category];
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:27,代码来源:PlayerFeature.cs
示例15: ClearProps
/// <summary>
/// Clear all props
/// </summary>
/// <param name="sender">Source menu item</param>
public static void ClearProps(MenuItem sender)
{
Function.Call(Hash.CLEAR_ALL_PED_PROPS, Game.Player.Character.Handle);
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:8,代码来源:PlayerFeature.cs
示例16: SetToModel
/// <summary>
/// Sets to specified Model
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetToModel(MenuItem sender)
{
if (sender.Data == null) return;
SetModel(sender.Data as ModelData);
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:9,代码来源:PlayerFeature.cs
示例17: Add
/// <summary>
/// Adds a menu item into this menu.
/// </summary>
/// <param name="item">Menu item</param>
public void Add(MenuItem item)
{
if (item != null) _items.Add(item);
item.Index = _items.Count - 1;
item.Parent = this;
EnsurePage();
EnsureSelectedIndexInCurrentPage();
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:12,代码来源:Menu.cs
示例18: SetRestrictedZones
/// <summary>
/// Sets restricted zones
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetRestrictedZones(MenuItem sender)
{
RestrictedZones = sender.On;
Config.DoAutoSave();
}
开发者ID:betenner,项目名称:betrainer,代码行数:9,代码来源:WorldFeature.cs
示例19: SetMoonGravity
/// <summary>
/// Sets moon gravity
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetMoonGravity(MenuItem sender)
{
MoonGravity = sender.On;
Config.DoAutoSave();
}
开发者ID:betenner,项目名称:betrainer,代码行数:9,代码来源:WorldFeature.cs
示例20: SetPropDrawableTexture
/// <summary>
/// Set prop drawable texture
/// </summary>
/// <param name="sender">Source menu item</param>
public static void SetPropDrawableTexture(MenuItem sender)
{
SkinPropDetail detail = (SkinPropDetail)sender.Data;
int currentProp = Function.Call<int>(Hash.GET_PED_PROP_INDEX, Game.Player.Character.Handle, detail.Category);
int currentTexture = Function.Call<int>(Hash.GET_PED_PROP_TEXTURE_INDEX, Game.Player.Character.Handle, detail.Category, currentProp);
if (currentProp != detail.Drawable || currentTexture != detail.Texture)
{
Function.Call(Hash.SET_PED_PROP_INDEX, Game.Player.Character.Handle, detail.Category, detail.Drawable, detail.Texture, 0);
ChosenDrawables[detail.Category] = detail.Drawable + 1;
ChosenTextures[detail.Category][detail.Drawable] = detail.Texture;
Script.Wait(SET_PROP_WAIT_TIME);
}
}
开发者ID:Immortal-,项目名称:betrainer,代码行数:17,代码来源:PlayerFeature.cs
注:本文中的GTAVBETrainerDotNet.Menu.MenuItem类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论