Example #1
0
    private void OnGUI()
    {
        levelScriptable = (MonsterConfig)EditorGUILayout.ObjectField(levelScriptable, typeof(MonsterConfig), false);


        if (GUI.Button(new Rect(30, 30, 50, 30), "Load"))
        {
            LevelEditor levelEditorWindow = (LevelEditor)GetWindow(typeof(LevelEditor));

            if (levelScriptable != null)
            {
                Debug.Log(levelScriptable.rooms);
                if (levelScriptable.rooms.Count > 0)
                {
                    foreach (BaseNode node in levelScriptable.rooms)
                    {
                        levelEditorWindow.NewNode(node.x, node.y);
                    }
                }
            }

            levelEditorWindow.Show();
        }

        /*
         * EditorGUILayout.LabelField("Quedan cosas por hacer aca. Pero iria un espacio para cargar un prefab/scriptable object de un nivel.");
         * EditorGUILayout.LabelField("Una vez lleno ese espacio, podemos clickear LOAD y se abriria la ventana de Level Editor");
         * EditorGUILayout.LabelField("Cerrando a su vez esta ventana y la ventana de Start Up");
         */
    }
Example #2
0
    public void Open()
    {
        var cell = MatchManager.Instance.GetCell(Id);

        if (cell.IsHide) //翻开
        {
            cell.IsHide = false;
            transform.Find("Blood").gameObject.SetActive(true);
            transform.Find("Str").gameObject.SetActive(true);

            MonsterId = cell.MonsterId;
            MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(MonsterId);
            cell.Str    = monsterConfig.Atk;
            cell.HpLeft = monsterConfig.Hp;
            //Debug.Log("aaaa" + Id + "aaa" + cell.MonsterId + monsterConfig.Name);

            transform.GetChild(0).GetComponent <AutoSpriteLoader>().Load(monsterConfig.Url + ".jpg");
            transform.Find("Race").GetComponent <AutoSpriteLoader>().Load(string.Format("chessg{0}.png", monsterConfig.Group));

            iTween.RotateBy(gameObject, new Vector3(0, 1f, 0), 1);
            StartCoroutine(LateColor());

            if (monsterConfig.Group == (int)MonsterGroupTypes.King)
            {
                panel.ShakeAll(Id);
            }
        }
    }
Example #3
0
        // Use this for initialization
        public override void Init(GameObject gObject)
        {
            base.Init(gObject);
            handCollider = enemyTransform.Find(BoneName.ENEMY_HAND).gameObject.GetComponent <Collider>();
            lastTarget   = Vector3.zero;
            MonsterConfig mConf = gConfig.GetMonsterConfig("Zombie");

            hp              = mConf.hp * gameScene.GetDifficultyHpFactor;
            attackDamage    = mConf.damage * gameScene.GetDifficultyDamageFactor;
            attackFrequency = mConf.attackRate;
            runSpeed        = mConf.walkSpeed;
            lootCash        = mConf.lootCash;


            RandomRunAnimation();

            if (IsElite)
            {
                hp           *= 3;
                runSpeed     += 2;
                attackDamage *= 2;
                animation[runAnimationName].speed = 1.5f;
            }


            TimerManager.GetInstance().SetTimer(TimerName.ZOMBIE_AUDIO, 8.0f, true);

            //animation[runAnimationName].speed = 1.5f;
        }
Example #4
0
        static Question GetQuestionInfoMonster()
        {
            string[] eids = { "hp", "race", "star", "type", "atk", "def" };
            string[] cids = { "初始生命值", "种族", "星级", "属性", "初始攻击", "初始防御" };
            int      type = MathTool.GetRandom(eids.Length);

            MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(MonsterBook.GetRandMonsterId());
            Question      question      = new Question();

            question.info = string.Format("|以下哪一个怪物的{0}是|Yellow|{1}||?", cids[type], MonsterBook.GetAttrByString(monsterConfig.Id, eids[type]));
            question.ans  = new string[4];
            question.ans[MathTool.GetRandom(4)] = monsterConfig.Name;
            int idx = 0;
            SimpleSet <string> set = new SimpleSet <string>();

            set.Add(MonsterBook.GetAttrByString(monsterConfig.Id, eids[type]));
            while (idx < 4)
            {
                if (question.ans[idx] != null)
                {
                    idx++;
                    continue;
                }

                MonsterConfig guessConfig = ConfigData.GetMonsterConfig(MonsterBook.GetRandMonsterId());
                if (!set.Has(guessConfig.Name) && MonsterBook.GetAttrByString(monsterConfig.Id, eids[type]) != MonsterBook.GetAttrByString(guessConfig.Id, eids[type]))
                {
                    question.ans[idx] = guessConfig.Name;
                    set.Add(guessConfig.Name);
                    idx++;
                }
            }
            question.result = monsterConfig.Name;
            return(question);
        }
Example #5
0
 public MonsterAttack(Transform transform, Animator animator, MonsterConfig cfg)
 {
     this.transform    = transform;
     this.animator     = animator;
     commonAttackRange = new Vector3(0.5f, 0.25f, 0.5f);
     this.cfg          = cfg;
 }
Example #6
0
 public static void Spawn(int x, int y, GameObject prefab)
 {
     World.Grid grid = World.Instance.GetGrid();
     World.Cell cell = grid.GetCell(x, y);
     if (!cell.IsBlocked)
     {
         //Vector3 position = new Vector3(x, heightOffset, y);
         GameObject spawn = Instantiate <GameObject>(prefab);
         spawn.transform.position = spawn.transform.position;
         SynchronizedActor actor = spawn.GetComponent <SynchronizedActor>();
         if (actor != null)
         {
             Entity entity = null;
             if (actor.tag == "Player")
             {
                 entity = new Player(x, y, EntityStatistics.GetRandomPlayerStats());
             }
             else if (actor.tag == "Enemy")
             {
                 MonsterConfig config = spawn.GetComponent <MonsterConfig>();
                 entity = new Monster(x, y, config.GetStats());
             }
             if (entity != null)
             {
                 actor.InitActor(entity);
             }
         }
     }
 }
Example #7
0
        public static Image GetMonsterImage(int id, int width, int height)
        {
            MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(id);

            string fname = string.Format("Monsters/{0}{1}x{2}", monsterConfig.Icon, width, height);

            if (!ImageManager.HasImage(fname))
            {
                Image image = PicLoader.Read("Monsters", string.Format("{0}.JPG", monsterConfig.Icon));
                if (image == null)
                {
                    NLog.Error(string.Format("GetMonsterImage {0} {1} not found", id, fname));
                    return(null);
                }
#if DEBUG
                if (monsterConfig.Remark.Contains("未完成"))
                {
                    Graphics g    = Graphics.FromImage(image);
                    var      icon = PicLoader.Read("System", "NotFinish.PNG");
                    g.DrawImage(icon, 0, 0, 180, 180);
                    g.Save();
                }
#endif
                if (image.Width != width || image.Height != height)
                {
                    image = image.GetThumbnailImage(width, height, null, new IntPtr(0));
                }
                ImageManager.AddImage(fname, image);
            }
            return(ImageManager.GetImage(fname));
        }
Example #8
0
File: Swat.cs Project: kidundead/ow
        public override void Init(GameObject gObject)
        {
            base.Init(gObject);
            hitParticles = rConfig.hitparticles;
            lineR        = enemyObject.GetComponent <Renderer>() as LineRenderer;

            attackRange = 14.0f;

            MonsterConfig mConf = gConfig.GetMonsterConfig("Swat");

            hp              = mConf.hp * gameScene.GetDifficultyHpFactor;
            attackDamage    = mConf.damage * gameScene.GetDifficultyDamageFactor;
            attackFrequency = mConf.attackRate;
            runSpeed        = mConf.walkSpeed;
            lootCash        = mConf.lootCash;
            RandomRunAnimation();


            if (IsElite)
            {
                hp           *= 1.5f;
                runSpeed     += 2f;
                attackDamage *= 1.5f;
                animation[runAnimationName].speed = 1.2f;
            }

            TimerManager.GetInstance().SetTimer(TimerName.NURSE_AUDIO, 12.0f, true);
            //animation[runAnimationName].speed = 1.5f;
        }
        private void ReadMonsterConfig()
        {
            string monsterConfigContent =
                ((TextAsset)EditorGUIUtility.Load("Assets/Resources/Config/General/MonsterConfig.txt")).text;

            monsterConfig = JsonMapper.ToObject <MonsterConfig>(monsterConfigContent);
            challengePresetAsset?.SetMonsterConfig(monsterConfig);
        }
	public GhostInfo (MonsterConfig config, int level, int HP, int curArmor, int curMaxArmor)
	{
		monsterTemplate = config;
		id = config.id;
		curBlood = HP;   
		this.curArmor = curArmor;
		this.curMaxArmor = curMaxArmor;
	}
Example #11
0
        public static void HandleLeveling(ref MonsterConfig monster)
        {
            monster.experience += 1;
            var monsterLevel = monster.critter.GetLevel();

            Debug.LogWarning($"[{MODNAME}] Monster Level: {monsterLevel}");
            Debug.LogWarning($"[{MODNAME}] Monster Experience: {monster.experience}");
        }
Example #12
0
    void LoadMonstersConf(XmlReader reader)
    {
        MonsterConfig mConf = new MonsterConfig();
        string        name  = "";

        if (reader.HasAttributes)
        {
            while (reader.MoveToNextAttribute())
            {
                if (reader.Name == "name")
                {
                    name = reader.Value;
                }
                else if (reader.Name == "damage")
                {
                    mConf.damage = float.Parse(reader.Value);
                }
                else if (reader.Name == "attackRate")
                {
                    mConf.attackRate = float.Parse(reader.Value);
                }
                else if (reader.Name == "walkSpeed")
                {
                    mConf.walkSpeed = float.Parse(reader.Value);
                }
                else if (reader.Name == "hp")
                {
                    mConf.hp = float.Parse(reader.Value);
                }
                else if (reader.Name == "rushSpeed")
                {
                    mConf.rushSpeed = float.Parse(reader.Value);
                }
                else if (reader.Name == "rushDamage")
                {
                    mConf.rushDamage = float.Parse(reader.Value);
                }
                else if (reader.Name == "rushAttack")
                {
                    mConf.rushAttackDamage = float.Parse(reader.Value);
                }
                else if (reader.Name == "rushRate")
                {
                    mConf.rushInterval = float.Parse(reader.Value);
                }
                else if (reader.Name == "score")
                {
                    mConf.score = int.Parse(reader.Value);
                }
                else if (reader.Name == "lootCash")
                {
                    mConf.lootCash = int.Parse(reader.Value);
                }
            }
        }

        monsterConfTable.Add(name, mConf);
    }
        public void OnGUI()
        {
            if (monsterConfig == null)
            {
                string monsterConfigContent =
                    ((TextAsset)EditorGUIUtility.Load("Assets/Resources/Config/General/MonsterConfig.txt")).text;
                monsterConfig = JsonMapper.ToObject <MonsterConfig>(monsterConfigContent);
                List <int> listAllGroupIds = monsterConfig.ListAllGroupIds();
                listAllGroupIds.Sort((i, i1) => { return(i - i1); });
                poolOfCharacterGroupId = new List <int>(listAllGroupIds);
            }

            if (equipmentVisualConfig == null)
            {
                poolOfWeaponVisualId = new List <int>();
                poolOfWeaponName     = new List <string>();
                CharacterId characterId = new CharacterId(1, 1);
                string      equipmentVisualConfigContent =
                    ((TextAsset)EditorGUIUtility.Load("Assets/Resources/Config/General/EquipmentVisualConfig.txt"))
                    .text;
                equipmentVisualConfig = JsonMapper.ToObject <EquipmentVisualConfig>(equipmentVisualConfigContent);
                IEnumerable <KeyValuePair <string, EquipmentVisualAvailableInfo> > allEquipmentVisualAvailableInfos =
                    equipmentVisualConfig.GetAllEquipmentVisualAvailableInfos(EquipmentType.Weapon);
                List <KeyValuePair <string, EquipmentVisualAvailableInfo> > sorted = new List <KeyValuePair <string, EquipmentVisualAvailableInfo> >(allEquipmentVisualAvailableInfos);
                sorted.Sort((pair1, pair2) => { return(pair1.Value.VisualId.CompareTo(pair2.Value.VisualId)); });
                HashSet <int> uniqueVisualIds = new HashSet <int>();
                foreach (KeyValuePair <string, EquipmentVisualAvailableInfo> pair in sorted)
                {
                    if (!uniqueVisualIds.Contains(pair.Value.VisualId))
                    {
                        uniqueVisualIds.Add(pair.Value.VisualId);
                        poolOfWeaponVisualId.Add(pair.Value.VisualId);
                        poolOfWeaponName.Add(pair.Value.GetLocalizeName(characterId));
                    }
                }
            }

            if (foldout == null)
            {
                Foldout f = LoadFoldout(this);
                if (f == null)
                {
                    f = new Foldout();
                }

                foldout = f;
            }

            EditorGUI.BeginChangeCheck();
            DrawProxyNames();
            DrawProxyEntries(foldout);
            if (EditorGUI.EndChangeCheck())
            {
                EditorUtility.SetDirty(this);
                SaveFoldout(this, foldout);
            }
        }
Example #14
0
    // Use this for initialization
    void Start()
    {
        ConfigLoader.Load();

        MonsterConfig   monsterCfg = MonsterConfig.Get(210102);
        EquipConfig     equipCfg   = EquipConfig.Get(601110);
        TestTypesConfig typesCfg   = TestTypesConfig.Get("1");

        print(monsterCfg.name);
        print(equipCfg.boxBonus);
        print(typesCfg.p15);
    }
Example #15
0
    /** 选择怪物 */
    public void chooseMonster(MonsterConfig config)
    {
        _chooseElementType   = SceneElementType.Monster;
        _chooseMonsterConfig = config;

        cancelPick();
        cancelSelect();

        _tempData = createNewElement(SceneElementType.Monster, config.id);

        selectElement(_tempData);
        pickUpSelect();
    }
Example #16
0
        public void RefreshData(DbCardProduct pro)
        {
            show    = pro.Id != 0;
            product = pro;
            if (product.Id != 0)
            {
                virtualRegion.SetRegionKey(1, product.Cid);
            }

            string effectName = "";
            var    card       = CardAssistant.GetCard(product.Cid);

            if (card.GetCardType() == CardTypes.Monster)
            {
                MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(product.Cid);
                foreach (var skill in MonsterBook.GetSkillList(monsterConfig.Id))
                {
                    int         skillId     = skill.Id;
                    SkillConfig skillConfig = ConfigData.GetSkillConfig(skillId);
                    if (skillConfig.Cover != null)
                    {
                        effectName = skillConfig.Cover;
                    }
                }
                if (monsterConfig.Cover != "")
                {
                    effectName = monsterConfig.Cover;
                }
            }

            string nowEffectName = "";

            if (coverEffect != null)
            {
                nowEffectName = coverEffect.Name;
            }

            if (effectName != nowEffectName)
            {
                if (effectName == "")
                {
                    coverEffect = null;
                }
                else
                {
                    coverEffect = new CoverEffect(EffectBook.GetEffect(effectName), new Point(x + 12, y + 14), new Size(64, 84));
                }
            }

            parent.Invalidate(new Rectangle(x + 12, y + 14, 64, 84));
        }
Example #17
0
        public override void Init(IConfig cfg)
        {
            base.Init(cfg);
            MonsterConfig mCfg = (MonsterConfig)cfg;

            mName      = mCfg.Name;
            Hp         = mCfg.HP;
            Power      = mCfg.Power;
            Poise      = mCfg.Poise;
            PoiseValue = 0;
            Speed      = mCfg.Speed;
            Exp        = mCfg.Exp;
            mIsInited  = true;
        }
        private void ReadMonsterConfig()
        {
            string monsterConfigContent =
                ((TextAsset)EditorGUIUtility.Load("Assets/Resources/Config/General/MonsterConfig.txt")).text;

            monsterConfig = JsonMapper.ToObject <MonsterConfig>(monsterConfigContent);

            string staticMonsterConfigContent =
                ((TextAsset)EditorGUIUtility.Load("Assets/Resources/Config/General/StaticMonsterConfig.txt")).text;
            StaticMonsterConfig staticMonsterConfig =
                JsonMapper.ToObject <StaticMonsterConfig>(staticMonsterConfigContent);

            monsterConfig.Merge(staticMonsterConfig);
        }
Example #19
0
 public void LoadConfigs()
 {
     ItemConfig.LoadCsvCfg();
     AnimConfig.LoadCsvCfg();
     PlayerConfig.LoadCsvCfg();
     MonsterConfig.LoadCsvCfg();
     BossConfig.LoadCsvCfg();
     BuffConfig.LoadCsvCfg();
     SkillConfig.LoadCsvCfg();
     LevelConfig.LoadCsvCfg();
     BulletConfig.LoadCsvCfg();
     BarrageConfig.LoadCsvCfg();
     ColliderConfig.LoadCsvCfg();
 }
Example #20
0
        public void GUI_Item(MonsterConfig config)
        {
            GUILayout.Space(10);
            EditorGUILayout.BeginHorizontal();

            GUILayout.Label(config.id + "", style_label_id, GUILayout.Width(100), GUILayout.Height(200));

            Texture2D icon = Resources.Load <Texture2D>(config.avatarConfig.full);

            if (GUILayout.Button(icon, GUILayout.Width(200), GUILayout.Height(200)))
            {
                if (sOnSelect != null)
                {
                    sOnSelect(config, onSelectParameter);

                    sOnSelect         = null;
                    onSelectParameter = null;
                }
            }

            EditorGUILayout.BeginVertical();
            GUILayout.Space(20);
            GUILayout.Label(config.name, style_label_name);
            GUILayout.Space(20);

            foreach (Prop prop in config.props)
            {
                if (prop.value == 0)
                {
                    continue;
                }
                if (isShowPropId)
                {
                    GUILayout.Label(prop.id + " " + prop.Name + ":" + prop.ValueStr, GUILayout.Width(150));
                }
                else
                {
                    GUILayout.Label(prop.Name + ":" + prop.ValueStr, GUILayout.Width(150));
                }
            }


            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();
            GUILayout.Space(10);
            GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
        }
Example #21
0
        public Monster(int id)
        {
            MonsterConfig = ConfigData.GetMonsterConfig(id);
            Def           = MonsterConfig.Def;
            Spd           = MonsterConfig.Spd;
            Mag           = MonsterConfig.Mag;
            Luk           = MonsterConfig.Luk;
            Hit           = MonsterConfig.Hit;
            Dhit          = MonsterConfig.Dhit;
            Crt           = MonsterConfig.Crt;
            Mov           = MonsterConfig.Mov;
            Range         = MonsterConfig.Range;

            Name = MonsterConfig.Name;
            UpgradeToLevel1();
        }
Example #22
0
        // Use this for initialization
        public override void Init(GameObject gObject)
        {
            base.Init(gObject);
            handCollider     = enemyTransform.Find(BoneName.ENEMY_HAND).GetComponent <Collider>();
            leftHandCollider = enemyTransform.Find(BoneName.ENEMY_LEFTHAND).GetComponent <Collider>();


            collider    = enemyTransform.GetComponent <Collider>();
            controller  = enemyTransform.GetComponent <Collider>() as CharacterController;
            lastTarget  = Vector3.zero;
            attackRange = 3f;

            onhitRate       = 10f;
            lastRushingTime = -99;
            startAttacking  = false;
            rushingCollided = false;
            rushingAttacked = false;

            detectionRange = 120.0f;
            MonsterConfig mConf = gConfig.GetMonsterConfig("Hunter");

            hp              = mConf.hp * gameScene.GetDifficultyHpFactor;
            attackDamage    = mConf.damage * gameScene.GetDifficultyDamageFactor;
            attackFrequency = mConf.attackRate;

            runSpeed            = mConf.walkSpeed;
            rushingInterval     = mConf.rushInterval;
            rushingSpeed        = mConf.rushSpeed;
            rushingDamage       = mConf.rushDamage * gameScene.GetDifficultyDamageFactor;
            rushingAttackDamage = mConf.rushAttackDamage * gameScene.GetDifficultyDamageFactor;
            lootCash            = mConf.lootCash;

            if (IsElite)
            {
                hp *= 1.5f;
            }



            animation[AnimationName.ENEMY_RUN].speed = 1.5f;
            //animation[AnimationName.ENEMY_GOTHIT].speed = 0.1f;
            animation[AnimationName.ENEMY_JUMPSTART].wrapMode = WrapMode.ClampForever;
            animation[AnimationName.ENEMY_JUMPING].wrapMode   = WrapMode.Loop;
            animation[AnimationName.ENEMY_JUMPGEND].wrapMode  = WrapMode.ClampForever;
        }
Example #23
0
        // Use this for initialization
        public override void Init(GameObject gObject)
        {
            base.Init(gObject);

            if (Application.loadedLevelName == SceneName.SCENE_ARENA)
            {
                pathFinding = new FastPathFinding();
            }
            handCollider     = enemyTransform.Find(BoneName.ENEMY_HAND).GetComponent <Collider>();
            leftHandCollider = enemyTransform.Find(BoneName.ENEMY_LEFTHAND).GetComponent <Collider>();


            collider    = enemyTransform.GetComponent <Collider>();// enemyTransform.Find(BoneName.ENEMY_BODY).collider;
            controller  = enemyTransform.GetComponent <Collider>() as CharacterController;
            lastTarget  = Vector3.zero;
            attackRange = 3f;

            onhitRate       = 10f;
            lastRushingTime = -99;
            startAttacking  = false;
            rushingCollided = false;
            rushingAttacked = false;

            MonsterConfig mConf = gConfig.GetMonsterConfig("Tank");

            hp                  = mConf.hp * gameScene.GetDifficultyHpFactor;
            attackDamage        = mConf.damage * gameScene.GetDifficultyDamageFactor;
            attackFrequency     = mConf.attackRate;
            runSpeed            = mConf.walkSpeed;
            rushingInterval     = mConf.rushInterval;
            rushingSpeed        = mConf.rushSpeed;
            rushingDamage       = mConf.rushDamage * gameScene.GetDifficultyDamageFactor;
            rushingAttackDamage = mConf.rushAttackDamage * gameScene.GetDifficultyDamageFactor;
            lootCash            = mConf.lootCash;

            if (IsElite)
            {
                hp                  *= 1.2f;
                runSpeed            += 1f;
                attackDamage        *= 1.2f;
                rushingDamage       *= 1.2f;
                rushingAttackDamage *= 1.2f;
            }
        }
Example #24
0
    /** 重新加载配置 */
    private void reloadConfig()
    {
        long now = Ctrl.getTimer();

        BaseC.config.loadSyncForEditorAll();

        long now2 = Ctrl.getTimer();

        Ctrl.print("editor加载配置All完成,耗时:", now2 - now);

        int i = 0;

        _sceneList     = new SList <SceneConfig>();
        _sceneListStrs = new string[SceneConfig.getDic().size()];

        SceneConfig.getDic().getSortedKeyList().forEach(k =>
        {
            SceneConfig config = SceneConfig.get(k);
            _sceneList.add(config);
            _sceneListStrs[i++] = config.id + ":" + config.name;
        });

        i                = 0;
        _monsterList     = new SList <MonsterConfig>();
        _monsterListStrs = new string[MonsterConfig.getDic().size()];

        MonsterConfig.getDic().getSortedKeyList().forEach(k =>
        {
            MonsterConfig config = MonsterConfig.get(k);
            _monsterList.add(config);
            _monsterListStrs[i++] = config.id + ":" + config.name;
        });

        i = 0;
        _operationList     = new SList <OperationConfig>();
        _operationListStrs = new string[OperationConfig.getDic().size()];

        OperationConfig.getDic().getSortedKeyList().forEach(k =>
        {
            OperationConfig config = OperationConfig.get(k);
            _operationList.add(config);
            _operationListStrs[i++] = config.id + ":" + config.name;
        });
    }
Example #25
0
        public static string GetAttrByString(int id, string des)
        {
            MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(id);

            switch (des)
            {
            case "hp": return(monsterConfig.VitP.ToString());   //todo

            case "race": return(Core.HSTypes.I2CardTypeSub(monsterConfig.Type));

            case "type": return(Core.HSTypes.I2Attr(monsterConfig.Attr));

            case "star": return(monsterConfig.Star.ToString());

            case "atk": return(monsterConfig.AtkP.ToString());
                //     case "def": return monsterConfig.DefP.ToString();
            }
            return("");
        }
Example #26
0
    public static void Load()
    {
        //各配置加载自动生成在此行下面
        int    startIndex  = ConfigManagerSettings.FilesURL.LastIndexOf("Resources/") + 10;
        int    length      = ConfigManagerSettings.FilesURL.Length - startIndex;
        string relativeURL = ConfigManagerSettings.FilesURL.Substring(startIndex, length);

        string EquipText = Resources.Load <TextAsset>(relativeURL + "/" + "Equip").text;

        EquipConfig.Parse(EquipText);

        string MonsterText = Resources.Load <TextAsset>(relativeURL + "/" + "Monster").text;

        MonsterConfig.Parse(MonsterText);

        string TestTypesText = Resources.Load <TextAsset>(relativeURL + "/" + "TestTypes").text;

        TestTypesConfig.Parse(TestTypesText);
    }
Example #27
0
    public static void Parse(string cfgStr)
    {
        Map = new Dictionary <uint, MonsterConfig>();
        string[][] configArray = ConfigUtils.ParseConfig(cfgStr);
        int        len         = configArray.Length;

        for (int i = 3; i < len; i++)
        {
            string[]      args = configArray[i];
            MonsterConfig cfg  = new MonsterConfig();

            cfg.id             = uint.Parse(args[0]);
            cfg.name           = Convert.ToString(args[1]);
            cfg.coinBase       = byte.Parse(args[2]);
            cfg.tokenBase      = byte.Parse(args[3]);
            cfg.expBase        = byte.Parse(args[4]);
            cfg.eggID          = uint.Parse(args[5]);
            cfg.Attack         = uint.Parse(args[6]);
            cfg.HealthPpint    = uint.Parse(args[7]);
            cfg.HealthRegen    = float.Parse(args[8]);
            cfg.SkillAttack    = uint.Parse(args[9]);
            cfg.AttackSpead    = float.Parse(args[10]);
            cfg.AttackRange    = float.Parse(args[11]);
            cfg.CritChance     = float.Parse(args[12]);
            cfg.CriticalDamage = float.Parse(args[13]);
            cfg.SplashDamage   = float.Parse(args[14]);
            cfg.Dodge          = float.Parse(args[15]);
            cfg.MoveSpeed      = float.Parse(args[16]);
            cfg.modelID        = Convert.ToString(args[17]);
            cfg.modelSize      = float.Parse(args[18]);
            cfg.effectName     = Convert.ToString(args[19]);
            cfg.effectTime     = float.Parse(args[20]);
            cfg.atkAnime       = int.Parse(args[21]);
            cfg.detail1        = Convert.ToString(args[22]);
            cfg.detail2        = Convert.ToString(args[23]);
            cfg.detail3        = Convert.ToString(args[24]);


            Map[cfg.id] = cfg;
        }
    }
Example #28
0
            public static void Postfix(ref Tameable __instance)
            {
                if (__instance.m_character.IsTamed())
                {
                    monster = new MonsterConfig();

                    monster.critter    = __instance.m_character;
                    monster.monsterID  = __instance;
                    monster.experience = 0;

                    if (FindMonster(monster, ref monsters))
                    {
                        Debug.LogWarning("Found Monster.");
                    }
                    else
                    {
                        Debug.LogWarning("Added Monster.");
                        monsters.Add(monster);
                    }
                }
            }
Example #29
0
        private static void TryUpdateCache(int id)
        {
            if (!pieces.ContainsKey(id))
            {
                MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(id);
                pieces[id] = new List <CardPieceRate>();
                if (monsterConfig.DropId1 > 0)
                {
                    pieces[id].Add(CardPieceRate.FromCardPiece(monsterConfig.DropId1, monsterConfig.Star));
                }
                if (monsterConfig.DropId2 > 0)
                {
                    pieces[id].Add(CardPieceRate.FromCardPiece(monsterConfig.DropId2, monsterConfig.Star));
                }

                foreach (CardPieceRaceConfig cardPieceConfig in ConfigData.CardPieceRaceDict.Values)
                {
                    if (cardPieceConfig.Race != -1 && cardPieceConfig.Race != monsterConfig.Type)
                    {
                        continue;
                    }

                    if (cardPieceConfig.Attr != -1 && cardPieceConfig.Attr != monsterConfig.Attr)
                    {
                        continue;
                    }

                    if (monsterConfig.Star >= cardPieceConfig.DropStarMin && monsterConfig.Star <= cardPieceConfig.DropStarMax)
                    {
                        var rate = CardPieceRate.FromCardRacePiece(cardPieceConfig.Id, monsterConfig.Star);
                        if (rate.Rate > 0)
                        {
                            pieces[id].Add(rate);
                        }
                    }
                }

                pieces[id].Sort((a, b) => b.Rate - a.Rate);
            }
        }
Example #30
0
    protected override void RegistAttribute()
    {
        base.RegistAttribute();
        _cfg = MonsterConfig.GetData(Id);

        gameObject.name = _cfg.Name;
        var _hp = new GameRangeAttribute(E_Attribute.Hp.ToString(), 0, _cfg.Hp);

        m_Hp = AddRangeAttribute(_hp);
        var _mp = new GameRangeAttribute(E_Attribute.Mp.ToString(), 0, _cfg.Mp, 0.1f);

        m_Mp = AddRangeAttribute(_mp);
        var _attack = new GameAttribute(E_Attribute.Atk.ToString(), _cfg.Attack);

        m_Attack = AddAttribute(_attack);
        var _moveSpeed = new GameAttribute(E_Attribute.MoveSpeed.ToString(), _cfg.MoveSpeed);

        m_MoveSpeed = AddAttribute(_moveSpeed);

        m_CaculateDelta = TimerManager.Instance.AddListener(0, 0.02f, m_MonoAttribute.CaculateRangeDelta, null, true);
        AttackTarget    = GameManager.Player;
    }
Example #31
0
    private void makeElementModel(SceneElementEditorData data)
    {
        switch (data.config.type)
        {
        case SceneElementType.Npc:
        {
        }
        break;

        case SceneElementType.Monster:
        {
            MonsterConfig monsterConfig = MonsterConfig.get(data.config.id);

            data.gameObject = createModel(FightUnitConfig.get(monsterConfig.fightUnitID).modelID, data);
        }
        break;

        case SceneElementType.Operation:
        {
            OperationConfig operationConfig = OperationConfig.get(data.config.id);

            data.gameObject = createModel(operationConfig.modelID, data);
        }
        break;

        case SceneElementType.FieldItem:
        {
            ItemConfig itemConfig = ItemConfig.get(data.config.id);

            data.gameObject = createModel(itemConfig.fieldItemModelID, data);
        }
        break;
        }

        setPosToGameObject(data);
    }
	public void SpawnMonster (MonsterConfig monster, int level, int HP, int armor, int maxArmor, Vector3 pos, float dir, BoolAction<GameObject> Cb = null)
	{

	}
	void PreLoadMonster (MonsterConfig monster)
	{

	}
	public void SpawnObstructObject (MonsterConfig monster, IBattleInfo ghost)
	{
		
	}