예제 #1
0
 public void Clear()
 {
     horse            = null;
     uIMatchRankLogic = null;
     matchItemData    = null;
     battleModule     = null;
 }
예제 #2
0
        //private Color redColor = Color.red;
        //private Color whiteColor = Color.white;
        //private Color customColor = new Color(0xa7, 0xff, 0x34);//<color=#a7ff34>

        public void Init(Transform transParent, UIMatchRankLogic uiParent)//只初始化一次UI数据
        {
            uIMatchRankLogic        = uiParent;
            battleModule            = UtilsModuleManager.GetModule(ModuleType.MatchModule) as MatchModule;
            matchItemData           = new MatchItemData();
            matchItemData.transform = transParent;
            matchItemData.InitUI();

            matchItemData.button_templateMatchItem.onClick.AddListener(OnItemClick);
        }
예제 #3
0
        public bool Equals(MatchItemData obj)
        {
            for (int i = 0; i < _data.Count; i++)
            {
                if (!obj._data.Contains(_data[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #4
0
    /// <summary>
    /// 判斷有無過關
    /// </summary>
    void CheckPass()
    {
        StopAllMatchCItem();
        //移除check按鈕事件
        GameEventSystem.Instance.OnPushCheckBtn -= CheckPass;
        //背景音漸弱
        GamePublicAudioControl.Instance.DownSceneMusic();

        List <MatchPosItemControl_PermutationsSum> m_MatchPosItemControl = new List <MatchPosItemControl_PermutationsSum>();

        foreach (var matchPosItemObj in MatchPosItemObj)
        {
            m_MatchPosItemControl.Add(matchPosItemObj.GetComponent <MatchPosItemControl_PermutationsSum>());
        }



        ///幹這沙小企劃文件啦 一直修改 直接變一個新的模組的企劃了耖
        ///後續的人你慢慢改ㄅ 我自己都看不懂了 +U

        Dictionary <int, List <string> > allDic = new Dictionary <int, List <string> >();


        List <MatchItemData> allMatchItem = new List <MatchItemData>();



        for (int i = 0; i < m_MatchPosItemControl.Count; i++)
        {
            //判斷所有的感應區內是否都有物件
            if (m_MatchPosItemControl[i].OnCollidionrObjCount() == 0)
            {
                //換失敗場景
                GameResultManager.Instance.TriggerGameResult(GameResultManager.GameResultType.Fail);
                Debug.Log("物件數量錯誤");
                return;
            }

            Debug.Log("配對區 分數: " + m_MatchPosItemControl[i].GetPoint() + "子物件分數 : " + m_MatchPosItemControl[i].GetChildPoint());
            if (m_MatchPosItemControl[i].GetChildPoint() != m_MatchPosItemControl[i].GetPoint())
            {
                GameResultManager.Instance.TriggerGameResult(GameResultManager.GameResultType.Fail);
                Debug.Log("分數不一致");
                return;
            }


            ///////////////將目前的配對感應區的子物件全都轉成字串
            List <string> MathItemChildNames = new List <string>();
            var           childObjs          = m_MatchPosItemControl[i].OnCollisionObjName();

            for (int a = 0; a < childObjs.Count; a++)
            {
                string spriteName = childObjs[a].GetComponent <SpriteRenderer>().sprite.name;
                MathItemChildNames.Add(spriteName);
            }

            //////////////// 判斷是否與存在相同
            if (m_didnotHaveSameMatchItem)
            {
                var _matchdata = new MatchItemData(MathItemChildNames);
                if (allMatchItem.Exists(data => { return(data.Equals(_matchdata)); }))
                {
                    Debug.LogError("存在相同的配對");
                    GameResultManager.Instance.TriggerGameResult(GameResultManager.GameResultType.Fail);
                    return;
                }
                else
                {
                    allMatchItem.Add(new MatchItemData(MathItemChildNames));
                }
            }



            if (!m_couldHaveSameChildCount)
            {
                ////////////////字典是否有相同個數的子物件
                Debug.Log(m_MatchPosItemControl[i].OnCollisionObjName());
                int num = m_MatchPosItemControl[i].OnCollidionrObjCount();

                if (!allDic.ContainsKey(num))
                {
                    int index = m_MatchPosItemControl[i].OnCollidionrObjCount();
                    Debug.Log("字典內無相同子物件個數物體,新增陣列 Index : " + index);
                    allDic.Add(index, MathItemChildNames);
                    // MathItemChildCounts.Add(m_MatchPosItemControl[i].OnCollidionrObjCount());
                }
                else
                {
                    foreach (var c in allDic)
                    {
                        if (c.Key == num)
                        {
                            if (IsSameElement(allDic[num], MathItemChildNames))
                            {
                                Debug.Log("找到相同個數,且差集為0的陣列 : " + num);
                                GameResultManager.Instance.TriggerGameResult(GameResultManager.GameResultType.Fail);
                                return;
                            }
                        }
                    }
                    Debug.Log("找到相同個數陣列,但差集!=0 : " + num);
                    ///如果掃描一遍後發現都不是同樣陣列,就+進去
                    int index = m_MatchPosItemControl[i].OnCollidionrObjCount();
                    allDic.Add(index, MathItemChildNames);
                }
            }
        }



        //判斷播放正確音效
        PlaySceneSound(m_SceneSound.CorrectSound, m_SceneSound.CorrectSoundOnOff);
        //播放額外動畫
        PlayOtherAnimObjAnim();
        StartCoroutine(IE_ChangeToNextScene());
    }