Ejemplo n.º 1
0
    private void SaveDiary()
    {
        if (_curLoveDiaryEditType == LoveDiaryEditType.Edit)
        {
            List <DiaryElementPB> pbs = new List <DiaryElementPB>();
            pbs.Add(curLabelPb);
            if (curLabelPb.ElementId == -1)
            {
                //  PopupManager.ShowAlertWindow("请输入标签");
                FlowText.ShowMessage(I18NManager.Get("LoveDiary_Hint4"));
                return;
            }

            for (int i = 0; i < _editContains.transform.childCount; i++)
            {
                DiaryElementPB pb = _editContains.transform.GetChild(i).GetComponent <DiaryElementBase>()
                                    .GetDiaryElementData();
                if (pb == null)
                {
                    continue;
                }

//                Debug.LogError(pb);
                pbs.Add(pb);
            }

            SendMessage(new Message(MessageConst.CMD_LOVEDIARY_EDIT_SAVE, Message.MessageReciverType.CONTROLLER, pbs));
        }
        else
        {
            SendMessage(new Message(MessageConst.CMD_LOVEDIARY_ENTER_EDITTYPE, Message.MessageReciverType.CONTROLLER,
                                    LoveDiaryEditType.Edit));
        }
    }
Ejemplo n.º 2
0
 public void SetData(DiaryElementPB diaryElementPB, RectTransform container)
 {
     _container = container;
     pb         = diaryElementPB;
     Debug.LogError(pb);
     UpdateView();
     loveDiaryEditType = LoveDiaryEditType.Show;
 }
Ejemplo n.º 3
0
    private void OnElementTextItemDeleteClick(DiaryElementPB pb)
    {
        Debug.Log("OnElementTextItemDeleteClick");
        ElementPB elementRule = CalendarDetailVo.GetElementRuleById(pb.ElementId);

        _curCalendarDetailVo.CurDiaryElementCount.SubCount(elementRule.ElementType);
        IsModify = true;
    }
Ejemplo n.º 4
0
    private DiaryElementPB GetNewDiaryElementPB(int id, string content = "")
    {
        DiaryElementPB pb = new DiaryElementPB();

        pb.ElementId = id;
        pb.XPos      = 0;
        pb.YPos      = 0;
        pb.ScaleX    = id == 7000?10: 1;
        pb.ScaleY    = 1;
        pb.Content   = content;
        pb.Rotation  = 0;
        pb.Size      = 50;
        return(pb);
    }
Ejemplo n.º 5
0
    public void SetData(LoveDiaryEditType editType, DiaryElementModel diaryElementModel,
                        CalendarDetailVo calendarDetailVo)
    {
        _diaryElementModel = diaryElementModel;
        SetShowSelectItem(ElementTypePB.Image);
        SetShowLabelSelectItem();

        for (int i = 0; i < calendarDetailVo.DiaryElements.Count; i++)
        {
            CreateElementItem(calendarDetailVo.DiaryElements[i]);
        }

        curLabelPb         = calendarDetailVo.LabelElement;
        _curLabelElementId = curLabelPb.ElementId;
        SetTitleLabel();
    }
Ejemplo n.º 6
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;
    }
Ejemplo n.º 7
0
    public void SetBgElement(int ElementId)
    {
        Debug.LogError("SetBgElement " + ElementId);

        BgElememt bg = _editContains.GetChild(0).GetComponent <BgElememt>();

        if (bg.GetDiaryElementData() == null)
        {
            DiaryElementPB pb = new DiaryElementPB();
            pb.ElementId = ElementId;
            pb.XPos      = 0;
            pb.YPos      = 0;
            pb.ScaleX    = 1;
            pb.ScaleY    = 1;
            pb.Content   = "";
            pb.Rotation  = 0;
            bg.SetData(pb, _editContains.GetComponent <RectTransform>());
        }

        _editContains.GetChild(0).GetComponent <BgElememt>().SetBg(ElementId);
    }
Ejemplo n.º 8
0
    //给界面添加物品

    public void AddElement(DiaryElementPB pb, bool enable)
    {
        CreateElementItem(pb, enable);
    }