Exemple #1
0
        /// <summary>
        /// Get parameter from Config table in DB
        /// </summary>
        /// <param name="parm">Parm value desired</param>
        /// <param name="def">default value if no parm</param>
        /// <returns>Parm value or default</returns>
        private string GetParm(string parm, string def)
        {
            string value = string.Empty;
            string group = (UseTestDB) ? "PODFOReports.Test" : "PODFOReports";

            value = Conf.Get(group, parm);
            if (string.IsNullOrEmpty(value))
            {
                value = def;
            }
            return(value);
        }
Exemple #2
0
    public void Show(SaveableNumberDictionary <int> items, Action <int> selectCallback = null, Func <Jyx2Item, bool> filter = null)
    {
        HSUnityTools.DestroyChildren(m_Container);
        callback = selectCallback;
        foreach (var kv in items)
        {
            string id    = kv.Key;
            int    count = kv.Value;

            var item = ConfigTable.Get <Jyx2Item>(id);
            if (item == null)
            {
                Debug.LogError("调用了错误的物品,id=" + id);
                continue;
            }

            //过滤器逻辑
            if (filter != null && filter(item) == false)
            {
                continue;
            }

            var itemUI = Jyx2ItemUI.Create(int.Parse(id), count);
            itemUI.transform.SetParent(m_Container);
            var btn = itemUI.GetComponent <Button>();

            btn.onClick.RemoveAllListeners();
            btn.onClick.AddListener(() => {
                SelectItem(itemUI);
            });
        }
    }
Exemple #3
0
    /// <summary>
    /// 获取当前所在地图
    /// </summary>
    /// <returns></returns>
    public GameMap GetCurrentGameMap()
    {
        string sceneName = SceneManager.GetActiveScene().name;
        var    gameMap   = ConfigTable.Get <GameMap>(sceneName);

        return(gameMap);
    }
Exemple #4
0
    public void Show(int roleId, string msg, int type, Action callback)
    {
        _currentText = $"{msg}";
        _callback    = callback;
        SelectionPanel_RectTransform.gameObject.SetActive(false);

        HeadAvataPre_RectTransform.gameObject.SetActive(!(type == 2 || type == 3));

        //不显示人物
        if (type == 2 || type == 3)
        {
            RoleHeadImage_Image.gameObject.SetActive(false);
        }
        else
        {
            var headMapping = ConfigTable.Get <Jyx2RoleHeadMapping>(roleId);
            if (headMapping != null && !string.IsNullOrEmpty(headMapping.HeadAvata))
            {
                ShowCharacter(headMapping.HeadAvata);
                //RoleHeadImage_Image.gameObject.SetActive(true);
            }
            else
            {
                RoleHeadImage_Image.gameObject.SetActive(false);
            }
        }
        ShowText();
    }
Exemple #5
0
        /// <summary>
        /// 获取场景进入条件码
        /// </summary>
        /// <param name="scene"></param>
        /// <returns></returns>
        public int GetSceneEntranceCondition(string scene)
        {
            scene = scene.Split('&')[0]; //处理一些特殊格式的

            var gamemap = ConfigTable.Get <GameMap>(scene);

            if (gamemap != null)
            {
                //大地图
                if (gamemap.Tags == "WORLDMAP")
                {
                    return(0);
                }

                //已经有地图打开的纪录
                string key = "SceneEntraceCondition_" + gamemap.Jyx2MapId;
                if (KeyValues.ContainsKey(key))
                {
                    return(int.Parse(GetKeyValues(key)));
                }

                //否则取配置表初始值
                var map = ConfigTable.Get <Jyx2Map>(gamemap.Jyx2MapId);
                if (map != null)
                {
                    return(map.EnterCondition);
                }
            }

            return(-1);
        }
Exemple #6
0
    void TryDisplaySkill()
    {
        //播放技能
        Jyx2Skill skill  = ConfigTable.Get <Jyx2Skill>(SkillId.ToString());
        var       wugong = new WugongInstance(SkillId);

        SkillCastHelper helper = new SkillCastHelper();

        helper.Source  = player;
        helper.Targets = enemys;

        wugong.Level   = SkillLevel;
        helper.Zhaoshi = new BattleZhaoshiInstance(wugong);

        //直接在每个敌人身上受击
        List <Transform> blocks = new List <Transform>();

        foreach (var e in enemys)
        {
            blocks.Add(e.transform);
        }
        helper.CoverBlocks = blocks;

        helper.Play();
    }
Exemple #7
0
 //获取技能所有的招式
 public IEnumerable <BattleZhaoshi> GetZhaoshis()
 {
     foreach (var zhaoshiId in ZhaoshiList.Split(','))
     {
         yield return(ConfigTable.Get <BattleZhaoshi>(zhaoshiId));
     }
 }
Exemple #8
0
    void OnUseItemClick()
    {
        Func <Jyx2Item, bool> filter = (item) => {
            //Ò©Îï»ò°µÆ÷
            return(item.ItemType == 3 || item.ItemType == 4);
        };

        Jyx2_UIManager.Instance.ShowUI("BagUIPanel", GameRuntimeData.Instance.Items, new Action <int>((itemId) =>
        {
            if (itemId == -1)
            {
                return;
            }

            var item = ConfigTable.Get <Jyx2Item>(itemId);
            //Ò©Æ·
            if (item.ItemType == 3)
            {
                if (m_currentRole.CanUseItem(itemId))
                {
                    BattleStateMechine.Instance.BindItem(item);
                    BattleStateMechine.Instance.SwitchState(BattleManager.BattleViewStates.UseItem);
                }
            }
            //°µÆ÷
            else if (item.ItemType == 4)
            {
                var zhaoshi = new AnqiZhaoshiInstance(m_currentRole.Anqi, item);
                m_chooseBtn = true;
                BattleStateMechine.Instance.BindSkill(zhaoshi);
                CheckNeedChangeState();
            }
        }), filter);
    }
Exemple #9
0
    void OnConfirmClick()
    {
        if (curSelectItem == null)
        {
            return;
        }
        int count = curSelectItem.GetBuyCount();

        if (count <= 0)
        {
            return;
        }
        Jyx2ShopItem item    = curShopData.ShopItems[curSelectItem.GetIndex()];
        Jyx2Item     itemCfg = ConfigTable.Get <Jyx2Item>(item.Id);

        if (itemCfg == null)
        {
            return;
        }
        int moneyCost = count * item.Price;

        if (GameRuntimeData.Instance.GetMoney() < moneyCost)
        {
            GameUtil.DisplayPopinfo("银两不够");
            return;
        }
        GameRuntimeData.Instance.AddItem(item.Id, count);
        AddBuyCount(item.Id, count);
        GameUtil.DisplayPopinfo($"获得物品{itemCfg.Name},数量{count}");
        GameRuntimeData.Instance.AddItem(Jyx2Consts.MONEY_ID, -moneyCost);

        RefreshChild();
        RefreshMoney();
    }
Exemple #10
0
        //开始一场战斗
        static public bool TryBattle(int battleId)
        {
            if (isQuickBattle)
            {
                return(ShowYesOrNoSelectPanel("是否战斗胜利?"));
            }

            bool isWin = false;

            RunInMainThrad(() => {
                var pos             = LevelMaster.Instance.GetPlayerPosition();
                string posStr       = UnityTools.Vector3ToString(pos);
                string currentScene = SceneManager.GetActiveScene().name;
                LevelLoader.LoadBattle(battleId, (ret) => {
                    LevelLoader.LoadGameMap(ConfigTable.Get <GameMap>(currentScene), new LevelMaster.LevelLoadPara()
                    {
                        loadType   = LevelMaster.LevelLoadPara.LevelLoadType.StartAtPos,
                        CurrentPos = posStr
                    }, "", () => {
                        isWin = (ret == BattleFieldModel.BattleResult.Win);
                        Next();
                    });
                });
            });
            Wait();
            return(isWin);
        }
Exemple #11
0
    public void Show(int roleId, string msg, int type, Action callback)
    {
        message.text = $"{msg}";
        _callback    = callback;
        SelectionPanel.SetActive(false);
        gameObject.SetActive(true);

        //不显示人物
        if (type == 2 || type == 3)
        {
            roleHeadImage.gameObject.SetActive(false);
        }
        else
        {
            var headMapping = ConfigTable.Get <Jyx2RoleHeadMapping>(roleId);
            if (headMapping != null && !string.IsNullOrEmpty(headMapping.HeadAvata))
            {
                ShowCharacter(headMapping.HeadAvata);
                roleHeadImage.gameObject.SetActive(true);
            }
            else
            {
                roleHeadImage.gameObject.SetActive(false);
            }
        }
    }
Exemple #12
0
 public Jyx2Item GetArmor()
 {
     if (Armor == -1)
     {
         return(null);
     }
     return(ConfigTable.Get <Jyx2Item>(Armor));
 }
Exemple #13
0
 public Jyx2Item GetXiulianItem()
 {
     if (Xiulianwupin == -1)
     {
         return(null);
     }
     return(ConfigTable.Get <Jyx2Item>(Xiulianwupin));
 }
Exemple #14
0
 public Jyx2Item GetWeapon()
 {
     if (Weapon == -1)
     {
         return(null);
     }
     return(ConfigTable.Get <Jyx2Item>(Weapon));
 }
Exemple #15
0
    /// <summary>
    /// 切换技能待机动作
    /// </summary>
    void SwitchSkillPose()
    {
        Jyx2Skill skill  = ConfigTable.Get <Jyx2Skill>(SkillId.ToString());
        var       wugong = new WugongInstance(SkillId);

        //切换武器和动作

        player.SwitchSkillTo(wugong);
    }
Exemple #16
0
        public string GetShowName()
        {
            if (!string.IsNullOrEmpty(Jyx2MapId))
            {
                return(ConfigTable.Get <Jyx2Map>(Jyx2MapId).Name);
            }

            return(Name);
        }
Exemple #17
0
        //离队
        static public void Leave(int roleId)
        {
            RunInMainThrad(() => {
                runtime.Team.RemoveAll(p => p.Key == roleId.ToString());

                var role = ConfigTable.Get <Jyx2Role>(roleId);
                storyEngine.DisplayPopInfo(role.Name + "离队。");
                Next();
            });
            Wait();
        }
Exemple #18
0
    public static string GetItemDesText(int itemId)
    {
        Jyx2Item item = ConfigTable.Get <Jyx2Item>(itemId);

        if (item == null)
        {
            GameUtil.LogError("配置表错误,查询不到物品,itemid=" + itemId);
            return("");
        }
        return(GetItemDesText(item));
    }
Exemple #19
0
        /// <summary>
        /// 加载地图
        /// </summary>
        /// <param name="levelKey"></param>
        /// <param name="fromPosTag">是否从存档中取出生点</param>
        public static void LoadGameMap(string levelKey, LevelMaster.LevelLoadPara para = null)
        {
            if (para == null)
            {
                para = new LevelMaster.LevelLoadPara(); //默认生成一份
            }
            var mapKey  = levelKey.Contains("&") ? levelKey.Split('&')[0] : levelKey;
            var command = levelKey.Contains("&") ? levelKey.Split('&')[1] : "";

            LoadGameMap(ConfigTable.Get <GameMap>(mapKey), para, command);
        }
Exemple #20
0
    protected override void OnShowPanel(params object[] allParams)
    {
        base.OnShowPanel(allParams);
        curShopId   = (int)allParams[0];
        curShopData = ConfigTable.Get <Jyx2Shop>(curShopId);

        curSelectIndex = 0;
        currentBuyCount.Clear();
        RefreshChild();
        RefreshProperty();
        RefreshMoney();
    }
Exemple #21
0
    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent <Animator>();
        Jyx2Skill skill  = ConfigTable.Get <Jyx2Skill>(SkillId.ToString());
        var       wugong = new WugongInstance(SkillId);

        var display = wugong.GetDisplay();

        this.CurDisplay = display;

        this.Idle();
    }
Exemple #22
0
    List <Jyx2Item> GetAvailableItems(RoleInstance role, int itemType)
    {
        List <Jyx2Item> items = new List <Jyx2Item>();

        foreach (var item in role.Items)
        {
            var tmp = ConfigTable.Get <Jyx2Item>(item.Id);
            if (tmp.ItemType == itemType)
            {
                items.Add(tmp);
            }
        }
        return(items);
    }
Exemple #23
0
        private string GenerateSaveSummaryInfo()
        {
            string mapName = "";

            if (!string.IsNullOrEmpty(CurrentMap))
            {
                var map = ConfigTable.Get <GameMap>(CurrentMap);
                if (map != null)
                {
                    mapName = map.Name;
                }
            }

            return($"{TeamLevel}级,{mapName},队伍:{Team.Count}人");
        }
Exemple #24
0
        static public void LearnMagic2(int roleId, int magicId, int noDisplay)
        {
            RunInMainThrad(() => {
                var role = runtime.GetRole(roleId);
                role.LearnMagic(magicId);

                if (noDisplay != 0)
                {
                    var skill = ConfigTable.Get <Jyx2Skill>(magicId);
                    storyEngine.DisplayPopInfo(role.Name + "习得武学" + skill.Name);
                }
                Next();
            });
            Wait();
        }
Exemple #25
0
        //获取物品
        static public void GetItem(int itemId, int count)
        {
            RunInMainThrad(() =>
            {
                var item = ConfigTable.Get <Jyx2Item>(itemId);
                if (item == null)
                {
                    Debug.LogError("调用了未定义的物品:" + itemId);
                    return;
                }

                runtime.AddItem(itemId, count);

                storyEngine.DisplayPopInfo("获得物品:" + item.Name + "×" + count);
            });
        }
Exemple #26
0
    public void Refresh(Jyx2ShopItem shopItem, int index, int hasBuyNum)
    {
        this.index    = index;
        this.shopItem = shopItem;
        Jyx2Item item = ConfigTable.Get <Jyx2Item>(shopItem.Id);

        if (item == null)
        {
            GameUtil.LogError("查询不到物品配置,id =" + shopItem.Id);
            return;
        }
        Jyx2ResourceHelper.GetItemSprite(int.Parse(item.Id), iconImg);
        desText.text = $"{item.Name}\n价格:{shopItem.Price}";
        leftNum      = shopItem.Count - hasBuyNum;
        leftNum      = Tools.Limit(leftNum, 0, shopItem.Count);
        itemNum.text = leftNum.ToString();
    }
Exemple #27
0
        private void LoadConfig()
        {
            if (ConfigTable.ContainsKey("Application"))
            {
                TomlTable appSettings = ConfigTable.Get <TomlTable>("Application");

                if (appSettings.ContainsKey("ListenPort"))
                {
                    ServerPort = (int)appSettings.Get <TomlInt>("ListenPort").Value;
                    Messenger.Default.ServerPort = ServerPort;
                }
            }

            foreach (var item in Items)
            {
                (item as IConfigViewModel).LoadConfigs(ConfigTable);
            }
        }
Exemple #28
0
        //加载战斗
        public static void LoadBattle(int battleId, Action <BattleResult> callback)
        {
            var battle = ConfigTable.Get <Jyx2Battle>(battleId);

            string sceneName = "Jyx2Battle_" + battle.MapId;

            if (!Application.CanStreamedLevelBeLoaded(sceneName))
            {
                sceneName = "BattleScene_hufeiju";
            }

            LoadingPanel.Create(sceneName, () => {
                GameObject obj          = new GameObject("BattleLoader");
                var battleLoader        = obj.AddComponent <BattleLoader>();
                battleLoader.m_BattleId = battleId;
                battleLoader.Callback   = callback;
            });
        }
Exemple #29
0
        public string GetEnterMusic()
        {
            if (!string.IsNullOrEmpty(Jyx2MapId))
            {
                var map = ConfigTable.Get <Jyx2Map>(Jyx2MapId);

                if (map == null || map.InMusic < 0)
                {
                    return(string.Empty);
                }

                string path = "Assets/BuildSource/Musics/" + (map.InMusic) + ".mp3";
                return(path);
            }
            else
            {
                return(Music);
            }
        }
Exemple #30
0
    //需要物品
    static string GetNeedItem(Jyx2Item item)
    {
        StringBuilder sb = new StringBuilder();

        if (item.GenerateItemNeedExp > 0)
        {
            sb.Append($"练出物品需经验:  {item.GenerateItemNeedExp}\n");
        }
        if (item.GenerateItemNeedCost > 0)
        {
            Jyx2Item cfg = ConfigTable.Get <Jyx2Item>(item.GenerateItemNeedCost);
            if (cfg != null)
            {
                sb.Append($"材料:  {cfg.Name}\n");
            }
        }

        return(sb.ToString());
    }