Exemple #1
0
    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);
        }
    }
 public override void Init(object[] data) {
   base.Init(data);
   gameType = (BaseSlotMachineScreen.GameType)data[0];
   roomId = data[1].ToString();
   inviterName = data[2].ToString();
   messageLabel.text = data[3].ToString();
   EventDelegate.Set(btnConfirm.onClick, EventJoinGame);
   EventDelegate.Set(btnCancel.onClick, Close);
 }
Exemple #3
0
    // 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));
    }
Exemple #4
0
    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));
    }
Exemple #5
0
 public override void Init(object[] data)
 {
     base.Init(data);
     gameType          = (BaseSlotMachineScreen.GameType)data[0];
     roomId            = data[1].ToString();
     inviterName       = data[2].ToString();
     messageLabel.text = data[3].ToString();
     EventDelegate.Set(btnConfirm.onClick, EventJoinGame);
     EventDelegate.Set(btnCancel.onClick, Close);
 }
    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 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);
    }
Exemple #8
0
    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);
    }
    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 void EventOpenSlotGame(BaseSlotMachineScreen.GameType type)
 {
     SlotMachineClient.Instance.JoinRoom(type);
 }