private void RefreshAllInfo(PWeflareInfo info)
    {
        m_data = moduleWelfare.GetProgress(info);
        m_oneExpend.SafeSetActive(false);
        m_oneExpend.SafeSetActive(false);

        if ((WelfareType)info.type == WelfareType.StrengConsum || (WelfareType)info.type == WelfareType.SpecifiedStreng)
        {
            SetStreng(info);
        }
        else if ((WelfareType)info.type == WelfareType.MatchStreetPvP)
        {
            SetMatchStreePvP(info);
        }
        else if ((WelfareType)info.type == WelfareType.FirstFlush)
        {
            SetFirstFlush(info);
        }

        m_getBtn.onClick.RemoveAllListeners();
        m_getBtn.onClick.AddListener(delegate
        {
            if (moduleWelfare.chooseInfo.rewardid != null && moduleWelfare.chooseInfo.rewardid.Length > 0)
            {
                parentWindow.GetAward(moduleWelfare.chooseInfo.rewardid[0], 1);
            }
        });

        m_firstBtn.onClick.RemoveAllListeners();
        m_firstBtn.onClick.AddListener(delegate
        {
            parentWindow.BtnDropClick(info.interfaceID);
        });
    }
    //进度值有改变
    void _Packet(ScWeflareMoney p)
    {
        PWeflareInfo info = null;

        bool have = m_puzzleList.Exists(a => a.id == p.id);

        if (have)
        {
            SetWelfarweChange(info, m_puzzleList, p);
        }
        else
        {
            SetWelfarweChange(info, m_allWeflarInfo, p);
        }

        var puzzle = m_puzzleList.Find(a => a.id == p.id);
        var other  = m_allWeflarInfo.Find(a => a.id == p.id);

        if (other != null && puzzle != null)
        {
            m_allWeflarInfo.Remove(other);
            m_allWeflarInfo.Add(puzzle);
            m_allWeflarInfo.Sort((a, b) => a.priority.CompareTo(b.priority));
        }

        if (chooseInfo == null || info == null)
        {
            return;
        }
        DispatchModuleEvent(EventWelfareMoneyChange, info);
    }
Exemple #3
0
    private void SetCumulative(PWeflareInfo info)
    {
        if (info == null)
        {
            return;
        }

        var dataProgress = moduleWelfare.GetProgress(info);

        if ((WelfareType)info.type == WelfareType.Continuous)
        {
            Util.SetText(m_twoExpend, ConfigText.GetDefalutString(700, 1), moduleWelfare.ShowTxt(dataProgress, 1));
        }
        else if ((WelfareType)info.type == WelfareType.DailyFlush)
        {
            Util.SetText(m_twoExpend, ConfigText.GetDefalutString(700, 2), moduleWelfare.ShowTxt(dataProgress, 2));
        }

        var icon = parentWindow.GetIconName(info.icon, 0);

        UIDynamicImage.LoadImage(m_cumlativeIcon.gameObject, icon, null, true);
        m_cunlativeTxt.text = info.introduce.Replace("\\n", "\n");
        parentWindow.RemainTime(m_cunlativeTime, info.closetime);
        m_cunlativeData.SetItems(info.rewardid);
    }
 private void SetSpecificInfo(PWeflareInfo info, List <PWeflareInfo> welfareList)
 {
     if (info == null)
     {
         return;
     }
     for (int i = 0; i < welfareList.Count; i++)
     {
         if (welfareList[i] == null)
         {
             continue;
         }
         if (info.id == welfareList[i].id)
         {
             welfareList[i] = info;
             for (int j = 0; j < welfareList[i].rewardid.Length; j++)
             {
                 SetCanGet(welfareList[i], j);
                 if (welfareList[i].rewardid[j]?.state == 1)
                 {
                     moduleHome.UpdateIconState(HomeIcons.Welfare, true);
                 }
             }
             return;
         }
     }
 }
    public void LableClickHint(PWeflareInfo Info)
    {
        if (Info == null)
        {
            return;
        }
        string date_now = Util.GetServerLocalTime().ToString();
        string idm      = "welf" + Info.id.ToString() + modulePlayer.roleInfo.roleId.ToString();

        PlayerPrefs.SetString(idm, date_now);

        bool isShow = moduleWelfare.notClick.Exists(a => a == Info.id);

        if (isShow)
        {
            moduleWelfare.notClick.Remove(Info.id);
        }

        int index = moduleWelfare.allWeflarInfo.IndexOf(Info);

        if (Info.type == (int)WelfareType.ActiveNewPuzzle && index == -1)
        {
            index = moduleWelfare.allWeflarInfo.FindIndex(a => a.type == Info.type);
        }
        if (Info.type >= (int)WelfareType.ChargeDailySale && index == -1)
        {
            index = moduleWelfare.allChargeInfo.IndexOf(Info);
        }
        if (index != -1)
        {
            m_lableShow.UpdateItem(index);
        }
    }
    private void OnLableClick(RectTransform rt, PWeflareInfo info)
    {
        if (moduleWelfare.chooseInfo == null || info == null)
        {
            return;
        }
        if (info.id == moduleWelfare.chooseInfo.id)
        {
            return;
        }

        moduleWelfare.chooseInfo = info;
        SetTypePlane(info);
        LableClickHint(info);

        m_checkImg.duration = 0.15f;
        m_checkImg.from     = m_checkImg.transform.localPosition;
        var pos = rt.parent.localPosition;

        pos.y        -= 4;
        m_checkImg.to = pos;
        m_checkImg.Play();

        var tog = rt.parent.GetComponentDefault <Toggle>();

        tog.isOn = true;
    }
    private void AddWelfareData(PWeflareInfo info, int type, int taskId = 0)
    {
        List <PWeflareData> list = new List <PWeflareData>();

        if (info.roleData == null)
        {
            list.Add(CreateWeflareData(type, taskId));
        }
        else
        {
            if (info.roleData.Length > 0)
            {
                list.AddRange(info.roleData);
            }
            var have = info.roleData.Find(a => a.type == type);
            if (have == null)
            {
                list.Add(CreateWeflareData(type, taskId));
            }
            else if (taskId != 0)
            {
                list.Remove(have);
                have.taskInfo = CreateChaseData(taskId, have.taskInfo);
                list.Add(have);
            }
        }
        info.roleData = list.ToArray();
    }
    void _Packet(ScWeflareSpecificInfo p)
    {
        PWeflareInfo info = p.thisinfo.Clone();

        SetSpecificInfo(info, m_allWeflarInfo);
        SetSpecificInfo(info, m_puzzleList);
        SetSpecificInfo(info, m_allChargeInfo);
        DispatchModuleEvent(EventWelfareSpecificInfo, info);
    }
    private void SetLevelInfo(PWeflareInfo info)
    {
        SetTipTxt(info);
        var backImg = parentWindow.GetIconName(info.icon, 0);
        var txtImg  = parentWindow.GetIconName(info.icon, 1);

        UIDynamicImage.LoadImage(m_levelUpBgICon.gameObject, backImg, null, true);
        UIDynamicImage.LoadImage(m_levelUpICon.gameObject, txtImg, null, true);
        m_levleUpTxt.text = info.introduce.Replace("\\n", "\n");
        parentWindow.RemainTime(m_levelUpTime, info.closetime);
        m_levelUpData.SetItems(info.rewardid);
    }
Exemple #10
0
    private void RefreshGetSucced(PWeflareInfo info, int index)
    {
        if (!parentWindow.RestWelfarePlane(info, index))
        {
            return;
        }

        var sub    = -1;
        var lockId = 0;

        for (int i = 0; i < info.rewardid.Length; i++)
        {
            if (info.rewardid[i].index == index)
            {
                sub = i;
                if (index == 1)
                {
                    parentWindow.SetBtnState(info.rewardid[i].state, m_totalBtn, m_totalTxt);
                }
                lockId = i - 1;
                if (lockId < 0)
                {
                    lockId = 0;
                }
                if (info.rewardid[i].state == 2 && lockId < m_lockObj.Count)
                {
                    m_lockObj[lockId].saturation = 1;
                }
            }
        }
        if (sub < 0)
        {
            return;
        }
        var aIndex = moduleWelfare.puzzleList.FindIndex(a => a.id == info.id);

        if (aIndex != -1)
        {
            if (aIndex >= 0 && aIndex < m_newCheck.Count - 1)
            {
                if (info.rewardid[0] != null && m_newCheck[aIndex + 1] != null)
                {
                    m_newCheck[aIndex + 1].interactable = info.rewardid[0].state == 2 ? true : false;
                }
            }
        }
        m_puzzleData.UpdateItem(lockId);
        SetPuzzleHint(moduleWelfare.chooseInfo);
        if (parentWindow.m_welfareTog.isOn)
        {
            parentWindow.m_lableShow.UpdateItems();
        }
    }
 private void RefreshGetSucced(PWeflareInfo info, int index)
 {
     if (!parentWindow.RestWelfarePlane(info, index))
     {
         return;
     }
     m_continousData.UpdateItems();
     if (parentWindow.m_welfareTog.isOn)
     {
         parentWindow.m_lableShow.UpdateItems();
     }
 }
    private void SetContinuous(PWeflareInfo info)
    {
        var dataProgress = moduleWelfare.GetProgress(info);

        Util.SetText(m_threeExpend, ConfigText.GetDefalutString(700, 0), moduleWelfare.ShowTxt(dataProgress, 2));

        var icon = parentWindow.GetIconName(info.icon, 0);

        UIDynamicImage.LoadImage(m_continuousIcon.gameObject, icon, null, true);
        m_continousTxt.text = info.introduce.Replace("\\n", "\n");
        parentWindow.RemainTime(m_continousTime, info.closetime);
        m_continousData.SetItems(info.rewardid);
    }
    private void SetlableInfo(RectTransform rt, PWeflareInfo info)
    {
        if (moduleWelfare.chooseInfo == null || info == null)
        {
            return;
        }
        var lable = rt.Find("label_Txt").GetComponent <Text>();
        var tip   = rt.Find("tip");

        Util.SetText(lable, info.title);
        tip.gameObject.SetActive(false);
        if (info.title.Contains("&"))
        {
            var t   = info.title.Split('&')[0];
            var txt = info.title.Split('&')[1];
            tip.gameObject.SetActive(true);
            Util.SetText(lable, txt);
            var index = Util.Parse <int>(t);
            if (index < 0 || index >= recommend.Length)
            {
                index = 0;
            }
            AtlasHelper.SetShared(tip, recommend[index], null, true);
        }

        if (info.type == (int)WelfareType.ActiveNewPuzzle)
        {
            Util.SetText(lable, info.introduce);
        }

        if (info.id == moduleWelfare.chooseInfo.id || (moduleWelfare.chooseInfo.type == (int)WelfareType.ActiveNewPuzzle && info.type == (int)WelfareType.ActiveNewPuzzle))
        {
            var tog = rt.parent.GetComponentDefault <Toggle>();
            tog.isOn            = false;
            m_checkImg.duration = 0.15f;
            m_checkImg.from     = m_checkImg.transform.localPosition;
            var pos = rt.parent.localPosition;
            pos.y        -= 4;
            m_checkImg.to = pos;
            m_checkImg.Play();
            tog.isOn = true;
        }
        else if (lable.color != Color.white)
        {
            var teween = lable.transform.GetComponent <TweenColor>();
            teween.PlayReverse();
        }
        var hint = rt.Find("hint");

        hint.SafeSetActive(moduleWelfare.GeLableHint(info));
    }
 private void SetMatchStreePvP(PWeflareInfo info)
 {
     m_oneExpend.SafeSetActive(true);
     SetFirstFlush(info);
     //使用 days代替taskinfo中的taskid 来寻找通次数
     if (info.rewardid == null || info.rewardid.Length == 0 || info.rewardid[0] == null || info.rewardid[0].reachnum.Length == 0 || info.rewardid[0].reachnum[0] == null)
     {
         Util.SetText(m_oneExpend, ConfigText.GetDefalutString(700, 9), "0");
     }
     else
     {
         Util.SetText(m_oneExpend, ConfigText.GetDefalutString(700, 9), moduleWelfare.ShowTxt(m_data, 3, info.rewardid[0].reachnum[0].days));
     }
 }
Exemple #15
0
    private void SetPuzzlePlane(PWeflareInfo info)
    {
        if (info == null)
        {
            return;
        }
        Util.SetText(WindowCache.GetComponent <Text>("jigsaw_Panel/bg/Text"), info.title.Substring(0, 1));
        Util.SetText(WindowCache.GetComponent <Text>("jigsaw_Panel/bg/content_txt"), info.title.Substring(1));

        moduleWelfare.chooseInfo = info;
        for (int i = 0; i < m_lockObj.Count; i++)
        {
            m_lockObj[i].saturation = 0;
        }
        List <PWeflareAward> award = new List <PWeflareAward>();

        for (int i = 0; i < info.rewardid.Length; i++)
        {
            if (info.rewardid[i] == null)
            {
                continue;
            }
            //约定 拼图活动的第一个奖励为最终的整体奖励 第一个奖励的第一个物品为拼图图片
            if (i == 0)
            {
                var save = info.rewardid[0].state != 0 ? true : false;
                m_saveBtn.interactable = save;
                m_photo.gameObject.SetActive(save);
                m_lockMask.gameObject.SetActive(!save);

                Util.SetText(WindowCache.GetComponent <Text>("jigsaw_Panel/right/bottom/title"), info.rewardid[0].rewardname);
                parentWindow.SetBtnState(info.rewardid[0].state, m_totalBtn, m_totalTxt);
                SetRewardInfo(info.rewardid[0].reward, m_totalObj, true);
            }
            else
            {
                var index = i - 1;
                if (index < 0)
                {
                    index = 0;
                }
                if (info.rewardid[i].state == 2 && index < m_lockObj.Count)
                {
                    m_lockObj[index].saturation = 1;
                }
                award.Add(info.rewardid[i]);
            }
        }
        m_puzzleData.SetItems(award);
    }
    private void SetTypePlane(PWeflareInfo info)//并设置对应的道具
    {
        if (info == null || !subWindows.ContainsKey((WelfareType)info.type))
        {
            return;
        }

        foreach (var window in subWindows)
        {
            window.Value?.UnInitialize();
        }

        subWindows[(WelfareType)info.type].Initialize_Async();
        SetToggleHint();
    }
 private void RefreshChangeInfo(PWeflareInfo info, bool refresh)
 {
     if (refresh)
     {
         parentWindow.RefreshLablePlane();
     }
     if (moduleWelfare.chooseInfo == null)
     {
         return;
     }
     if (info.id == moduleWelfare.chooseInfo.id)
     {
         SetContinuous(info);
     }
 }
 private void SetWelfarweChange(PWeflareInfo info, List <PWeflareInfo> list, ScWeflareMoney p)
 {
     for (int i = 0; i < list.Count; i++)
     {
         if (list[i] == null)
         {
             continue;
         }
         if (list[i].id == p.id)
         {
             SetProgress(list[i], p.type, p.money, p.taskID);
             info = list[i];
             break;
         }
     }
 }
    private int GetWelfareType(PWeflareInfo info, int index = 0)
    {
        int type = info.type;

        if (info.rewardid != null && info.rewardid?.Length > 0)
        {
            if (info.rewardid[index] != null && info.rewardid[index]?.reachnum.Length > 0)
            {
                if (info.rewardid[index].reachnum[0] != null)
                {
                    type = info.rewardid[index].reachnum[0].type;
                }
            }
        }
        return(type);
    }
Exemple #20
0
    private void SetPuzzleLableState(bool setIndex)
    {
        var checkIndex = 0;

        for (int i = 0; i < moduleWelfare.puzzleList.Count; i++)
        {
            if (i >= m_newCheck.Count || m_newCheck[i] == null)
            {
                continue;
            }
            PWeflareInfo info = moduleWelfare.puzzleList[i];
            if (info == null)
            {
                continue;
            }
            m_newCheck[i].SafeSetActive(true);
            var togTxt = m_newCheck[i].transform.Find("Label")?.GetComponentDefault <Text>();
            Util.SetText(togTxt, info.title);
            var hint = m_newCheck[i].transform.Find("hint");
            hint.SafeSetActive(moduleWelfare.GetWelfareHint(info));

            if (m_newCheck.Count > 0 && i == 0)
            {
                m_newCheck[i].interactable = true;
            }
            if (i >= m_newCheck.Count - 1)
            {
                continue;
            }
            if (info.rewardid != null && info.rewardid.Length > 0)
            {
                if (info.rewardid[0] != null && m_newCheck[i + 1] != null)
                {
                    m_newCheck[i + 1].interactable = false;
                    if (info.rewardid[0].state == 2)
                    {
                        m_newCheck[i + 1].interactable = true;
                        checkIndex = i + 1;
                    }
                }
            }
        }
        if (setIndex && checkIndex < m_newCheck.Count)
        {
            m_newCheck[checkIndex].isOn = true;
        }
    }
Exemple #21
0
    private void SetPuzzleHint(PWeflareInfo info)
    {
        for (int i = 0; i < moduleWelfare.puzzleList.Count; i++)
        {
            if (i >= m_newCheck.Count || m_newCheck[i] == null)
            {
                continue;
            }
            if (!m_newCheck[i].isOn)
            {
                continue;
            }

            var hint = m_newCheck[i].transform.Find("hint");
            hint.SafeSetActive(moduleWelfare.GetWelfareHint(info));
        }
    }
    private void SetStreng(PWeflareInfo info)
    {
        if (info == null)
        {
            return;
        }
        m_oneExpend.SafeSetActive(false);
        SetFirstFlush(info);
        m_oneExpend.SafeSetActive(true);
        var dataProgress = moduleWelfare.GetProgress(info);

        Util.SetText(m_oneExpend, ConfigText.GetDefalutString(700, 8), moduleWelfare.ShowTxt(dataProgress, 2));
        m_firstBtn.onClick.RemoveAllListeners();
        m_firstBtn.onClick.AddListener(delegate
        {
            parentWindow.BtnDropClick(moduleWelfare.chooseInfo?.interfaceID);
        });
    }
    private void SetFirstFlush(PWeflareInfo firstInfo)
    {
        if (firstInfo == null)
        {
            return;
        }
        var icon = parentWindow.GetIconName(firstInfo.icon, 0);

        UIDynamicImage.LoadImage(m_firstIcon.gameObject, icon, null, true);

        if (firstInfo.rewardid.Length <= 0)
        {
            return;
        }

        m_firstTxt.text = firstInfo.introduce.Replace("\\n", "\n");
        m_getBtn.SafeSetActive(false);
        m_getBtn.interactable = false;
        m_firstBtn.SafeSetActive(false);
        parentWindow.RemainTime(m_firstTime, firstInfo.closetime);

        var list = moduleWelfare.CheckProto(firstInfo.rewardid[0].reward);

        m_firstData.SetItems(list);

        var state = firstInfo.rewardid[0].state;

        if (state == 0)
        {
            m_firstBtn.SafeSetActive(true);
        }
        else if (state == 1)
        {
            m_getBtn.SafeSetActive(true);
            m_getBtn.interactable = true;
            Util.SetText(m_getBtnTxt, ConfigText.GetDefalutString(211, 3));
        }
        else if (state == 2)
        {
            m_getBtn.SafeSetActive(true);
            Util.SetText(m_getBtnTxt, ConfigText.GetDefalutString(211, 4));
        }
    }
    private void RemoveState(int closeId, PWeflareInfo info)
    {
        bool not = m_notClick.Exists(a => a == closeId);

        if (not)
        {
            m_notClick.Remove(closeId);
        }

        if ((WelfareType)info.type == WelfareType.Sign)
        {
            return;
        }

        for (int i = 0; i < info.rewardid.Length; i++)
        {
            SetCanGet(info, i, false);
        }
    }
    //任务关闭
    void _Packet(ScWeflareClose p)
    {
        for (int i = 0; i < p.closeid.Length; i++)
        {
            PWeflareInfo info = m_allWeflarInfo.Find(a => a.id == p.closeid[i]);
            if (info != null)
            {
                m_allWeflarInfo.Remove(info);
                RemoveState(p.closeid[i], info);
            }
            PWeflareInfo puzzle = m_puzzleList.Find(a => a.id == p.closeid[i]);
            if (puzzle != null)
            {
                m_puzzleList.Remove(puzzle);
                RemoveState(p.closeid[i], puzzle);
            }
            PWeflareInfo charge = m_allChargeInfo.Find(a => a.id == p.closeid[i]);
            if (charge != null)
            {
                m_puzzleList.Remove(charge);
                RemoveState(p.closeid[i], charge);
            }
            if (m_dropUps.ContainsKey(p.closeid[i]))
            {
                m_dropUps.Remove(p.closeid[i]);
            }
        }

        var have = m_allWeflarInfo.Find(a => a.type == (int)WelfareType.ActiveNewPuzzle);

        if (have == null && m_puzzleList.Count > 0)
        {
            m_allWeflarInfo.Add(m_puzzleList[0]);
            m_allWeflarInfo.Sort((a, b) => a.priority.CompareTo(b.priority));
        }

        DispatchModuleEvent(EventWelfareClose);
        if (m_notClick.Count <= 0 && isget && m_canGet.Count <= 0)
        {
            moduleHome.UpdateIconState(HomeIcons.Welfare, false);
        }
    }
 private void SetWelfareState(List <PWeflareInfo> stateList)
 {
     for (int i = 0; i < stateList.Count; i++)
     {
         if (stateList[i] == null)
         {
             continue;
         }
         if ((WelfareType)stateList[i].type == WelfareType.Sign)
         {
             m_signWefare = stateList[i];
         }
         else
         {
             for (int j = 0; j < stateList[i].rewardid.Length; j++)
             {
                 SetCanGet(stateList[i], j);
             }
         }
     }
 }
    public bool GetWelfareHint(PWeflareInfo info)
    {
        if (info == null)
        {
            return(false);
        }
        var click = notClick.Exists(a => a == info.id);

        if (click)
        {
            return(true);
        }
        for (int j = 0; j < info.rewardid.Length; j++)
        {
            if (info.rewardid[j].state == 1)
            {
                return(true);
            }
        }
        return(false);
    }
Exemple #28
0
    private void RefreshChangeInfo(PWeflareInfo info, bool refresh)
    {
        if (refresh)
        {
            parentWindow.RefreshLablePlane();
        }
        if (moduleWelfare.chooseInfo == null)
        {
            return;
        }

        if (info.id == moduleWelfare.chooseInfo.id)
        {
            SetPuzzleHint(info);
            SetPuzzlePlane(info);
        }
        else if (info.type == moduleWelfare.chooseInfo.type)
        {
            SetPuzzleLableState(false);
        }
    }
    private void SetCanGet(PWeflareInfo info, int index, bool add = true)
    {
        if (info == null || index >= info.rewardid.Length)
        {
            return;
        }
        if (info.rewardid[index] == null)
        {
            return;
        }

        string strId = info.id.ToString() + info.rewardid[index].index.ToString();

        if (m_canGet.Contains(strId))
        {
            m_canGet.Remove(strId);
        }
        if (info.rewardid[index].state == 1 && add)
        {
            m_canGet.Add(strId);
        }
    }
    private void SetTipTxt(PWeflareInfo info)
    {
        var dataProgress = moduleWelfare.GetProgress(info);

        m_fourExpend.SafeSetActive(true);
        switch ((WelfareType)info.type)
        {
        case WelfareType.ContDaily: Util.SetText(m_fourExpend, ConfigText.GetDefalutString(700, 3), moduleWelfare.ShowTxt(dataProgress, 1)); break;

        case WelfareType.CumulDaily: Util.SetText(m_fourExpend, ConfigText.GetDefalutString(700, 4), moduleWelfare.ShowTxt(dataProgress, 1)); break;

        case WelfareType.DiamondFlush: Util.SetText(m_fourExpend, ConfigText.GetDefalutString(700, 5), moduleWelfare.ShowTxt(dataProgress, 2)); break;

        case WelfareType.DiamondConsum: Util.SetText(m_fourExpend, ConfigText.GetDefalutString(700, 6), moduleWelfare.ShowTxt(dataProgress, 2)); break;

        case WelfareType.Level: Util.SetText(m_fourExpend, ConfigText.GetDefalutString(700, 7), modulePlayer.roleInfo.level.ToString()); break;

        case WelfareType.WaitTime:
        case WelfareType.VictoryTimes:
        case WelfareType.DailyNewSign: m_fourExpend.SafeSetActive(false); break;
        }
    }