Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. niaina
N

niaina

@niaina

Chat Follow Unfollow
0
Reputation
7
Posts
1.0k
Profile views
0
Followers
0
Following
Joined 26 Mar 2021, 02:13 Last Online 10 Jan 2022, 04:19

  • Profile
  • More
    • Continue chat with niaina
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups
niaina Follow

Posts made by niaina

RE: Schema mismatch server-unity

Finally, got i worked. The problem was in the child schema type. I have two schemas A and B. B contains A. I used the wrong type anotation :
[Type(0, "A", typeof(A))]
public A a = new A();

Should be
[Type(0, "ref", typeof(A))]
public A a = new A();

posted in Questions & Help • 8 Apr 2021, 02:01
RE: Schema Child Objects Not Updated

Hey! I'm having a difficulty to implement Child Schema Type on client-side (unity) , it always gives me error like 'schema mismatch ... ' could you show me an example, please. For example, if the folowing is the server-side schema :
class IAmAChild extends Schema {
@type("number") x: number;
@type("number") y: number;
}
class ChildSchemaTypes extends Schema {
@type(IAmAChild) child: IAmAChild;
@type(IAmAChild) secondChild: IAmAChild;
}

How the client-side schema must be implemented?
Thanks

posted in Questions & Help • 5 Apr 2021, 02:22
RE: Schema mismatch server-unity

Tried but unfortunately the problem persists

posted in Questions & Help • 31 Mar 2021, 02:05
Schema mismatch server-unity

Hey! I'm stucking on this problem, don't know what's wrong please help

Server-side:
import { ArraySchema, Schema, type } from "@colyseus/schema";

export class Profile extends Schema {
@type("string")
uid: string = '';

@type("string")
nickname: string = '';

@type("number")
avatar: number = 0;

@type("number")
score: number = 0;

@type("number")
exp: number = 0;

@type("number")
level: number = 0;

};

export class Gamer extends Schema {

/// BUG !!!

@type(Profile)
profile: Profile = new Profile();

@type(["number"])
cards = new ArraySchema<number>();

@type("number")
coins: number = 0;

@type("number")
chips: number = 0;

@type("number")
prize: number = 0;

@type("number")
seat: number = -1;

};

client-side:

using Colyseus.Schema;

namespace Poker.Entities {

/// <summary>
/// Represent gamer datas other gamers could see
/// </summary>


public class Profile : Schema {
    
    [Type(0, "string")]
    public string uid = default(string);
    
    [Type(1, "string")]
    public string nickname = default(string);

    [Type(2, "number")]
    public float avatar = default(float);

    [Type(3, "number")]
    public float score  = default(float);

    [Type(4, "number")]
    public float exp  = default(float);

    [Type(5, "number")]
    public float level  = default(float);
    
}


/// <summary>
/// Instance of user in holdem game
/// </summary>
public class Gamer : Schema
{
    [Type(0, "Profile", typeof(Profile))]
    public Profile profile = new Profile();
    
    [Type(1, "array", typeof(ArraySchema<float>))]
    public ArraySchema<float> cards = new ArraySchema<float>();
    
    [Type(2, "number")]
    public float coins  = default(float);

    [Type(3, "number")]
    public float chips  = default(float);

    [Type(4, "number")]
    public float prize  = default(float);

    [Type(5, "number")]
    public float seat  = default(float);
    

}

}

I believe the problem comes from Profile but don't know how to solve that. Thanks.

posted in Questions & Help • 30 Mar 2021, 02:16
RE: Auth

May be I'll explain more. So the problem is the following: when connect to the LoginServer + the json , it works perfectly. The req.body contains the json I send. I'm using Insomnia here. 0_1616986471155_bug1.PNG

But when using client.Auth.Login , It give me back "email or password incorrect". So I took a look at req.body and it's always empty.
0_1616987025291_bug2.PNG

posted in Questions & Help • 29 Mar 2021, 02:06
Auth

Hey! if i have my own auth server (running on localhost), can i use client.Auth.Login("email","password") to get access token that I'll use in Room onAuth() ? Is there any available examples?

posted in Questions & Help • 28 Mar 2021, 14:45
room list update

Hello. I'd like to keep track of rooms beeing added and deleted using lobby event callbacks (onMessage) . But I could not find the implementation code in c#, only in javascript (below). Could you help me. Thanks.0_1616729046594_Capture d’écran de 2021-03-26 06-14-26.png

posted in Questions & Help • 26 Mar 2021, 02:24

© 2023 Endel Dreyer