Пример #1
0
        public void SetSort(bool newSort = true)
        {
            Properties.Settings.Default.LibrarySort = sortType;
            Properties.Settings.Default.Save();
            if (newSort)
            {
                sortType = (sortType == 2) ? 0 : sortType + 1;
            }
            switch (sortType)
            {
            case 0:
                lib.SortAlphaPosters(true);
                lib.SortAlphaList(true);
                SortImage.SetResourceReference(Image.SourceProperty, "AlphabeticalIcon");
                break;

            case 1:
                lib.SortAlphaPosters(false);
                lib.SortAlphaList(false);
                SortImage.SetResourceReference(Image.SourceProperty, "AlphabeticalReverseIcon");
                break;

            case 2:
                lib.SortCalendarPosters();
                lib.SortCalendarList();
                SortImage.SetResourceReference(Image.SourceProperty, "CalendarIcon");
                break;
            }
        }
Пример #2
0
    //  点击左右向按键时初始化克隆的物体
    public void CloneInit(string state, GameObject revert)
    {
        GameObject cloneself = null;
        bool       isfind    = true;

        tempindex  = tparents[1].transform.childCount;
        tempindex += 1;
        if (state == "right")
        {
            cloneself = Instantiate(itemsprefab);//按下按键时克隆一个自己
            for (int i = 0; i < tparents[1].transform.childCount; i++)
            {
                // Debug.Log(tparents[1].transform.GetChild(i).childCount + "tparents[1].transform.GetChild(i).childCount");
                if (tparents[1].transform.GetChild(i).childCount == 0)
                {
                    cloneself.transform.SetParent(tparents[1].transform.GetChild(i));
                    isfind = true;
                    break;      //执行这行代码时,
                }
                else
                {
                    isfind = false;
                }
            }
            //先将for循环执行完成后再执行此if语句
            if (!isfind || tparents[1].transform.childCount == 0)
            {
                GameObject Ucell = Instantiate(Ucellprefab);
                InitePre(Ucell, "None");
                cloneself.transform.SetParent(Ucell.transform);
            }
            string[] typescene = revert.transform.GetChild(0).GetComponent <Text> ().text.Split('.');
            //  cloneself.transform.SetParent(tparents[1].transform);
            cloneself.transform.GetChild(0).GetComponent <Text>().text = tempindex + "." + typescene[1];
            cloneself.transform.localPosition = Vector3.zero;
            cloneself.transform.localRotation = Quaternion.identity;
            cloneself.transform.localScale    = Vector3.one;
            SortImage cloneimage = cloneself.AddComponent <SortImage>();
            cloneimage.gridcontroll = this;
            cloneimage.id           = revert.GetComponent <SortImage>().id;
            cloneimage.scenetype    = revert.GetComponent <SortImage>().scenetype;
        }
        else
        {
            Destroy(cloneself);
            //左侧不要删除完:
            if (revert.transform.parent.parent.childCount > 1)
            {
                DestroyImmediate(revert.transform.parent.gameObject);
            }
            //Debug.Log(revert.transform.parent + "revert.transform.parent");
            //handsitems.Remove(revert);
            RefreshIndex();
        }
    }
Пример #3
0
 //遍历子物体,保存用于配置信息:
 public static void Loadinformation(GameObject parent)
 {
     roomid.Clear(); //每次收集roomid信息时清空以前保存的信息;
     for (int i = 0; i < parent.transform.childCount; i++)
     {
         if (parent.transform.GetChild(i).childCount > 0)
         {
             SortImage sortimage = parent.transform.GetChild(i).GetChild(0).GetComponent <SortImage>();
             // if (!roomid.ContainsValue(sortimage.id))
             {
                 roomid.Add(sortimage.id);
                 sceneindex.Add(sortimage.scenetype);
             }
             //  Debug.Log(sortimage.scenetype);
             //  Debug.Log(sortimage.id);
         }
     }
 }
Пример #4
0
    public void InitePre(GameObject pre, string Name)
    {
        pre.transform.SetParent(tparents[0].transform);
        DestroyImmediate(pre.GetComponent <Button>());
        pre.transform.localPosition = Vector3.zero;
        pre.transform.rotation      = Quaternion.identity;
        pre.transform.localScale    = Vector3.one;
        if (pre.tag == "UU")    //如果是初始化Ucells,从这里结束;
        {
            pre.transform.SetParent(tparents[1].transform);
            return;
        }
        pre.transform.GetChild(0).GetComponent <Text>().text = (templink + 1).ToString() + ".     " + Global.childtextsscene[templink] + "/" + Global.childtexts[templink];

        SortImage sortimage = pre.AddComponent <SortImage>();

        sortimage.gridcontroll = this;
        sortimage.id           = Name;
        sortimage.scenetype    = Global.typeidscene[templink];
    }
Пример #5
0
        public void DisplaySortImageOnColumn(int column, SortImage image)
        {
            HDITEM.Format format = GetColumnFormat(column);

            // Reset any existing sort images
            format &= ~HDITEM.Format.SortDown;
            format &= ~HDITEM.Format.SortUp;

            // Set new image (if any)
            if (image == SortImage.Ascending)
            {
                format |= HDITEM.Format.SortUp;
            }
            else if (image == SortImage.Descending)
            {
                format |= HDITEM.Format.SortDown;
            }

            SetColumnFormat(column, format);
        }