Example #1
0
        void Attend(TwitchCommandData commandData)
        {
            if (!DocsaCanAttend || WaitingViewerDict.Count > WaitingViewerLimit)
            {
                return;
            }

            if (AttendingDocsaDict.ContainsKey(commandData.Author) || AttendingHunterDict.ContainsKey(commandData.Author))
            {
                return;
            }

            DocsaData data;

            if (WaitingViewerDict.TryGetValue(commandData.Author, out data))
            {
                data.ChatCount++;
                return;
            }

            // Docsa 참여와 Hunter 참여를 어떻게 구분할지
            // 1. 명령어를 나눈다
            // 2. 랜덤하게 임의로 나눈다.
            data = new DocsaData(commandData.Author);
            WaitingViewerDict.Add(data.Author, data);
            ESCUIManager.instance.AddWaitingViewer(WaitingViewerDict[data.Author]);
        }
Example #2
0
        public void RemoveWaitingViewer(DocsaData viewer)
        {
            Button buttonTemp;

            if (_listItemsRemoveActionDict.TryGetValue(viewer.Author, out buttonTemp))
            {
                buttonTemp.onClick.Invoke();
                _listItemsRemoveActionDict.Remove(viewer.Author);
            }
            else
            {
                return;
            }
        }
Example #3
0
        public void RemoveAttendingHunter(DocsaData hunter)
        {
            Button buttonTemp;

            if (_listItemsRemoveActionDict.TryGetValue(hunter.Author, out buttonTemp))
            {
                buttonTemp.onClick.Invoke();
                _listItemsRemoveActionDict.Remove(hunter.Author);
            }
            else
            {
                return;
            }
        }
Example #4
0
        public void AddWaitingViewer(DocsaData viewer)
        {
            GameObject item = Instantiate(ListItemPrefab, WaitingViewerList.transform);

            item.GetComponentInChildren <TextMeshProUGUI>().text = viewer.Author;
            UnityEngine.Events.UnityAction action = () =>
            {
                DocsaSakkiManager.instance.Kick(viewer.Author);
                _listItemsRemoveActionDict.Remove(viewer.Author);
                Destroy(item);
            };
            item.GetComponentInChildren <Button>().onClick.AddListener(action);
            _listItemsRemoveActionDict.Add(viewer.Author, item.GetComponentInChildren <Button>());
        }
Example #5
0
        public void AddAttendingDocsa(DocsaData docsa)
        {
            GameObject item = Instantiate(ListItemPrefab, AttendingDocsaList.transform);

            item.GetComponentInChildren <Text>().text = docsa.Author;
            UnityEngine.Events.UnityAction action = () =>
            {
                DocsaSakkiManager.instance.Kick(docsa.Author);
                _listItemsRemoveActionDict.Remove(docsa.Author);
                Destroy(item);
            };
            item.GetComponentInChildren <Button>().onClick.AddListener(action);
            _listItemsRemoveActionDict.Add(docsa.Author, item.GetComponentInChildren <Button>());
        }
Example #6
0
        public void Kick(string viewer)
        {
            if (AttendingDocsaDict.ContainsKey(viewer))
            {
                DocsaSakki docsa = (DocsaSakki)AttendingDocsaDict[viewer].Character;
                DocsaData  data  = AttendingDocsaDict[viewer];
                AttendingDocsaDict.Remove(viewer);

                if (DocsaCanAttend)
                {
                    docsa.ViewerName = WaitingViewerDict.GetEnumerator().Current.Value.Author;
                    AttendingDocsaDict.Add(docsa.ViewerName, data);
                }

                return;
            }

            if (AttendingHunterDict.ContainsKey(viewer))
            {
                Hunter    hunter = (Hunter)AttendingHunterDict[viewer].Character;
                DocsaData data   = AttendingDocsaDict[viewer];
                AttendingHunterDict.Remove(viewer);

                if (DocsaCanAttend)
                {
                    hunter.ViewerName = WaitingViewerDict.GetEnumerator().Current.Value.Author;
                    AttendingHunterDict.Add(hunter.ViewerName, data);
                }

                return;
            }

            if (WaitingViewerDict.ContainsKey(viewer))
            {
                DocsaData docsa = WaitingViewerDict[viewer];
                WaitingViewerDict.Remove(viewer);

                return;
            }
        }
Example #7
0
        public void MoveDocsaDataTo(DocsaData from, DocsaData.DocsaState to)
        {
            if (from == null)
            {
                return;
            }

            switch (from.State)
            {
            case DocsaData.DocsaState.Waiting:
                WaitingViewerDict.Remove(from.Author);
                break;

            case DocsaData.DocsaState.Docsa:
                AttendingDocsaDict.Remove(from.Author);
                break;

            case DocsaData.DocsaState.Hunter:
                AttendingHunterDict.Remove(from.Author);
                break;
            }

            from.State = to;

            switch (to)
            {
            case DocsaData.DocsaState.Waiting:
                WaitingViewerDict.Add(from.Author, from);
                break;

            case DocsaData.DocsaState.Docsa:
                AttendingDocsaDict.Add(from.Author, from);
                break;

            case DocsaData.DocsaState.Hunter:
                AttendingHunterDict.Add(from.Author, from);
                break;
            }
        }
Example #8
0
 public void MoveDocsaDataCardTo(DocsaData docsaData, DocsaData.DocsaState to)
 {
     MoveDocsaDataCardTo(docsaData.Author, to);
 }