public void onClickSlot(GameObject go)
        {
            if (m_RuneComposeState != RuneComposeState.stepNone)
            {
                return;
            }

            SlotInfo sSlotInfo = null;

            slot2RuneGoDict.TryGetValue(go.transform.name, out sSlotInfo);
            if (sSlotInfo != null)
            {
                sSlotInfo.sprite.spriteName = "";

                var num         = updateRuneOnTempSlotDic(sSlotInfo.runeID, -1);
                var oneRuneInfo = MarketRuneListModel.Instance.GetOneRuneInfo(sSlotInfo.runeID);
                var leftNum     = oneRuneInfo.num - num;
                var cfg         = ConfigReader.GetRuneFromID(sSlotInfo.runeID);
                if (IfCanShow(cfg.level))
                {
                    LoadOneRune(sSlotInfo.runeID, leftNum);
                    mGrid.Reposition();

                    mScroll.ResetPosition();
                }

                slot2RuneGoDict.Remove(go.name);

                go.SetActive(false);

                AudioManager.Instance.PlatUnloadRuneAudio();
            }
        }
Esempio n. 2
0
        private void ClearFreshSlot()
        {
            if (m_RefreshCardSlotInfo == null)
            {
                return;
            }
            m_RefreshCardSlotInfo.sprite.spriteName = "";
            var oriInfo = GoodsModel.Instance.GetRuneBaptze((int)m_RefreshCardSlotInfo.runeID);

            if (oriInfo.mNum == 1)
            {
                LoadOneRefreshCard(m_RefreshCardSlotInfo.runeID, oriInfo.mNum);
                m_RefreshGrid.Reposition();
            }
            else
            {
                var freshCardInfo = refreshCardListID2GoDict[m_RefreshCardSlotInfo.runeID];

                var numLabel = freshCardInfo.go.transform.FindChild("NumLabel").GetComponent <UILabel>();
                numLabel.text = oriInfo.mNum.ToString();
                freshCardInfo.go.SetActive(true);
            }

            m_RefreshCardSlotInfo.sprite.gameObject.SetActive(false);
            m_RefreshCardSlotInfo = null;
        }
Esempio n. 3
0
        public void onClickSlot(GameObject go)
        {
            if (m_RuneSlotInfo == null)
            {
                return;
            }
            m_RuneSlotInfo.sprite.spriteName = "";
            AudioManager.Instance.PlatUnloadRuneAudio();

            var oneRuneInfo = MarketRuneListModel.Instance.GetOneRuneInfo(m_RuneSlotInfo.runeID);

            LoadOneRune(m_RuneSlotInfo.runeID, oneRuneInfo.num);
            if (oneRuneInfo.num == 1)
            {
                m_BagGrid.Reposition();
                m_BagScroll.ResetPosition();
            }

            m_RuneSlotInfo.sprite.gameObject.SetActive(false);

            ClearFreshSlot();

            m_RuneSlotInfo      = null;
            m_WashBtn.isEnabled = false;
        }
Esempio n. 4
0
 //窗口控件释放
 protected override void RealseWidget()
 {
     m_Curlevel            = 0;
     m_RuneSlotInfo        = null;
     m_RefreshCardSlotInfo = null;
     if (m_EffectGO != null)
     {
         MonoBehaviour.DestroyImmediate(m_EffectGO);
         m_EffectGO = null;
     }
     refreshCardListID2GoDict.Clear();
     nowAllRuneGO.Clear();
     m_SuccessTime = -1;
 }
Esempio n. 5
0
        public void RefeshCardInfo(uint cardid, int num, long lefttime)
        {
            if (cardid < RuneWashCfgBegin || cardid > RuneWashCfgEnd)
            {
                return;
            }
            m_RefreshCardSlotInfo.sprite.spriteName = "";
            AudioManager.Instance.PlatUnloadRuneAudio();

            if (m_RefreshCardSlotInfo != null && m_RefreshCardSlotInfo.runeID == cardid && num == 0)
            {
                refreshCardListID2GoDict.Remove(cardid);
            }
            else
            {
                var info = refreshCardListID2GoDict[cardid];
                info.go.transform.FindChild("NumLabel").GetComponent <UILabel>().text = num.ToString();
            }

            m_RefreshCardSlotInfo = null;
        }
Esempio n. 6
0
        public void RefeshRuneBagInfo(uint runeId, int num, long gottime)
        {
            if (m_RuneSlotInfo != null)
            {
                m_RuneSlotInfo.sprite.spriteName = "";
                AudioManager.Instance.PlatUnloadRuneAudio();
                m_RuneSlotInfo      = null;
                m_WashBtn.isEnabled = false;
            }

            if (num > 0)
            {
                RuneConfigInfo sRuneConfigInfo = ConfigReader.GetRuneFromID(runeId);
                if (m_EffectGO != null)
                {
                    MonoBehaviour.DestroyImmediate(m_EffectGO);
                }
                m_EffectGO      = LoadUiResource.AddChildObject(m_BackGroundGO.transform, GameConstDefine.RuneFreshFlash);
                m_EffectGO.name = effectName;

                m_NewID       = runeId;
                m_SuccessTime = Time.time;
            }
        }
        //窗口控件初始化
        protected override void InitWidget()
        {
            var userLevel     = GameUserModel.Instance.UserLevel;
            var unlockSlotNum = userLevel / 3;

            m_CloseBtn = mRoot.Find("CloseBtn").GetComponent <UIButton>();
            EventDelegate.Add(m_CloseBtn.onClick, OnCloseInterface);

            mPopupListBtn = mRoot.Find("RuneSelect/PopupList").GetComponent <UIButton>();
            EventDelegate.Add(mPopupListBtn.onClick, OnShowLevel);

            m_RuneLevelGo = mRoot.Find("RuneSelect/RuneLevel").gameObject;

            m_PopList_Label = mRoot.Find("RuneSelect/PopupList/Label").GetComponent <UILabel>();

            mScroll = mRoot.Find("Package").GetComponent <UIScrollView>();
            mGrid   = mRoot.Find("Package/Grid").GetComponent <UIGrid>();

            m_StatusLabel      = mRoot.Find("InfoWindow/Staus").GetComponent <UILabel>();
            m_StatusLabel.text = "";

            m_LevelLabelArray = new GameObject[GameDefine.GameConstDefine.MaxRuneLevel];
            string resFile = "RuneSelect/RuneLevel/Level";

            for (int i = 0; i < m_LevelLabelArray.GetLength(0); ++i)
            {
                string indexStr = Convert.ToString(i);
                string filename = resFile + indexStr;

                GameObject levelGo = mRoot.Find(filename).gameObject;
                levelGo.name = indexStr;
                UIEventListener.Get(levelGo).onClick += onClickLevel;
                m_LevelLabelArray[i] = levelGo;
            }

            m_Page1Btn = mRoot.Find("PagesList/Grid/RunePages").GetComponent <UIButton>();
            EventDelegate.Add(m_Page1Btn.onClick, onClickPage);

            m_AddPageBtn = mRoot.Find("PagesList/AddButton").GetComponent <UIButton>();
            EventDelegate.Add(m_AddPageBtn.onClick, onAddPageClick);

            string slotFilePre = "EquipBlank/Slot";

            for (int i = 0; i < GameDefine.GameConstDefine.MaxRuneSlot; ++i)
            {
                string indexName        = Convert.ToString(i + 1);
                string slotColliderFile = slotFilePre + indexName;

                GameObject slotGo = mRoot.Find(slotColliderFile).gameObject;
                UIEventListener.Get(slotGo).onClick += onClickSlot;

                string curFileStr = slotColliderFile + "/Icon";
                m_Slot_Sprite_Array[i]        = new SlotInfo();
                m_Slot_Sprite_Array[i].sprite = new UISprite();
                m_Slot_Sprite_Array[i].runeid = new uint();
                var tempSprite = mRoot.Find(curFileStr).GetComponent <UISprite>();
                m_Slot_Sprite_Array[i].sprite            = tempSprite;
                m_Slot_Sprite_Array[i].sprite.name       = indexName;
                m_Slot_Sprite_Array[i].sprite.spriteName = "";
                m_Slot_Sprite_Array[i].lockGO            = mRoot.Find(slotColliderFile + "/Lock").gameObject;

                if (i < unlockSlotNum)
                {
                    m_Slot_Sprite_Array[i].lockGO.SetActive(false);
                    m_Slot_Sprite_Array[i].ifCanEquip = true;
                }

                slotGo.name = Convert.ToString(i);
            }

            m_CombineBtn = mRoot.Find("CombineBtn").GetComponent <UIButton>();
            EventDelegate.Add(m_CombineBtn.onClick, onClickCombine);

            m_WashBtn = mRoot.Find("WashBtn").GetComponent <UIButton>();
            EventDelegate.Add(m_WashBtn.onClick, onClickWash);

            m_CurPageNum = 0;

            ifFirstLoad = true;
            LoadRunes();

            LoadEquip();
        }
        //点击左侧背包,准备合成
        public void onClickRuneCard(GameObject go)
        {
            if (m_RuneComposeState != RuneComposeState.stepNone)
            {
                return;
            }

            uint runeID      = Convert.ToUInt32(go.name);
            var  oneRuneInfo = MarketRuneListModel.Instance.GetOneRuneInfo(runeID);
            var  cfg         = ConfigReader.GetRuneFromID(runeID);

            for (int i = 0; i < GameDefine.GameConstDefine.MaxCombineSlotNum - 1; ++i)
            {
                if (!slot2RuneGoDict.ContainsKey(m_Slot_SpriteArray[i].gameObject.name))
                {
                    m_Slot_SpriteArray[i].gameObject.SetActive(true);
                    m_Slot_SpriteArray[i].spriteName = cfg.Icon;

                    SlotInfo SInfo = new SlotInfo();
                    SInfo.sprite = m_Slot_SpriteArray[i];
                    SInfo.runeID = runeID;

                    slot2RuneGoDict[m_Slot_SpriteArray[i].name] = SInfo;

                    var num     = updateRuneOnTempSlotDic(runeID, 1);
                    var leftNum = oneRuneInfo.num - num;

                    UILabel levelLabel = go.transform.Find("NumLabel").GetComponent <UILabel>();
                    levelLabel.text = Convert.ToString(leftNum);

                    if (leftNum == 0)
                    {
                        go.transform.parent = null;
                        mGrid.RemoveChild(go.transform);

                        mGrid.Reposition();
                        nowAllRuneGO.Remove(runeID);
                        MonoBehaviour.DestroyImmediate(go);
                    }

                    break;
                }
            }

            if (slot2RuneGoDict.Count == 3)
            {
                int[] level = { 0, 0, 0 };
                int   index = 0;
                foreach (var kv in slot2RuneGoDict)
                {
                    var tempCfg = ConfigReader.GetRuneFromID(kv.Value.runeID);
                    level[index] = tempCfg.level;
                    ++index;
                }

                bool bIfSameID = runeOnTempSlotDic.Count == 1;
                if (!bIfSameID)
                {
                    bool ifSameLevel = (level[0] == level[1]) && (level[0] == level[2]);
                    if (!ifSameLevel)
                    {
                        return;
                    }
                }

                if (level[0] > 5)
                {
                    return;
                }

                m_tryToCombineRuneLevel = level[0];
                IsCanCombine(true);
            }
        }
Esempio n. 9
0
        public void onClickRuneCard(GameObject go)
        {
            if (m_SuccessTime > 0)
            {
                return;
            }
            uint           runeID          = Convert.ToUInt32(go.name);
            RuneConfigInfo sRuneConfigInfo = ConfigReader.GetRuneFromID(runeID);
            var            oneRuneInfo     = MarketRuneListModel.Instance.GetOneRuneInfo(runeID);

            if (null == m_RuneSlotInfo)
            {
                m_Slot_SpriteArray[GameDefine.GameConstDefine.RefreshRuneSlotIndex].gameObject.SetActive(true);
                m_Slot_SpriteArray[GameDefine.GameConstDefine.RefreshRuneSlotIndex].spriteName = sRuneConfigInfo.Icon;

                m_RuneSlotInfo = new SlotInfo();

                int num = oneRuneInfo.num - 1;
                if (num == 0)
                {
                    go.transform.parent = null;
                    m_BagGrid.RemoveChild(go.transform);
                    MonoBehaviour.DestroyImmediate(go);
                    nowAllRuneGO.Remove(runeID);
                }
                else
                {
                    UILabel levelLabel = go.transform.FindChild("NumLabel").GetComponent <UILabel>();

                    levelLabel.text = Convert.ToString(num);
                }

                m_WashBtn.isEnabled = true;
            }
            else
            {
                //如果替换不一致的符文,则把原来的换回去,新的减少1
                var runeOnSlotID = m_RuneSlotInfo.runeID;
                if (runeOnSlotID != runeID)
                {
                    RuneConfigInfo runeCfg = ConfigReader.GetRuneFromID(runeOnSlotID);
                    if (runeCfg.level == m_Curlevel || m_Curlevel == 0)
                    {
                        var slotRuneInfo = MarketRuneListModel.Instance.GetOneRuneInfo(runeOnSlotID);
                        LoadOneRune(runeOnSlotID, slotRuneInfo.num);
                        if (slotRuneInfo.num == 1)
                        {
                            m_BagGrid.Reposition();
                        }
                    }

                    int num = oneRuneInfo.num - 1;
                    if (num == 0)
                    {
                        go.transform.parent = null;
                        m_BagGrid.RemoveChild(go.transform);
                        MonoBehaviour.DestroyImmediate(go);
                        nowAllRuneGO.Remove(runeID);
                    }
                    else
                    {
                        UILabel levelLabel = go.transform.FindChild("NumLabel").GetComponent <UILabel>();

                        levelLabel.text = Convert.ToString(num);
                    }
                }
            }

            m_Slot_SpriteArray[GameDefine.GameConstDefine.RefreshRuneSlotIndex].spriteName = sRuneConfigInfo.Icon;
            m_RuneSlotInfo.runeInfo = go;
            m_RuneSlotInfo.sprite   = m_Slot_SpriteArray[GameDefine.GameConstDefine.RefreshRuneSlotIndex];
            m_RuneSlotInfo.runeID   = runeID;

            ClearFreshSlot();

            m_BagGrid.Reposition();

            m_BagScroll.ResetPosition();
        }
Esempio n. 10
0
        private void onClickRefreshCard(GameObject go)
        {
            if (m_SuccessTime > 0)
            {
                return;
            }

            if (m_RuneSlotInfo == null)
            {
                MsgInfoManager.Instance.ShowMsg(10037);
                return;
            }

            RuneConfigInfo sRuneConfigInfo = ConfigReader.GetRuneFromID(m_RuneSlotInfo.runeID);

            var nowLevel = sRuneConfigInfo.level;

            var refreshID = Convert.ToUInt32(go.name);
            var sInfo     = refreshCardListID2GoDict[refreshID];

            if (sInfo.cfg.effectvalue < nowLevel)
            {
                MsgInfoManager.Instance.ShowMsg(10038);
                return;
            }

            var nowInfo = GoodsModel.Instance.GetRuneBaptze((int)refreshID);
            int num     = nowInfo.mNum - 1;

            if (num == 0)
            {
                go.transform.parent = null;
                m_RefreshGrid.RemoveChild(go.transform);
                MonoBehaviour.DestroyImmediate(go);
                m_RefreshGrid.Reposition();
                m_RefreshScroll.ResetPosition();
                refreshCardListID2GoDict.Remove(refreshID);
            }
            else
            {
                var numLabel = go.transform.FindChild("NumLabel").GetComponent <UILabel>();
                numLabel.text = num.ToString();
            }

            if (m_RefreshCardSlotInfo == null)
            {
                m_RefreshCardSlotInfo = new SlotInfo();
            }
            else
            {
                //原来有洗练券,现在还原
                var oriInfo       = GoodsModel.Instance.GetRuneBaptze((int)m_RefreshCardSlotInfo.runeID);
                var freshCardInfo = refreshCardListID2GoDict[m_RefreshCardSlotInfo.runeID];
                if (refreshID != m_RefreshCardSlotInfo.runeID)
                {
                    if (oriInfo.mNum == 1)
                    {
                        //记载洗练券
                        LoadOneRefreshCard(m_RefreshCardSlotInfo.runeID, oriInfo.mNum);
                        m_RefreshGrid.Reposition();
                        m_RefreshScroll.ResetPosition();
                    }
                    else
                    {
                        var numLabel = freshCardInfo.go.transform.FindChild("NumLabel").GetComponent <UILabel>();
                        numLabel.text = oriInfo.mNum.ToString();
                    }
                }
            }

            m_Slot_SpriteArray[GameDefine.GameConstDefine.RefreshRuneCardIndex].gameObject.SetActive(true);
            m_Slot_SpriteArray[GameDefine.GameConstDefine.RefreshRuneCardIndex].spriteName = sInfo.cfg.icon;
            m_RefreshCardSlotInfo.runeInfo = go;
            m_RefreshCardSlotInfo.sprite   = m_Slot_SpriteArray[GameDefine.GameConstDefine.RefreshRuneCardIndex];
            m_RefreshCardSlotInfo.runeID   = refreshID;
        }