コード例 #1
0
ファイル: Skill.cs プロジェクト: chanyowthea/PixelWorld
    public Skill(int id)
    {
        if (CfgManager.GetInstance().Skills.ContainsKey(id) == false)
        {
            Debug.LogErrorFormat("skill cfg not found: {0}", id);
            return;
        }

        CfgSkill cfg = CfgManager.GetInstance().Skills[id];

        this.id    = cfg.id;
        name       = cfg.name;
        desc       = cfg.desc;
        animation  = cfg.animation;
        sound      = cfg.sound;
        hiteffect  = cfg.hiteffect;
        hitpoints  = cfg.hitpoints;
        targettype = cfg.targettype;
        aoe        = cfg.aoe;
        spcost     = cfg.spcost;
        colddown   = cfg.colddown;

        // skill effects
        int count = cfg.skilleffects.Length;

        if (count > 0)
        {
            skilleffects = new SkillEffect[count];
            for (int i = 0; i < count; i++)
            {
                skilleffects[i] = SkillEffect.CreateSkillEffect(cfg.skilleffects[i], this);
            }
        }
    }
コード例 #2
0
        private void astCfgButton_Click(object sender, RoutedEventArgs e)
        {
            if (!good)
            {
                return;
            }

            try
            {
                AstManager.GetInstance().GenerateStructures(parsed, pkb);
                addLog("AST Create: Ok");
            }
            catch (Exception ex)
            {
                addLog("AST Create: " + ex.GetType().Name + ": " + ex);
                good = false;
                return;
            }

            try
            {
                CfgManager.GetInstance().GenerateStructure(parsed, pkb);
                addLog("CFG Create: Ok");
            }
            catch (Exception ex)
            {
                addLog("CFG Create: " + ex.GetType().Name + ": " + ex);
                good = false;
                return;
            }
            good = true;
        }
コード例 #3
0
ファイル: PanelUpdate.cs プロジェクト: ccUnity3d/PixelWorld
    // 更新检查完成
    void OnDownloadFinish()
    {
        UpdateManager.Instance.UpdateVersion();

        AssetBundleManager.InitDependenceInfo();

        ResourceManager.Instance.Init();

        LanguageManager.GetInstance().Init();

        CfgManager.GetInstance().Init();

        // 初始化lua engine
        LuaFileUtils loader = new LuaResLoader();

        loader.beZip = GameConfig.EnableUpdate;         // 是否读取assetbundle lua文件
        Dictionary <string, string> localfiles = UpdateManager.Instance.LocalFiles;

        foreach (string file in localfiles.Keys)
        {
            if (file.Substring(0, 3) == "lua")
            {
                AssetBundle assetBundle = AssetBundleManager.GetAssetBundle(file);
                string      name        = Path.GetFileNameWithoutExtension(file);
                LuaFileUtils.Instance.AddSearchBundle(name, assetBundle);
            }
        }

        //
        LuaManager luaManager = LuaManager.Instance;

        luaManager.InitStart();
        luaManager.DoFile("Game");
        Util.CallMethod("Game", "OnInitOK");
    }
コード例 #4
0
 public static SkillEffect CreateSkillEffect(int id, Skill skill)
 {
     if (CfgManager.GetInstance().SkillEffects.ContainsKey(id))
     {
         return(new SkillEffect(id, skill));
     }
     return(null);
 }
コード例 #5
0
ファイル: Skill.cs プロジェクト: chanyowthea/PixelWorld
 public static Skill CreateSkill(int id)
 {
     if (CfgManager.GetInstance().Skills.ContainsKey(id))
     {
         return(new Skill(id));
     }
     return(null);
 }
コード例 #6
0
 public static Buff CreateBuff(int id)
 {
     if (CfgManager.GetInstance().Buffs.ContainsKey(id))
     {
         return(new Buff(id));
     }
     return(null);
 }
コード例 #7
0
 public SkillEffect(int id, Skill skill)
 {
     if (CfgManager.GetInstance().SkillEffects.ContainsKey(id) == false)
     {
         Debug.LogErrorFormat("SkillEffect cfg not found: {0}", id);
         return;
     }
     ownSkill = skill;
     cfg      = CfgManager.GetInstance().SkillEffects[id];
 }
コード例 #8
0
 public Enemy SpawnEnemy(int id, Vector3 pos, Quaternion rot)
 {
     if (CfgManager.GetInstance().Monsters.ContainsKey(id))
     {
         string prefab = CfgManager.GetInstance().Monsters [id].prefab;
         Enemy  enemy  = CharacterManager.Instance.AddEnemy(prefab, pos, rot);
         CallMethod("enemy_spawn", enemy);
         return(enemy);
     }
     return(null);
 }
コード例 #9
0
    public Buff(int id)
    {
        if (CfgManager.GetInstance().Buffs.ContainsKey(id) == false)
        {
            Debug.LogErrorFormat("buff cfg not found: {0}", id);
            return;
        }

        cfg     = CfgManager.GetInstance().Buffs[id];
        this.id = cfg.id;

        if (cfg.operation == BuffOperation.OPERATION_HP ||
            cfg.operation == BuffOperation.OPERATION_SP ||
            cfg.operation == BuffOperation.OPERATION_DAMAGE)
        {
            bPeriod     = true;
            periodTimer = cfg.life / cfg.args[0];
        }
    }
コード例 #10
0
ファイル: SkillSummon.cs プロジェクト: chanyowthea/PixelWorld
    private int hitcount = 0;   // 统计攻击次数

    public void SetInfo(int id, Character actor, SkillSummonInfo info)
    {
        ID    = id;
        owner = actor;

        cfg = CfgManager.GetInstance().SkillSummons[info.id];

        skill = actor.GetSkill(info.skillid);

        // skill effects
        int count = cfg.skilleffects.Length;

        if (count > 0)
        {
            skilleffects = new SkillEffect[count];
            for (int i = 0; i < count; i++)
            {
                skilleffects[i] = SkillEffect.CreateSkillEffect(cfg.skilleffects[i], skill);
            }
        }
    }
コード例 #11
0
ファイル: Character.cs プロジェクト: chanyowthea/PixelWorld
 public void AddSummon(int uid, Vector3 pos, Quaternion rot, SkillSummonInfo info)
 {
     if (CfgManager.GetInstance().SkillSummons.ContainsKey(info.id))
     {
         CfgSkillSummon cfg    = CfgManager.GetInstance().SkillSummons[info.id];
         GameObject     prefab = (GameObject)ResourceManager.Instance.LoadAsset(cfg.prefab);
         GameObject     go     = Instantiate(prefab) as GameObject;
         go.tag = gameObject.tag + "Missile";
         go.transform.localScale = Vector3.one;
         go.transform.rotation   = rot;
         if (cfg.speed > 0)              //移动
         {
             go.transform.position = pos + new Vector3(0, 0.5f, 0) + transform.forward * 0.5f;
         }
         else
         {
             go.transform.position = pos;
         }
         SkillSummon summon = go.AddComponent <SkillSummon>();
         summon.SetInfo(uid, this, info);
     }
 }
コード例 #12
0
ファイル: Program.cs プロジェクト: sandfrozen/SpaWpfApp
        static void Main(string[] args)
        {
            string SourceCode = "";
            PkbAPI pkb;

            if (args.Length == 0)
            {
                Console.WriteLine("No parameter with path to file");
                Console.WriteLine("Program exit.");
                return;
            }

            string path = args[0];

            try
            {
                SourceCode = File.ReadAllText(path);
                Console.WriteLine("File ok: " + path);

                SourceCode = ParserByTombs.Instance.Parse(SourceCode);
                Console.WriteLine("Source Parsed ok");

                pkb = ParserByTombs.Instance.pkb;
                QueryEvaluator.GetInstance().pkb = pkb;
                QueryProjector.GetInstance().Pkb = pkb;
                Console.WriteLine("PKB ok");

                AstManager.GetInstance().GenerateStructures(SourceCode, pkb);
                Console.WriteLine("AST ok");

                CfgManager.GetInstance().GenerateStructure(SourceCode, pkb);
                Console.WriteLine("CFG ok");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Before");
                Console.WriteLine(ex.GetType().Name + ": " + ex);
            }
            Console.WriteLine("Ready");

            int i = 0;

            while (true)
            {
                string answer = "";
                string query  = Console.ReadLine();
                query += " " + Console.ReadLine();

                try
                {
                    query = QueryPreProcessor.GetInstance().Parse(query);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("#" + ex.GetType().Name + ": " + ex.Message);
                    continue;
                }

                try
                {
                    List <Condition> conditionsList = QueryPreProcessor.GetInstance().conditionsList;
                    QueryEvaluator.GetInstance().Evaluate(conditionsList);
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    try
                    {
                        QueryResult    queryResult    = QueryResult.GetInstance();
                        QueryProjector queryProjector = QueryProjector.GetInstance();
                        answer = queryProjector.PrintResult();
                    }
                    catch (Exception ex)
                    {
                        answer = "none";
                    }
                }
                Console.WriteLine(answer);
            }

            Console.WriteLine("Program exit.");
            return;
        }