Пример #1
0
    public void SetData(CalendarDetailVo calendarDetailVo)
    {
        Debug.Log("LoveDiaryEditController   SetData");
        _curCalendarDetailVo = calendarDetailVo;
        _curCalendarDetailVo.CurDiaryElementCount.MaxImageCount  = GlobalData.ConfigModel.GetConfigByKey(GameConfigKey.DIARY_MAX_IMAG_COUNT);
        _curCalendarDetailVo.CurDiaryElementCount.MaxTextCount   = GlobalData.ConfigModel.GetConfigByKey(GameConfigKey.DIARY_MAX_TEXT_COUNT);
        _curCalendarDetailVo.CurDiaryElementCount.MaxRacketCount = GlobalData.ConfigModel.GetConfigByKey(GameConfigKey.DIARY_MAX_RACKET_COUNT);
        _curCalendarDetailVo.CurDiaryElementCount.CurImageCount  = 0;
        _curCalendarDetailVo.CurDiaryElementCount.CurTextCount   = 0;
        _curCalendarDetailVo.CurDiaryElementCount.CurRacketCount = 0;
        DiaryElementPB pb;

        for (int i = 0; i < _curCalendarDetailVo.DiaryElements.Count; i++)
        {
            pb = _curCalendarDetailVo.DiaryElements[i];
            ElementPB elementRule = CalendarDetailVo.GetElementRuleById(pb.ElementId);
            if (elementRule.ElementType == ElementTypePB.Image)
            {
                _curCalendarDetailVo.CurDiaryElementCount.CurImageCount++;
            }
            else if (elementRule.ElementType == ElementTypePB.Text)
            {
                _curCalendarDetailVo.CurDiaryElementCount.CurTextCount++;
            }
            else if (elementRule.ElementType == ElementTypePB.Racket)
            {
                _curCalendarDetailVo.CurDiaryElementCount.CurRacketCount++;
            }
        }
        CurLoveDiaryEditView.SetData(_curEditType, GlobalData.DiaryElementModel, calendarDetailVo);
    }
Пример #2
0
        public bool IsCanUseElement(int id)
        {
            ElementPB pb = GetElementRuleById(id);

            // pb.NeedUnlock//1表示需要解锁;0表示不解锁
            if (pb.NeedUnlock == 0)
            {
                return(true);
            }
            //if (//pb.UnlockClaim.Gem == 0
            //    //&&pb.UnlockClaim.LevelId==0&&
            //    //pb.UnlockClaim.EvolutionLevel == 0&&
            //    // pb.UnlockClaim.CardId==0
            //    )
            //{ return true; }
            for (int i = 0; i < _userElement.Count; i++)
            {
                if (_userElement[i].ElementId == id)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
    private void OnElementTextItemEditClick(int elementId)
    {
        Debug.Log("OnElementTextItemEditClick");

        //有个问题啊,要知道点击的是什么类型的元素!
        ElementPB elementRule    = CalendarDetailVo.GetElementRuleById(elementId);
        var       bottomEditType = LoveDiaryBottomEditType.SecondText;

        switch (elementRule.ElementType)
        {
        case ElementTypePB.Text:
            bottomEditType = LoveDiaryBottomEditType.SecondText;
            break;

        case ElementTypePB.Image:
            bottomEditType = LoveDiaryBottomEditType.Image;
            break;

        case ElementTypePB.Racket:
            bottomEditType = LoveDiaryBottomEditType.Racket;
            break;

        case ElementTypePB.Bg:
            bottomEditType = LoveDiaryBottomEditType.Bg;
            break;

        default:
            bottomEditType = LoveDiaryBottomEditType.SecondText;
            break;
        }

        CurLoveDiaryEditView.OperateBottom(true, bottomEditType);
        IsModify = true;
    }
Пример #4
0
    private void OnElementTextItemDeleteClick(DiaryElementPB pb)
    {
        Debug.Log("OnElementTextItemDeleteClick");
        ElementPB elementRule = CalendarDetailVo.GetElementRuleById(pb.ElementId);

        _curCalendarDetailVo.CurDiaryElementCount.SubCount(elementRule.ElementType);
        IsModify = true;
    }
Пример #5
0
    private void OnMyBuyElementHandler(BuyElementRes res)
    {
        Debug.Log("OnMyBuyElementHandler");
        GlobalData.PlayerModel.UpdateUserMoney(res.UserMoney);
        GlobalData.DiaryElementModel.UpdateElement(res.UserElement.ElementId, res.UserElement.Num);
        ElementPB pb = GlobalData.DiaryElementModel.GetElementRuleById(res.UserElement.ElementId);

        CurLoveDiaryEditView.UpdateItemState(pb);
        FlowText.ShowMessage(I18NManager.Get("Common_BuySucceed"));// ("购买成功!");
    }
Пример #6
0
    private void OnElementItemClick(int id)
    {
        Debug.Log("OnElementItemClick........................ id " + id);

        ElementPB elementRule = CalendarDetailVo.GetElementRuleById(id);


        if (GlobalData.DiaryElementModel.IsCanUseElement(id)) //表示需要购买
        {
            if (_curCalendarDetailVo.CurDiaryElementCount.IsUpperLimited(elementRule.ElementType))
            {
                FlowText.ShowMessage(I18NManager.Get("LoveDiary_Hint6"));// ("已达上限!");
                return;
            }

            if (elementRule.ElementType == ElementTypePB.Label)
            {
                CurLoveDiaryEditView.CurLabelElementId = id;
            }
            else
            {
                CurLoveDiaryEditView.AddElement(GetNewDiaryElementPB(id), false);
            }
            _curCalendarDetailVo.CurDiaryElementCount.AddCount(elementRule.ElementType);
            CurLoveDiaryEditView.OperateBottom(false);
            IsModify = true;
        }
        else
        {
            string stype = "";
            switch (elementRule.ElementType)
            {
            case ElementTypePB.Bg:
                stype = I18NManager.Get("LoveDiary_Background");    //"背景";
                break;

            case ElementTypePB.Image:
                stype = I18NManager.Get("LoveDiary_Tags");    //"贴纸";
                break;
            }
            string str = I18NManager.Get("LoveDiary_Hint12") + elementRule.UnlockClaim.Gem + I18NManager.Get("LoveDiary_Hint7") + stype;
            PopupManager.ShowConfirmWindow(str).WindowActionCallback = evt =>
            {
                if (evt != WindowEvent.Ok)
                {
                    return;
                }

                BuyElementReq req = new BuyElementReq();
                req.ElementId = id;
                var dataBytes = NetWorkManager.GetByteData(req);
                NetWorkManager.Instance.Send <BuyElementRes>(CMD.DIARYC_ELEMENTS_BUY, dataBytes, OnMyBuyElementHandler);
            };
        }
    }
Пример #7
0
 public override void SetData(ElementPB pb, bool isLock = false)
 {
     base.SetData(pb);
     transform.Find("Bg/Image").GetComponent <Image>().sprite = AssetManager.Instance.GetSpriteAtlas("UIAtlas_LoveDiary_Element_" + pb.Id);
     transform.Find("Lock").gameObject.SetActive(isLock);
     if (isLock == false)
     {
         return;
     }
     transform.Find("Lock/Text").GetComponent <Text>().text = pb.UnlockClaim.Gem.ToString();
 }
Пример #8
0
        public ElementPB GetElementRuleById(int id)
        {
            for (int i = 0; i < _rules.Count; i++)
            {
                ElementPB pb = _rules[i];
                if (pb.Id == id)
                {
                    return(pb);
                }
            }

            return(null);
        }
Пример #9
0
 public HeadVo(ElementPB pb)
 {
     Id            = pb.Id;
     ElementType   = pb.ElementType;
     ElementModule = pb.ElementModule;
     Name          = pb.Name;
     NeedUnlock    = pb.NeedUnlock;
     UnlockClaim   = pb.UnlockClaim;
     _userCardVo   = GlobalData.CardModel.GetUserCardById(UnlockClaim.CardId);
     Desc          = pb.Desc;
     SetPlayerTypeAndPath(pb.UnlockClaim.CardId, pb.Id);
     SetIsUnlock();
 }
Пример #10
0
    public void UpdateItemState(ElementPB pb)
    {
        //  List<ElementPB> _lockElementItemList;
        ElementPB unPb;

        for (int i = 0; i < _lockElementItemList.Count; i++)
        {
            unPb = _lockElementItemList[i];
            if (unPb.Id == pb.Id)
            {
                _lockElementItemList.Remove(unPb);
                _unlockElementItemList.Add(unPb);
                _imageList.RefreshCells();
            }
        }
    }
Пример #11
0
    private void SetTitleLabel()
    {
        string str = "";

        if (curLabelPb.ElementId == -1)
        {
            str = I18NManager.Get("LoveDiary_SelectLabel"); //"选择标签";
        }
        else
        {
            ElementPB pb = GlobalData.DiaryElementModel.GetElementRuleById(curLabelPb.ElementId);
            str = pb.Name;
        }

        transform.Find("Label/SelectBtn/Text").GetComponent <Text>().text = str;
    }
Пример #12
0
    private void OnElementInputClick(string str)
    {
        //int id = 7000;// rule 默认 Text id==7000;
        ElementPB elementRule = CalendarDetailVo.GetElementRuleById(7000);

        if (_curCalendarDetailVo.CurDiaryElementCount.IsUpperLimited(elementRule.ElementType))
        {
            FlowText.ShowMessage(I18NManager.Get("LoveDiary_Hint6"));//("已达上限!");
            return;
        }

        CurLoveDiaryEditView.AddElement(GetNewDiaryElementPB(7000, str), true);
        _curCalendarDetailVo.CurDiaryElementCount.AddCount(elementRule.ElementType);
        //CurLoveDiaryEditView.OperateBottom(false);
        IsModify = true;
    }
Пример #13
0
    private void CreateElementItem(DiaryElementPB diaryElementPB, bool immidiateInput = false)
    {
        ElementPB elementRule = CalendarDetailVo.GetElementRuleById(diaryElementPB.ElementId);
        string    prefabPath  = "";

        switch (elementRule.ElementType)
        {
        case ElementTypePB.Image:
            prefabPath = "LoveDiary/Prefabs/Elements/ImageElement";
            break;

        case ElementTypePB.Racket:
            prefabPath = "LoveDiary/Prefabs/Elements/ImageElement";
            //    prefabPath = "LoveDiary/Prefabs/LoveDiaryEditRacketItem";
            break;

        case ElementTypePB.Bg:
            _editContains.GetChild(0).GetComponent <BgElememt>()
            .SetData(diaryElementPB, _editContains.GetComponent <RectTransform>());
            SetBgElement(diaryElementPB.ElementId);
            return;

        case ElementTypePB.Text:
            prefabPath = "LoveDiary/Prefabs/Elements/WordElement";
            break;

        default:
            return;
        }

        var prefab = GetPrefab(prefabPath);
        var item   = Instantiate(prefab) as GameObject;

        item.transform.SetParent(_editContains, false);
        item.transform.localScale  = Vector3.one;
        item.transform.eulerAngles = Vector3.zero;
        item.GetComponent <DiaryElementBase>().SetData(diaryElementPB, _editContains.GetComponent <RectTransform>());
        if (immidiateInput)
        {
            _curClickElement = item;
            _curClickElement.GetComponent <DiaryElementBase>().loveDiaryEditType = LoveDiaryEditType.Edit;
            _curBottomEditType = LoveDiaryBottomEditType.SecondText;
        }

        UIEventListener.Get(item).onClick = OnClickElememtItem;
        return;
    }
Пример #14
0
    public HeadFrameVo(ElementPB pb)
    {
        Id            = pb.Id;
        ElementType   = pb.ElementType;
        ElementModule = pb.ElementModule;
        Name          = pb.Name;
        UnlockClaim   = pb.UnlockClaim;
        Desc          = pb.Desc;
        SetIsUnlock();
        Path = "HeadFrame/" + pb.Id;
        Key  = GlobalData.PlayerModel.PlayerVo.UserId + Id + "";
        SetRedDot();

        if (!IsUnlock)
        {
            Sort = 1;
        }
    }
Пример #15
0
        public ElementPB GetDialogByCardId(int cardId)
        {
            ElementPB pb = null;

            for (int i = 0; i < _rules.Count; i++)
            {
                pb = _rules[i];
                if (pb.UnlockClaim.CardId == cardId)
                {
                    break;
                }
            }

            return(pb);

            // int labelId= ClientData.GetExpressionLabelIdByDialogID(
            //     (int)GlobalData.CardModel.GetCardBase(cardId).Player,
            //     EXPRESSIONTRIGERTYPE.LOVEDIARY,
            //     pb.Id
            //     );
            // return GetElementRuleById(labelId);
        }
Пример #16
0
        public List <ElementPB> GetDialogsByCardId(int cardId)
        {
            List <ElementPB> elementPBs = new List <ElementPB>();

            ElementPB pb = null;

            for (int i = 0; i < _rules.Count; i++)
            {
                pb = _rules[i];
                if (pb.UnlockClaim.CardId == cardId)
                {
                    elementPBs.Add(pb);
                    continue;
                }
            }

            //int labelId = ClientData.GetExpressionLabelIdByDialogID(
            //    (int)GlobalData.CardModel.GetCardBase(cardId).Player,
            //    EXPRESSIONTRIGERTYPE.LOVEDIARY,
            //    pb.Id
            //    );
            return(elementPBs);
        }
Пример #17
0
 public override void SetData(ElementPB pb, bool isLock = false)
 {
     base.SetData(pb);
     transform.Find("Image/Text").GetComponent <Text>().text = pb.Name;
 }
Пример #18
0
 public virtual void SetData(ElementPB pb, bool isLock = false)
 {
     _pb = pb;
 }