CustomGames.ru - Dota 2 пользовательские игры

Файлы .cs

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн Adam Smith

  • Друзья CG
  • 476
  • Мощь: 6
  • жрять жри его
Файлы .cs
« : 10-03-2016, 15:21:47 »
Короче, наше такой файл, это C#, зачем он нужен и для как его использовали?
Код
using System;
using System.ComponentModel;
using WorldSmith.Panels;
using WorldSmith.Dialogs;
using KVLib;

namespace WorldSmith.DataClasses
{
[DotaAction]
[EditorGrammar("Do %DamageAmount of %Type damage to %Target")]
public partial class Damage : TargetedAction
{
public Damage(KeyValue kv)
: base(kv)
{
}
public Damage(string className)
: base(className)
{
}
public enum TypeEnum
{
DAMAGE_TYPE_COMPOSITE,
DAMAGE_TYPE_HP_REMOVAL,
DAMAGE_TYPE_MAGICAL,
DAMAGE_TYPE_PHYSICAL,
DAMAGE_TYPE_PURE,
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(TypeEnum.DAMAGE_TYPE_MAGICAL)]
public TypeEnum Type
{
get
{
KeyValue kv = GetSubkey("Type");
return (kv == null ? TypeEnum.DAMAGE_TYPE_MAGICAL : kv.GetEnum<TypeEnum>());
}
set
{
KeyValue kv = GetSubkey("Type");
if(kv == null)
{
kv = new KeyValue("Type");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("int")]
[DefaultValue(typeof(NumberValue), "")]
public NumberValue DamageAmount
{
get
{
KeyValue kv = GetSubkey("DamageAmount");
return (kv == null ? new NumberValue("DamageAmount") : kv.GetNumberValue());
}
set
{
KeyValue kv = GetSubkey("DamageAmount");
if(kv == null)
{
kv = new KeyValue("DamageAmount");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

}
}

Код
using System;
using System.ComponentModel;
using WorldSmith.Panels;
using WorldSmith.Dialogs;
using KVLib;

namespace WorldSmith.DataClasses
{
public partial class DotaAbility : BaseScriptType
{
public DotaAbility(KeyValue kv)
: base(kv)
{
}
public DotaAbility(string className)
: base(className)
{
}
[Category("Misc")]
[Description("No Description Set")]
[ReadOnly(true)]
[DefaultValue(0)]
public int ID
{
get
{
KeyValue kv = GetSubkey("ID");
return (kv == null ? 0 : kv.GetInt());
}
set
{
KeyValue kv = GetSubkey("ID");
if(kv == null)
{
kv = new KeyValue("ID");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue("")]
public string AbilityName
{
get
{
KeyValue kv = GetSubkey("AbilityName");
return (kv == null ? "" : kv.GetString());
}
set
{
KeyValue kv = GetSubkey("AbilityName");
if(kv == null)
{
kv = new KeyValue("AbilityName");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

public enum AbilityTypeEnum
{
DOTA_ABILITY_TYPE_BASIC,
DOTA_ABILITY_TYPE_ATTRIBUTES,
DOTA_ABILITY_TYPE_ULTIMATE,
DOTA_ABILITY_TYPE_HIDDEN,
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(AbilityTypeEnum.DOTA_ABILITY_TYPE_BASIC)]
public AbilityTypeEnum AbilityType
{
get
{
KeyValue kv = GetSubkey("AbilityType");
return (kv == null ? AbilityTypeEnum.DOTA_ABILITY_TYPE_BASIC : kv.GetEnum<AbilityTypeEnum>());
}
set
{
KeyValue kv = GetSubkey("AbilityType");
if(kv == null)
{
kv = new KeyValue("AbilityType");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

public enum AbilityUnitDamageTypeEnum
{
DAMAGE_TYPE_COMPOSITE,
DAMAGE_TYPE_HP_REMOVAL,
DAMAGE_TYPE_MAGICAL,
DAMAGE_TYPE_PHYSICAL,
DAMAGE_TYPE_PURE,
DAMAGE_TYPE_NONE,
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(AbilityUnitDamageTypeEnum.DAMAGE_TYPE_MAGICAL)]
public AbilityUnitDamageTypeEnum AbilityUnitDamageType
{
get
{
KeyValue kv = GetSubkey("AbilityUnitDamageType");
return (kv == null ? AbilityUnitDamageTypeEnum.DAMAGE_TYPE_MAGICAL : kv.GetEnum<AbilityUnitDamageTypeEnum>());
}
set
{
KeyValue kv = GetSubkey("AbilityUnitDamageType");
if(kv == null)
{
kv = new KeyValue("AbilityUnitDamageType");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Flags]
public enum AbilityBehaviorFlags : long
{
DOTA_ABILITY_BEHAVIOR_NONE = 0,
DOTA_ABILITY_BEHAVIOR_HIDDEN = 1 << 0,
DOTA_ABILITY_BEHAVIOR_PASSIVE = 1 << 1,
DOTA_ABILITY_BEHAVIOR_NO_TARGET = 1 << 2,
DOTA_ABILITY_BEHAVIOR_UNIT_TARGET = 1 << 3,
DOTA_ABILITY_BEHAVIOR_POINT = 1 << 4,
DOTA_ABILITY_BEHAVIOR_AOE = 1 << 5,
DOTA_ABILITY_BEHAVIOR_NOT_LEARNABLE = 1 << 6,
DOTA_ABILITY_BEHAVIOR_CHANNELLED = 1 << 7,
DOTA_ABILITY_BEHAVIOR_ITEM = 1 << 8,
DOTA_ABILITY_BEHAVIOR_TOGGLE = 1 << 9,
DOTA_ABILITY_BEHAVIOR_DIRECTIONAL = 1 << 10,
DOTA_ABILITY_BEHAVIOR_IMMEDIATE = 1 << 11,
DOTA_ABILITY_BEHAVIOR_AUTOCAST = 1 << 12,
DOTA_ABILITY_BEHAVIOR_NOASSIST = 1 << 13,
DOTA_ABILITY_BEHAVIOR_AURA = 1 << 14,
DOTA_ABILITY_BEHAVIOR_ATTACK = 1 << 15,
DOTA_ABILITY_BEHAVIOR_DONT_RESUME_MOVEMENT = 1 << 16,
DOTA_ABILITY_BEHAVIOR_ROOT_DISABLES = 1 << 17,
DOTA_ABILITY_BEHAVIOR_UNRESTRICTED = 1 << 18,
DOTA_ABILITY_BEHAVIOR_IGNORE_PSEUDO_QUEUE = 1 << 19,
DOTA_ABILITY_BEHAVIOR_IGNORE_CHANNEL = 1 << 20,
DOTA_ABILITY_BEHAVIOR_DONT_CANCEL_MOVEMENT = 1 << 21,
DOTA_ABILITY_BEHAVIOR_DONT_ALERT_TARGET = 1 << 22,
DOTA_ABILITY_BEHAVIOR_DONT_RESUME_ATTACK = 1 << 23,
DOTA_ABILITY_BEHAVIOR_NORMAL_WHEN_STOLEN = 1 << 24,
DOTA_ABILITY_BEHAVIOR_IGNORE_BACKSWING = 1 << 25,
DOTA_ABILITY_BEHAVIOR_RUNE_TARGET = 1 << 26,
DOTA_ABILITY_BEHAVIOR_IGNORE_TURN = 1 << 27,
DOTA_ABILITY_BEHAVIOR_POINT_TARGET = 1 << 28,
DOTA_ABILITY_BEHAVIOR_DONT_CANCEL_CHANNEL = 1 << 29,
DOTA_ABILITY_TYPE_ULTIMATE = 1 << 30,
DOTA_ABILITY_BEHAVIOR_OPTIONAL_UNIT_TARGET = 1 << 31,
DOTA_ABILITY_IMMEDIATE = 1 << 32,
}

[Editor(typeof(FlagEnumDialogUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(AbilityBehaviorFlags.DOTA_ABILITY_BEHAVIOR_NONE)]
public AbilityBehaviorFlags AbilityBehavior
{
get
{
KeyValue kv = GetSubkey("AbilityBehavior");
return (kv == null ? AbilityBehaviorFlags.DOTA_ABILITY_BEHAVIOR_NONE : kv.GetEnum<AbilityBehaviorFlags>());
}
set
{
KeyValue kv = GetSubkey("AbilityBehavior");
if(kv == null)
{
kv = new KeyValue("AbilityBehavior");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue("")]
public string AbilityTextureName
{
get
{
KeyValue kv = GetSubkey("AbilityTextureName");
return (kv == null ? "" : kv.GetString());
}
set
{
KeyValue kv = GetSubkey("AbilityTextureName");
if(kv == null)
{
kv = new KeyValue("AbilityTextureName");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Flags]
public enum AbilityUnitTargetTeamFlags : long
{
DOTA_UNIT_TARGET_TEAM_NONE = 0,
DOTA_UNIT_TARGET_TEAM_ENEMY = 1 << 1,
DOTA_UNIT_TARGET_TEAM_FRIENDLY = 1 << 2,
DOTA_UNIT_TARGET_TEAM_CUSTOM = 1 << 3,
DOTA_UNIT_TARGET_TEAM_BOTH = 1 << 4,
DOTA_UNIT_TARGET_ALL = 0xFFFF,
}

[Editor(typeof(FlagEnumDialogUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(AbilityUnitTargetTeamFlags.DOTA_UNIT_TARGET_TEAM_NONE)]
public AbilityUnitTargetTeamFlags AbilityUnitTargetTeam
{
get
{
KeyValue kv = GetSubkey("AbilityUnitTargetTeam");
return (kv == null ? AbilityUnitTargetTeamFlags.DOTA_UNIT_TARGET_TEAM_NONE : kv.GetEnum<AbilityUnitTargetTeamFlags>());
}
set
{
KeyValue kv = GetSubkey("AbilityUnitTargetTeam");
if(kv == null)
{
kv = new KeyValue("AbilityUnitTargetTeam");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Flags]
public enum AbilityUnitTargetTypeFlags : long
{
DOTA_UNIT_TARGET_NONE = 0,
DOTA_UNIT_TARGET_HERO = 1 << 1,
DOTA_UNIT_TARGET_CREEP = 1 << 2,
DOTA_UNIT_TARGET_BUILDING = 1 << 3,
DOTA_UNIT_TARGET_MECHANICAL = 1 << 4,
DOTA_UNIT_TARGET_COURIER = 1 << 5,
DOTA_UNIT_TARGET_OTHER = 1 << 6,
DOTA_UNIT_TARGET_TREE = 1 << 7,
DOTA_UNIT_TARGET_CUSTOM = 1 << 8,
DOTA_UNIT_TARGET_BASIC = 1 << 9,
DOTA_UNIT_TARGET_OTHERS = 1 << 10,
DOTA_UNIT_TARGET_ALL = 0xFFFF,
}

[Editor(typeof(FlagEnumDialogUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(AbilityUnitTargetTypeFlags.DOTA_UNIT_TARGET_NONE)]
public AbilityUnitTargetTypeFlags AbilityUnitTargetType
{
get
{
KeyValue kv = GetSubkey("AbilityUnitTargetType");
return (kv == null ? AbilityUnitTargetTypeFlags.DOTA_UNIT_TARGET_NONE : kv.GetEnum<AbilityUnitTargetTypeFlags>());
}
set
{
KeyValue kv = GetSubkey("AbilityUnitTargetType");
if(kv == null)
{
kv = new KeyValue("AbilityUnitTargetType");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Flags]
public enum AbilityUnitTargetFlagsFlags : long
{
DOTA_UNIT_TARGET_FLAG_NONE = 0,
DOTA_UNIT_TARGET_FLAG_RANGED_ONLY = 1 << 1,
DOTA_UNIT_TARGET_FLAG_MELEE_ONLY = 1 << 2,
DOTA_UNIT_TARGET_FLAG_DEAD = 1 << 3,
DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES = 1 << 4,
DOTA_UNIT_TARGET_FLAG_NOT_MAGIC_IMMUNE_ALLIES = 1 << 5,
DOTA_UNIT_TARGET_FLAG_INVULNERABLE = 1 << 6,
DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE = 1 << 7,
DOTA_UNIT_TARGET_FLAG_NO_INVIS = 1 << 8,
DOTA_UNIT_TARGET_FLAG_NOT_ANCIENTS = 1 << 9,
DOTA_UNIT_TARGET_FLAG_PLAYER_CONTROLLED = 1 << 10,
DOTA_UNIT_TARGET_FLAG_NOT_DOMINATED = 1 << 11,
DOTA_UNIT_TARGET_FLAG_NOT_SUMMONED = 1 << 12,
DOTA_UNIT_TARGET_FLAG_NOT_ILLUSION = 1 << 13,
DOTA_UNIT_TARGET_FLAG_NOT_ATTACK_IMMUNE = 1 << 14,
DOTA_UNIT_TARGET_FLAG_MANA_ONLY = 1 << 15,
DOTA_UNIT_TARGET_FLAG_CHECK_DISABLE_HELP = 1 << 16,
DOTA_UNIT_TARGET_FLAG_NOT_CREEP_HERO = 1 << 17,
DOTA_UNIT_TARGET_FLAG_OUT_OF_WORLD = 1 << 18,
DOTA_UNIT_TARGET_FLAG_NOT_NIGHTMARED = 1 << 19,
}

[Editor(typeof(FlagEnumDialogUIEditor), typeof(System.Drawing.Design.UITypeEditor))]
[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(AbilityUnitTargetFlagsFlags.DOTA_UNIT_TARGET_FLAG_NONE)]
public AbilityUnitTargetFlagsFlags AbilityUnitTargetFlags
{
get
{
KeyValue kv = GetSubkey("AbilityUnitTargetFlags");
return (kv == null ? AbilityUnitTargetFlagsFlags.DOTA_UNIT_TARGET_FLAG_NONE : kv.GetEnum<AbilityUnitTargetFlagsFlags>());
}
set
{
KeyValue kv = GetSubkey("AbilityUnitTargetFlags");
if(kv == null)
{
kv = new KeyValue("AbilityUnitTargetFlags");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(false)]
public bool OnCastbar
{
get
{
KeyValue kv = GetSubkey("OnCastbar");
return (kv == null ? false : kv.GetBool());
}
set
{
KeyValue kv = GetSubkey("OnCastbar");
if(kv == null)
{
kv = new KeyValue("OnCastbar");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(false)]
public bool OnLearnbar
{
get
{
KeyValue kv = GetSubkey("OnLearnbar");
return (kv == null ? false : kv.GetBool());
}
set
{
KeyValue kv = GetSubkey("OnLearnbar");
if(kv == null)
{
kv = new KeyValue("OnLearnbar");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(0)]
public int AbilityCastRange
{
get
{
KeyValue kv = GetSubkey("AbilityCastRange");
return (kv == null ? 0 : kv.GetInt());
}
set
{
KeyValue kv = GetSubkey("AbilityCastRange");
if(kv == null)
{
kv = new KeyValue("AbilityCastRange");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(250)]
public int AbilityCastRangeBuffer
{
get
{
KeyValue kv = GetSubkey("AbilityCastRangeBuffer");
return (kv == null ? 250 : kv.GetInt());
}
set
{
KeyValue kv = GetSubkey("AbilityCastRangeBuffer");
if(kv == null)
{
kv = new KeyValue("AbilityCastRangeBuffer");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(typeof(NumberValue), "AbilityCastPoint")]
public NumberValue AbilityCastPoint
{
get
{
KeyValue kv = GetSubkey("AbilityCastPoint");
return (kv == null ? new NumberValue("AbilityCastPoint") : kv.GetNumberValue());
}
set
{
KeyValue kv = GetSubkey("AbilityCastPoint");
if(kv == null)
{
kv = new KeyValue("AbilityCastPoint");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(typeof(NumberValue), "AbilityChannelTime")]
public NumberValue AbilityChannelTime
{
get
{
KeyValue kv = GetSubkey("AbilityChannelTime");
return (kv == null ? new NumberValue("AbilityChannelTime") : kv.GetNumberValue());
}
set
{
KeyValue kv = GetSubkey("AbilityChannelTime");
if(kv == null)
{
kv = new KeyValue("AbilityChannelTime");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(typeof(NumberValue), "AbilityCooldown")]
public NumberValue AbilityCooldown
{
get
{
KeyValue kv = GetSubkey("AbilityCooldown");
return (kv == null ? new NumberValue("AbilityCooldown") : kv.GetNumberValue());
}
set
{
KeyValue kv = GetSubkey("AbilityCooldown");
if(kv == null)
{
kv = new KeyValue("AbilityCooldown");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(typeof(NumberValue), "AbilityDuration")]
public NumberValue AbilityDuration
{
get
{
KeyValue kv = GetSubkey("AbilityDuration");
return (kv == null ? new NumberValue("AbilityDuration") : kv.GetNumberValue());
}
set
{
KeyValue kv = GetSubkey("AbilityDuration");
if(kv == null)
{
kv = new KeyValue("AbilityDuration");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue("")]
public string AbilitySharedCooldown
{
get
{
KeyValue kv = GetSubkey("AbilitySharedCooldown");
return (kv == null ? "" : kv.GetString());
}
set
{
KeyValue kv = GetSubkey("AbilitySharedCooldown");
if(kv == null)
{
kv = new KeyValue("AbilitySharedCooldown");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(typeof(NumberValue), "AbilityDamage")]
public NumberValue AbilityDamage
{
get
{
KeyValue kv = GetSubkey("AbilityDamage");
return (kv == null ? new NumberValue("AbilityDamage") : kv.GetNumberValue());
}
set
{
KeyValue kv = GetSubkey("AbilityDamage");
if(kv == null)
{
kv = new KeyValue("AbilityDamage");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(typeof(NumberValue), "AbilityManaCost")]
public NumberValue AbilityManaCost
{
get
{
KeyValue kv = GetSubkey("AbilityManaCost");
return (kv == null ? new NumberValue("AbilityManaCost") : kv.GetNumberValue());
}
set
{
KeyValue kv = GetSubkey("AbilityManaCost");
if(kv == null)
{
kv = new KeyValue("AbilityManaCost");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(1.0f)]
public float AbilityModifierSupportValue
{
get
{
KeyValue kv = GetSubkey("AbilityModifierSupportValue");
return (kv == null ? 1f : kv.GetFloat());
}
set
{
KeyValue kv = GetSubkey("AbilityModifierSupportValue");
if(kv == null)
{
kv = new KeyValue("AbilityModifierSupportValue");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(0f)]
public float AbilityModifierSupportBonus
{
get
{
KeyValue kv = GetSubkey("AbilityModifierSupportBonus");
return (kv == null ? 0f : kv.GetFloat());
}
set
{
KeyValue kv = GetSubkey("AbilityModifierSupportBonus");
if(kv == null)
{
kv = new KeyValue("AbilityModifierSupportBonus");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

[Category("Misc")]
[Description("No Description Set")]
[DefaultValue(false)]
public bool AbilityProcsMagicStick
{
get
{
KeyValue kv = GetSubkey("AbilityProcsMagicStick");
return (kv == null ? false : kv.GetBool());
}
set
{
KeyValue kv = GetSubkey("AbilityProcsMagicStick");
if(kv == null)
{
kv = new KeyValue("AbilityProcsMagicStick");
KeyValue.AddChild(kv);
}
kv.Set(value);
}
}

}
}
« Последнее редактирование: 10-03-2016, 15:29:01 от Adam Smith »
By PG.Freeman

Оффлайн Илья

  • Супермодератор
  • 2031
  • Мощь: 19
Re: Файлы .cs
« Ответ #1 : 10-03-2016, 16:16:01 »
Ну первый работает с уроном "DamageAmount". Соответственно, есть геттеры и сеттеры для задания типа и количества дмг.

Второй с абилками. Тоже сеттеры и геттеры для имени, типа и т.п.

Оффлайн Adam Smith

  • Друзья CG
  • 476
  • Мощь: 6
  • жрять жри его
Re: Файлы .cs
« Ответ #2 : 10-03-2016, 16:19:59 »
Ну первый работает с уроном "DamageAmount". Соответственно, есть геттеры и сеттеры для задания типа и количества дмг.

Второй с абилками. Тоже сеттеры и геттеры для имени, типа и т.п.
А как их использовать?
By PG.Freeman

Оффлайн Илья

  • Супермодератор
  • 2031
  • Мощь: 19
Re: Файлы .cs
« Ответ #3 : 10-03-2016, 22:13:50 »
Ну объявляешь какой-нибудь объект имеющий тип этих классов, например

Damage  MoiDMG = ....


И потом задаешь ему MoiDMG.set(2358746)

Я с C# не возился, поэтому большего сказать не могу.

Оффлайн Adam Smith

  • Друзья CG
  • 476
  • Мощь: 6
  • жрять жри его
Re: Файлы .cs
« Ответ #4 : 10-03-2016, 22:56:56 »
Ну объявляешь какой-нибудь объект имеющий тип этих классов, например

Damage  MoiDMG = ....


И потом задаешь ему MoiDMG.set(2358746)

Я с C# не возился, поэтому большего сказать не могу.

Не ну я имею ввиду как их подключать к кастомке
By PG.Freeman