Example #1
0
        public void Update()
        {
            if (m_isShowLabel)
            {
                // 计算鼠标与点赞按钮的角度
                Vector2 vec    = InputManager.MousePosition - m_startPos;
                float   rot    = (float)Math.Atan2(vec.y, vec.x);
                float   angles = rot * Mathf.Rad2Deg;
                if (angles < 0)
                {
                    angles += 360;
                }

                int newLabel = (int)(angles / m_LabelAngler);

                if (newLabel != m_curLabel)
                {
                    Vector3 newAngles = new Vector3(0f, 0f, (int)newLabel * m_LabelAngler + m_highlightImageOffset);
                    m_curLabel = newLabel;
                    highlightImage.rectTransform.eulerAngles = newAngles;

                    ClickEffect.eulerAngles = newAngles;

                    // 播放划过音效
                    SSchemeUSoundData soundData = new SSchemeUSoundData();
                    if (UISoundConfig.Instance.GetData("support", "Support_slide", ref soundData))
                    {
                        SoundManager.CreateUISound(soundData.USoundID);
                    }
                }
            }
        }
Example #2
0
        public void onClick()
        {
            if (m_Pdbid <= 0 || !m_isShowLabel || m_curLabelList == null)
            {
                return;
            }

            // 显示点击特效
            ClickEffect.gameObject.SetActive(true);

            // 播放点击音效
            SSchemeUSoundData soundData = new SSchemeUSoundData();

            if (UISoundConfig.Instance.GetData("support", "Support_click", ref soundData))
            {
                SoundManager.CreateUISound(soundData.USoundID);
            }

            // 延迟隐藏点赞按钮,等点击特效播放
            StartCoroutine(delayHideAllVoteBtn());

            int nCurLabelID = m_curLabelList[m_curLabel];

            cmd_war_add_label msgInfo = new cmd_war_add_label();

            msgInfo.targetPdbid = m_Pdbid;
            msgInfo.nLabelID    = nCurLabelID;


            EntityEventHelper.Instance.SendCommand <cmd_war_add_label>(EntityFactory.MainHeroID, EntityLogicDef.ENTITY_CMD_WAR_ADD_LABEL, ref msgInfo);
        }
Example #3
0
        // 播放失败音效
        private void playFailedSound()
        {
            SSchemeUSoundData soundData = new SSchemeUSoundData();

            if (UISoundConfig.Instance.GetData("warzone", "warzonedefeat", ref soundData))
            {
                SoundManager.CreateUISound(soundData.USoundID);
            }
        }
Example #4
0
        public int GetSoundID()
        {
            int resultID = -1;

            if (!string.IsNullOrEmpty(SoundName))
            {
                SSchemeUSoundData data = UISoundConfig.Instance.GetData(SoundName);
                if (data != null)
                {
                    resultID = data.USoundID;
                }
            }
            return(resultID);
        }
Example #5
0
        // 勋章动画结束后播放音效,所有勋章只播放一次
        private void playMedalSound()
        {
            SSchemeUSoundData soundData = new SSchemeUSoundData();

            if (UISoundConfig.Instance.GetData("statistics", "Button_statisticsmedal", ref soundData))
            {
                SoundManager.CreateUISound(soundData.USoundID);
            }

            SSchemeUSoundData soundData2 = new SSchemeUSoundData();

            if (UISoundConfig.Instance.GetData("statistics", "Button_statisticsscore", ref soundData2))
            {
                SoundManager.CreateUISound(soundData2.USoundID);
            }
        }
Example #6
0
        private void DoSound(int nVotePoint)
        {
            string strSoundKey = "";

            if (nVotePoint == 5)
            {
                strSoundKey = "FivePoint";
            }
            else if (nVotePoint == 10)
            {
                strSoundKey = "TenPoint";
            }

            if (strSoundKey.Length > 0)
            {
                SSchemeUSoundData soundData = new SSchemeUSoundData();
                if (UISoundConfig.Instance.GetData("support", strSoundKey, ref soundData))
                {
                    SoundManager.CreateUISound(soundData.USoundID);
                }
            }
        }
Example #7
0
        // 完成链接
        public void OnClickFinishRT(string eventName)
        {
            if (eventName == "Finish")
            {
                float fNow = Time.unscaledTime;
                if (fNow - m_fFinishCoolTime < 3.0f)
                {
                    return;
                }
                m_fFinishCoolTime = fNow;

                gamelogic_finish_task finishTask = new gamelogic_finish_task();
                finishTask.nTaskID = m_unfoldTask.nTaskID;
                ViewEventHelper.Instance.SendCommand <gamelogic_finish_task>(GameLogicDef.GVIEWCMD_FINISH_TASK, ref finishTask);

                SSchemeUSoundData soundData = new SSchemeUSoundData();
                if (UISoundConfig.Instance.GetData("task", "Button_taskGetreward_click", ref soundData))
                {
                    SoundManager.CreateUISound(soundData.USoundID);
                }
            }
        }
Example #8
0
        // 删除链接
        public void OnClickDeleteRT(string eventName)
        {
            if (eventName == "Delete")
            {
                float fNow = Time.unscaledTime;
                if (fNow - m_fDeleteCoolTime < 3.0f)
                {
                    return;
                }
                m_fDeleteCoolTime = fNow;

                gamelogic_delete_task_list deleteTaskList = new gamelogic_delete_task_list();
                deleteTaskList.nTaskID = m_unfoldTask.nTaskID;
                ViewEventHelper.Instance.SendCommand <gamelogic_delete_task_list>(GameLogicDef.GVIEWCMD_DELETE_TASK_LIST, ref deleteTaskList);

                SSchemeUSoundData soundData = new SSchemeUSoundData();
                if (UISoundConfig.Instance.GetData("task", "Button_taskDelete_click", ref soundData))
                {
                    SoundManager.CreateUISound(soundData.USoundID);
                }
            }
        }
Example #9
0
        private void DrawSoundHandlerInfo(EventTriggerType _eTriggerType, SerializedProperty _handler)
        {
            if (_handler == null)
            {
                return;
            }

            UISoundConfig.Instance.Load_Editor();

            //取音效ID拆分作用域和关键字
            List <string> USoundIDList = UISoundConfig.Instance.GetSoundNameList();

            if (USoundIDList == null)
            {
                EditorGUILayout.LabelField("获取UI音效ID列表失败。");
                return;
            }

            {
                //取筛选器
                List <string> filters = new List <string>();


                UISoundConfig.Instance.GetSoundFilterList(ref filters);

                if (filters.Count == 0)
                {
                    return;
                }

                SSchemeUSoundData ssUoundData = UISoundConfig.Instance.GetData(_handler.FindPropertyRelative("m_strSoundName").stringValue);

                string curFilter = ssUoundData == null ? string.Empty:ssUoundData.USoundFilter;
                string curKey    = ssUoundData == null ? string.Empty:ssUoundData.USoundKey;

                int filterIndex       = filters.IndexOf(curFilter);
                int selectFilterIndex = EditorGUILayout.Popup("Filter:", filterIndex, filters.ToArray());

                if (filterIndex == -1)
                {
                    curFilter = filters[0];
                }
                if (selectFilterIndex != filterIndex)
                {
                    curFilter = filters[selectFilterIndex];
                    EditorUtility.SetDirty(target);
                }
                //取关键字
                List <string> keys = new List <string>();
                UISoundConfig.Instance.GetSoundFilterKeyList(curFilter, ref keys);

                if (keys.Count == 0)
                {
                    return;
                }

                int keyIndex       = keys.IndexOf(curKey);
                int selectKeyIndex = EditorGUILayout.Popup("Key:", keyIndex, keys.ToArray());
                if (keyIndex == -1)
                {
                    curKey = keys[0];
                }
                if (selectKeyIndex != keyIndex)
                {
                    curKey = keys[selectKeyIndex];
                    EditorUtility.SetDirty(target);
                }

                string tmpSoundName = string.Empty;
                UISoundConfig.Instance.GetSoundName(curFilter, curKey, ref tmpSoundName);
                _handler.FindPropertyRelative("m_strSoundName").stringValue = tmpSoundName;

                if (!string.IsNullOrEmpty(tmpSoundName))
                {
                    SSchemeUSoundData data = UISoundConfig.Instance.GetData(tmpSoundName);
                    if (data != null)
                    {
                        EditorGUILayout.LabelField("SoundID:", data.USoundID.ToString());
                    }
                }
            }

            ////下面只是另一种方法而已,不容易理解
            return;

            /////////////////////////////////////////////////////////////

            //string[] FilterList = new string[USoundIDList.Count];
            //string[] KeyList = new string[USoundIDList.Count];
            //string[] IDSplit;

            //for (int i=0;i< USoundIDList.Count;++i)
            //{
            //    IDSplit = USoundIDList[i].Split(new char[] { '_'},2);

            //    FilterList[i] = IDSplit[0];
            //    KeyList[i] = IDSplit[1];
            //}


            //int USoundFilter = 0;
            //int NewUSoundFilter = 0;
            //int USoundKey = 0;


            //if (_handler.SoundName != null)
            //{
            //    IDSplit = _handler.SoundName.Split(new char[] { '_' }, 2);
            //    if(IDSplit.Length == 2)
            //    {
            //        USoundFilter = Array.IndexOf(FilterList, IDSplit[0]);
            //        USoundKey = Array.IndexOf(KeyList, IDSplit[1]);
            //    }
            //}

            //NewUSoundFilter = EditorGUILayout.Popup("Filter:", USoundFilter, FilterList);


            //List<string> SoundKeyList = new List<string>();
            //USoundIDList.ForEach((v, i) =>
            //{
            //    if(v.IndexOf(FilterList[NewUSoundFilter]) == 0)
            //    {
            //        SoundKeyList.Add(KeyList[i]);
            //    }
            //});


            //USoundKey = USoundFilter != NewUSoundFilter ? 0:SoundKeyList.IndexOf(KeyList[USoundKey]);
            //USoundKey = EditorGUILayout.Popup("Key:", USoundKey, SoundKeyList.ToArray());

            //_handler.SoundName = FilterList[NewUSoundFilter] +'_'+ SoundKeyList[USoundKey];


            //EditorGUILayout.LabelField("SoundID:", _handler.GetSoundID().ToString());
        }