Ejemplo n.º 1
0
    public void OnReceivePrizeResultPacket(int node, PacketId id, byte[] data)
    {
        PrizeResultPacket packet = new PrizeResultPacket(data);
        PrizeResultData   result = packet.GetPacket();

        Debug.Log("[CLIENT] ReceivePrizeResultPacket");

        for (int i = 0; i < result.cakeDataNum; ++i)
        {
            this.cake_counts[i] = result.cakeNum[i];

            Debug.Log("[CLIENT] Cake num[" + i + "]:" + result.cakeNum[i]);
        }

        chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer();

        QueryCakeCount query = QueryManager.get().findQuery <QueryCakeCount>(x => x.account_id == local_player.getAcountID());

        if (query != null)
        {
            Debug.Log("[CLIENT]QueryCakeCount done");
            query.set_done(true);
            query.set_success(true);
        }
    }
Ejemplo n.º 2
0
    // ---------------------------------------------------------------- //
    // 쿼리를 갱신.

    protected void  update_queries()
    {
        List <QueryBase> done_queries = QueryManager.get().findDoneQuery <QueryCakeCount>();

        foreach (var query in done_queries)
        {
            QueryCakeCount query_cake = query as QueryCakeCount;

            if (query_cake == null)
            {
                continue;
            }

            int global_index = AccountManager.get().accountID_to_GlobalIndex(query_cake.account_id);

            if (global_index < 0)
            {
                continue;
            }

            this.cake_counts[global_index] = query_cake.count;

            query.set_expired(true);
        }
    }
Ejemplo n.º 3
0
    // 레벨 시작 시에 호출.
    public override void            start()
    {
        // 각 플레이어가 케이크를 획득한 수..

        this.cake_counts = new int[NetConfig.PLAYER_MAX];

        for (int i = 0; i < this.cake_counts.Length; i++)
        {
            if (GameRoot.get().isConnected(i))
            {
                this.cake_counts[i] = -1;
            }
            else
            {
                this.cake_counts[i] = 0;
            }
        }

        chrBehaviorLocal local_player = PartyControl.get().getLocalPlayer();

        this.cake_counts[local_player.getGlobalIndex()] = local_player.getCakeCount();

        QueryCakeCount query_cake = new QueryCakeCount(local_player.getAcountID(), local_player.getCakeCount());

        query_cake.timeout = 20.0f;

        QueryManager.get().registerQuery(query_cake);

        // Network 클래스의 컴포넌트 획득.
        GameObject obj = GameObject.Find("Network");

        if (obj != null)
        {
            this.m_network = obj.GetComponent <Network>();

            if (this.m_network != null)
            {
                this.m_network.RegisterReceiveNotification(PacketId.PrizeResult, OnReceivePrizeResultPacket);
            }
        }

        // 케이크 데이터 송신.
        sendPrizeData();

        this.step.set_next(STEP.WAIT_FRIEND);
    }
Ejemplo n.º 4
0
	// 레벨 시작 시에 호출.
	public override void		start()
	{
		// 각 플레이어가 케이크를 획득한 수..

		this.cake_counts = new int[NetConfig.PLAYER_MAX];

		for(int i = 0;i < this.cake_counts.Length;i++) {

			if(GameRoot.get().isConnected(i)) {

				this.cake_counts[i] = -1;

			} else {

				this.cake_counts[i] = 0;
			}
		}

		chrBehaviorLocal	local_player = PartyControl.get().getLocalPlayer();

		this.cake_counts[local_player.getGlobalIndex()] = local_player.getCakeCount();

		QueryCakeCount	query_cake = new QueryCakeCount(local_player.getAcountID(), local_player.getCakeCount());

		query_cake.timeout = 20.0f;

		QueryManager.get().registerQuery(query_cake);

		// Network 클래스의 컴포넌트 획득.
		GameObject	obj = GameObject.Find("Network");
		
		if(obj != null) {
			
			this.m_network = obj.GetComponent<Network>();
			
			if (this.m_network != null) {
				this.m_network.RegisterReceiveNotification(PacketId.PrizeResult, OnReceivePrizeResultPacket);
			}
		}

		// 케이크 데이터 송신.
		sendPrizeData();

		this.step.set_next(STEP.WAIT_FRIEND);
	}
Ejemplo n.º 5
0
    protected void          create_debug_window()
    {
        var window = dbwin.root().createWindow("query");

        window.createButton("select.done")
        .setOnPress(() =>
        {
            for (int i = 0; i < NetConfig.PLAYER_MAX; i++)
            {
                var query = new QuerySelectDone(AccountManager.get().getAccountData(i).account_id);

                QueryManager.get().registerQuery(query);
            }
        });
        window.createButton("select.finish")
        .setOnPress(() =>
        {
            var query = new QuerySelectFinish("Daizuya");

            QueryManager.get().registerQuery(query);
        });

        window.createButton("summon dog")
        .setOnPress(() =>
        {
            QuerySummonBeast query_summon = new QuerySummonBeast("Daizuya", "Dog");

            QueryManager.get().registerQuery(query_summon);
        });

        window.createButton("summon neko")
        .setOnPress(() =>
        {
            QuerySummonBeast query_summon = new QuerySummonBeast("Daizuya", "Neko");

            QueryManager.get().registerQuery(query_summon);
        });

        window.createButton("cake count")
        .setOnPress(() =>
        {
            for (int i = 0; i < PartyControl.get().getFriendCount(); i++)
            {
                chrBehaviorPlayer friend = PartyControl.get().getFriend(i);

                QueryCakeCount query_cake = new QueryCakeCount(friend.getAcountID(), (i + 1) * 10);

                QueryManager.get().registerQuery(query_cake);
            }
        });

#if false
        window.createButton("버린다")
        .setOnPress(() =>
        {
            chrBehaviorLocal player = CharacterRoot.get().findCharacter <chrBehaviorLocal>(GameRoot.getInstance().account_name_local);

            player.controll.cmdItemQueryDrop();
        });

        window.createButton("말풍선")
        .setOnPress(() =>
        {
            //chrBehaviorLocal	player = CharacterRoot.get().findCharacter<chrBehaviorLocal>(GameRoot.getInstance().account_name_local);
            chrBehaviorNet player = CharacterRoot.get().findCharacter <chrBehaviorNet>("Daizuya");

            player.controll.cmdQueryTalk("멀리 있는 사람과 Talk한다", true);
        });
#endif
    }