/// <summary> /// Return obj to the pool /// </summary> /// <param name="go"></param> public void ReturnObjectToPool(GameObject go) { PoolObject po = go.GetComponent <PoolObject>(); if (po == null) { #if UNITY_EDITOR VKDebug.LogWarning("Specified object is not a pooled instance: " + go.name); #endif } else { Pool pool = null; if (poolDict.TryGetValue(po.poolName, out pool)) { pool.ReturnObjectToPool(po); } #if UNITY_EDITOR else { VKDebug.LogWarning("No pool available with name: " + po.poolName); } #endif } }
/// <summary> /// Returns an available object from the pool /// OR null in case the pool does not have any object available & can grow size is false. /// </summary> /// <param name="poolName"></param> /// <returns></returns> public GameObject GetObjectFromPool(string poolName, bool autoActive = true, int autoCreate = 0) { GameObject result = null; if (!poolDict.ContainsKey(poolName) && autoCreate > 0) { InitPool(poolName, autoCreate, PoolInflationType.INCREMENT); } if (poolDict.ContainsKey(poolName)) { Pool pool = poolDict[poolName]; result = pool.NextAvailableObject(autoActive); //scenario when no available object is found in pool #if UNITY_EDITOR if (result == null) { VKDebug.LogWarning("[ResourceManager]:No object available in " + poolName); } #endif } #if UNITY_EDITOR else { VKDebug.LogError("[ResourceManager]:Invalid pool name specified: " + poolName); } #endif return(result); }
public void NextTextField(VKButtonKeyboard bt) { if (bt.inputs != null && bt.inputs.Count > 0) { int max = bt.inputs.Count; int index = bt.inputs.FindIndex(a => a.isFocused); VKDebug.LogWarning(index.ToString()); if (index <= -1) { return; } else { index++; if (index >= max) { index = 0; } VKDebug.LogWarning(index.ToString()); EventSystem.current.SetSelectedGameObject(bt.inputs[index].gameObject, null); } } }
public void LoadGameConfig(string config) { if (!string.IsNullOrEmpty(config)) { VKDebug.LogWarning("config " + config); serverConfig = JsonUtility.FromJson <ServerConfig>(config); } }
public void Add(VKButtonKeyboard bt) { if (!buttons.ContainsKey(bt.key)) { buttons.Add(bt.key, new List <VKButtonKeyboard>()); } buttons[bt.key].Insert(0, bt); AddCurrent(bt); VKDebug.LogWarning("Add VKButtonKeyboard"); }
public void DownloadGame(int gameId) { if (Database.Instance.islogin) { VKDebug.LogWarning("Open Game " + (int)gameId); AssetbundlesManager.Instance.DownloadBundle(gameId, null, null, null, () => { DownloadGameDone(gameId); }); } else { NotifyController.Instance.Open("Bạn cần phải đăng nhập để chơi game!", NotifyController.TypeNotify.Error); } }
public void Remove(VKButtonKeyboard bt) { if (buttons.ContainsKey(bt.key)) { buttons[bt.key].Remove(bt); if (buttons[bt.key].Count > 0) { AddCurrent(buttons[bt.key][0]); } else { currentButton.Remove(bt.key); } VKDebug.LogWarning("Remove VKButtonKeyboard"); } }
public void InitSelectLine(SRSSlot20LineConfig config, List <int> lines, Action <List <int> > callback) { _config = config; gSelectLineContent.SetActive(true); onSelectLineCallBack = callback; lineSelecteds = lines; VKDebug.LogWarning("LINE " + lines.Count); foreach (var uiLine in uiLineItems) { uiLine.SetSelected(lines.Contains(uiLine.id)); } SetupButtonTab(); }
public static void SaveTextureToFile(Texture2D texture, string filename) { string path = GetPath(filename); try { if (filename.Contains(".png")) { File.WriteAllBytes(path, texture.EncodeToPNG()); } else if (filename.Contains(".jpg")) { File.WriteAllBytes(path, texture.EncodeToJPG()); } VKDebug.Log("Saved Data to: " + path.Replace("/", "\\")); } catch (Exception e) { VKDebug.LogWarning("Failed To Save Data to: " + path.Replace("/", "\\")); VKDebug.LogWarning("Error: " + e.Message); } }
protected virtual void OnStateChanged(Connection con, ConnectionStates oldState, ConnectionStates newState) { VKDebug.LogWarning("Code: OnStateChanged - oldState: " + oldState + " - newState: " + newState, VKCommon.HEX_VIOLET); }
protected virtual void RequestPreparator(Connection con, HTTPRequest req, RequestTypes type) { VKDebug.LogWarning("Code: RequestPreparator", VKCommon.HEX_VIOLET); }
protected virtual void OnNonHubMessage(Connection con, object data) { VKDebug.LogWarning("Code: OnNonHubMessage", VKCommon.HEX_VIOLET); }
public void HideLoading() { VKDebug.LogWarning("Close Loading"); StopAllCoroutines(); gameObject.SetActive(false); }
public void DownloadGameDone() { VKDebug.LogWarning("Download done"); if (UILayerController.Instance.IsCurrentLayer(UILayerKey.LViewLobby)) { AssetBundleSettingItem assetConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(gameId); switch (gameId) { case GameId.SLOT_NONGTRAI: case GameId.SLOT_MAFIA: if (Database.Instance.currentGame != GameId.NONE) { return; } else { Database.Instance.currentGame = gameId; UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot20LineLobby, assetConfig.name); } break; case GameId.SLOT_HAIVUONG: if (Database.Instance.currentGame != GameId.NONE) { return; } else { Database.Instance.currentGame = gameId; UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot25LineLobby, assetConfig.name); } break; case GameId.MINIPOKER: if (UILayerController.Instance.GetLayer(UILayerKey.LGameMiniPoker) == null) { UILayerController.Instance.ShowLayer(UILayerKey.LGameMiniPoker, assetConfig.name); } else { UILayerController.Instance.FocusMiniGame(UILayerKey.LGameMiniPoker); } break; case GameId.HIGHLOW: if (UILayerController.Instance.GetLayer(UILayerKey.LGameHighLow) == null) { UILayerController.Instance.ShowLayer(UILayerKey.LGameHighLow, assetConfig.name); } else { UILayerController.Instance.FocusMiniGame(UILayerKey.LGameHighLow); } break; case GameId.VUABAO: if (UILayerController.Instance.GetLayer(UILayerKey.LGameVuaBao) == null) { UILayerController.Instance.ShowLayer(UILayerKey.LGameVuaBao, assetConfig.name); } else { UILayerController.Instance.FocusMiniGame(UILayerKey.LGameVuaBao); } break; case GameId.TAIXIU: if (UILayerController.Instance.GetLayer(UILayerKey.LGameTaiXiu) == null) { MenuMiniGame.Instance.DisconnectTaiXiu(); UILayerController.Instance.ShowLayer(UILayerKey.LGameTaiXiu, assetConfig.name); } else { UILayerController.Instance.FocusMiniGame(UILayerKey.LGameTaiXiu); } break; case GameId.LUCKYSPIN: if (UILayerController.Instance.GetLayer(UILayerKey.LGameLuckySpin) == null) { UILayerController.Instance.ShowLayer(UILayerKey.LGameLuckySpin, assetConfig.name); } else { UILayerController.Instance.FocusMiniGame(UILayerKey.LGameLuckySpin); } break; case GameId.BAUCUA: if (UILayerController.Instance.GetLayer(UILayerKey.LGameBauCua) == null) { UILayerController.Instance.ShowLayer(UILayerKey.LGameBauCua, assetConfig.name); } else { UILayerController.Instance.FocusMiniGame(UILayerKey.LGameBauCua); } break; case GameId.XOCXOC: if (UILayerController.Instance.GetLayer(UILayerKey.LGameXocXocLobby) == null) { UILayerController.Instance.ShowLayer(UILayerKey.LGameXocXocLobby, assetConfig.name); //UILayerController.Instance.ShowLayer(UILayerKey.LGameXocXocLobby); } else { UILayerController.Instance.FocusMiniGame(UILayerKey.LGameXocXocLobby); } break; case GameId.SAM: if (UILayerController.Instance.GetLayer(UILayerKey.LGameSamLobby) == null) { UILayerController.Instance.ShowLayer(UILayerKey.LGameSamLobby, assetConfig.name, (layer) => { ((LGameSamLobby)layer).Init(isSoloServer); }); //UILayerController.Instance.ShowLayer(UILayerKey.LGameXocXocLobby); } else { UILayerController.Instance.FocusMiniGame(UILayerKey.LGameSamLobby); } break; #if USE_XLUA default: if (UILayerController.Instance.GetLayer(layerName) == null) { UILayerController.Instance.ShowLayer(layerName, assetConfig.name); } else { UILayerController.Instance.FocusMiniGame(layerName); } break; #endif } } }
protected virtual void OnReconnected(Connection con) { isConnected = true; VKDebug.LogWarning("Code: OnReconnected", VKCommon.HEX_VIOLET); }
protected virtual void RegisterHubFunction() { VKDebug.LogWarning("RegisterHubFunction", VKCommon.HEX_VIOLET); }
public void HideLayer(UILayer layer) { #if USE_XLUA InvokeXLua("HideLayer", layer); #else if (layer == null) { return; } List <UILayer> uiLayerTemps = layers[layer.position]; if (!uiLayerTemps.Contains(layer)) { return; } // remove uiLayerTemps.Remove(layer); UILayer lastLayer = null; if (layer.layerIndex > 0 && uiLayerTemps.Count > layer.layerIndex - 1) { try { lastLayer = uiLayerTemps[layer.layerIndex - 1]; lastLayer.gameObject.SetActive(true); lastLayer.ReloadLayer(); } catch (Exception e) { VKDebug.LogWarning("DONOT HAVE LAYER " + (layer.layerIndex - 1) + " - " + e.Message); } } if (layer.layerIndex == uiLayerTemps.Count) { if (lastLayer != null) { lastLayer.EnableLayer(); } } else { for (int i = layer.layerIndex; i < uiLayerTemps.Count; i++) { uiLayerTemps[i].SetLayerIndex(i); } } // call hide layer.BeforeHideLayer(); //// if last game in middle close => clear all layer game cache and layer cache > 5 //if (layer.position == UILayer.Position.Middle && uiLayerTemps.Count <= 0) //{ // layerMiniMask.SetActive(false); // StartCoroutine(WaitRemoveLayerGame(layer)); //} switch (layer.layerAnimType) { case UILayer.AnimType.None: layer.HideLayer(); if (layer.allowDestroy) { layer.DestroyLayer(); Destroy(layer.gameObject); UnloadAllAssets(); } else { CacheLayer(layer); } break; case UILayer.AnimType.Popup: layer.PlayAnimation(UILayer.AnimKey.ClosePopup); break; } #endif }
protected override void OnNonHubMessage(Connection con, object data) { base.OnNonHubMessage(con, data); VKDebug.LogWarning("OnNonHubMessage"); }
protected virtual void OnError(Connection con, string err) { isConnected = false; VKDebug.LogWarning("Code: OnError - " + err, VKCommon.HEX_VIOLET); }