public void Load(IAccount account, string path)
        {
            _totalSpellLauch = 0;
            _account         = account;
            _spells          = ScriptsManager.LoadSpellsFromIA($"{path}.lua");

            var spellsId = _account.Character.Spells.Select(s => s.SpellId).ToList();

            foreach (var spell in _spells)
            {
                if (spellsId.Contains(spell.SpellId))
                {
                    continue;
                }
                var spellTmp = _spells.FirstOrDefault(s => s.SpellId == spell.SpellId);
                if (spellTmp != null)
                {
                    _spells.Remove(spellTmp);
                }
            }

            /*foreach (var spell in _spells)
             * {
             *  Logger.Default.Log(spell.SpellId.ToString());
             * }*/
            _account.Character.Fight.FightStarted += StartFight;
            _account.Character.Fight.TurnStarted  += ExecuteSpell;
            _account.Character.Fight.FightEnded   += FightEnd;
        }
示例#2
0
        public void OnCommand(IAccount account, string[] args)
        {
            if (args.Length < 1)
            {
                Logger.Default.Log("Erreur argument command ." + CommandName + ", LogMessageType.Public");
                return;
            }

            var spells = ScriptsManager.LoadSpellsFromIA($"{args[0]}");

            if (spells == null)
            {
                return;
            }
            foreach (var spell in spells)
            {
                Logger.Default.Log(
                    $@"Spell ({spell.SpellId}), Target: {spell.Target}, Relaunchs: {spell.Relaunchs}, Condition: {
                            spell.HandToHand
                        }");
            }
            if (((Character)account.Character).Ia == null)
            {
                ((Character)account.Character).Ia = new ArtificialIntelligence();
            }
            ((Character)account.Character).Ia.Load(account, args[0]);
        }
示例#3
0
        public JsonResult Delete(int id)
        {
            var _repo  = new ScriptsManager();
            var script = _repo.GetById(id);

            if (script.Id > 0)
            {
                _repo.Delete(script.Id);
                return(Json(true));
            }
            else
            {
                return(Json(false));
            }
        }
示例#4
0
    // Start is called before the first frame update
    void Start()
    {
        attached = false;
        resize   = false;

        Debug.Log("NAME: " + gameObject.name);

        if (gameObject.name == "whileCol" || gameObject.name == "doCol")
        {
            Debug.Log("found: " + gameObject.name);
            scriptsManager = transform.parent.parent.GetComponent <ScriptsManager>();
        }
        else
        {
            Debug.Log("found: " + gameObject.name);
            scriptsManager = GetComponentInParent <ScriptsManager>();
        }
    }
示例#5
0
        public void OnCommand(IAccount account, string[] args)
        {
            if (args.Length < 1)
            {
                Logger.Default.Log("Erreur argument command ." + CommandName + ", LogMessageType.Public");
                return;
            }

            var spells = ScriptsManager.LoadSpellsFromIA($"{args[0]}.lua");

            if (spells == null)
            {
                return;
            }
            foreach (var spell in spells)
            {
                Logger.Default.Log(
                    $@"Spell ({spell.SpellId}), Target: {spell.Target}, Relaunchs: {spell.Relaunchs}, Condition: {
                            spell.Condition
                        }");
            }
        }
示例#6
0
        public JsonResult GetAll()
        {
            var _repo = new ScriptsManager();

            return(Json(new { data = _repo.GetAll() }));
        }
示例#7
0
 /// <summary>
 /// 获取所有脚本
 /// </summary>
 /// <param name="ctx"></param>
 /// <returns></returns>
 public static IExtensionScript[] GetScripts(Context ctx)
 {
     return(ScriptsManager.GetScripts(ctx));
 }
示例#8
0
 /// <summary>
 /// 重载所有脚本
 /// </summary>
 /// <param name="ctx"></param>
 public static void ReloadAllScripts(Context ctx)
 {
     ScriptsManager.ReloadAll(ctx);
 }
示例#9
0
 /// <summary>
 /// 卸载脚本
 /// </summary>
 /// <param name="ctx"></param>
 /// <param name="script"></param>
 public static void UnloadScripts(Context ctx, IExtensionScript script)
 {
     ScriptsManager.Unload(ctx, script);
 }
示例#10
0
 /// <summary>
 /// 加载脚本
 /// </summary>
 /// <param name="ctx"></param>
 /// <param name="path"></param>
 public static void LoadScript(Context ctx, string path)
 {
     ScriptsManager.Load(ctx, path);
 }
 // Use this for initialization
 void Start()
 {
     dialogUI = GameObject.FindWithTag("DialogUI");
     inGameUI = GameObject.FindWithTag("InGameUI");
     n = GameObject.FindWithTag("DialogName").GetComponent<Text>();
     d = GameObject.FindWithTag("DialogText").GetComponent<Text>();
     if (uniqueInstance == null)
         uniqueInstance = this;
     else
         Destroy(this.gameObject);
 }