示例#1
0
    Dictionary <GameMenu, MenuInfo> cachedMenu = new Dictionary <GameMenu, MenuInfo>(); //讲预设体 和他的管理者 存起来的 字典
    MenuInfo LoadMenu(GameMenu gameMenu, MenuParams parms, bool bInit = true)           //通过当前所在的gameMenu 的位置来加载预设体
    {
        MenuInfo   menuInfo;
        GameObject menu = null;

        if (cachedMenu.TryGetValue(gameMenu, out menuInfo) == false)                                              //如果cacheMenu中没有这个预设体
        {
            GameObject obj = Resources.Load(string.Format("Prefab/Menu/{0}", gameMenu.ToString())) as GameObject; //通过 当前gameMenu 的状态来获取 预设体
            menu = Instantiate(obj);                                                                              //实例化这个预设体
            menu.transform.SetParent(m_UIRoot.transform, false);                                                  //在这里就添加上去了
            menu.transform.localScale = Vector3.one;
            parms.RemoveGameObject();                                                                             //从字典中移除所有的预设体
            parms.AddParam <GameObject>(menu);                                                                    //把这个预设体加入到字典中
            menuInfo = new MenuInfo(gameMenu, parms);                                                             //实例化一个预设体的管理类
            cachedMenu.Add(gameMenu, menuInfo);                                                                   //讲当前的预设体 和 他的管理类 添加打cachedMenu中
        }
        else //cacheMenu里面已经有这个预设体了
        {
            parms.RemoveGameObject();
            parms.AddParam <GameObject>(menuInfo.obj);
            menuInfo = new MenuInfo(gameMenu, parms);
        }
        menuInfo.SetActive(true); //激活这儿预设体
        if (bInit == true)
        {
            menuInfo.Init();
        }

        return(menuInfo);
    }
示例#2
0
    void OnClickItemLocation(MoveMenuInfo info)
    {
        switch (info.menu)
        {
        case GameMenu.Dungeon:
            pe_Difficulty difficulty = (pe_Difficulty)Enum.Parse(typeof(pe_Difficulty), info.menu_parm_2);
            if (MapClearDataManager.Instance.AvailableMap(info.menu_parm_1, difficulty) == false)
            {
                Tooltip.Instance.ShowMessageKey("NotAvailbleStage");
                return;
            }
            Network.TargetItemInfo = m_Info;
            GameMain.Instance.StackPopup();

            MenuParams parm = new MenuParams();
            parm.AddParam("menu_parm_1", info.menu_parm_1);
            parm.AddParam("menu_parm_2", info.menu_parm_2);
            GameMain.Instance.ChangeMenu(info.menu, parm);
            break;

        case GameMenu.Store:
            GameMain.Instance.StackPopup();
            GameMain.MoveStore(info.menu_parm_1);
            break;

        default:
            GameMain.Instance.StackPopup();
            GameMain.Instance.ChangeMenu(info.menu);
            break;
        }
    }
示例#3
0
    public void OnClickEvolve()
    {
        MenuParams menu = new MenuParams();

        menu.AddParam <Creature>(m_Creature);
        menu.AddParam("show_evolve", m_EvolveReady.gameObject.activeSelf);
        GameMain.Instance.ChangeMenu(GameMenu.HeroEvolve, menu);
    }
示例#4
0
    void OnDeepTouchListCharacter(Creature hero)
    {
        MenuParams menu = new MenuParams();

        menu.AddParam <Creature>(hero);
        menu.AddParam("Creatures", m_Heroes.Where(h => h.Creature != null).Select(h => h.Creature).ToList());

        GameMain.Instance.ChangeMenu(GameMenu.HeroInfoDetail, menu);
    }
示例#5
0
文件: PVP.cs 项目: tapenjoyGame/cry
    public void OnClickDefenseTeam()
    {
        m_DefenseTeamManager.Clear();
        MenuParams parm = new MenuParams();

        parm.AddParam("deck_type", "defense");
        parm.AddParam("is_regist", m_MyPvpInfo == null);
        GameMain.Instance.ChangeMenu(GameMenu.PVPDeckInfo, parm);
    }
示例#6
0
    void OnDeepTouchCharacter(EnchantHero hero)
    {
        MenuParams menu = new MenuParams();

        menu.AddParam <Creature>(hero.Creature);
        bool bShowChangeHeroButton = true;

        menu.AddParam("bShowChangeHeroButton", bShowChangeHeroButton);

        GameMain.Instance.ChangeMenu(GameMenu.HeroInfoDetail, menu);
    }
示例#7
0
    void EvalInitInfoHandler(C2G.CreatureEvalInitInfo send, C2G.CreatureEvalInitInfoAck recv)
    {
        MenuParams parms = new MenuParams();

        parms.AddParam("InitInfo", recv);
        parms.AddParam("CreatureID", send.creature_id);

        if (Popup.Instance.GetCurrentPopup() != null)
        {
            StackPopup();
        }

        ChangeMenu(GameMenu.HeroesEval, parms);
    }
示例#8
0
    void OpenCharacterDetail() //显示角色的详细信息
    {
        if (selected_character == null)
        {
            return;
        }

        MenuParams menu = new MenuParams();                                                                                    //创建场景的字典 用来存放场景的信息

        menu.AddParam <Creature>(CreatureManager.Instance.GetInfoByIdx(selected_character.CharacterAsset.Asset.Creature.Idx)); //通过选中的角色的信息创建角色的信息界面
        menu.AddParam("Creatures", m_MainLayout.Creatures);

        GameMain.Instance.ChangeMenu(GameMenu.HeroInfoDetail, menu);
        selected_character = null;
    }
示例#9
0
    /////////////////////////////////////////////////

    override public void OnClose()
    {
        m_CharacterContainer.gameObject.SetActive(false);
        parent.Close(true);

        if (m_IsMoveDetail == true)
        {
            MenuParams menu = new MenuParams();
            menu.AddParam <Creature>(m_Creature);
            bool bShowChangeHeroButton = false;
            menu.AddParam("bShowChangeHeroButton", bShowChangeHeroButton);

            GameMain.Instance.ChangeMenu(GameMenu.HeroInfoDetail, menu);
        }
    }
示例#10
0
    public void OnClickBattleEnter()
    {
        if (MapClearDataManager.Instance.GetMapDailyClearCount(m_SelectedMap.IDN) >= m_SelectedMap.TryLimit)
        {
            Tooltip.Instance.ShowMessageKey("NotEnoughTryCount");
            return;
        }

        if (CheckCondition() == false)
        {
            return;
        }

        if (m_StageInfo.Waves.Count > 0)
        {
            GameMain.Instance.StackPopup();

            MenuParams parms = new MenuParams();
            parms.AddParam <MapStageDifficulty>(m_StageInfo);
            GameMain.Instance.ChangeMenu(GameMenu.DungeonInfo, parms);
        }
        else
        {
            Tooltip.Instance.ShowMessageKey("NotImplement");
        }
    }
示例#11
0
    //---------------------------------------------------------------------------

    public void OnClick()
    {
        MenuParams menu = new MenuParams();

        menu.AddParam <Creature>(CreatureInfo);
        GameMain.Instance.ChangeMenu(GameMenu.HeroInfoDetail, menu);
    }
示例#12
0
    void OnMainCharacter(Creature hero, bool deep_touch)
    {
        if (deep_touch == true && Tutorial.Instance.Completed == false)
        {
            return;
        }

        MenuParams menu = new MenuParams();

        menu.AddParam <Creature>(hero);
        menu.AddParam("Creatures", m_MainLayout.Creatures);

        m_MainLayout.DragContainer = null;

        GameMain.Instance.ChangeMenu(GameMenu.HeroInfoDetail, menu);
    }
示例#13
0
    public void OnClickEnchant()
    {
        if (Tutorial.Instance.Completed == false)
        {
            foreach (var reward_base in Tutorial.Instance.CurrentInfo.rewards)
            {
                if (reward_base.CreatureInfo == null)
                {
                    continue;
                }
                CreatureInfo info             = reward_base.CreatureInfo;
                Creature     enchant_creature = new Creature(-1, info.IDN, 0, (short)reward_base.Value, (short)reward_base.Value3, (short)reward_base.Value2);
                CreatureManager.Instance.AddTutorialCard(enchant_creature);
            }
        }
        if (m_Creature.Enchant >= 10)
        {
            Tooltip.Instance.ShowMessageKey("MaxEquipEnchant");
            return;
        }
        MenuParams menu = new MenuParams();

        menu.AddParam <Creature>(m_Creature);
        GameMain.Instance.ChangeMenu(GameMenu.HeroEnchant, menu);
    }
示例#14
0
    void OnClick(string menu_id)
    {
        switch (menu_id)
        {
        case "pvp":
            if (TeamDataManager.Instance.GetTeam(pe_Team.PVP_Defense) == null)
            {
                MenuParams parm = new MenuParams();
                parm.AddParam("deck_type", "defense");
                GameMain.Instance.ChangeMenu(GameMenu.PVPDeckInfo, parm);
            }
            else
            {
                GameMain.Instance.ChangeMenu(GameMenu.PVP);
            }
            OnCancel();

            return;

        case "totalwar":
            break;
        }

        Tooltip.Instance.ShowMessageKey("NotImplement");
    }
示例#15
0
    public void OnClickRuneEquip()
    {
        MenuParams menu = new MenuParams();

        menu.AddParam <Creature>(m_Creature);
        GameMain.Instance.ChangeMenu(GameMenu.HeroRune, menu);
    }
示例#16
0
    void Init(bool bBack, bool show_evolve)
    {
        m_Hero = DungeonHeroPrefabManager.GetNewObject <DungeonHero>(DungeonHeroPrefabManager.transform, Vector3.zero);

        m_SortInfo.Init(OnSorted);

        m_MixLevelLimit        = CreatureInfoManager.Instance.MixLevelLimit(m_Creature.Grade);
        m_MixBaseLevelLimit    = CreatureInfoManager.Instance.MixBaseLevelLimit(m_Creature.Grade);
        m_EvolveLevelLimit     = CreatureInfoManager.Instance.EvolveLevelLimit(m_Creature.Grade);
        m_EvolveBaseLevelLimit = CreatureInfoManager.Instance.EvolveBaseLevelLimit(m_Creature.Grade);

        if (bBack == true)
        {
            Creature enchant_creature = m_EnchantCreature;
            if (m_ToggleMix.value == true)
            {
                OnValueChanged(m_ToggleMix);
            }
            else
            {
                OnValueChanged(m_ToggleEvolve);
            }
            if (enchant_creature != null)
            {
                m_Heroes.Find(h => h.Creature == enchant_creature).m_toggle.value = true;
                m_EnchantMaterial.Init(enchant_creature, OnClickEnchantMaterial);
                m_EnchantCreature = enchant_creature;
                m_parms.AddParam("EnchantCreature", m_EnchantCreature);
            }
        }
        else
        {
            if (show_evolve)
            {
                m_ToggleEvolve.value = true;
                OnValueChanged(m_ToggleEvolve);
            }
            else
            {
                m_ToggleMix.value = true;
                OnValueChanged(m_ToggleEvolve);
            }
            //OnValueChanged(m_ToggleMix);
        }

        UpdateEventMark();
    }
示例#17
0
    public void OnLeft()
    {
        int cur_idx  = m_Creatures.FindIndex(c => c == m_Creature);
        int next_idx = cur_idx == 0?-1: m_Creatures.FindLastIndex(cur_idx - 1, c => c.Grade > 0);

        if (next_idx == -1)
        {
            next_idx = m_Creatures.FindLastIndex(c => c.Grade > 0);
            if (next_idx == -1)
            {
                return;
            }
        }

        m_Creature = m_Creatures[next_idx];
        m_parms.AddParam <Creature>(m_Creature);
        Init();
    }
示例#18
0
    void OnClickStage(DungeonSpot spot)
    {
        //        SetCharacterPosition(spot.transform.position);
        m_SelectStageInfo = spot.StageInfo;

        MenuParams parms = new MenuParams();

        parms.AddParam <MapStageDifficulty>(spot.StageInfo);
        GameMain.Instance.ChangeMenu(GameMenu.DungeonInfo, parms);
    }
示例#19
0
    void RefreshInfo()
    {
        m_HeroCount.text = Localization.Format("HeroCount", m_CreatureCount, Network.PlayerInfo.creature_count_max);

        m_NewTotalEnchantPoint = GetTotalEnchantPoint();
        m_Price.text           = GetPrice().ToString();

        m_MaterialCreatures = m_Materials.Where(m => m.Creature != null).Select(m => m.Creature).ToList();
        m_parms.AddParam("MaterialCreatures", m_MaterialCreatures);
    }
示例#20
0
    void OnDeepTouchCharacter(EnchantHero hero)
    {
//        GameMain.Instance.BackMenu(false);
//        GameMain.Instance.BackMenu(false);

        MenuParams menu = new MenuParams();

        menu.AddParam <Creature>(hero.Creature);

        GameMain.Instance.ChangeMenu(GameMenu.HeroInfoDetail, menu);
    }
示例#21
0
    static public void MoveStore(string store_id)
    {
        MenuParams parm = new MenuParams();

        parm.AddParam("StoreTab", store_id);
        //parm.AddPopup
        if (Popup.Instance.GetCurrentPopup() != null)
        {
            GameMain.Instance.StackPopup();
        }
        Instance.ChangeMenu(GameMenu.Store, parm);
    }
示例#22
0
    static public void MissionMove(Quest quest)
    {
        QuestMoveBase move = quest.Info.Move;

        switch (move.MoveType)
        {
        case eQuestMove.Menu:
            //GameMain.Instance.StackPopup();
        {
            QuestMoveMenu menu = move as QuestMoveMenu;
            if (menu.menu == GameMenu.HeroesInfo)
            {
                GameMain.MoveShortCut(menu.menu);
            }
            else
            {
                string value2 = (move as QuestMoveMenu).value2;
                if (string.IsNullOrEmpty(value2) == true)
                {
                    GameMain.Instance.ChangeMenu((move as QuestMoveMenu).menu);
                }
                else
                {
                    eDifficult difficulty = (move as QuestMoveMenu).difficulty;
                    MenuParams parm       = new MenuParams();
                    parm.AddParam("menu_parm_1", value2);
                    parm.AddParam("menu_parm_2", difficulty.ToString());
                    GameMain.Instance.ChangeMenu((move as QuestMoveMenu).menu, parm);
                }
            }
        }
        break;

        case eQuestMove.Popup:
            Popup.Instance.Show((move as QuestMovePopup).popup);
            break;
        }
    }
示例#23
0
    public void OnClickEnter()
    {
        MapInfo map_info = MapInfoManager.Instance.GetInfoByID("10001_boss");

        if (MapClearDataManager.Instance.GetMapDailyClearCount(map_info.IDN, PacketEnums.pe_Difficulty.Normal) >= map_info.TryLimit)
        {
            Tooltip.Instance.ShowMessageKey("NotEnoughTryCount");
            return;
        }

        MenuParams parms = new MenuParams();

        parms.AddParam <MapStageDifficulty>(m_StageInfo);
        OnClose();
        GameMain.Instance.ChangeMenu(GameMenu.DungeonInfo, parms);
    }
示例#24
0
    public void OnClickBossEnter()
    {
        var event_info = EventHottimeManager.Instance.GetInfoByID("worldboss");
//#if !(SH_DEV || UNITY_EDITOR)
//        DateTime now = Network.Instance.ServerTime;
//        if (event_info == null || event_info.end_date < now)
//        {
//            Tooltip.Instance.ShowMessageKey("WorldBossNotHottime");
//            return;
//        }
//#endif
        MenuParams parms = new MenuParams();

        parms.AddParam <MapStageDifficulty>(m_MapStageInfo);
        GameMain.Instance.ChangeMenu(GameMenu.DungeonInfo, parms);
    }
示例#25
0
    ////////////////////////////////////////////////////////////////
    override public bool Init(MenuParams parms)
    {
        m_parms = parms;
        //if(m_Creature == null || parms.bBack == false)
        m_Creature = parms.GetObject <Creature>();

        if (parms.bBack == true && CreatureManager.Instance.Contains(m_Creature) == false)
        {
            return(false);
        }

        m_Creatures = parms.GetObject <List <Creature> >("Creatures");
        if (m_Creatures != null)
        {
            m_Creatures = m_Creatures.Where(c => CreatureManager.Instance.Contains(c)).ToList();
        }
        parms.AddParam("Creatures", m_Creatures);

        Init();
        return(true);
    }
示例#26
0
 public void AddMenuParam(string key, object obj) //往字典中添加
 {
     parms.AddParam(key, obj);
 }
示例#27
0
    void OnSelectCharacter(HeroesInfoItem item)
    {
        if (m_HeroSalePanel.activeSelf == false)
        {
            MenuParams menu = new MenuParams();
            menu.AddParam("Creature", item.Creature);
            menu.AddParam("Creatures", m_Creatures);
            GameMain.Instance.ChangeMenu(GameMenu.HeroInfoDetail, menu);
        }
        else
        {
            if (item.m_SpriteSelected.gameObject.activeSelf == true)
            {
                item.SetSelect(false);
                m_SaleSelected.Remove(item);
                UpdateSalePrice(m_SalePrice - item.Creature.SalePrice);
            }
            else
            {//select
                if (item.Creature.IsLock)
                {
                    Popup.Instance.ShowMessageKey("HeroSaleConfirmTeamLocked");
                    return;
                }
                if (TeamDataManager.Instance.CheckTeam(item.Creature.Idx, PacketEnums.pe_Team.PVP_Defense) == true)
                {
                    m_SelectConfirmItem = item;
                    Popup.Instance.ShowMessageKey("HeroSaleConfirmTeamPVPDefense");
                    return;
                }
                if (TeamDataManager.Instance.CheckTeam(item.Creature.Idx) != PacketEnums.pe_Team.Invalid)
                {
                    m_SelectConfirmItem = item;
                    Popup.Instance.ShowConfirmKey(new PopupConfirm.Callback(OnSelectSaleConfirm), "HeroSaleConfirmTeam");
                    return;
                }
                if (item.Creature.Enchant > 0)
                {
                    m_SelectConfirmItem = item;
                    Popup.Instance.ShowConfirmKey(new PopupConfirm.Callback(OnSelectSaleConfirm), "SelectCreatureConfirmEnchanted");
                    return;
                }
                if (item.Creature.Armor.EnchantLevel > 0 || item.Creature.Weapon.EnchantLevel > 0)
                {
                    m_SelectConfirmItem = item;
                    Popup.Instance.ShowConfirmKey(new PopupConfirm.Callback(OnSelectSaleConfirm), "SelectCreatureConfirmEquipEnchanted");
                    return;
                }
                if (item.Creature.Runes.Count > 0)
                {
                    m_SelectConfirmItem = item;
                    Popup.Instance.ShowConfirmKey(new PopupConfirm.Callback(OnSelectSaleConfirm), "SelectCreatureConfirmEquipRune");
                    return;
                }

                item.SetSelect(true);
                m_SaleSelected.Add(item);
                UpdateSalePrice(m_SalePrice + item.Creature.SalePrice);
            }
        }
    }