예제 #1
0
    private void Objective_OnStarted(Objective sender)
    {
        UpdateListItem updateLine = Instantiate(updateListItemPrefab) as UpdateListItem;

        updateLine.transform.SetParent(transform);
        updateLine.AnimateTime = animationTime;
        updateLine.Text        = "Current Objective: " + sender.description;
        sender.OnStarted      -= Objective_OnStarted;
        itemsToBeAddedQueue.Enqueue(updateLine);
    }
예제 #2
0
    private void Quest_OnCompleted(Quest sender)
    {
        UpdateListItem updateLine = Instantiate(updateListItemPrefab) as UpdateListItem;

        updateLine.transform.SetParent(transform);
        updateLine.AnimateTime = animationTime;
        updateLine.Text        = "Quest completed!";
        sender.OnCompleted    -= Quest_OnCompleted;
        itemsToBeAddedQueue.Enqueue(updateLine);
    }
예제 #3
0
파일: MainForm.cs 프로젝트: seank-com/STDF
        public MainForm()
        {
            InitializeComponent();

            _col = (int)ColumnIndex.Path;
            listView.ListViewItemSorter = this;

            _directories = new List<string>();

            _updateHash = new UpdateListItem(UpdateHash);

            UpdateUI(false);
        }
예제 #4
0
 private void ShowListItemOnScreen(UpdateListItem listItem)
 {
     listItem.GetComponent <RectTransform>().anchoredPosition = localStartPosition;
     itemList.Enqueue(listItem);
     listItem.AddToTop();
     while (itemList.Count > maxRows)
     {
         itemList.Dequeue().RemoveFromBottom();
     }
     foreach (var item in itemList)
     {
         item.MoveDown();
     }
 }
예제 #5
0
    /// <summary>
    /// 初始化
    /// </summary>
    /// <param name="maxLength"></param>
    /// <param name="updateItem"></param>
    public void Init(int maxLength, UpdateListItem updateItem)
    {
        m_showArea = GetComponent<RectTransform>().sizeDelta;
        m_item.SetActive(false);
        m_firstItemPos.y += m_itemHeight;
        m_curSbVal = m_sb.value;
        m_curShowEndIndex = m_fixedColCount;

        m_listMaxLength = maxLength;
        m_updateItem = updateItem;
        for (int i = 0; i < m_fixedColCount+1; i++)
        {
            Transform item = CreateItem(i);
            m_updateItem(item, i);
        }
    }
예제 #6
0
    private void QuestManager_OnQuestAdd(Quest addedQuest)
    {
        // Subscribe to quest events
        addedQuest.OnCompleted += Quest_OnCompleted;
        foreach (Objective obj in addedQuest.objectives)
        {
            Debug.Log("Subscribed to objective");
            obj.OnCompleted += Objective_OnCompleted;
            obj.OnStarted   += Objective_OnStarted;
        }

        // Notification of new quest
        UpdateListItem updateLine = Instantiate(updateListItemPrefab) as UpdateListItem;

        updateLine.transform.SetParent(transform);
        updateLine.AnimateTime = animationTime;
        updateLine.Text        = "New Quest Added";
        itemsToBeAddedQueue.Enqueue(updateLine);
    }
예제 #7
0
    /// <summary>
    /// 初始化滚动列表
    /// </summary>
    /// <param name="isHorizontal">是否是横向的列表</param>
    /// <param name="count">列表数量</param>
    /// <param name="gap">间隔</param>
    /// <param name="updateItem">每一项的回调</param>
    /// <returns></returns>
    public void init(bool isHorizontal         = false,
                     int count                 = 0,
                     float gap                 = 5,
                     UpdateListItem updateItem = null)
    {
        this.totalCount = -1;
        if (count < 0)
        {
            count = 0;
        }
        if (this.scroll == null)
        {
            return;
        }
        if (this.content == null)
        {
            return;
        }
        this.m_updateItem = updateItem;
        this.isHorizontal = isHorizontal;
        //设置组件横向纵向滚动
        this.sr            = this.scroll.GetComponent <ScrollRect>();
        this.sr.horizontal = this.isHorizontal;
        this.sr.vertical   = !this.isHorizontal;
        this.gapH          = gap;
        this.gapV          = gap;
        this.listWidth     = this.scroll.GetComponent <RectTransform>().sizeDelta.x;
        this.listHeight    = this.scroll.GetComponent <RectTransform>().sizeDelta.y;
        this.itemWidth     = this.itemPrefab.GetComponent <RectTransform>().sizeDelta.x;
        this.itemHeight    = this.itemPrefab.GetComponent <RectTransform>().sizeDelta.y;

        //this.scroll.transform.localPosition = new Vector3(-this.listWidth / 2, this.listHeight / 2);
        this.contentRectTf               = this.content.GetComponent <RectTransform>();
        this.contentRectTf.sizeDelta     = new Vector2(listWidth, listHeight);
        this.contentRectTf.localPosition = new Vector3(0, 0);
        this.prevItemPos     = new Vector2();
        this.contentStartPos = this.scroll.transform.localPosition;
        this.reloadData(count);
        this.isReload = true;
    }
예제 #8
0
    IEnumerator ShowListItemDelay(UpdateListItem listItem, float delayTime)
    {
        yield return(new WaitForSeconds(delayTime));

        itemsToBeAddedQueue.Enqueue(listItem);
    }
예제 #9
0
    /// <summary>
    /// 初始化滚动列表
    /// </summary>
    /// <param name="isHorizontal">是否是横向的列表</param>
    /// <param name="count">列表数量</param>
    /// <param name="gap">间隔</param>
    /// <param name="updateItem">每一项的回调</param>
    /// <returns></returns>
    public void init(bool isHorizontal = false,
                     int count = 0, 
                     float gap = 5,
                     UpdateListItem updateItem = null)
    {
        this.totalCount = -1;
        if (count < 0) count = 0;
        if (this.scroll == null) return;
        if (this.content == null) return;
        this.m_updateItem = updateItem;
        this.isHorizontal = isHorizontal;
        //设置组件横向纵向滚动
        this.sr = this.scroll.GetComponent<ScrollRect>();
        this.sr.horizontal = this.isHorizontal;
        this.sr.vertical = !this.isHorizontal;
        this.gapH = gap;
        this.gapV = gap;
        this.listWidth = this.scroll.GetComponent<RectTransform>().sizeDelta.x;
        this.listHeight = this.scroll.GetComponent<RectTransform>().sizeDelta.y;
        this.itemWidth = this.itemPrefab.GetComponent<RectTransform>().sizeDelta.x;
        this.itemHeight = this.itemPrefab.GetComponent<RectTransform>().sizeDelta.y;

        //this.scroll.transform.localPosition = new Vector3(-this.listWidth / 2, this.listHeight / 2);
        this.contentRectTf = this.content.GetComponent<RectTransform>();
        this.contentRectTf.sizeDelta = new Vector2(listWidth, listHeight);
        this.contentRectTf.localPosition = new Vector3(0, 0);
        this.prevItemPos = new Vector2();
        this.contentStartPos = this.scroll.transform.localPosition;
        this.reloadData(count);
        this.isReload = true;
    }
예제 #10
0
 private void ShowListItemOnScreen(UpdateListItem listItem)
 {
     listItem.GetComponent<RectTransform>().anchoredPosition = localStartPosition;
     itemList.Enqueue(listItem);
     listItem.AddToTop();
     while (itemList.Count > maxRows)
     {
         itemList.Dequeue().RemoveFromBottom();
     }
     foreach(var item in itemList)
     {
         item.MoveDown();
     }
 }
예제 #11
0
 IEnumerator ShowListItemDelay(UpdateListItem listItem, float delayTime)
 {
     yield return new WaitForSeconds(delayTime);
     itemsToBeAddedQueue.Enqueue(listItem);
 }