Ejemplo n.º 1
0
    IEnumerator RefreshAbleExchangeCardList(int Quality)
    {
        MyTools.DestroyChildNodes(AbleExchangeTable.transform);

        UIScrollView sv = AbleExchangeTable.transform.parent.GetComponent <UIScrollView>();

        foreach (KeyValuePair <int, MagicCardConfig> pair in CsvConfigTables.Instance.MagicCardCsvDic)
        {
            if (pair.Value.Quality <= Quality && SerPlayerData.GetItemCount(pair.Value.CardID) > 1)
            {
                GameObject newUnit = NGUITools.AddChild(AbleExchangeTable.gameObject, AbleExchangeCardPrefab);
                newUnit.SetActive(true);
                newUnit.name = "Card_" + pair.Value.CardID;

                UI_MagicCard mc = newUnit.GetComponent <UI_MagicCard>();
                mc.UnconditionalShow(pair.Value.CardID);

                AbleExchangeTable.repositionNow = true;

                yield return(new WaitForEndOfFrame());

                sv.ResetPosition();
            }
        }
    }
Ejemplo n.º 2
0
    IEnumerator RefreshAccumulativeLoginList()
    {
        string AccumulativeLoginKey = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_AccumulativeLogin");

        if (!PlayerPrefs.HasKey(AccumulativeLoginKey))
        {
            PlayerPrefs.SetString(AccumulativeLoginKey, DateTime.Now.Ticks.ToString());
        }
        string   LastTime    = PlayerPrefs.GetString(AccumulativeLoginKey);
        DateTime dtLastTime  = new DateTime(long.Parse(LastTime));
        TimeSpan ResidueTime = DateTime.Now - dtLastTime;

        MyTools.DestroyChildNodes(AccumulativeLoginGrid.transform);

        UIScrollView sv = AccumulativeLoginGrid.transform.parent.GetComponent <UIScrollView>();

        for (int i = 1; i <= 31; i++)
        {
            GameObject newUnit = NGUITools.AddChild(AccumulativeLoginGrid.gameObject, AccumulativeLoginUnitPrefab);
            newUnit.SetActive(true);
            newUnit.name = "AccumulativeLoginUnit_" + i;
            newUnit.transform.localPosition = new Vector3(0, -140 * (i - 1), 0);

            UI_AccumulativeLoginUnit alu = newUnit.GetComponent <UI_AccumulativeLoginUnit>();
            alu.Set(i, ResidueTime.Days + 1);

            sv.ResetPosition();
            AccumulativeLoginGrid.repositionNow = true;

            yield return(new WaitForEndOfFrame());
        }
    }
Ejemplo n.º 3
0
    void Start()
    {
        PlayerName.text = SerPlayerData.GetName();
        AccountId.text  = SerPlayerData.GetAccountID().ToString();

        /////////////////////////////////////////////////////////////
        bool isMusicMuteOn = GameApp.Instance.SoundInstance.BgmMute;

        MusicSwitch[0].value = !isMusicMuteOn;
        MusicSwitch[1].value = isMusicMuteOn;

        bool isSeMuteOn = GameApp.Instance.SoundInstance.SeMute;

        SeSwitch[0].value = !isSeMuteOn;
        SeSwitch[1].value = isSeMuteOn;

        InitPetInfo();
        InvokeRepeating("RefreshPetModifBtnState", 1f, 0.2f);

        InitSleepSet();
        InvokeRepeating("RefreshSleepModifBtnState", 1f, 0.2f);

#if UNITY_EDITOR
        SystemSetTab.SetActive(true);
#endif
    }
Ejemplo n.º 4
0
    IEnumerator RefreshFishList()
    {
        MyTools.DestroyChildNodes(LstTable.transform);
        foreach (KeyValuePair <int, MagicCardConfig> pair in CsvConfigTables.Instance.MagicCardCsvDic)
        {
            if (pair.Value.ThemeID != 103)
            {
                continue;
            }

            if (SerPlayerData.GetItemCount(pair.Key) > 0)
            {
                GameObject newUnit = NGUITools.AddChild(LstTable.gameObject, CardPrefab);
                newUnit.SetActive(true);
                newUnit.name = "Card_" + pair.Key;

                UI_MagicCard mc = newUnit.GetComponent <UI_MagicCard>();
                mc.UnconditionalShow(pair.Key);

                LstTable.repositionNow = true;
                yield return(new WaitForEndOfFrame());

                FishLst.ResetPosition();
            }
        }
    }
    public void OnClick_Get()
    {
        GameApp.Instance.SoundInstance.PlaySe("button");

        GameApp.Instance.GetItemsDlg.OpenGetItemsBox(AwardItemDic);

        GetBtn.isEnabled = false;
        GetBtnText.text  = "已领取";

        foreach (KeyValuePair <int, int> pair in AwardItemDic)
        {
            GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", pair.Key, " ", pair.Value));
        }

        string IsGetStateKey = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_AccumulativeLogin_IsGetState");

        if (PlayerPrefs.HasKey(IsGetStateKey))
        {
            string OldState = PlayerPrefs.GetString(IsGetStateKey);
            OldState += StringBuilderTool.ToString("_", CurIndex);
            PlayerPrefs.SetString(IsGetStateKey, OldState);
        }
        else
        {
            PlayerPrefs.SetString(IsGetStateKey, CurIndex.ToString());
        }
    }
Ejemplo n.º 6
0
    /*void OnDestroy()
     * {
     *
     * }*/

    /*void Update()
     * {
     *  if (Input.GetKeyUp(KeyCode.A))
     *  {
     *      GameApp.SendMsg.GetRank(RankType.RankType_Achievement);
     *  }
     *  if (Input.GetKeyUp(KeyCode.B))
     *  {
     *      GameApp.SendMsg.GetRank(RankType.RankType_PVE);
     *  }
     *  if (Input.GetKeyUp(KeyCode.C))
     *  {
     *
     *  }
     * }*/

    public void Show(bool isShow)
    {
        if (isShow)
        {
            gameObject.SetActive(true);

            AppearEffect.transform.localScale = Vector3.one * 0.01f;
            AppearEffect.Open(AppearType.Popup, AppearEffect.gameObject);

            /////////////////////////////////////////////////////
            MyselfRI.ServerRankInfo.name  = SerPlayerData.GetName();
            MyselfRI.ServerRankInfo.score = SerPlayerData.GetCardCount();

            CurShowRankType = 4;

            RankTitleLab.text        = "收集卡牌排行榜";
            RankTitleIcon.spriteName = "pic_biaoti_paiming";
            RankValueDes.text        = "卡牌数";

            GameApp.SendMsg.GetRank(RankType.RankType_Card);
            /////////////////////////////////////////////////////
        }
        else
        {
            AppearEffect.Close(AppearType.Popup, () =>
            {
                gameObject.SetActive(false);
            });
        }
    }
Ejemplo n.º 7
0
    public SleepInfo()
    {
        uint AccountID = SerPlayerData.GetAccountID();

        key_SleepBeginTime    = StringBuilderTool.ToString(AccountID, "_PetInfo_SleepBeginTime");
        key_SleepEndTime      = StringBuilderTool.ToString(AccountID, "_PetInfo_key_SleepEndTime");
        key_EnableUseDuration = StringBuilderTool.ToString(AccountID, "_PetInfo_EnableUseDuration");
        key_RestUseDuration   = StringBuilderTool.ToString(AccountID, "_PetInfo_RestUseDuration");
    }
Ejemplo n.º 8
0
    public PetInfo()
    {
        uint AccountID = SerPlayerData.GetAccountID();

        key_Name     = StringBuilderTool.ToString(AccountID, "_PetInfo_Name");
        key_Sex      = StringBuilderTool.ToString(AccountID, "_PetInfo_Sex");
        key_AgeYeah  = StringBuilderTool.ToString(AccountID, "_PetInfo_AgeYeah");
        key_AgeMonth = StringBuilderTool.ToString(AccountID, "_PetInfo_AgeMonth");
    }
Ejemplo n.º 9
0
    /// <summary> 显示商品详情 </summary>
    public void ShowCommodityDetails(ItemConfig ItemCfg)
    {
        TweenAlpha.Begin(DetailsRoot, 0.1f, 1);

        Details_ItemCfg      = ItemCfg;
        Details_Name.text    = ItemCfg.Name;
        Details_Des.text     = ItemCfg.Describe;
        Details_HoldNum.text = StringBuilderTool.ToString("已拥有:", SerPlayerData.GetItemCount(ItemCfg.ItemID));
    }
Ejemplo n.º 10
0
    public void Show()
    {
        isShowing = true;
        TweenAlpha.Begin(gameObject, 0.1f, 1);

        CandyCnt.text = SerPlayerData.GetItemCount(1003).ToString();

        StartCoroutine("RefreshCommodityList");
    }
Ejemplo n.º 11
0
    public void BuyRes()
    {
        CandyCnt.text = SerPlayerData.GetItemCount(1003).ToString();

        if (Details_ItemCfg != null)
        {
            Details_HoldNum.text = StringBuilderTool.ToString("已拥有:", SerPlayerData.GetItemCount(Details_ItemCfg.ItemID));
        }
    }
Ejemplo n.º 12
0
    /*void Update()
     * {
     *  if (Input.GetKeyUp(KeyCode.A))
     *  {
     *      //MyTools.SetStageProgress(0,2);
     *      PlayerPrefs.DeleteAll();
     *  }
     * }*/

    public void UpdateStageState()
    {
        switch (CurGroupIndex)
        {
        case 1:
            SetStageState(SerPlayerData.GetMainStageProgress() /*Const.IsStageAllOpen ? 4 : MyTools.GetStageProgress(CurIndex)*/);
            break;

        case 2:
            int StageProgress = 0;
            if (GameApp.Instance.PlayerData != null)
            {
                string key_zoo = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_Zoo_StageProgress");
                if (PlayerPrefs.HasKey(key_zoo))
                {
                    StageProgress = PlayerPrefs.GetInt(key_zoo);
                }
                else
                {
                    PlayerPrefs.SetInt(key_zoo, 0);
                }
            }
            else
            {
                StageProgress = 999;
            }
            SetStageState(StageProgress);
            break;

        case 3:
            SetStageState(999);
            break;
        }


        /*if (AllStageDotShow)
         * {
         *  GameApp.Instance.SelModeUI.StageGroupLabs[CurIndex].transform.parent.Find("Bg").GetComponent<UISprite>().spriteName = "gamemode_button_normal_g";
         *  GameApp.Instance.SelModeUI.StageGroupLabs[CurIndex].transform.parent.Find("SelBg").gameObject.SetActive(false);
         *
         *  GameObject nextBtn = transform.parent.parent.Find("Anchor_Left").Find("Mode_" + (CurIndex + 2)).gameObject;
         *  GameApp.Instance.SelModeUI.SwitchShowStageGroup(nextBtn);
         * }
         * else
         * {
         *  GameApp.Instance.SelModeUI.StageGroupLabs[CurIndex].transform.parent.Find("Bg").GetComponent<UISprite>().spriteName = "gamemode_button_normal";
         * }*/
    }
Ejemplo n.º 13
0
    void Start()
    {
        GameApp.Instance.SoundInstance.PlayBgm("BGM_HomePage");

        MainPlayerInfo.UseBigHeadPortrait();
        MainPlayerInfo.Init(GameApp.Instance.MainPlayerData);

        int i = 0;

        foreach (KeyValuePair <int, ChapterConfig> pair in CsvConfigTables.Instance.ChapterCsvDic)
        {
            if (i < ChapterLst.Length)
            {
                ChapterLst[i].Set(pair.Value.ChapterID);
                i++;
            }
        }

        Invoke("CheckPrivilegeAward", 1f);

        if (GameApp.Instance.PlayerData != null)
        {
            bool   NeedShowFirstChessGuide = true;
            string key = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_NeedShow_FirstChessGuide");
            if (PlayerPrefs.HasKey(key))
            {
                NeedShowFirstChessGuide = (PlayerPrefs.GetInt(key) == 1);
            }
            else
            {
                PlayerPrefs.SetInt(key, 1);
            }
            if (NeedShowFirstChessGuide)
            {
                GameObject FirstChessGuideObj = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/UI/UI_FirstChessGuide"));
                if (FirstChessGuideObj != null)
                {
                    UI_FirstChessGuide fcg = FirstChessGuideObj.GetComponent <UI_FirstChessGuide>();
                    if (fcg != null)
                    {
                        fcg.SetGuideState(0);
                    }
                }
            }
        }
    }
Ejemplo n.º 14
0
    /// <summary> 点击购买 </summary>
    public void OnClick_Buy()
    {
        GameApp.Instance.SoundInstance.PlaySe("button");
        Debug.Log("点击【购买】");

        if (SerPlayerData.GetItemCount(1003) < Details_ItemCfg.PriceValue)
        {
            GameApp.Instance.CommonHintDlg.OpenHintBox("糖果不足!");
            return;
        }
        if (SerPlayerData.GetItemCount(Details_ItemCfg.ItemID) > 0 && Details_ItemCfg.EnableSuperposition == 0)
        {
            GameApp.Instance.CommonHintDlg.OpenHintBox(StringBuilderTool.ToInfoString(Details_ItemCfg.Name, "只能拥有一个!"));
            return;
        }

        GameApp.SendMsg.BuyItem((uint)Details_ItemCfg.ItemID);
    }
Ejemplo n.º 15
0
    private bool EnableCompound(int CardID)
    {
        MagicCardConfig MCCfg        = null;
        bool            isEnableComp = false;

        if (CsvConfigTables.Instance.MagicCardCsvDic.TryGetValue(CardID, out MCCfg))
        {
            isEnableComp = (MCCfg.NeedItemsLst.Count > 0);
            for (int i = 0; i < MCCfg.NeedItemsLst.Count; i++)
            {
                if (SerPlayerData.GetItemCount(MCCfg.NeedItemsLst[i].ItemID) == 0)
                {
                    isEnableComp = false;
                    break;
                }
            }
        }
        return(isEnableComp);
    }
Ejemplo n.º 16
0
    /*void Update()
     * {
     *  if (Input.GetKeyUp(KeyCode.A))
     *  {
     *
     *  }
     * }*/

    public void Refresh()
    {
        if (GameApp.Instance.FightUI != null)
        {
            return;
        }

        uint Gold = SerPlayerData.GetItemCount(1001);

        //uint Diamond = SerPlayerData.GetItemCount(1002);

        GoldCnt.text = Gold.ToString();
        //DiamondCnt.text = Diamond.ToString();

        if (CandyCnt != null)
        {
            uint Candy = SerPlayerData.GetItemCount(1003);
            CandyCnt.text = Candy.ToString();
        }
    }
Ejemplo n.º 17
0
    /// <summary> 申请修改玩家名 </summary>
    public void ModifPlayerName()
    {
        GameApp.Instance.SoundInstance.PlaySe("button");

        if (PlayerNameInp.value.Length == 0)
        {
            GameApp.Instance.CommonHintDlg.OpenHintBox("玩家昵称不能为空!");
            return;
        }
        if (PlayerNameInp.value.Contains("*"))
        {
            GameApp.Instance.CommonHintDlg.OpenHintBox("玩家昵称中含有非法字符!");
            return;
        }

        if (SerPlayerData.GetItemCount(1000) < 200)
        {
            GameApp.Instance.CommonHintDlg.OpenHintBox("钻石不足!");
            return;
        }

        GameApp.SendMsg.CheckPlayerName(PlayerNameInp.value);
    }
Ejemplo n.º 18
0
    private void StatisHoldCnt()
    {
        if (ThemeID == 0)
        {
            return;
        }

        int total = 0;
        int hold  = 0;

        foreach (KeyValuePair <int, MagicCardConfig> pair in CsvConfigTables.Instance.MagicCardCsvDic)
        {
            if (pair.Value.ThemeID == ThemeID)
            {
                total++;
                if (SerPlayerData.GetItemCount(pair.Key) > 0)
                {
                    hold++;
                }
            }
        }
        Count.text = StringBuilderTool.ToString(hold, "/", total);
        Count.gameObject.SetActive(hold != 0 || total != 0);
    }
Ejemplo n.º 19
0
    public void SetGuideState(int stateIdx)
    {
        if (PetModel == null)
        {
            RoleConfig rc = null;
            if (CsvConfigTables.Instance.RoleCsvDic.TryGetValue((int)GameApp.Instance.MainPlayerData.PetID, out rc))
            {
                GameObject model = Resources.Load <GameObject>(StringBuilderTool.ToString("Prefabs/Actor/", rc.ModelName));
                if (model != null)
                {
                    PetModel = GameObject.Instantiate(model);
                    MyTools.setLayerDeep(PetModel, LayerMask.NameToLayer("Guide"));
                    PetModel.transform.parent           = PetRoot;
                    PetModel.transform.localPosition    = new Vector3(-110, -73, -84);
                    PetModel.transform.localEulerAngles = new Vector3(0, -140, 0);
                    PetModel.transform.localScale       = Vector3.one * 220;

                    PetAnim = PetModel.GetComponent <Animator>();
                    PetAnim.runtimeAnimatorController = PetFlyAnimCrl;
                }
            }
        }

        switch (stateIdx)
        {
        case 0:
            GameApp.Instance.SoundInstance.PlayVoice("0_HomePageEntrance");
            PetModel.transform.localPosition    = new Vector3(-110, -73, -84);
            PetModel.transform.localEulerAngles = new Vector3(0, -140, 0);
            StepObjs[0].SetActive(true);
            break;

        case 1:
            GameApp.Instance.SoundInstance.StopSe("0_HomePageEntrance");
            GameApp.Instance.SoundInstance.PlayVoice("1_IntroToDinosaurLevel");
            StepObjs[0].SetActive(false);
            StepObjs[1].SetActive(true);
            break;

        case 2:
            GameApp.Instance.SoundInstance.StopSe("1_IntroToDinosaurLevel");
            GameApp.Instance.SoundInstance.PlayVoice("2_FromTriassicPeriod");
            PetModel.transform.localPosition = new Vector3(111, -73, -84);
            StepObjs[1].SetActive(false);
            StepObjs[2].SetActive(true);
            break;

        case 3:
            GameApp.Instance.SoundInstance.StopSe("2_FromTriassicPeriod");
            GameApp.Instance.SoundInstance.PlayVoice("3_CreateAdventureTeams");
            StepObjs[2].SetActive(false);
            StepObjs[3].SetActive(true);
            break;

        case 4:
            GameApp.Instance.SoundInstance.StopSe("3_CreateAdventureTeams");
            GameApp.Instance.SoundInstance.PlayVoice("4_CheckReward");
            PetModel.transform.localPosition = new Vector3(-187, -275, -84);
            StepObjs[3].SetActive(false);
            StepObjs[4].SetActive(true);
            break;

        case 5:
            GameApp.Instance.SoundInstance.StopSe("4_CheckReward");
            GameApp.Instance.SoundInstance.PlayVoice("5_InvitePartner");
            PetModel.transform.localPosition    = new Vector3(300, -112, -84);
            PetModel.transform.localEulerAngles = new Vector3(0, 140, 0);
            StepObjs[4].SetActive(false);
            StepObjs[5].SetActive(true);
            break;

        case 6:
            GameApp.Instance.SoundInstance.StopSe("5_InvitePartner");
            GameApp.Instance.SoundInstance.PlayVoice("6_InvitePet");
            PetModel.transform.localPosition    = new Vector3(166, -69, -84);
            PetModel.transform.localEulerAngles = new Vector3(0, -140, 0);
            StepObjs[5].SetActive(false);
            StepObjs[6].SetActive(true);
            break;

        case 7:
            GameApp.Instance.SoundInstance.StopSe("6_InvitePet");
            GameApp.Instance.SoundInstance.PlayVoice("7_BeganToAdventure");
            PetModel.transform.localPosition    = new Vector3(218, -256, -84);
            PetModel.transform.localEulerAngles = new Vector3(0, 140, 0);
            StepObjs[6].SetActive(false);
            StepObjs[7].SetActive(true);
            break;

        case 8:
            GameApp.Instance.SoundInstance.StopSe("7_BeganToAdventure");
            PetModel.SetActive(false);
            StepObjs[7].SetActive(false);
            break;

        case 9:
            GameApp.Instance.SoundInstance.PlayVoice("8_Throwing");
            PetModel.SetActive(true);
            StepObjs[8].SetActive(true);
            break;

        case 10:
            GameApp.Instance.SoundInstance.StopSe("8_Throwing");
            StepObjs[8].SetActive(false);

            string key = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_NeedShow_FirstChessGuide");
            PlayerPrefs.SetInt(key, 0);

            Destroy(gameObject);
            break;
        }
    }
Ejemplo n.º 20
0
    public void RefreshResidueTime()
    {
        uint ItemCount = SerPlayerData.GetItemCount(ItemID);

        if (ItemCount > 0)
        {
            string des       = "";
            int    DaySum    = 0;
            uint   AccountID = SerPlayerData.GetAccountID();
            string itemKey   = "";
            string awardKey  = "";
            switch (PrivilegeType)
            {
            case EPrivilegeType.eMonth:
                des      = "月";
                DaySum   = 30 * (int)ItemCount;
                itemKey  = StringBuilderTool.ToString(AccountID, "_Privilege_Month");
                awardKey = StringBuilderTool.ToString(AccountID, "_Award_Month_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                break;

            case EPrivilegeType.eSeason:
                des      = "季";
                DaySum   = 90 * (int)ItemCount;
                itemKey  = StringBuilderTool.ToString(AccountID, "_Privilege_Season");
                awardKey = StringBuilderTool.ToString(AccountID, "_Award_Season_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                break;

            case EPrivilegeType.eYear:
                des      = "年";
                DaySum   = 365 * (int)ItemCount;
                itemKey  = StringBuilderTool.ToString(AccountID, "_Privilege_Year");
                awardKey = StringBuilderTool.ToString(AccountID, "_Award_Year_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                break;
            }

            if (ItemCount == 1)
            {
                PlayerPrefs.SetString(itemKey, DateTime.Now.Ticks.ToString());
            }

            string   RecordFirstItemTime = PlayerPrefs.GetString(itemKey);
            DateTime dtFirstItemTime     = new DateTime(long.Parse(RecordFirstItemTime));
            TimeSpan ResidueTime         = DateTime.Now - dtFirstItemTime;
            DaySum -= ResidueTime.Days;
            ResidueTimeDesLab.text = StringBuilderTool.ToString("[6BFF78]", des, "卡特权已开通[-]([FEE209]", DaySum, "[-]天)");

            if (!PlayerPrefs.HasKey(awardKey))
            {
                PlayerPrefs.SetInt(awardKey, 1);

                Dictionary <int, int> AwardItemDic = new Dictionary <int, int>();
                switch (PrivilegeType)
                {
                case EPrivilegeType.eMonth:
                    AwardItemDic.Add(20002, 3);
                    AwardItemDic.Add(1001, 100);
                    AwardItemDic.Add(1003, 100);
                    break;

                case EPrivilegeType.eSeason:
                    AwardItemDic.Add(20002, 4);
                    AwardItemDic.Add(1001, 200);
                    AwardItemDic.Add(1003, 200);
                    break;

                case EPrivilegeType.eYear:
                    AwardItemDic.Add(20002, 5);
                    AwardItemDic.Add(1001, 300);
                    AwardItemDic.Add(1003, 300);
                    break;
                }
                foreach (KeyValuePair <int, int> pair in AwardItemDic)
                {
                    GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", pair.Key, " ", pair.Value));
                }
                GameApp.Instance.GetItemsDlg.OpenGetItemsBox(AwardItemDic);
            }
        }
        else
        {
            ResidueTimeDesLab.text = "[C74343]未开通[-]";
        }
    }
Ejemplo n.º 21
0
    public void Set(int AchievementID)
    {
        if (CsvConfigTables.Instance.AchievementCsvDic.TryGetValue(AchievementID, out AchievementCfg))
        {
            Name.text       = AchievementCfg.Name;
            Des.text        = AchievementCfg.AchievementTarget.Replace("#", AchievementCfg.TargetParameters.ToString());
            Icon.spriteName = AchievementCfg.Icon;

            bool isFinish = false;
            long Schedule = 0;
            int  deno     = 0;
            switch (AchievementCfg.Type)
            {
            case 0:    //套卡收集
                //if ( <= SerPlayerData.GetMainStageProgress())
            {
                Schedule = SerPlayerData.GetCardCounLimitThemet(AchievementCfg.AchievementParameters);
                foreach (KeyValuePair <int, MagicCardConfig> pair in CsvConfigTables.Instance.MagicCardCsvDic)
                {
                    if (pair.Value.ThemeID == AchievementCfg.AchievementParameters)
                    {
                        deno++;
                    }
                }
                ScheduleValue.text = Schedule + "/" + deno;
                SchedulePB.value   = (float)Schedule / (float)deno;

                isFinish = (Schedule >= deno) && deno != 0;
            }
            break;
                //        case 1://关卡类型
                //            for (int i = 0; i < AchievementCfg.AchievementParameters.Count; i++)
                //            {
                //                Schedule += GameApp.Instance.TIDS.GetMethodPassedCnt(AchievementCfg.AchievementParameters[i]);
                //            }
                //            if (Schedule >= AchievementCfg.TargetParameters)
                //            {
                //                isFinish = true;
                //            }
                //            break;
                //        case 2://击杀指定怪物
                //            Schedule = GameApp.Instance.TIDS.GetKillMonsterCnt(AchievementCfg.AchievementParameters[0]);
                //            if (Schedule >= AchievementCfg.TargetParameters)
                //            {
                //                isFinish = true;
                //            }
                //            break;
                //        case 3://造成伤害
                //            Schedule = GameApp.Instance.TIDS.GetTotalHarmValue();
                //            if (Schedule >= AchievementCfg.TargetParameters)
                //            {
                //                isFinish = true;
                //            }
                //            break;
                //        case 4://强化技能
                //            WeaponSkillConfig wsc = null;
                //            if (CsvConfigTables.Instance.WeaponSkillCsvDic.TryGetValue((int)PeripheralEventMgr.Instance.weaponType, out wsc))
                //            {
                //                for (int i = 0; i < wsc.SuperSkillIDs.Count; i++)
                //                {
                //                    common.PlayerSkillItem psi = SerPlayerData.GetSkillInfo(wsc.SuperSkillIDs[i]);
                //                    if (psi != null)
                //                    {
                //                        if (psi.m_level >= AchievementCfg.TargetParameters)
                //                        {
                //                            Schedule++;
                //                        }
                //                    }
                //                }
                //            }
                //            if (Schedule >= 3)
                //            {
                //                isFinish = true;
                //            }
                //            break;
                //        case 5://击杀指定阵营怪物
                //            Schedule = GameApp.Instance.TIDS.GetKillCampCnt(AchievementCfg.AchievementParameters[0]);
                //            if (Schedule >= AchievementCfg.TargetParameters)
                //            {
                //                isFinish = true;
                //            }
                //            break;
            }
            GetAwardBtnObj.SetActive(isFinish);
            InProgressHintObj.SetActive(!isFinish);
            //    PassedHintObj.SetActive(false);

            //

            //

            string[] TempSplit = AchievementCfg.Pool.Split('&');
            AwardItem[0].SetItemData(int.Parse(TempSplit[0]), int.Parse(TempSplit[1]));
            GMOrderItemStr = TempSplit[0] + " " + TempSplit[1];
            AwardItemLst.Clear();
            AwardItemLst.Add(int.Parse(TempSplit[0]), int.Parse(TempSplit[1]));

            //if (GameApp.Instance.TIDS.GetReceiveAwardState(AchievementID))
            if (PlayerPrefs.HasKey(GetLocalSaveKey()))
            {
                if (PlayerPrefs.GetInt(GetLocalSaveKey()) > 0)
                {
                    ResetNextAchievementInfo();
                }
            }
        }
    }
Ejemplo n.º 22
0
    IEnumerator RefreshCardList()
    {
        MyTools.DestroyChildNodes(CardTable.transform);

        HoldLst.Clear();
        List <int> WithoutLst = new List <int>();
        List <int> WithoutAndEnableCompLst = new List <int>();
        List <int> WithoutAndUnableCompLst = new List <int>();

        foreach (KeyValuePair <int, MagicCardConfig> pair in CsvConfigTables.Instance.MagicCardCsvDic)
        {
            if (pair.Value.SystemID == CurChapterID && pair.Value.ThemeID == CurGroupID && (CurQuality == 0 ? true : pair.Value.Quality == CurQuality))
            {
                if (SerPlayerData.GetItemCount(pair.Key) > 0)
                {
                    HoldLst.Add(pair.Key);
                }
                else
                {
                    WithoutLst.Add(pair.Key);
                }
            }
        }

        if (HoldLst.Count == 0 && WithoutLst.Count == 0)
        {
            TweenAlpha.Begin(GroupExplain, 0.2f, 1);

            GroupConfig gc = null;
            CsvConfigTables.Instance.GroupCsvDic.TryGetValue(CurGroupID, out gc);
            if (gc != null)
            {
                GroupExplain_Pic.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("MagicCardTheme/", gc.ThemePic)) as Texture;
                GroupExplain_Title.text      = gc.Name;
                GroupExplain_Explain.text    = gc.Explain;
            }
            yield break;
        }
        else
        {
            TweenAlpha.Begin(GroupExplain, 0.2f, 0);
        }

        for (int i = 0; i < HoldLst.Count; i++)
        {
            AddCard(HoldLst[i]);
            yield return(new WaitForEndOfFrame());
        }

        for (int i = 0; i < WithoutLst.Count; i++)
        {
            if (EnableCompound(WithoutLst[i]))
            {
                WithoutAndEnableCompLst.Add(WithoutLst[i]);
            }
            else
            {
                WithoutAndUnableCompLst.Add(WithoutLst[i]);
            }
        }
        for (int i = 0; i < WithoutAndEnableCompLst.Count; i++)
        {
            AddCard(WithoutAndEnableCompLst[i]);
            yield return(new WaitForEndOfFrame());
        }
        for (int i = 0; i < WithoutAndUnableCompLst.Count; i++)
        {
            AddCard(WithoutAndUnableCompLst[i]);
            yield return(new WaitForEndOfFrame());
        }

        CardLstRoot.GetComponent <UIScrollView>().ResetPosition();
    }
Ejemplo n.º 23
0
    /*void Awake()
     * {
     *
     * }
     *
     * void Start()
     * {
     *
     * }
     *
     * void OnDestroy()
     * {
     *
     * }
     *
     * void Update()
     * {
     *
     * }*/

    public void Show(int CardID)
    {
        if (CsvConfigTables.Instance.MagicCardCsvDic.TryGetValue(CardID, out MCCfg))
        {
            gameObject.SetActive(true);

            Name.text = MCCfg.Name;

            if (MagicVal != null)
            {
                MagicVal.text = MCCfg.MagicVal.ToString();
            }

            if (Des != null)
            {
                Des.text = MCCfg.Describe;
            }

            if (Count != null)
            {
                Count.text = SerPlayerData.GetItemCount(MCCfg.CardID).ToString();
            }

            if (SerPlayerData.GetItemCount(MCCfg.CardID) > 0)
            {
                Icon.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("MagicCard/", MCCfg.ColouredIcon)) as Texture;

                for (int i = 0; i < Star.Length; i++)
                {
                    Star[i].spriteName = "c_t_star01";
                    Star[i].gameObject.SetActive(i < MCCfg.StarLv);
                }

                if (Bg != null)
                {
                    switch (MCCfg.Quality)
                    {
                    case 1:
                        Bg.spriteName = "lvbian";
                        break;

                    case 2:
                        Bg.spriteName = "lanbian";
                        break;

                    case 3:
                        Bg.spriteName = "zibian";
                        break;
                    }
                }

                if (QualitySign != null)
                {
                    switch (MCCfg.Quality)
                    {
                    case 1:
                        QualitySign.spriteName = "lvbiao";
                        break;

                    case 2:
                        QualitySign.spriteName = "lanbiao";
                        break;

                    case 3:
                        QualitySign.spriteName = "zibiao";
                        break;
                    }
                    QualitySign.MakePixelPerfect();
                }
            }
            else
            {
                Icon.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("MagicCard/", MCCfg.ColorlessIcon)) as Texture;

                for (int i = 0; i < Star.Length; i++)
                {
                    Star[i].spriteName = "c_t_star01_hui";
                    Star[i].gameObject.SetActive(i < MCCfg.StarLv);
                }

                if (Bg != null)
                {
                    Bg.spriteName = "huibian";
                }

                if (QualitySign != null)
                {
                    QualitySign.spriteName = "";
                }
            }

            bool isEnableComp = (MCCfg.NeedItemsLst.Count > 0);
            if (isEnableComp)
            {
                bool MaterialCardsNotEnough    = false;
                Dictionary <int, int> ItemsDic = new Dictionary <int, int>();
                for (int i = 0; i < MCCfg.NeedItemsLst.Count; i++)
                {
                    if (ItemsDic.ContainsKey(MCCfg.NeedItemsLst[i].ItemID))
                    {
                        ItemsDic[MCCfg.NeedItemsLst[i].ItemID] += MCCfg.NeedItemsLst[i].ItemCnt;
                    }
                    else
                    {
                        ItemsDic.Add(MCCfg.NeedItemsLst[i].ItemID, MCCfg.NeedItemsLst[i].ItemCnt);
                    }
                }
                foreach (KeyValuePair <int, int> pair in ItemsDic)
                {
                    if (SerPlayerData.GetItemCount(pair.Key) < pair.Value)
                    {
                        MaterialCardsNotEnough = true;
                        break;
                    }
                }
                if (MaterialCardsNotEnough)
                {
                    isEnableComp = false;
                }
            }
            if (EnableCompound != null)
            {
                EnableCompound.SetActive(isEnableComp);
            }

            if (NewSign != null)
            {
                if (ShowNewSignCardIDLst.Contains(CardID))
                {
                    NewSign.alpha = 1;
                }
                else
                {
                    NewSign.alpha = 0;
                }
            }

            switch (MCCfg.StarLv)
            {
            case 1:
                Star[0].transform.localPosition = Vector3.zero;
                break;

            case 2:
                Star[0].transform.localPosition = new Vector3(-12, 0, 0);
                Star[1].transform.localPosition = new Vector3(12, 0, 0);
                break;

            case 3:
                Star[0].transform.localPosition = new Vector3(-24, 0, 0);
                Star[1].transform.localPosition = Vector3.zero;
                Star[2].transform.localPosition = new Vector3(24, 0, 0);
                break;

            case 4:
                Star[0].transform.localPosition = new Vector3(-36, 0, 0);
                Star[1].transform.localPosition = new Vector3(-12, 0, 0);
                Star[2].transform.localPosition = new Vector3(12, 0, 0);
                Star[3].transform.localPosition = new Vector3(36, 0, 0);
                break;

            case 5:
                break;
            }
        }
        else
        {
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 24
0
    public void UnconditionalShow(int CardID)
    {
        if (CsvConfigTables.Instance.MagicCardCsvDic.TryGetValue(CardID, out MCCfg))
        {
            gameObject.SetActive(true);

            Name.text = MCCfg.Name;

            if (MagicVal != null)
            {
                MagicVal.text = MCCfg.MagicVal.ToString();
            }

            if (Des != null)
            {
                Des.text = StringBuilderTool.ToInfoString("  ", MCCfg.Describe.Replace("\\n", "\n"));
                BoxCollider bc = Des.gameObject.GetComponent <BoxCollider>();
                if (bc != null)
                {
                    bc.center = new Vector3(Des.width / 2, -Des.height / 2, 0);
                    bc.size   = new Vector3(Des.width, Des.height, 0);
                }
                UITable tab = Des.transform.parent.GetComponent <UITable>();
                if (tab != null)
                {
                    tab.Reposition();
                    UIScrollView sv = tab.transform.parent.GetComponent <UIScrollView>();
                    if (sv != null)
                    {
                        sv.ResetPosition();
                    }
                }
            }

            if (Count != null)
            {
                Count.text = SerPlayerData.GetItemCount(MCCfg.CardID).ToString();
            }

            Icon.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("MagicCard/", MCCfg.ColouredIcon)) as Texture;

            for (int i = 0; i < Star.Length; i++)
            {
                Star[i].spriteName = "c_t_star01";
                Star[i].gameObject.SetActive(i < MCCfg.StarLv);
            }


            if (MCCfg.ThemeID == 101)//恐龙世界
            {
                if (Title != null)
                {
                    Title.gameObject.SetActive(true);
                }
                if (LatinName != null)
                {
                    LatinName.gameObject.SetActive(true);
                }
                if (Epoch != null)
                {
                    Epoch.gameObject.SetActive(true);
                }
                if (Family != null)
                {
                    Family.gameObject.SetActive(true);
                }
                if (Weight != null)
                {
                    Weight.gameObject.SetActive(false);
                }
                if (Height != null)
                {
                    Height.gameObject.SetActive(true);
                }
                if (Habitat != null)
                {
                    Habitat.gameObject.SetActive(true);
                }
                if (Food != null)
                {
                    Food.gameObject.SetActive(true);
                }
                if (Satellite != null)
                {
                    Satellite.gameObject.SetActive(false);
                }
                if (Distance != null)
                {
                    Distance.gameObject.SetActive(false);
                }
                if (Temperature != null)
                {
                    Temperature.gameObject.SetActive(false);
                }
                if (Diameter != null)
                {
                    Diameter.gameObject.SetActive(false);
                }
                if (Day != null)
                {
                    Day.gameObject.SetActive(false);
                }
                if (Year != null)
                {
                    Year.gameObject.SetActive(false);
                }
                if (Time != null)
                {
                    Time.gameObject.SetActive(false);
                }
                if (Ruler != null)
                {
                    Ruler.gameObject.SetActive(false);
                }
            }
            else if (MCCfg.ThemeID == 102)//动物园
            {
                if (Title != null)
                {
                    Title.gameObject.SetActive(true);
                }
                if (LatinName != null)
                {
                    LatinName.gameObject.SetActive(true);
                }
                if (Epoch != null)
                {
                    Epoch.gameObject.SetActive(false);
                }
                if (Family != null)
                {
                    Family.gameObject.SetActive(false);
                }
                if (Weight != null)
                {
                    Weight.gameObject.SetActive(true);
                }
                if (Height != null)
                {
                    Height.gameObject.SetActive(true);
                }
                if (Habitat != null)
                {
                    Habitat.gameObject.SetActive(true);
                }
                if (Food != null)
                {
                    Food.gameObject.SetActive(true);
                }
                if (Satellite != null)
                {
                    Satellite.gameObject.SetActive(false);
                }
                if (Distance != null)
                {
                    Distance.gameObject.SetActive(false);
                }
                if (Temperature != null)
                {
                    Temperature.gameObject.SetActive(false);
                }
                if (Diameter != null)
                {
                    Diameter.gameObject.SetActive(false);
                }
                if (Day != null)
                {
                    Day.gameObject.SetActive(false);
                }
                if (Year != null)
                {
                    Year.gameObject.SetActive(false);
                }
                if (Time != null)
                {
                    Time.gameObject.SetActive(false);
                }
                if (Ruler != null)
                {
                    Ruler.gameObject.SetActive(false);
                }
            }
            else if (MCCfg.ThemeID == 103)//海洋世界
            {
                if (Title != null)
                {
                    Title.gameObject.SetActive(true);
                }
                if (LatinName != null)
                {
                    LatinName.gameObject.SetActive(true);
                }
                if (Epoch != null)
                {
                    Epoch.gameObject.SetActive(false);
                }
                if (Family != null)
                {
                    Family.gameObject.SetActive(false);
                }
                if (Weight != null)
                {
                    Weight.gameObject.SetActive(true);
                }
                if (Height != null)
                {
                    Height.gameObject.SetActive(true);
                }
                if (Habitat != null)
                {
                    Habitat.gameObject.SetActive(true);
                }
                if (Food != null)
                {
                    Food.gameObject.SetActive(true);
                }
                if (Satellite != null)
                {
                    Satellite.gameObject.SetActive(false);
                }
                if (Distance != null)
                {
                    Distance.gameObject.SetActive(false);
                }
                if (Temperature != null)
                {
                    Temperature.gameObject.SetActive(false);
                }
                if (Diameter != null)
                {
                    Diameter.gameObject.SetActive(false);
                }
                if (Day != null)
                {
                    Day.gameObject.SetActive(false);
                }
                if (Year != null)
                {
                    Year.gameObject.SetActive(false);
                }
                if (Time != null)
                {
                    Time.gameObject.SetActive(false);
                }
                if (Ruler != null)
                {
                    Ruler.gameObject.SetActive(false);
                }
            }
            else if (MCCfg.ThemeID == 201)//太阳系
            {
                if (Title != null)
                {
                    Title.gameObject.SetActive(true);
                }
                if (LatinName != null)
                {
                    LatinName.gameObject.SetActive(true);
                }
                if (Epoch != null)
                {
                    Epoch.gameObject.SetActive(false);
                }
                if (Family != null)
                {
                    Family.gameObject.SetActive(false);
                }
                if (Weight != null)
                {
                    Weight.gameObject.SetActive(false);
                }
                if (Height != null)
                {
                    Height.gameObject.SetActive(false);
                }
                if (Habitat != null)
                {
                    Habitat.gameObject.SetActive(false);
                }
                if (Food != null)
                {
                    Food.gameObject.SetActive(false);
                }
                if (Satellite != null)
                {
                    Satellite.gameObject.SetActive(true);
                }
                if (Distance != null)
                {
                    Distance.gameObject.SetActive(true);
                }
                if (Temperature != null)
                {
                    Temperature.gameObject.SetActive(true);
                }
                if (Diameter != null)
                {
                    Diameter.gameObject.SetActive(true);
                }
                if (Day != null)
                {
                    Day.gameObject.SetActive(true);
                }
                if (Year != null)
                {
                    Year.gameObject.SetActive(true);
                }
                if (Time != null)
                {
                    Time.gameObject.SetActive(false);
                }
                if (Ruler != null)
                {
                    Ruler.gameObject.SetActive(false);
                }
            }
            else if (MCCfg.ThemeID == 601)//春节
            {
                if (Title != null)
                {
                    Title.gameObject.SetActive(false);
                }
                if (LatinName != null)
                {
                    LatinName.gameObject.SetActive(false);
                }
                if (Epoch != null)
                {
                    Epoch.gameObject.SetActive(false);
                }
                if (Family != null)
                {
                    Family.gameObject.SetActive(false);
                }
                if (Weight != null)
                {
                    Weight.gameObject.SetActive(false);
                }
                if (Height != null)
                {
                    Height.gameObject.SetActive(false);
                }
                if (Habitat != null)
                {
                    Habitat.gameObject.SetActive(false);
                }
                if (Food != null)
                {
                    Food.gameObject.SetActive(false);
                }
                if (Satellite != null)
                {
                    Satellite.gameObject.SetActive(false);
                }
                if (Distance != null)
                {
                    Distance.gameObject.SetActive(false);
                }
                if (Temperature != null)
                {
                    Temperature.gameObject.SetActive(false);
                }
                if (Diameter != null)
                {
                    Diameter.gameObject.SetActive(false);
                }
                if (Day != null)
                {
                    Day.gameObject.SetActive(false);
                }
                if (Year != null)
                {
                    Year.gameObject.SetActive(false);
                }
                if (Time != null)
                {
                    Time.gameObject.SetActive(true);
                }
                if (Ruler != null)
                {
                    Ruler.gameObject.SetActive(false);
                }
            }
            else if (MCCfg.ThemeID == 603)//星座
            {
                if (Title != null)
                {
                    Title.gameObject.SetActive(false);
                }
                if (LatinName != null)
                {
                    LatinName.gameObject.SetActive(true);
                }
                if (Epoch != null)
                {
                    Epoch.gameObject.SetActive(false);
                }
                if (Family != null)
                {
                    Family.gameObject.SetActive(false);
                }
                if (Weight != null)
                {
                    Weight.gameObject.SetActive(false);
                }
                if (Height != null)
                {
                    Height.gameObject.SetActive(false);
                }
                if (Habitat != null)
                {
                    Habitat.gameObject.SetActive(false);
                }
                if (Food != null)
                {
                    Food.gameObject.SetActive(false);
                }
                if (Satellite != null)
                {
                    Satellite.gameObject.SetActive(false);
                }
                if (Distance != null)
                {
                    Distance.gameObject.SetActive(false);
                }
                if (Temperature != null)
                {
                    Temperature.gameObject.SetActive(false);
                }
                if (Diameter != null)
                {
                    Diameter.gameObject.SetActive(false);
                }
                if (Day != null)
                {
                    Day.gameObject.SetActive(false);
                }
                if (Year != null)
                {
                    Year.gameObject.SetActive(false);
                }
                if (Time != null)
                {
                    Time.gameObject.SetActive(true);
                }
                if (Ruler != null)
                {
                    Ruler.gameObject.SetActive(true);
                }
            }

            if (Bg != null)
            {
                switch (MCCfg.Quality)
                {
                case 1:
                    Bg.spriteName = "lvbian";
                    break;

                case 2:
                    Bg.spriteName = "lanbian";
                    break;

                case 3:
                    Bg.spriteName = "zibian";
                    break;
                }
            }

            if (QualitySign != null)
            {
                switch (MCCfg.Quality)
                {
                case 1:
                    QualitySign.spriteName = "lvbiao";
                    break;

                case 2:
                    QualitySign.spriteName = "lanbiao";
                    break;

                case 3:
                    QualitySign.spriteName = "zibiao";
                    break;
                }
                QualitySign.MakePixelPerfect();
            }

            if (System != null)
            {
                ChapterConfig cc = null;
                if (CsvConfigTables.Instance.ChapterCsvDic.TryGetValue(MCCfg.SystemID, out cc))
                {
                    System.text = cc.Name;
                }
            }

            if (Theme != null)
            {
                GroupConfig gc = null;
                if (CsvConfigTables.Instance.GroupCsvDic.TryGetValue(MCCfg.ThemeID, out gc))
                {
                    Theme.text = gc.Name;
                }
            }

            if (Quality != null)
            {
                Quality.text = StringBuilderTool.ToInfoString(ArabicToChinese(MCCfg.Quality), "阶卡");
            }

            if (Epoch != null)
            {
                Epoch.text = MCCfg.Epoch;
            }

            if (Family != null)
            {
                Family.text = MCCfg.Family;
            }

            if (LatinName != null)
            {
                LatinName.text = MCCfg.LatinName;
            }

            if (Height != null)
            {
                Height.text = MCCfg.Height;
            }

            if (Habitat != null)
            {
                Habitat.text = MCCfg.Habitat;
            }

            if (Food != null)
            {
                Food.text = MCCfg.Food;
            }

            if (Weight != null)
            {
                if (MCCfg.Weight.Length == 0)
                {
                    Weight.gameObject.SetActive(false);
                }
                Weight.text = MCCfg.Weight;
            }

            if (Satellite != null)
            {
                if (MCCfg.Satellite.Length == 0)
                {
                    Satellite.gameObject.SetActive(false);
                }
                Satellite.text = MCCfg.Satellite;
            }

            if (Temperature != null)
            {
                if (MCCfg.Temperature.Length == 0)
                {
                    Temperature.gameObject.SetActive(false);
                }
                Temperature.text = MCCfg.Temperature;
            }

            if (Distance != null)
            {
                if (MCCfg.Distance.Length == 0)
                {
                    Distance.gameObject.SetActive(false);
                }
                Distance.text = MCCfg.Distance;
            }

            if (Diameter != null)
            {
                if (MCCfg.Diameter.Length == 0)
                {
                    Diameter.gameObject.SetActive(false);
                }
                Diameter.text = MCCfg.Diameter;
            }

            if (Day != null)
            {
                if (MCCfg.Day.Length == 0)
                {
                    Day.gameObject.SetActive(false);
                }
                Day.text = MCCfg.Day;
            }

            if (Year != null)
            {
                if (MCCfg.Year.Length == 0)
                {
                    Year.gameObject.SetActive(false);
                }
                Year.text = MCCfg.Year;
            }

            if (Time != null)
            {
                if (MCCfg.Time.Length == 0)
                {
                    Time.gameObject.SetActive(false);
                }
                Time.text = MCCfg.Time;
            }

            if (Title != null)
            {
                if (MCCfg.Title.Length == 0)
                {
                    Title.gameObject.SetActive(false);
                }
                Title.text = MCCfg.Title;
            }

            if (GetWayFromStage != null)
            {
                bool showShortcut = (MCCfg.Shortcut != 0);
                GetWayFromStage.gameObject.SetActive(showShortcut);
                if (showShortcut)
                {
                    StageConfig sc = null;
                    if (CsvConfigTables.Instance.StageCsvDic.TryGetValue(MCCfg.Shortcut, out sc))
                    {
                        GetWayFromStage.text = sc.Name;
                    }
                }
            }

            if (EnableCompound != null)
            {
                EnableCompound.SetActive(false);
            }

            if (NewSign != null)
            {
                NewSign.alpha = 0;
            }

            switch (MCCfg.StarLv)
            {
            case 1:
                Star[0].transform.localPosition = Vector3.zero;
                break;

            case 2:
                Star[0].transform.localPosition = new Vector3(-12, 0, 0);
                Star[1].transform.localPosition = new Vector3(12, 0, 0);
                break;

            case 3:
                Star[0].transform.localPosition = new Vector3(-24, 0, 0);
                Star[1].transform.localPosition = Vector3.zero;
                Star[2].transform.localPosition = new Vector3(24, 0, 0);
                break;

            case 4:
                Star[0].transform.localPosition = new Vector3(-36, 0, 0);
                Star[1].transform.localPosition = new Vector3(-12, 0, 0);
                Star[2].transform.localPosition = new Vector3(12, 0, 0);
                Star[3].transform.localPosition = new Vector3(36, 0, 0);
                break;

            case 5:
                break;
            }
        }
        else
        {
            gameObject.SetActive(false);
        }
    }
Ejemplo n.º 25
0
    public void OnClick()
    {
        GameApp.Instance.SoundInstance.PlaySe("button");
        Debug.Log("点击:" + Name.text);

        //if (MCCfg != null && GameApp.Instance.CardHoldCountLst[MCCfg.CardID] > 0)
        //{
        //GameApp.Instance.HomePageUI.MagicBookUI.FullCard.Show(MCCfg.CardID);

        //Debug.Log(Name.text);
        //}
        //else
        //{
        //GameApp.Instance.CommonHintDlg.OpenHintBox("请先收集到此魔卡后再查看详情!");
        //}
        if (GameApp.Instance.TravelUI != null)
        {
            if (GameApp.Instance.TravelUI.TravelSeafloor != null)
            {
                GameApp.Instance.TravelUI.TravelSeafloor.PutFishModelInScene(MCCfg);
            }
            return;
        }

        if (Price != null)
        {
            Debug.Log("显示购买确认");
            GameApp.Instance.HomePageUI.MarketUI.ShowPurchaseConfirmation(gameObject);
            return;
        }

        if (ExchangeLab != null)
        {
            Debug.Log("显示可换魔卡界面");
            GameApp.Instance.HomePageUI.MarketUI.ShowAbleExchangeCardLst(this);
            return;
        }

        if (Sel != null)
        {
            Debug.Log("选中待更换的魔卡");
            for (int i = 0; i < transform.parent.childCount; i++)
            {
                Transform child = transform.parent.GetChild(i);
                if (child.name == transform.name)
                {
                    continue;
                }

                UI_MagicCard mc = child.GetComponent <UI_MagicCard>();
                mc.ShowSelSign(false);
            }
            ShowSelSign(true);
            GameApp.Instance.HomePageUI.MarketUI.SelectExchangeCard(this);
            return;
        }

        if (EnableCompound != null && EnableCompound.activeSelf)
        {
            if (GameApp.Instance.HomePageUI != null)
            {
                GameApp.Instance.HomePageUI.MagicBookUI.ShowCompound(MCCfg.CardID);
            }
            else if (GameApp.Instance.TravelUI != null)
            {
                GameApp.Instance.TravelUI.MagicBookUI.ShowCompound(MCCfg.CardID);
            }
        }
        else
        {
            if (SerPlayerData.GetItemCount(MCCfg.CardID) > 0)
            {
                RemoveShowNewSignCardID(MCCfg.CardID);
                if (NewSign != null)
                {
                    NewSign.alpha = 0;
                }

                if (GameApp.Instance.HomePageUI != null)
                {
                    GameApp.Instance.HomePageUI.MagicBookUI.ShowCardDetails(MCCfg.CardID);
                }
                else if (GameApp.Instance.TravelUI != null)
                {
                    GameApp.Instance.TravelUI.MagicBookUI.ShowCardDetails(MCCfg.CardID);
                }
            }
            else
            {
                GameApp.Instance.CommonHintDlg.OpenHintBox("请先收集到此魔卡后再查看详情!");
            }
            //GameApp.Instance.CommonHintDlg.OpenHintBox(StringBuilderTool.ToInfoString("查看", FullName(), "的卡牌详情!"));
        }
    }
Ejemplo n.º 26
0
    public void OnClick_Purchase()
    {
        GameApp.Instance.SoundInstance.PlaySe("button");
        Debug.Log("点击【购买】");

        switch (CurType)
        {
        case 1:
        {
            uint Gold           = SerPlayerData.GetItemCount(1001);
            uint CommodityID    = 0;
            uint CommodityPrice = 0;

            UI_MagicCard     mc = CurCommodityObj.GetComponent <UI_MagicCard>();
            UI_CommodityItem ci = CurCommodityObj.GetComponent <UI_CommodityItem>();
            if (mc != null)
            {
                CommodityID    = (uint)mc.MCCfg.CardID;
                CommodityPrice = uint.Parse(mc.Price.text);
            }
            else if (ci != null)
            {
                CommodityID    = (uint)ci.ItemCfg.ItemID;
                CommodityPrice = uint.Parse(ci.Price.text);
            }
            else
            {
                return;
            }

            if (Gold >= CommodityPrice)
            {
                if (mc != null)
                {
                    mc.SetPurchased();

                    GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", mc.MCCfg.CardID, " 1"));
                }
                else if (ci != null)
                {
                    ci.SetPurchased();

                    GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", ci.ItemCfg.ItemID, " 1"));
                }

                TweenAlpha.Begin(PurchaseConfirmationRoot, 0.2f, 0).from = 1;

                GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem 1001 ", -CommodityPrice));
            }
            else
            {
                ShowGoldCoinNotEnough();
            }
        }
        break;

        case 2:
            break;

        case 3:
        {
            UI_CommodityItem ci = CurCommodityObj.GetComponent <UI_CommodityItem>();
            if (ci != null)
            {
                if (GameApp.Instance.Platform != null && GameApp.Instance.LeSDKInstance != null)
                {
                    GameApp.Instance.Platform.CreateOrder(ci.GoodsID);
                }
            }
        }
        break;
        }
    }
Ejemplo n.º 27
0
 void RefreshCoinCount()
 {
     NormalCoinCountLab.text = SerPlayerData.GetItemCount(20001).ToString();
     GoldCoinCountLab.text   = SerPlayerData.GetItemCount(20002).ToString();
 }
Ejemplo n.º 28
0
    void CheckPrivilegeAward()
    {
        //GameApp.Instance.RollingNoticeDlg.AddRollingNotice("欢迎试玩《魔卡百科》Demo版本!");

        Dictionary <EPrivilegeType, int> PrivilegeLst = new Dictionary <EPrivilegeType, int>();

        PrivilegeLst.Add(EPrivilegeType.eMonth, 2001);
        PrivilegeLst.Add(EPrivilegeType.eSeason, 2002);
        PrivilegeLst.Add(EPrivilegeType.eYear, 2003);
        foreach (KeyValuePair <EPrivilegeType, int> pair in PrivilegeLst)
        {
            uint ItemCount = SerPlayerData.GetItemCount(pair.Value);
            if (ItemCount > 0)
            {
                string des       = "";
                uint   AccountID = SerPlayerData.GetAccountID();
                string awardKey  = "";
                switch (pair.Key)
                {
                case EPrivilegeType.eMonth:
                    des      = "月";
                    awardKey = StringBuilderTool.ToString(AccountID, "_Award_Month_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                    break;

                case EPrivilegeType.eSeason:
                    des      = "季";
                    awardKey = StringBuilderTool.ToString(AccountID, "_Award_Season_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                    break;

                case EPrivilegeType.eYear:
                    des      = "年";
                    awardKey = StringBuilderTool.ToString(AccountID, "_Award_Year_", DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                    break;
                }

                if (!PlayerPrefs.HasKey(awardKey))
                {
                    PlayerPrefs.SetInt(awardKey, 1);

                    Dictionary <int, int> AwardItemDic = new Dictionary <int, int>();
                    switch (pair.Key)
                    {
                    case EPrivilegeType.eMonth:
                        AwardItemDic.Add(20002, 3);
                        AwardItemDic.Add(1001, 100);
                        AwardItemDic.Add(1003, 100);
                        break;

                    case EPrivilegeType.eSeason:
                        AwardItemDic.Add(20002, 4);
                        AwardItemDic.Add(1001, 200);
                        AwardItemDic.Add(1003, 200);
                        break;

                    case EPrivilegeType.eYear:
                        AwardItemDic.Add(20002, 5);
                        AwardItemDic.Add(1001, 300);
                        AwardItemDic.Add(1003, 300);
                        break;
                    }
                    foreach (KeyValuePair <int, int> pair2 in AwardItemDic)
                    {
                        GameApp.SendMsg.GMOrder(StringBuilderTool.ToString("AddItem ", pair2.Key, " ", pair2.Value));
                    }
                    GameApp.Instance.GetItemsDlg.OpenGetItemsBox(AwardItemDic);
                    GameApp.Instance.CommonHintDlg.OpenHintBox(StringBuilderTool.ToInfoString(des, "卡特权每日奖励!"));
                }
            }
        }
    }
    public void Set(int Index, int CurAL)
    {
        CurIndex = Index;

        Title.text    = StringBuilderTool.ToString("累计登录", Index, "天");
        Schedule.text = StringBuilderTool.ToString(CurAL, "/", Index);

        bool   IsGet         = false;
        string StateStr      = "";
        string IsGetStateKey = StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_AccumulativeLogin_IsGetState");

        if (PlayerPrefs.HasKey(IsGetStateKey))
        {
            StateStr = PlayerPrefs.GetString(IsGetStateKey);
            string[] tempSplit = StateStr.Split('_');
            for (int k = 0; k < tempSplit.Length; k++)
            {
                if (int.Parse(tempSplit[k]) == CurIndex)
                {
                    IsGet = true;
                    break;
                }
            }
        }

        if (CurAL - Index == 1 || (CurAL == Index && Index == 1))
        {
            if (IsGet)
            {
                GetBtn.isEnabled = false;
                GetBtnText.text  = "已领取";
            }
            else
            {
                GetBtn.isEnabled = true;
                GetBtnText.text  = "领取";
            }
        }
        else
        {
            if (IsGet)
            {
                GetBtn.isEnabled = false;
                GetBtnText.text  = "已领取";
            }
            else
            {
                GetBtn.isEnabled = false;
                GetBtnText.text  = "未完成";
            }
        }

        for (int k = 0; k < AwardItemRoot.Length; k++)
        {
            AwardItemRoot[k].SetActive(false);
        }
        ActivityConfig ACfg = null;

        CsvConfigTables.Instance.ActivityCsvDic.TryGetValue(Index, out ACfg);
        if (ACfg != null)
        {
            int i = 0;

            AwardItemDic = ACfg.GetAward();
            foreach (KeyValuePair <int, int> pair in AwardItemDic)
            {
                if (i < AwardItemIcon.Length)
                {
                    AwardItemRoot[i].SetActive(true);

                    ItemConfig ItemCfg = null;
                    CsvConfigTables.Instance.ItemCsvDic.TryGetValue(pair.Key, out ItemCfg);
                    if (ItemCfg != null)
                    {
                        if (ItemCfg.Type == 2)
                        {
                            AwardItemIcon[i].enabled = false;

                            UITexture cardIcon = AwardItemIcon[i].gameObject.AddComponent <UITexture>();
                            cardIcon.mainTexture = Resources.Load(StringBuilderTool.ToInfoString("MagicCard/", ItemCfg.GetIcon())) as Texture;
                            cardIcon.width       = 40;
                            cardIcon.height      = 60;
                            cardIcon.depth       = 14;
                        }
                        else
                        {
                            AwardItemIcon[i].spriteName = ItemCfg.Icon;
                        }
                    }

                    //AwardItemDic[pair.Key] = pair.Value * Index;
                    AwardItemCnt[i].text = pair.Value.ToString();
                }
                i++;
            }
        }
    }
Ejemplo n.º 30
0
 private string GetLocalSaveKey()
 {
     return(StringBuilderTool.ToString(SerPlayerData.GetAccountID(), "_Achievement_", AchievementID));
 }