// Join user to game lobby room and join available room
	public void JoinRoom(BaseSlotMachineScreen.GameType gameType, string roomName = null) {
	  PopupManager.Instance.ShowLoadingPopup("LoadingText_JoinRoom");
	  JSONObject jsonData = new JSONObject();
		jsonData.Add("gameType", GetCommandByGameType(gameType));
		jsonData.Add("roomName", roomName);
		SmartfoxClient.Instance.HandleServerRequest(CreateExtensionRequest(Command.SLOT_MACHINE.SLOT_JOIN_ROOM, jsonData));
	}
 public virtual void Init(int type, int currentHP, int maxHP, BaseSlotMachineScreen slotMachineScreen, string callback)
 {
     this.slotMachineScreen = slotMachineScreen;
     this.handler           = slotMachineScreen.gameObject;
     this.callback          = callback;
     Init(type, currentHP, maxHP);
 }
 public void Init(BaseSlotMachineScreen currentScreen)
 {
     this.currentScreen = currentScreen;
     EventDelegate.Set(btnOpenChat.onClick, ShowChatPanel);
     EventDelegate.Set(btnSendChat.onClick, SendChat);
     Utils.SetActive(chatPanel, false);
 }
	public UIAtlas GetAtlasReferenceBySlotType(BaseSlotMachineScreen.GameType slotType) {
		switch(slotType) {
			case BaseSlotMachineScreen.GameType.SLOT_DRAGON:
				return slotMachineDragonReference;
			break;
			case BaseSlotMachineScreen.GameType.SLOT_PIRATE:
				return slotMachinePirateReference;
			break;
			case BaseSlotMachineScreen.GameType.SLOT_ZOMBIE:
				return slotMachineZombieReference;
			break;
		}
		return null;
	}
Exemple #5
0
	public static string GetItemSpriteName(BaseSlotMachineScreen.GameType gameType, int index) {
		switch(gameType) {
			case BaseSlotMachineScreen.GameType.SLOT_DRAGON:
				return SlotItemDragon.spriteNames[index];
			break;
			case BaseSlotMachineScreen.GameType.SLOT_PIRATE:
				return SlotItemPirate.spriteNames[index];
			break;
			case BaseSlotMachineScreen.GameType.SLOT_ZOMBIE:
				return SlotItemZombie.spriteNames[index];
			break;
		}
		return null;
	}
	public virtual string GetBossPrefabName(BaseSlotMachineScreen.GameType gameType, int type) {
		switch(gameType) {
			case BaseSlotMachineScreen.GameType.SLOT_PIRATE:
				return bossPiratePrefabs[type];
			break;
			case BaseSlotMachineScreen.GameType.SLOT_DRAGON:
				return bossDragonPrefabs[type];
			break;
			case BaseSlotMachineScreen.GameType.SLOT_ZOMBIE:
				return bossZombiePrefabs[type];
			break;
		}
		Debug.LogError("Cant find boss: " + gameType + " type: " + type);
		return string.Empty;
	}
    private BaseScreen SetSlotGameScreen(BaseSlotMachineScreen.GameType gameType, object[] data = null)
    {
        GameObject            tempGameObject;
        BaseSlotMachineScreen tempScreen;

        switch (gameType)
        {
        case BaseSlotMachineScreen.GameType.SLOT_DRAGON:
            tempGameObject      = NGUITools.AddChild(root, Resources.Load(Global.SCREEN_PATH + "/GameScreen/SlotMachine/SlotDragonScreen/SlotDragonScreen", typeof(GameObject)) as GameObject);
            tempGameObject.name = "SlotDragonScreen";
            SlotDragonScreen slotDragonScreen = tempGameObject.GetComponent <SlotDragonScreen>();
            slotDragonScreen.Init(data);
            slotDragonScreen.Open();
            tempScreen = slotDragonScreen as BaseSlotMachineScreen;
            break;

        case BaseSlotMachineScreen.GameType.SLOT_PIRATE:
            tempGameObject      = NGUITools.AddChild(root, Resources.Load(Global.SCREEN_PATH + "/GameScreen/SlotMachine/SlotPirateScreen/SlotPirateScreen", typeof(GameObject)) as GameObject);
            tempGameObject.name = "SlotPirateScreen";
            SlotPirateScreen slotPirateScreen = tempGameObject.GetComponent <SlotPirateScreen>();
            slotPirateScreen.Init(data);
            slotPirateScreen.Open();
            tempScreen = slotPirateScreen as BaseSlotMachineScreen;
            break;

        case BaseSlotMachineScreen.GameType.SLOT_ZOMBIE:
            tempGameObject      = NGUITools.AddChild(root, Resources.Load(Global.SCREEN_PATH + "/GameScreen/SlotMachine/SlotZombieScreen/SlotZombieScreen", typeof(GameObject)) as GameObject);
            tempGameObject.name = "SlotZombieScreen";
            SlotZombieScreen slotZombieScreen = tempGameObject.GetComponent <SlotZombieScreen>();
            slotZombieScreen.Init(data);
            slotZombieScreen.Open();
            tempScreen = slotZombieScreen as BaseSlotMachineScreen;
            break;

        default:
            tempScreen = null;
            break;
        }
        CurrentSlotScreen = tempScreen as BaseSlotMachineScreen;
        return(tempScreen);
    }
 public static string GetCommandByGameType(BaseSlotMachineScreen.GameType gameType) {
   switch (gameType) {
     case BaseSlotMachineScreen.GameType.SLOT_FRUITS:
       return Command.SLOT_MACHINE.SLOT_TYPE_FRUITS;
     break;
     case BaseSlotMachineScreen.GameType.SLOT_HALLOWEEN:
       return Command.SLOT_MACHINE.SLOT_TYPE_HALLOWEEN;
     break;
     case BaseSlotMachineScreen.GameType.SLOT_DRAGON:
       return Command.SLOT_MACHINE.SLOT_TYPE_DRAGON;
     break;
     case BaseSlotMachineScreen.GameType.SLOT_PIRATE:
       return Command.SLOT_MACHINE.SLOT_TYPE_PIRATE;
     break;
     case BaseSlotMachineScreen.GameType.SLOT_ZOMBIE:
       return Command.SLOT_MACHINE.SLOT_TYPE_ZOMBIE;
     break;
     default:
       return string.Empty;
   }
 }
 private void EventOpenSlotGame(BaseSlotMachineScreen.GameType type) {
   SlotMachineClient.Instance.JoinRoom(type);
 }
  public void Init(BaseSlotMachineScreen currentScreen) {
    this.currentScreen = currentScreen;
    EventDelegate.Set(btnOpenChat.onClick, ShowChatPanel);
    EventDelegate.Set(btnSendChat.onClick, SendChat);
		Utils.SetActive(chatPanel, false);
  }
  public void InviteToGame(JSONArray inviteUsernames, BaseSlotMachineScreen.GameType gameType, string roomName) {
	  JSONObject jsonData = new JSONObject();
		jsonData.Add("gameType", SlotMachineClient.GetCommandByGameType(gameType));
		jsonData.Add("message", AccountManager.Instance.displayName + " invite you to play " + SlotMachineClient.GetCommandByGameType(gameType) + " with him.");
		jsonData.Add("roomName", roomName);
		jsonData.Add("invitees", inviteUsernames);
    SmartfoxClient.Instance.HandleServerRequest(CreateExtensionRequest(Command.USER.INVITE_TO_GAME, "InviteToGameSuccess", jsonData));
  }
	public virtual void Init(int type, int currentHP, int maxHP, BaseSlotMachineScreen slotMachineScreen, string callback) {
		this.slotMachineScreen = slotMachineScreen;
		this.handler = slotMachineScreen.gameObject;
		this.callback = callback;
		Init(type, currentHP, maxHP);
	}
  private BaseScreen SetSlotGameScreen(BaseSlotMachineScreen.GameType gameType, object[] data = null) {
    GameObject tempGameObject;
    BaseSlotMachineScreen tempScreen;
    switch(gameType) {
      case BaseSlotMachineScreen.GameType.SLOT_DRAGON:
        tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.SCREEN_PATH + "/GameScreen/SlotMachine/SlotDragonScreen/SlotDragonScreen", typeof(GameObject)) as GameObject);
       	tempGameObject.name = "SlotDragonScreen";
       	SlotDragonScreen slotDragonScreen = tempGameObject.GetComponent<SlotDragonScreen>();
       	slotDragonScreen.Init(data);
	     	slotDragonScreen.Open();
	     	tempScreen = slotDragonScreen as BaseSlotMachineScreen;
      break;
      case BaseSlotMachineScreen.GameType.SLOT_PIRATE:
        tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.SCREEN_PATH + "/GameScreen/SlotMachine/SlotPirateScreen/SlotPirateScreen", typeof(GameObject)) as GameObject);
       	tempGameObject.name = "SlotPirateScreen";
       	SlotPirateScreen slotPirateScreen = tempGameObject.GetComponent<SlotPirateScreen>();
       	slotPirateScreen.Init(data);
	     	slotPirateScreen.Open();
	     	tempScreen = slotPirateScreen as BaseSlotMachineScreen;
      break;
      case BaseSlotMachineScreen.GameType.SLOT_ZOMBIE:
        tempGameObject = NGUITools.AddChild(root, Resources.Load(Global.SCREEN_PATH + "/GameScreen/SlotMachine/SlotZombieScreen/SlotZombieScreen", typeof(GameObject)) as GameObject);
       	tempGameObject.name = "SlotZombieScreen";
       	SlotZombieScreen slotZombieScreen = tempGameObject.GetComponent<SlotZombieScreen>();
       	slotZombieScreen.Init(data);
	     	slotZombieScreen.Open();
	     	tempScreen = slotZombieScreen as BaseSlotMachineScreen;
      break;
      default:
        tempScreen = null;
      break;
    }
    CurrentSlotScreen = tempScreen as BaseSlotMachineScreen;
    return tempScreen;
  }