void BindTaskListView()
    {
        Task_Service.ListByPlanID(EPlan.ID, selectPeopleID, t =>
        {
            List <ETask> plist = t.GetData() as List <ETask>;
            List <KeyValuePair <string, int> > taskStateGroup = new List <KeyValuePair <string, int> >();
            foreach (var g in plist.GroupBy(c => c.StepName))
            {
                taskStateGroup.Add(new KeyValuePair <string, int>(g.Key, g.Count()));
            }

            TaskChartView.BindData <KeyValuePair <string, int> >("PlanChartItem", taskStateGroup, (i, e) =>
            {
                i.name = "PlanChartItem_" + e.Value.ToString();

                float bfb = (float)e.Value / plist.Count;
                float h   = (int)(bfb * 300);

                i.transform.Find("Text").GetComponent <Text>().text     = e.Value + "(" + (int)(bfb * 100) + "%)";
                i.transform.Find("Text (1)").GetComponent <Text>().text = e.Key;
                i.GetComponent <LayoutElement>().preferredHeight        = h;
                i.GetComponent <Image>().color = Color.green;
            });
        });
    }
Beispiel #2
0
    void BindPeopleList()
    {
        People_Service.ListMyPeople(t =>
        {
            PeopleView.OnItemClicked = OnPeopleClicked;
            List <EPeople> plist     = t.GetData() as List <EPeople>;
            plist = plist.Where(c => c.State == PeopleState.Normal).ToList();
            PeopleView.BindData <EPeople>("PeopleMsgItem", plist, (i, e) =>
            {
                i.name = "PeopleMsgItem_" + e.PeopleID;
                i.transform.Find("Name").GetComponent <Text>().text = e.PeopleName;

                App.Instance.ShowImage(i.transform.Find("Icon").GetComponent <RawImage>(), e.PeopleFace, 11);

                if (TipsList != null && TipsList.Count(c => c.Type == MessageType.OneToOne && c.OwnerID == e.PeopleID) > 0)
                {
                    i.transform.Find("tips").gameObject.SetActive(true);
                }
                else
                {
                    i.transform.Find("tips").gameObject.SetActive(false);
                }
            });
        });
    }
Beispiel #3
0
    void BindMessageList()
    {
        Message_Service.ListByTargetID(MessageType, TargetId, t =>
        {
            List <EMessage> mlist = t.GetData() as List <EMessage>;
            mlist = mlist.OrderBy(c => c.ID).ToList();
            MessageListView.BindData <EMessage>("MessageItem", mlist, (i, e) =>
            {
                i.name = "MessageItem_" + e.ID.ToString();
                i.transform.Find("Text (1)").GetComponent <Text>().text = e.CreateTime.ToString("yyyy-MM-dd hh:mm:ss");
                i.transform.Find("Text").GetComponent <Text>().text     = e.SenderName;
                Transform bg = i.transform.Find("Image (1)");
                Text content = bg.Find("Text").GetComponent <Text>();
                content.text = e.Content;
                float textH  = content.preferredHeight + 20;
                if (e.SenderID == Session.UserID)
                {
                    i.transform.Find("Image (2)").GetComponent <Image>().color = new Color(178 / 255.0f, 223 / 255.0f, 255 / 255.0f);
                    bg.GetComponent <Image>().color = new Color(178 / 255.0f, 223 / 255.0f, 255 / 255.0f);
                }
                else
                {
                    bg.GetComponent <Image>().color = Color.white;
                    i.transform.Find("Image (2)").GetComponent <Image>().color = Color.white;
                }
                i.GetComponent <LayoutElement>().preferredHeight = textH + 32;

                App.Instance.ShowImage(i.transform.Find("Image").GetComponent <RawImage>(), e.SenderFace, 11);
            }, true);
        });
    }
Beispiel #4
0
 private void BindData()
 {
     People_Service.ListMyPeople(t =>
     {
         ListView.BindData <EPeople>("PeopleItem", t.GetData() as List <EPeople>, (i, e) =>
         {
             i.name = "PeopleItem_" + e.PeopleID + "_" + e.ID;
             i.transform.Find("Name").GetComponent <Text>().text = e.PeopleName;
             if (e.State == Lemon.Team.Entity.Enum.PeopleState.Request)
             {
                 i.transform.Find("Phone").GetComponent <Text>().text = "请求中";// user.Phone;
             }
             else
             {
                 i.transform.Find("Phone").GetComponent <Text>().text = "";
             }
             if (e.State == Lemon.Team.Entity.Enum.PeopleState.NeedConfirm)
             {
                 GameObject tgbtn = i.transform.Find("tgbtn").gameObject;
                 GameObject jjbtn = i.transform.Find("jjbtn").gameObject;
                 tgbtn.SetActive(true);
                 jjbtn.SetActive(true);
                 EventListener.Get(tgbtn).onClick = OnTGBtnClicked;
                 EventListener.Get(jjbtn).onClick = OnJJBtnClicked;
             }
             else
             {
                 i.transform.Find("tgbtn").gameObject.SetActive(false);
                 i.transform.Find("jjbtn").gameObject.SetActive(false);
             }
             App.Instance.ShowImage(i.transform.Find("Icon").GetComponent <RawImage>(), e.PeopleFace, 11);
         });
     });
 }
Beispiel #5
0
 private void BindData()
 {
     People_Service.ListMyPeople(p =>
     {
         List <EPeople> myPeople = p.GetData() as List <EPeople>;
         User_Service.SearchUser(SearchWord.text, u =>
         {
             List <EUser> plist = u.GetData() as List <EUser>;
             ListView.BindData <EUser>("PeopleSearchItem", plist, (i, e) =>
             {
                 i.name = "PlanItem_" + e.ID;
                 i.transform.Find("Name").GetComponent <Text>().text  = e.Name;
                 i.transform.Find("Phone").GetComponent <Text>().text = e.Phone;
                 if (myPeople.Any(c => c.PeopleID == e.ID))
                 {
                     i.transform.Find("Button").GetComponent <Button>().gameObject.SetActive(false);
                 }
                 else
                 {
                     i.transform.Find("Button").GetComponent <Button>().gameObject.SetActive(true);
                     EventListener.Get(i.transform.Find("Button").gameObject).onClick = OnBtnAddClicked;
                 }
                 App.Instance.ShowImage(i.transform.Find("Icon").GetComponent <RawImage>(), e.Face, 11);
             });
         });
     });
 }
Beispiel #6
0
 void BindSystemMessageList()
 {
     Message_Service.ListByTargetID(MessageType.System, 0, t =>
     {
         SystemMessageView.BindData <EMessage>("MessageItem", t.GetData() as List <EMessage>, (i, e) =>
         {
             i.name = "MessageItem_" + e.ID.ToString();
             i.transform.Find("Text (1)").GetComponent <Text>().text = e.CreateTime.ToString("yyyy-MM-dd hh:mm:ss");
             i.transform.Find("Text").GetComponent <Text>().text     = "系统";
             Transform bg = i.transform.Find("Image (1)");
             Text content = bg.Find("Text").GetComponent <Text>();
             content.text = e.Content;
             float textH  = content.preferredHeight + 20;
             if (e.SenderID == Session.UserID)
             {
                 i.transform.Find("Image (2)").GetComponent <Image>().color = new Color(178 / 255.0f, 255 / 255.0f, 195 / 255.0f);
                 bg.GetComponent <Image>().color = new Color(178 / 255.0f, 255 / 255.0f, 195 / 255.0f);
             }
             else
             {
                 bg.GetComponent <Image>().color = Color.white;
                 i.transform.Find("Image (2)").GetComponent <Image>().color = Color.white;
             }
             i.GetComponent <LayoutElement>().preferredHeight = textH + 32;
         }, true);
     });
 }
Beispiel #7
0
 private void BindTransferOne(ListViewControl listview, System.DateTime date)
 {
     TaskTransfer_Service.ListByTaskID(TheTask.ID, t =>
     {
         List <ETaskTransfer> plist = t.GetData() as List <ETaskTransfer>;
         plist = plist.Where(c => c.CreateTime >= date && c.CreateTime < date.AddDays(1)).ToList();
         listview.BindData <ETaskTransfer>("TaskTransferOneItem", plist, (i, e) =>
         {
             i.name = "TaskTransferOneItem_" + e.ID;
             App.Instance.ShowImage(i.transform.Find("Icon").GetComponent <RawImage>(), e.AppointFace, 11);
             i.transform.Find("Name").GetComponent <Text>().text = e.AppointName;
             i.transform.Find("Idea").GetComponent <Text>().text = e.Note;
             i.transform.Find("Time").GetComponent <Text>().text = e.CreateTime.ToString("hh:mm");
             if (e.AssignedPersonID != 0)
             {
                 i.transform.Find("ToOther").gameObject.SetActive(true);
                 i.transform.Find("DoProcess").gameObject.SetActive(false);
                 i.transform.Find("ToOther").Find("Name (1)").GetComponent <Text>().text = e.AssignedName;
                 App.Instance.ShowImage(i.transform.Find("ToOther").Find("Icon (2)").GetComponent <RawImage>(), e.AppointFace, 11);
             }
             else
             {
                 i.transform.Find("ToOther").gameObject.SetActive(false);
                 i.transform.Find("DoProcess").gameObject.SetActive(true);
                 i.transform.Find("DoProcess").Find("Name (1)").GetComponent <Text>().text = e.StepName;
             }
         }, false);
     });
 }
Beispiel #8
0
    public void AllPropsCallBack(List <EStore> backdata)
    {
        List <EStore> goldList   = backdata.Where(c => c.Type == "Gold").ToList();
        List <EStore> diamonList = backdata.Where(c => c.Type == "Damion").ToList();
        List <EStore> vipList    = backdata.Where(c => c.Type == "Vip").ToList();
        List <EStore> bagList    = backdata.Where(c => c.Type == "Bag").ToList();

        GoldListView.BindData <EStore>("GoodsGold", goldList, (i, e) =>
        {
            i.name = e.Type + "_" + e.ID + "_" + e.Price;
            i.GetComponent <Goods>().SetGoods(e);
            EventListener.Get(i).onClick = ShopGoodsEvent;
        });

        DiamonListView.BindData <EStore>("GoodsDiamon", diamonList, (i, e) =>
        {
            i.name = e.Type + "_" + e.ID + "_" + e.Price;
            i.GetComponent <Goods>().SetGoods(e);
            EventListener.Get(i).onClick = OnPayEvent;
        });

        VipListView.BindData <EStore>("GoodsVip", vipList, (i, e) =>
        {
            i.name = e.Type + "_" + e.ID + "_" + e.Price;
            i.GetComponent <Goods>().SetGoods(e);
            EventListener.Get(i).onClick = OnPayEvent;
        });

        BagListView.BindData <EStore>("GoodsBag", bagList, (i, e) =>
        {
            i.name = e.Type + "_" + e.ID + "_" + e.Price;
            i.GetComponent <Goods>().SetGoods(e);
            EventListener.Get(i).onClick = ShopGoodsEvent;
        });
    }
 void BindPeopleSelect()
 {
     ProjectTeam_Service.ListByProjectID(EPlan.ProjectID, t =>
     {
         PeopleSelectListView.OnItemClicked = OnPeopleSelectClicked;
         List <EProjectTeam> projectTeam    = t.GetData() as List <EProjectTeam>;
         projectTeam.Insert(0, new EProjectTeam()
         {
             ProjectID = EPlan.ProjectID, UserID = -1
         });
         PeopleSelectListView.BindData <EProjectTeam>("PeopleSelectItem", projectTeam, (i, e) =>
         {
             if (e.UserID == -1)
             {
                 i.name = "PeopleSelectItem_" + e.UserID.ToString();
                 i.transform.Find("Text").GetComponent <Text>().text = "全部";
             }
             else
             {
                 i.name = "PeopleSelectItem_" + e.UserID.ToString();
                 i.transform.Find("Text").GetComponent <Text>().text = e.UserName;
             }
         }, true, true);
     });
 }
Beispiel #10
0
 void BindData(List <EKeyName> plist)
 {
     List.BindData <EKeyName>("UserSelectedItem", plist, (i, e) =>
     {
         i.name = "UserSelectedItem_" + e.ID.ToString();
         i.transform.Find("Name").GetComponent <Text>().text = e.Name;
         App.Instance.ShowImage(i.transform.Find("Icon").GetComponent <RawImage>(), e.Other, 11);
     }, true, true);
 }
Beispiel #11
0
 public void BindDataBack(List <EFriends> friends)
 {
     ListView.BindData <EFriends>("FriendsItem", friends, (i, e) =>
     {
         i.name = "FriendsItem_" + e.FriendID + "_" + e.ID;
         i.transform.Find("Name").GetComponent <Text>().text   = "(" + e.FriendID + ")" + e.FriendNickName;
         i.transform.Find("WinNum").GetComponent <Text>().text = e.FriendWinTimes;
         App.Instance.ShowImage(i.transform.Find("FriendIcon").GetComponent <RawImage>(), e.FriendIconUrl);
     });
 }
    void BindTaskTimeOne(ListViewControl listView, System.DateTime date, List <ETask> plist)
    {
        List <ETask> tasklist = plist.Where(c => date >= c.BeginTime.Date && date <= c.EndTime.Date).ToList();

        listView.BindData <ETask>("TaskTimeOneItem", tasklist, (i, e) =>
        {
            i.name = "TaskTimeOneItem_" + e.ID;
            i.SetActive(true);
            i.transform.Find("Idea").GetComponent <Text>().text = e.Title;
            App.Instance.ShowImage(i.transform.Find("Icon").GetComponent <RawImage>(), e.TaskHeadFace, 11);
        }, false);
    }
 private void BindPlan()
 {
     PlanList.Clear();
     Plan_Service.ListMyProjectID(NewSearch.ProjectID, t =>
     {
         PlanList.BindData <EPlan>("PlanItemSelect", t.GetData() as List <EPlan>, (i, e) =>
         {
             i.name = "PlanItem_" + e.ID;
             i.transform.Find("Name").GetComponent <Text>().text = e.Name;
         }, true, true);
         PlanList.OnItemClicked = OnPlanClicked;
     });
 }
    private void BindTaskPriority()
    {
        List <string> pList = EnumMapping.ListAll <TaskPriority>();

        pList.Insert(0, "全部");
        YXJList.Clear();
        YXJList.OnItemClicked = YXJItem_OnClicked;
        YXJList.BindData <string>("TextItem", pList, (i, e) =>
        {
            i.name = "TextItem_" + e;
            i.transform.Find("Name").GetComponent <Text>().text = e;
        }, true, true);
    }
 private void BindProject()
 {
     ProjectList.Clear();
     Project_Service.ListTeamProject(t =>
     {
         List <EProject> plist = t.GetData() as List <EProject>;
         ProjectList.BindData <EProject>("ProjectItemSelect", plist, (i, e) =>
         {
             i.name = "ProjectItem_" + e.ID.ToString();
             i.transform.Find("TIContent").GetComponent <Text>().text = e.Name;
         }, true, true);
         ProjectList.OnItemClicked = OnProjectClicked;
     });
 }
Beispiel #16
0
 private void BindData()
 {
     Plan_Service.ListMyProjectID(EProject.ID, t =>
     {
         List <EPlan> plist = t.GetData() as List <EPlan>;
         PlanListView.BindData <EPlan>("PlanItem", plist, (i, e) =>
         {
             i.name = "PlanItem_" + e.ID;
             i.transform.Find("Name").GetComponent <Text>().text      = e.Name;
             i.transform.Find("BeginTime").GetComponent <Text>().text = e.BeginTime.ToString("yyyy-MM-dd");
             i.transform.Find("EndTime").GetComponent <Text>().text   = e.EndTime.ToString("yyyy-MM-dd");
         });
     });
 }
Beispiel #17
0
 void BindAttachment()
 {
     if (string.IsNullOrEmpty(SelectFilePath))
     {
         AttachmentList.Clear();
         return;
     }
     AttachmentList.BindData <string>("AttachmentItem", SelectFilePath.Split('|').ToList(), (i, e) =>
     {
         string path = e;
         i.name      = path;
         i.transform.Find("Name").GetComponent <Text>().text = System.IO.Path.GetFileName(path);
         i.transform.Find("Button").gameObject.SetActive(true);
         EventListener.Get(i.transform.Find("Button").gameObject).onClick = OnDelAttachmentClicked;
     });
 }
Beispiel #18
0
 private void BindData()
 {
     TaskTransfer_Service.ListByTaskID(TheTask.ID, t =>
     {
         List <ETaskTransfer> plist      = t.GetData() as List <ETaskTransfer>;
         List <System.DateTime> datelist = plist.GroupBy(c => c.CreateTime.Date).Select(c => c.Key).OrderByDescending(c => c).ToList();
         TransferList.BindData <System.DateTime>("TaskTransferItem", datelist, (i, e) =>
         {
             i.name = "TaskTransferItem_" + e.Date.ToString();
             i.transform.Find("Day").GetComponent <Text>().text = e.Date.ToString("yyyy.MM.dd");
             BindTransferOne(i.transform.Find("Panel").Find("TransferOneList").GetComponent <ListViewControl>(), e.Date);
             int rowCount = plist.Count(c => c.CreateTime >= e.Date && c.CreateTime < e.Date.AddDays(1));
             i.GetComponent <LayoutElement>().preferredHeight = rowCount * (53 + 15);
         }, false);
     });
 }
Beispiel #19
0
    private void BindData()
    {
        Project_Service.ListMyProject(t =>
        {
            List <EProject> plist = t.GetData() as List <EProject>;
            ProjectList.BindData <EProject>("ProjectItem", plist, (i, e) =>
            {
                i.name = "ProjectItem_" + e.ID.ToString();
                i.transform.Find("TIContent").GetComponent <Text>().text = e.Name;
                i.transform.Find("Image").Find("Process").GetComponent <Image>().fillAmount = e.Progress / 100.0f;
                i.transform.Find("Text").GetComponent <Text>().text = e.Progress.ToString() + "%";

                App.Instance.ShowImage(i.GetComponent <RawImage>(), e.Face, 12);
            });
        });
    }
Beispiel #20
0
 void BindAttachment(string attachment)
 {
     if (string.IsNullOrEmpty(attachment))
     {
         AttachmentList.Clear();
         return;
     }
     AttachmentList.OnItemClicked = OnAttachmentItemClicked;
     AttachmentList.BindData <string>("AttachmentItem", attachment.Split('|').ToList(), (i, e) =>
     {
         string path = e;
         i.name      = path;
         i.transform.Find("Name").GetComponent <Text>().text = System.IO.Path.GetFileName(path);
         i.transform.Find("Button").gameObject.SetActive(false);
     });
 }
Beispiel #21
0
 private void BindData()
 {
     ProjectTeam_Service.ListByProjectID(EProject.ID, t =>
     {
         List <EProjectTeam> plist = t.GetData() as List <EProjectTeam>;
         ProjectList.OnItemClicked = OnPeopleClicked;
         ProjectList.BindData <EProjectTeam>("PeopleItem", plist, (i, e) =>
         {
             i.name = "PeopleItem_" + e.UserID;
             i.transform.Find("Name").GetComponent <Text>().text  = e.UserName;
             i.transform.Find("Phone").GetComponent <Text>().text = "";// user.Phone;
             i.transform.Find("tgbtn").gameObject.SetActive(false);
             i.transform.Find("jjbtn").gameObject.SetActive(false);
             App.Instance.ShowImage(i.transform.Find("Icon").GetComponent <RawImage>(), e.UserFace, 11);
         });
     });
 }
Beispiel #22
0
 public void BindDataBack(List <EBattleRecord> recordList)
 {
     RecordList = recordList;
     ListView.BindData <EBattleRecord>("AchievementObjItem", recordList, (i, e) =>
     {
         i.name = "AchievementObjItem_" + e.ID;
         i.transform.Find("Time").GetComponent <Text>().text    = e.BeginTime.ToString("yyyy-MM-dd hh:mm:ss");
         i.transform.Find("ID").GetComponent <Text>().text      = e.ID.ToString();
         i.transform.Find("My").GetComponent <Text>().text      = e.Sider1Score.ToString();
         i.transform.Find("Other01").GetComponent <Text>().text = e.Sider2Name;
         i.transform.Find("Other01").Find("Other01Num").GetComponent <Text>().text = e.Sider2Score.ToString();
         i.transform.Find("Other02").GetComponent <Text>().text = e.Sider3Name;
         i.transform.Find("Other02").Find("Other02Num").GetComponent <Text>().text = e.Sider3Score.ToString();
         i.transform.Find("Other03").GetComponent <Text>().text = e.Sider4Name;
         i.transform.Find("Other03").Find("Other03Num").GetComponent <Text>().text = e.Sider4Score.ToString();
         EventListener.Get(i.transform.Find("OverWatchButton").gameObject).onClick = OnRecordPlayClicked;
     });
 }
Beispiel #23
0
    void BindDays()
    {
        List <int> dayList   = new List <int>();
        int        dayCount  = System.DateTime.DaysInMonth(CurrentTime.Year, CurrentTime.Month);
        int        startWeek = (int)new System.DateTime(CurrentTime.Year, CurrentTime.Month, 1).DayOfWeek;

        for (int d = 0; d < dayCount + startWeek; d++)
        {
            dayList.Add(d);
        }
        DayGrid.OnItemClicked = g =>
        {
            int d = int.Parse(g.name.Split('_')[1]);
            if (d > 0)
            {
                CurrentTime = new System.DateTime(CurrentTime.Year, CurrentTime.Month, d);
                BindTitle();
                BindDays();
            }
        };
        DayGrid.BindData <int>(DayItemTemplate.gameObject, dayList, (i, e) =>
        {
            int thedaynum = e - startWeek + 1;
            i.name        = "DayItem_" + thedaynum.ToString();
            if (thedaynum <= 0)
            {
                i.transform.Find("Text").GetComponent <Text>().text = "";
            }
            else
            {
                i.transform.Find("Text").GetComponent <Text>().text = thedaynum.ToString();
            }
            if (thedaynum == CurrentTime.Day)
            {
                i.GetComponent <Image>().color = App.Instance.Theme.SelectedItemBgColor;
            }
            else
            {
                i.GetComponent <Image>().color = Color.white;
            }
            BindTitle();
        }, true, true);
    }
    private void BindTaskState()
    {
        ProjectTaskStep_Service.ListByProjectID(NewSearch.ProjectID, t =>
        {
            ProjectStepList = t.GetData() as List <EProjectTaskStep>;
            ProjectStepList.Insert(0, new EProjectTaskStep()
            {
                Name = "全部", Value = 0
            });

            StateList.Clear();
            StateList.OnItemClicked = StateItem_OnClicked;
            StateList.BindData <EProjectTaskStep>("TextItem", ProjectStepList, (i, e) =>
            {
                i.name = "TextItem_" + e.Name;
                i.transform.Find("Name").GetComponent <Text>().text = e.Name;
            }, true, true);
        });
    }
Beispiel #25
0
 void BindTaskStep()
 {
     BtnAddStep.interactable = false;
     ProjectTaskStep_Service.ListByProjectID(EProject.ID, t =>
     {
         BtnAddStep.interactable = true;
         StepList = t.GetData() as List <EProjectTaskStep>;
         if (StepList.Count > 0)
         {
             MaxStepValue = StepList.Max(c => c.Value);
         }
         TaskStepList.BindData <EProjectTaskStep>("ProjectTaskStepItem", StepList, (i, e) =>
         {
             i.name = "ProjectTaskStepItem_" + e.ID;
             i.transform.Find("Name").GetComponent <InputField>().text         = e.Name;
             EventListener.Get(i.transform.Find("BtnDel").gameObject).onClick  = DelTaskStep;
             EventListener.Get(i.transform.Find("BtnSave").gameObject).onClick = ChangeTaskStep;
         });
     });
 }
 void BindTaskListView()
 {
     Task_Service.ListByPlanID(EPlan.ID, selectPeopleID, t =>
     {
         List <ETask> plist         = t.GetData() as List <ETask>;
         TaskListView.OnItemClicked = OnTaskClicked;
         TaskListView.BindData <ETask>("PlanTaskItem", plist, (i, e) =>
         {
             i.name = "PlanTaskItem_" + e.ID.ToString();
             i.transform.Find("TIState").GetComponent <Text>().text    = e.StepName;
             i.transform.Find("TIPriority").GetComponent <Text>().text = EnumMapping.GetText <TaskPriority>((int)e.Priority);
             if (e.Priority == TaskPriority.First)
             {
                 i.transform.Find("TIPriority").GetComponent <Text>().color = new Color(156 / 255f, 93 / 255f, 0 / 255f);
             }
             else if (e.Priority == TaskPriority.Hurry)
             {
                 i.transform.Find("TIPriority").GetComponent <Text>().color = new Color(223 / 255f, 60 / 255f, 0 / 255f);
             }
             else if (e.Priority == TaskPriority.Urgent)
             {
                 i.transform.Find("TIPriority").GetComponent <Text>().color = Color.red;
             }
             else
             {
                 i.transform.Find("TIPriority").GetComponent <Text>().color = new Color(139 / 255f, 139 / 255f, 139 / 255f);
             }
             i.transform.Find("TIContent").GetComponent <Text>().text   = e.Title;
             i.transform.Find("TIBeginTime").GetComponent <Text>().text = e.BeginTime.ToString("yyyy-MM-dd");
             i.transform.Find("TIEndTime").GetComponent <Text>().text   = e.EndTime.ToString("yyyy-MM-dd");
             if (e.TaskHeadID == 0)
             {
                 i.transform.Find("TIPerson").GetComponent <Text>().text = "";
             }
             else
             {
                 i.transform.Find("TIPerson").GetComponent <Text>().text = e.TaskHeadName;
             }
         });
     });
 }
Beispiel #27
0
    void BindYears()
    {
        List <int> yearList = new List <int>();

        for (int y = System.DateTime.Now.Year - 50; y < System.DateTime.Now.Year + 50; y++)
        {
            yearList.Add(y);
        }
        YearList.OnItemClicked = g =>
        {
            int y        = int.Parse(g.name.Split('_')[1]);
            int dayCount = System.DateTime.DaysInMonth(y, CurrentTime.Month);
            if (CurrentTime.Day > dayCount)
            {
                CurrentTime = new System.DateTime(y, CurrentTime.Month, dayCount);
            }
            else
            {
                CurrentTime = new System.DateTime(y, CurrentTime.Month, CurrentTime.Day);
            }
            BindDays();
        };
        YearList.BindData <int>(YearItemTemplate.gameObject, yearList, (i, e) =>
        {
            i.name = "YearItem_" + e.ToString();
            i.transform.Find("Text").GetComponent <Text>().text = e + "年";
            if (e == CurrentTime.Year)
            {
                i.GetComponent <Image>().color = App.Instance.Theme.SelectedItemBgColor;
            }
            else
            {
                i.GetComponent <Image>().color = Color.white;
            }
        }, true, true);

        int yearIndex = yearList.IndexOf(CurrentTime.Year);

        YearList.Content.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, yearIndex * 50);
    }
 void BindTaskTimeView()
 {
     Task_Service.ListByPlanID(EPlan.ID, selectPeopleID, t =>
     {
         List <ETask> plist        = t.GetData() as List <ETask>;
         System.DateTime beginTime = System.DateTime.Now;
         System.DateTime endTime   = System.DateTime.Now;
         if (plist.Count > 0)
         {
             beginTime = plist.Min(c => c.BeginTime);
             endTime   = plist.Max(c => c.EndTime);
         }
         List <System.DateTime> datelist = new List <System.DateTime>();
         System.DateTime curTime         = beginTime;
         while (curTime.Date <= endTime.Date)
         {
             datelist.Add(curTime.Date);
             curTime = curTime.AddDays(1);
         }
         datelist = datelist.OrderByDescending(c => c).ToList();
         TaskTimeView.BindData <System.DateTime>("TaskTimeItem", datelist, (i, e) =>
         {
             i.name = "TaskTimeItem_" + e.Date.ToString();
             i.transform.Find("Day").GetComponent <Text>().text = e.Date.ToString("yyyy.MM.dd");
             BindTaskTimeOne(i.transform.Find("Panel").Find("TaskTimeOneList").GetComponent <ListViewControl>(), e.Date, plist);
             int rowCount = plist.Count(c => e.Date >= c.BeginTime.Date && e.Date <= c.EndTime.Date);
             if (rowCount == 0)
             {
                 rowCount = 1;
                 i.transform.Find("Panel").GetComponent <Image>().color = new Color(140 / 255.0f, 140 / 255.0f, 140 / 255.0f);
             }
             else
             {
                 i.transform.Find("Panel").GetComponent <Image>().color = new Color(105 / 255.0f, 197 / 255.0f, 251 / 255.0f);
             }
             i.GetComponent <LayoutElement>().preferredHeight = rowCount * 50 + 16;
         }, false);
     });
 }
    void BindTaskGanttView()
    {
        Task_Service.ListByPlanID(EPlan.ID, selectPeopleID, t =>
        {
            List <ETask> plist        = t.GetData() as List <ETask>;
            System.DateTime beginTime = System.DateTime.Now;
            System.DateTime endTime   = System.DateTime.Now;
            if (plist.Count > 0)
            {
                beginTime = plist.Min(c => c.BeginTime);
                endTime   = plist.Max(c => c.EndTime);
            }
            List <System.DateTime> datelist = new List <System.DateTime>();
            System.DateTime curTime         = beginTime;
            while (curTime.Date <= endTime.Date)
            {
                datelist.Add(curTime.Date);
                curTime = curTime.AddDays(1);
            }
            datelist = datelist.OrderBy(c => c).ToList();


            TaskGanttTimeView.BindData <System.DateTime>("GanttTimeItem", datelist, (i, e) =>
            {
                i.transform.Find("Text").GetComponent <Text>().text = e.ToString("yyyy-MM-dd");
            }, false);

            ListGanttTaskView.BindData <ETask>("GanttTaskItem", plist.OrderBy(c => c.BeginTime).ToList(), (i, e) =>
            {
                float x = (float)(e.BeginTime.Date - beginTime.Date).TotalDays * 100.0f;
                float w = (float)(e.EndTime.Date.AddDays(1) - e.BeginTime.Date).TotalDays * 100.0f;
                i.transform.Find("Image").GetComponent <RectTransform>().anchoredPosition = new Vector2(x, 0);
                i.transform.Find("Image").GetComponent <RectTransform>().sizeDelta        = new Vector2(w, 30);
                i.transform.Find("Image").Find("Text").GetComponent <Text>().text         = e.Title;
            }, false);

            CpntentRect.sizeDelta = new Vector2(datelist.Count * 100, plist.Count * 40 + 50);
        });
    }
Beispiel #30
0
    void BindMonths()
    {
        List <int> monthList = new List <int>();

        for (int m = 1; m < 13; m++)
        {
            monthList.Add(m);
        }
        MonthList.OnItemClicked = g =>
        {
            int m        = int.Parse(g.name.Split('_')[1]);
            int dayCount = System.DateTime.DaysInMonth(CurrentTime.Year, m);
            if (CurrentTime.Day > dayCount)
            {
                CurrentTime = new System.DateTime(CurrentTime.Year, m, dayCount);
            }
            else
            {
                CurrentTime = new System.DateTime(CurrentTime.Year, m, CurrentTime.Day);
            }
            BindTitle();
            BindDays();
        };
        MonthList.BindData <int>(MonthItemTemplate.gameObject, monthList, (i, e) =>
        {
            i.name = "MonthItem_" + e.ToString();
            i.transform.Find("Text").GetComponent <Text>().text = e + "月";
            if (e == CurrentTime.Month)
            {
                i.GetComponent <Image>().color = App.Instance.Theme.SelectedItemBgColor;
            }
            else
            {
                i.GetComponent <Image>().color = Color.white;
            }
        }, true, true);
        MonthList.Content.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, CurrentTime.Month * 50);
    }