123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- using System;
- using CommonLang;
- using CommonLang.IO;
- using CommonAI.Zone.Instance;
- using CommonAI.Zone.Formula;
- using CommonAI.Zone.Helper;
- using CommonAI.Zone.ZoneEditor;
- using CommonLang.Xml;
- using CommonAI.ZoneClient;
- using CommonAI.Zone.Simple;
- using CommonAI.Data;
- using System.Collections.Generic;
- namespace CommonAI.Zone
- {
-
-
-
- public interface InstanceZoneListener
- {
- void onEventHandler(Event e);
- bool CheckDropItem();
- }
- public abstract class InstanceZoneFactory
- {
- protected InstanceZoneFactory()
- {
- InitData();
- }
- public virtual Random CreateRandom(int seed)
- {
- return new Random(seed);
- }
-
- #region --Host--
-
-
-
- abstract public IFormula Formula { get; }
-
-
-
-
-
-
-
- public virtual EditorScene CreateEditorScene(TemplateManager templates, InstanceZoneListener listener, SceneData data, GSCreateAreaData gsData, string bindGameSrvId)
- {
- return new EditorScene(templates, listener, data, gsData, 9, DateTime.Now.Millisecond);
- }
-
-
-
-
-
-
-
-
-
- public virtual InstanceSpell CreateSpell(InstanceZone zone, SpellTemplate data, LaunchSpell launch, InstanceUnit launcher, InstanceZoneObject sender,
- XmdsSkillType fromSkillType, Dictionary<uint, InstanceUnit> damageList, int manyCannonMax, JSGCreateSpellData createData)
- {
- return new InstanceSpell(zone, data, launch, launcher, sender, damageList, fromSkillType, manyCannonMax, createData);
- }
-
-
-
-
-
-
-
-
-
- public virtual InstanceItem CreateItem(InstanceZone zone, ItemTemplate item, string name, int force, InstanceUnit creater, string disPlayName,int from)
- {
- return new InstanceItem(zone, item, name, force, creater, disPlayName,from);
- }
-
-
-
-
-
-
-
-
-
- public virtual InstanceUnit CreateUnit(InstanceZone zone, UnitInfo info, string name, int force, int alliesForce, int level)
- {
- InstanceUnit ret = null;
- if (info.UType == UnitInfo.UnitType.TYPE_PLAYER)
- {
- ret = new InstancePlayer(zone, info, name, force, level, alliesForce);
- }
- else if (info.UType == UnitInfo.UnitType.TYPE_PET)
- {
- ret = new InstancePet(zone, info, name, force, level);
- }
- else if (info.UType == UnitInfo.UnitType.TYPE_SUMMON)
- {
- ret = new InstanceSummon(zone, info, name, force, level);
- }
- else if (info.UType == UnitInfo.UnitType.TYPE_BUILDING)
- {
- ret = new InstanceBuilding(zone, info, name, force, level);
- }
- else if (info.UType == UnitInfo.UnitType.TYPE_MANUAL)
- {
- ret = new InstanceManual(zone, info, name, force, level);
- }
- else if (info.UType == UnitInfo.UnitType.TYPE_TRIGGER)
- {
- ret = new InstanceTriggerUnit(zone, info, name, force, level);
- }
- else if (info.UType == UnitInfo.UnitType.TYPE_NEUTRALITY)
- {
- ret = new InstanceNature(zone, info, name, force, level);
- }
- else
- {
- ret = new InstanceGuard(zone, info, name, force, level);
- }
- return ret;
- }
-
-
-
-
-
- public virtual HateSystem CreateHateSystem(InstanceUnit owner)
- {
- return new SimpleHateSystem(owner);
- }
-
-
-
-
-
- public abstract IQuestAdapter CreateQuestAdapter(InstanceZone zone);
- public virtual IVirtualUnit CreateUnitVirtual(InstanceUnit owner)
- {
- return null;
- }
- #endregion
-
- #region --Client--
-
-
-
-
-
-
- public virtual string ToClientDisplayName(UnitInfo info, SyncUnitInfo syncInfo)
- {
- return info.Name;
- }
-
-
-
-
-
-
- public virtual ZoneLayer CreateClientZoneLayer(EditorTemplates templates, ILayerClient listener)
- {
- return new ZoneLayer(templates, listener);
- }
- public virtual ZoneSpell CreateClientSpell(ZoneLayer parent, SpellTemplate info, SyncSpellInfo syn, AddSpellEvent add = null)
- {
- return new ZoneSpell(info, syn, parent, add);
- }
- public virtual ZoneItem CreateClientItem(ZoneLayer parent, ItemTemplate info, SyncItemInfo syn, AddItemEvent add = null)
- {
- return new ZoneItem(info, syn, parent, add);
- }
- public virtual ZoneUnit CreateClientUnit(ZoneLayer parent, UnitInfo info, SyncUnitInfo syn, AddUnitEvent add = null)
- {
- return new ZoneUnit(info, syn, parent, add);
- }
- public virtual ZoneActor CreateClientActor(ZoneLayer parent, UnitInfo info, LockActorEvent add)
- {
- return new ZoneActor(info, add, parent);
- }
- public virtual IVirtualClientUnit CreateClientUnitVirtual(ZoneClient.ZoneUnit owner)
- {
- return null;
- }
- #endregion
-
- #region --Data--
- public abstract ICommonConfig CreateCommonCFG();
- public abstract IUnitProperties CreateUnitProperties();
- public abstract ISkillProperties CreateSkillProperties();
- public abstract ISpellProperties CreateSpellProperties();
- public abstract IBuffProperties CreateBuffProperties();
- public abstract IItemProperties CreateItemProperties();
- public abstract IUnitTriggerProperties CreateTriggerProperties();
- public abstract ISceneProperties CreateSceneProperties();
- public abstract IAttackProperties CreateAttackProperties();
- public Type ExtConfigType { get; private set; }
- public Type ScenePropertiesType { get; private set; }
- public Type UnitPropertiesType { get; private set; }
- public Type BuffPropertiesType { get; private set; }
- public Type ItemPropertiesType { get; private set; }
- public Type SkillPropertiesType { get; private set; }
- public Type SpellPropertiesType { get; private set; }
- public Type UnitTriggerPropertiesType { get; private set; }
- private void InitData()
- {
- ExtConfigType = CreateCommonCFG().GetType();
- UnitPropertiesType = CreateUnitProperties().GetType();
- SkillPropertiesType = CreateSkillProperties().GetType();
- SpellPropertiesType = CreateSpellProperties().GetType();
- BuffPropertiesType = CreateBuffProperties().GetType();
- ItemPropertiesType = CreateItemProperties().GetType();
- UnitTriggerPropertiesType = CreateTriggerProperties().GetType();
- ScenePropertiesType = CreateSceneProperties().GetType();
- }
- #endregion
-
- }
-
- public interface ICommonConfig
- {
- void init();
- }
- public interface IUnitProperties : ICloneable, IExternalizable { }
- public interface ISkillProperties : ICloneable, IExternalizable
- {
- XmdsSkillType GetSkillType();
-
- int GetSkillUseTimes();
- int GetSkillAddTimeInterval();
- }
- public interface ISpellProperties : ICloneable, IExternalizable { }
- public interface IBuffProperties : ICloneable, IExternalizable { }
- public interface IItemProperties : ICloneable, IExternalizable { }
- public interface IUnitTriggerProperties : ICloneable, IExternalizable { }
- public interface ISceneProperties : ICloneable, IExternalizable
- {
- void OnInit(InstanceZone owner);
-
- byte GetAutoFightFlag();
- }
- public interface IAttackProperties : ICloneable, IExternalizable
- {
- int GetAttackID();
- }
-
-
- }
|