/// <summary> /// 解锁仓库 /// </summary> /// <param name="unlockWareHouse"></param> private void OnUnlockWareHosue(GameCmd.PACKAGETYPE unlockWareHouse) { if (IsKnapsackStatus(KnapsackStatus.WareHouse) || IsKnapsackStatus(KnapsackStatus.WareHouseNPC)) { } }
private void UpdateLockInfo(GameCmd.PACKAGETYPE ptype , table.UnlockStoreDataBase unlockdb , GameCmd.UnlockInfo serverUnlockInfo) { this.m_unlockDatabase = unlockdb; m_pType = ptype; m_ServerUnlockInfo = serverUnlockInfo; }
/// <summary> /// 合并本地位置信息为服务端位置 /// </summary> /// <returns></returns> public static uint TransformLocal2ServerLocation(GameCmd.PACKAGETYPE pType, Vector2 localPos) { uint serverLocation = ( (uint)pType << 20) //PType | (uint)localPos.y << 10 //Y Pos | (uint)localPos.x; //X pos return(serverLocation); }
/// <summary> /// 获取背包标识 /// </summary> /// <param name="pType"></param> /// <returns></returns> public static byte[] GetPackageMask(GameCmd.PACKAGETYPE pType) { int intValue = (int)pType; int size = intValue / 8 + (((intValue % 8) > 0) ? 1 : 0); if (size == 0) { size = 1; } byte[] maskByteArray = new byte[size]; maskByteArray[intValue / 8] |= (byte)(0xff & (1 << (intValue % 8))); return(maskByteArray); }
/// <summary> /// 创建本地仓库解锁信息 /// </summary> /// <param name="pType"></param> /// <param name="serverUnlockInfo"></param> /// <returns></returns> public static LocalUnlockInfo Create(GameCmd.PACKAGETYPE pType, GameCmd.UnlockInfo serverUnlockInfo) { table.UnlockStoreDataBase unlockDatabase = GameTableManager.Instance.GetTableItem <table.UnlockStoreDataBase>((uint)pType, 0); if (null == unlockDatabase) { Engine.Utility.Log.Error("Get Package unlock info failed ,pt={0}", pType); return(null); } LocalUnlockInfo info = new LocalUnlockInfo(); info.UpdateLockInfo(pType, unlockDatabase, serverUnlockInfo); return(info); }
/// <summary> /// 初始化仓库 /// </summary> private void InitWareHouse() { if (IsInitMode(KnapsackStatus.WareHouse)) { return; } SetInitMode(KnapsackStatus.WareHouse); Transform ts = null; UITabGrid tab = null; m_dic_wareHouseTabs = new Dictionary <GameCmd.PACKAGETYPE, UITabGrid>(); if (null != m_trans_WareHouseContent) { for (GameCmd.PACKAGETYPE i = GameCmd.PACKAGETYPE.PACKAGETYPE_STORE1; i <= GameCmd.PACKAGETYPE.PACKAGETYPE_STORE3; i++) { ts = m_trans_WareHouseContent.Find(GetWareHouseTabNameByStore(i)); if (null == ts) { continue; } tab = ts.GetComponent <UITabGrid>(); if (null == tab) { tab = ts.gameObject.AddComponent <UITabGrid>(); } if (null != tab) { tab.SetGridData(i); tab.RegisterUIEventDelegate(OnWareHouseGridUIEvent); tab.SetHightLight(false); m_dic_wareHouseTabs.Add(i, tab); } } } wareHouseItems = new List <uint>(); if (null != m_ctor_WareHouseItemGridScrollView && null != m_trans_UIItemGrid) { GameObject wareHosueGridClone = UIManager.GetResGameObj(GridID.Uiitemgrid) as GameObject; m_ctor_WareHouseItemGridScrollView.RefreshCheck(); //m_ctor_WareHouseItemGridScrollView.Initialize<UIItemGrid>((uint)GridID.Uiitemgrid // , UIManager.OnObjsCreate, UIManager.OnObjsRelease // , OnWareHouseGridDataUpdate, OnWareHouseGridUIEvent); m_ctor_WareHouseItemGridScrollView.Initialize <UIItemGrid>(m_trans_UIItemGrid.gameObject , OnWareHouseGridDataUpdate, OnWareHouseGridUIEvent); } }
/// <summary> /// 是否背包标识包含当前背包 /// </summary> /// <param name="pMask"></param> /// <param name="pType"></param> /// <returns></returns> public static bool IsPackageMaskContainType(byte[] pMask, GameCmd.PACKAGETYPE pType) { if (null == pMask && pMask.Length > 0) { return(false); } int intValue = (int)pType; int size = intValue / 8 + (((intValue % 8) > 0) ? 1 : 0); if (size == 0) { size = 1; } if (pMask.Length >= size) { return(0 != (pMask[intValue / 8] & (0xff & (1 << intValue % 8)))); } return(false); }
/// <summary> /// 获取仓库tabname /// </summary> /// <param name="pType"></param> /// <returns></returns> private string GetWareHouseTabNameByStore(GameCmd.PACKAGETYPE pType) { string tabName = "unknow"; switch (pType) { case GameCmd.PACKAGETYPE.PACKAGETYPE_STORE1: tabName = "WareHousebookmarktoggle/WareHouseToggle1"; break; case GameCmd.PACKAGETYPE.PACKAGETYPE_STORE2: tabName = "WareHousebookmarktoggle/WareHouseToggle2"; break; case GameCmd.PACKAGETYPE.PACKAGETYPE_STORE3: tabName = "WareHousebookmarktoggle/WareHouseToggle3"; break; } return(tabName); }
public void SetWareHousePackage(GameCmd.PACKAGETYPE ptype, bool force = false) { if (!m_kmgr.IsWareHosue(ptype) || (m_em_activeWareHouse == ptype && !force)) { return; } if (null != m_dic_wareHouseTabs) { UITabGrid tab = null; if (m_dic_wareHouseTabs.TryGetValue(m_em_activeWareHouse, out tab)) { tab.SetHightLight(false); } if (m_dic_wareHouseTabs.TryGetValue(ptype, out tab)) { tab.SetHightLight(true); } } m_em_activeWareHouse = ptype; CreateWareHouse(); UpdateWareHouseCapcity(); UpdateWareHouseStoreCopperNum(m_kmgr.WareHouseStoreCopperNum); }
private void UpdateLocation() { m_packType = (GameCmd.PACKAGETYPE)((null != location) ? location.PackType : GameCmd.PACKAGETYPE.PACKAGETYPE_NONE); }