Пример #1
0
        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);
 }
Пример #11
0
 // 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);
 }