Пример #1
0
    public void SetContentsByRandom(long uuid, List <int> contentIds, int dialogueTimes)
    {
        if (uuid > 0L && BillboardManager.Instance.IsBillboardInfoOff(uuid, BillboardManager.BillboardInfoOffOption.BubbleDialogue))
        {
            return;
        }
        if (contentIds == null || contentIds.get_Count() == 0)
        {
            return;
        }
        int                num            = Random.Range(0, contentIds.get_Count());
        string             chineseContent = GameDataUtils.GetChineseContent(contentIds.get_Item(num), false);
        BubbleDialogueUnit gridUI         = this.GetBubbleDialogueUnit(uuid);

        if (gridUI != null)
        {
            gridUI.SetContent(chineseContent);
            uint start = (uint)Mathf.Max(3000, dialogueTimes * 1000);
            TimerHeap.AddTimer(start, 0, delegate
            {
                if (gridUI != null)
                {
                    Transform transform = gridUI.get_transform();
                    this.RemoveBubbleDialogue(uuid, transform);
                }
            });
        }
    }
Пример #2
0
 public void SetContentsBySequence(long uuid, List <int> contentIds, List <int> dialogueTimes, int index = 0)
 {
     if (uuid > 0L && BillboardManager.Instance.IsBillboardInfoOff(uuid, BillboardManager.BillboardInfoOffOption.BubbleDialogue))
     {
         return;
     }
     if (contentIds.get_Count() > index && dialogueTimes.get_Count() > index)
     {
         BubbleDialogueUnit gridUI = this.GetBubbleDialogueUnit(uuid);
         if (gridUI != null)
         {
             gridUI.SetContent(GameDataUtils.GetChineseContent(contentIds.get_Item(index), false));
             uint start = (uint)Mathf.Max(3000, dialogueTimes.get_Item(index) * 1000);
             index++;
             TimerHeap.AddTimer(start, 0, delegate
             {
                 if (contentIds.get_Count() <= index)
                 {
                     if (gridUI != null)
                     {
                         Transform transform = gridUI.get_transform();
                         this.RemoveBubbleDialogue(uuid, transform);
                     }
                 }
                 else
                 {
                     this.SetContentsBySequence(uuid, contentIds, dialogueTimes, index);
                 }
             });
         }
     }
 }
Пример #3
0
    public void BubbleDialogue(Transform actorRoot, float height, long uuid, string content)
    {
        this.AddBubbleDialogue(actorRoot, height, uuid);
        BubbleDialogueUnit bubbleDialogueUnit = this.GetBubbleDialogueUnit(uuid);

        if (bubbleDialogueUnit != null)
        {
            bubbleDialogueUnit.SetContent(content);
        }
    }
Пример #4
0
 private BubbleDialogueUnit GetBubbleDialogueUnit(long uuid)
 {
     for (int i = 0; i < this.BubbleDialogues.get_Count(); i++)
     {
         BubbleDialogueUnit bubbleDialogueUnit = this.BubbleDialogues.get_Item(i);
         if (bubbleDialogueUnit.uuid == uuid)
         {
             return(bubbleDialogueUnit);
         }
     }
     return(null);
 }
Пример #5
0
    private BubbleDialogueUnit Create2BubbleDialogue(Transform parent, float height, long uuid)
    {
        GameObject gameObject = BubbleDialogueManager.BubbleDialoguePool.Get(string.Empty);

        gameObject.set_name(uuid.ToString());
        BubbleDialogueUnit bubbleDialogueUnit = parent.get_gameObject().AddMissingComponent <BubbleDialogueUnit>();

        bubbleDialogueUnit.AwakeSelf(gameObject.get_transform());
        this.BubbleDialogues.Add(bubbleDialogueUnit);
        bubbleDialogueUnit.set_enabled(true);
        return(bubbleDialogueUnit);
    }
Пример #6
0
    public void AddBubbleDialogue(Transform actorRoot, float height, long uuid)
    {
        if (!SystemConfig.IsBillboardOn)
        {
            return;
        }
        this.RemoveBubbleDialogue(uuid, actorRoot);
        BubbleDialogueUnit bubbleDialogueUnit = this.Create2BubbleDialogue(actorRoot, height, uuid);

        bubbleDialogueUnit.SetUUID(uuid);
        bubbleDialogueUnit.SetTargetPositionNode(BillboardManager.AddHeadInfoPosition(actorRoot, height));
    }
Пример #7
0
 public void RemoveBubbleDialogue(long uuid, Transform actorRoot)
 {
     for (int i = 0; i < this.BubbleDialogues.get_Count(); i++)
     {
         BubbleDialogueUnit bubbleDialogueUnit = this.BubbleDialogues.get_Item(i);
         if (bubbleDialogueUnit.uuid == uuid && bubbleDialogueUnit.get_transform() == actorRoot)
         {
             if (bubbleDialogueUnit != null && bubbleDialogueUnit.GetBillboardTransform() != null)
             {
                 BubbleDialogueManager.BubbleDialoguePool.ReUse(bubbleDialogueUnit.GetBillboardTransform().get_gameObject());
                 bubbleDialogueUnit.ResetAll();
             }
             this.BubbleDialogues.RemoveAt(i);
             return;
         }
     }
 }
Пример #8
0
    public void SetContentsByShopNpc(long uuid, int shopId, int dialogueTimes = 9999999)
    {
        if (uuid > 0L && BillboardManager.Instance.IsBillboardInfoOff(uuid, BillboardManager.BillboardInfoOffOption.BubbleDialogue))
        {
            return;
        }
        BubbleDialogueUnit gridUI = this.GetBubbleDialogueUnit(uuid);

        if (gridUI != null)
        {
            int              nextUpdateTime     = 0;
            string           str                = GameDataUtils.GetChineseContent(505602, false);
            bool             flag               = false;
            List <NpcShopSt> transactionNpcData = TransactionNPCManager.Instance.TransactionNpcData;
            if (transactionNpcData != null)
            {
                for (int i = 0; i < transactionNpcData.get_Count(); i++)
                {
                    if (transactionNpcData.get_Item(i).shopId == shopId)
                    {
                        nextUpdateTime = transactionNpcData.get_Item(i).nextUpdateTime;
                        flag           = transactionNpcData.get_Item(i).sellOut;
                        break;
                    }
                }
            }
            if (flag)
            {
                TimerHeap.AddTimer(0u, 1000, delegate
                {
                    if (gridUI != null)
                    {
                        int num = nextUpdateTime - TimeManager.Instance.PreciseServerSecond;
                        if (num > 0)
                        {
                            string text = string.Empty;
                            text        = TimeConverter.GetTime(num, TimeFormat.HHMMSS);
                            gridUI.SetContent(string.Format(str, text));
                        }
                        else
                        {
                            List <NPCShangChengBiao> dataList2 = DataReader <NPCShangChengBiao> .DataList;
                            for (int k = 0; k < dataList2.get_Count(); k++)
                            {
                                if (dataList2.get_Item(k).shopId == shopId)
                                {
                                    string chineseContent2 = GameDataUtils.GetChineseContent(dataList2.get_Item(k).shopBewrite, false);
                                    gridUI.SetContent(chineseContent2);
                                    break;
                                }
                            }
                        }
                    }
                });
            }
            else
            {
                List <NPCShangChengBiao> dataList = DataReader <NPCShangChengBiao> .DataList;
                for (int j = 0; j < dataList.get_Count(); j++)
                {
                    if (dataList.get_Item(j).shopId == shopId)
                    {
                        string chineseContent = GameDataUtils.GetChineseContent(dataList.get_Item(j).shopBewrite, false);
                        gridUI.SetContent(chineseContent);
                        break;
                    }
                }
            }
            uint start = (uint)Mathf.Max(3000, dialogueTimes * 1000);
            TimerHeap.AddTimer(start, 0, delegate
            {
                if (gridUI != null)
                {
                    Transform transform = gridUI.get_transform();
                    this.RemoveBubbleDialogue(uuid, transform);
                }
            });
        }
    }