repo_id stringlengths 4 98 | size int64 611 5.02M | file_path stringlengths 1 276 | content stringlengths 611 5.02M | shard_id int64 0 109 | quality_score float32 0.5 1 | quality_prediction int8 1 1 | quality_confidence float32 0.5 1 | topic_primary stringclasses 1 value | topic_group stringclasses 1 value | topic_score float32 0.05 1 | topic_all stringclasses 96 values | quality2_score float32 0.5 1 | quality2_prediction int8 1 1 | quality2_confidence float32 0.5 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
psiroki/gzdoomxxh | 23,348 | src/playsim/p_effect.cpp | /*
** p_effect.cpp
** Particle effects
**
**---------------------------------------------------------------------------
** Copyright 1998-2006 Randy Heit
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** 1. Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** 2. Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** 3. The name of the author may not be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**---------------------------------------------------------------------------
**
** If particles used real sprites instead of blocks, they could be much
** more useful.
*/
#include "doomtype.h"
#include "doomstat.h"
#include "actor.h"
#include "m_argv.h"
#include "p_effect.h"
#include "p_local.h"
#include "r_defs.h"
#include "gi.h"
#include "d_player.h"
#include "r_utility.h"
#include "g_levellocals.h"
#include "vm.h"
#include "actorinlines.h"
#include "g_game.h"
CVAR (Int, cl_rockettrails, 1, CVAR_ARCHIVE);
CVAR (Bool, r_rail_smartspiral, 0, CVAR_ARCHIVE);
CVAR (Int, r_rail_spiralsparsity, 1, CVAR_ARCHIVE);
CVAR (Int, r_rail_trailsparsity, 1, CVAR_ARCHIVE);
CVAR (Bool, r_particles, true, 0);
EXTERN_CVAR(Int, r_maxparticles);
FRandom pr_railtrail("RailTrail");
#define FADEFROMTTL(a) (1.f/(a))
static int grey1, grey2, grey3, grey4, red, green, blue, yellow, black,
red1, green1, blue1, yellow1, purple, purple1, white,
rblue1, rblue2, rblue3, rblue4, orange, yorange, dred, grey5,
maroon1, maroon2, blood1, blood2;
static const struct ColorList {
int *color;
uint8_t r, g, b;
} Colors[] = {
{&grey1, 85, 85, 85 },
{&grey2, 171, 171, 171},
{&grey3, 50, 50, 50 },
{&grey4, 210, 210, 210},
{&grey5, 128, 128, 128},
{&red, 255, 0, 0 },
{&green, 0, 200, 0 },
{&blue, 0, 0, 255},
{&yellow, 255, 255, 0 },
{&black, 0, 0, 0 },
{&red1, 255, 127, 127},
{&green1, 127, 255, 127},
{&blue1, 127, 127, 255},
{&yellow1, 255, 255, 180},
{&purple, 120, 0, 160},
{&purple1, 200, 30, 255},
{&white, 255, 255, 255},
{&rblue1, 81, 81, 255},
{&rblue2, 0, 0, 227},
{&rblue3, 0, 0, 130},
{&rblue4, 0, 0, 80 },
{&orange, 255, 120, 0 },
{&yorange, 255, 170, 0 },
{&dred, 80, 0, 0 },
{&maroon1, 154, 49, 49 },
{&maroon2, 125, 24, 24 },
{NULL, 0, 0, 0 }
};
inline particle_t *NewParticle (FLevelLocals *Level)
{
particle_t *result = nullptr;
if (Level->InactiveParticles != NO_PARTICLE)
{
result = &Level->Particles[Level->InactiveParticles];
Level->InactiveParticles = result->tnext;
result->tnext = Level->ActiveParticles;
Level->ActiveParticles = uint32_t(result - Level->Particles.Data());
}
return result;
}
//
// [RH] Particle functions
//
void P_InitParticles (FLevelLocals *);
void P_InitParticles (FLevelLocals *Level)
{
const char *i;
int num;
if ((i = Args->CheckValue ("-numparticles")))
num = atoi (i);
// [BC] Use r_maxparticles now.
else
num = r_maxparticles;
// This should be good, but eh...
int NumParticles = clamp<int>(num, 100, 65535);
Level->Particles.Resize(NumParticles);
P_ClearParticles (Level);
}
void P_ClearParticles (FLevelLocals *Level)
{
int i = 0;
memset (Level->Particles.Data(), 0, Level->Particles.Size() * sizeof(particle_t));
Level->ActiveParticles = NO_PARTICLE;
Level->InactiveParticles = 0;
for (auto &p : Level->Particles)
p.tnext = ++i;
Level->Particles.Last().tnext = NO_PARTICLE;
}
// Group particles by subsectors. Because particles are always
// in motion, there is little benefit to caching this information
// from one frame to the next.
void P_FindParticleSubsectors (FLevelLocals *Level)
{
if (Level->ParticlesInSubsec.Size() < Level->subsectors.Size())
{
Level->ParticlesInSubsec.Reserve (Level->subsectors.Size() - Level->ParticlesInSubsec.Size());
}
fillshort (&Level->ParticlesInSubsec[0], Level->subsectors.Size(), NO_PARTICLE);
if (!r_particles)
{
return;
}
for (uint16_t i = Level->ActiveParticles; i != NO_PARTICLE; i = Level->Particles[i].tnext)
{
// Try to reuse the subsector from the last portal check, if still valid.
if (Level->Particles[i].subsector == nullptr) Level->Particles[i].subsector = Level->PointInRenderSubsector(Level->Particles[i].Pos);
int ssnum = Level->Particles[i].subsector->Index();
Level->Particles[i].snext = Level->ParticlesInSubsec[ssnum];
Level->ParticlesInSubsec[ssnum] = i;
}
}
static TMap<int, int> ColorSaver;
static uint32_t ParticleColor(int rgb)
{
int *val;
int stuff;
val = ColorSaver.CheckKey(rgb);
if (val != NULL)
{
return *val;
}
stuff = rgb | (ColorMatcher.Pick(RPART(rgb), GPART(rgb), BPART(rgb)) << 24);
ColorSaver[rgb] = stuff;
return stuff;
}
static uint32_t ParticleColor(int r, int g, int b)
{
return ParticleColor(MAKERGB(r, g, b));
}
void P_InitEffects ()
{
const struct ColorList *color = Colors;
while (color->color)
{
*(color->color) = ParticleColor(color->r, color->g, color->b);
color++;
}
int kind = gameinfo.defaultbloodparticlecolor;
blood1 = ParticleColor(kind);
blood2 = ParticleColor(RPART(kind)/3, GPART(kind)/3, BPART(kind)/3);
}
void P_ThinkParticles (FLevelLocals *Level)
{
int i;
particle_t *particle, *prev;
i = Level->ActiveParticles;
prev = NULL;
while (i != NO_PARTICLE)
{
particle = &Level->Particles[i];
i = particle->tnext;
if (!particle->notimefreeze && Level->isFrozen())
{
prev = particle;
continue;
}
auto oldtrans = particle->alpha;
particle->alpha -= particle->fadestep;
particle->size += particle->sizestep;
if (particle->alpha <= 0 || oldtrans < particle->alpha || --particle->ttl <= 0 || (particle->size <= 0))
{ // The particle has expired, so free it
memset (particle, 0, sizeof(particle_t));
if (prev)
prev->tnext = i;
else
Level->ActiveParticles = i;
particle->tnext = Level->InactiveParticles;
Level->InactiveParticles = (int)(particle - Level->Particles.Data());
continue;
}
// Handle crossing a line portal
DVector2 newxy = Level->GetPortalOffsetPosition(particle->Pos.X, particle->Pos.Y, particle->Vel.X, particle->Vel.Y);
particle->Pos.X = newxy.X;
particle->Pos.Y = newxy.Y;
particle->Pos.Z += particle->Vel.Z;
particle->Vel += particle->Acc;
particle->subsector = Level->PointInRenderSubsector(particle->Pos);
sector_t *s = particle->subsector->sector;
// Handle crossing a sector portal.
if (!s->PortalBlocksMovement(sector_t::ceiling))
{
if (particle->Pos.Z > s->GetPortalPlaneZ(sector_t::ceiling))
{
particle->Pos += s->GetPortalDisplacement(sector_t::ceiling);
particle->subsector = NULL;
}
}
else if (!s->PortalBlocksMovement(sector_t::floor))
{
if (particle->Pos.Z < s->GetPortalPlaneZ(sector_t::floor))
{
particle->Pos += s->GetPortalDisplacement(sector_t::floor);
particle->subsector = NULL;
}
}
prev = particle;
}
}
enum PSFlag
{
PS_FULLBRIGHT = 1,
PS_NOTIMEFREEZE = 1 << 5,
};
void P_SpawnParticle(FLevelLocals *Level, const DVector3 &pos, const DVector3 &vel, const DVector3 &accel, PalEntry color, double startalpha, int lifetime, double size,
double fadestep, double sizestep, int flags)
{
particle_t *particle = NewParticle(Level);
if (particle)
{
particle->Pos = pos;
particle->Vel = vel;
particle->Acc = accel;
particle->color = ParticleColor(color);
particle->alpha = float(startalpha);
if (fadestep < 0) particle->fadestep = FADEFROMTTL(lifetime);
else particle->fadestep = float(fadestep);
particle->ttl = lifetime;
particle->bright = !!(flags & PS_FULLBRIGHT);
particle->size = size;
particle->sizestep = sizestep;
particle->notimefreeze = !!(flags & PS_NOTIMEFREEZE);
}
}
//
// JitterParticle
//
// Creates a particle with "jitter"
//
particle_t *JitterParticle (FLevelLocals *Level, int ttl)
{
return JitterParticle (Level, ttl, 1.0);
}
// [XA] Added "drift speed" multiplier setting for enhanced railgun stuffs.
particle_t *JitterParticle (FLevelLocals *Level, int ttl, double drift)
{
particle_t *particle = NewParticle (Level);
if (particle) {
int i;
// Set initial velocities
for (i = 3; i; i--)
particle->Vel[i] = ((1./4096) * (M_Random () - 128) * drift);
// Set initial accelerations
for (i = 3; i; i--)
particle->Acc[i] = ((1./16384) * (M_Random () - 128) * drift);
particle->alpha = 1.f; // fully opaque
particle->ttl = ttl;
particle->fadestep = FADEFROMTTL(ttl);
}
return particle;
}
static void MakeFountain (AActor *actor, int color1, int color2)
{
particle_t *particle;
if (!(actor->Level->time & 1))
return;
particle = JitterParticle (actor->Level, 51);
if (particle)
{
DAngle an = M_Random() * (360. / 256);
double out = actor->radius * M_Random() / 256.;
particle->Pos = actor->Vec3Angle(out, an, actor->Height + 1);
if (out < actor->radius/8)
particle->Vel.Z += 10./3;
else
particle->Vel.Z += 3;
particle->Acc.Z -= 1./11;
if (M_Random() < 30) {
particle->size = 4;
particle->color = color2;
} else {
particle->size = 6;
particle->color = color1;
}
}
}
void P_RunEffect (AActor *actor, int effects)
{
DAngle moveangle = actor->Vel.Angle();
particle_t *particle;
int i;
if ((effects & FX_ROCKET) && (cl_rockettrails & 1))
{
// Rocket trail
double backx = -actor->radius * 2 * moveangle.Cos();
double backy = -actor->radius * 2 * moveangle.Sin();
double backz = actor->Height * ((2. / 3) - actor->Vel.Z / 8);
DAngle an = moveangle + 90.;
double speed;
particle = JitterParticle (actor->Level, 3 + (M_Random() & 31));
if (particle) {
double pathdist = M_Random() / 256.;
DVector3 pos = actor->Vec3Offset(
backx - actor->Vel.X * pathdist,
backy - actor->Vel.Y * pathdist,
backz - actor->Vel.Z * pathdist);
particle->Pos = pos;
speed = (M_Random () - 128) * (1./200);
particle->Vel.X += speed * an.Cos();
particle->Vel.Y += speed * an.Sin();
particle->Vel.Z -= 1./36;
particle->Acc.Z -= 1./20;
particle->color = yellow;
particle->size = 2;
}
for (i = 6; i; i--) {
particle_t *particle = JitterParticle (actor->Level, 3 + (M_Random() & 31));
if (particle) {
double pathdist = M_Random() / 256.;
DVector3 pos = actor->Vec3Offset(
backx - actor->Vel.X * pathdist,
backy - actor->Vel.Y * pathdist,
backz - actor->Vel.Z * pathdist + (M_Random() / 64.));
particle->Pos = pos;
speed = (M_Random () - 128) * (1./200);
particle->Vel.X += speed * an.Cos();
particle->Vel.Y += speed * an.Sin();
particle->Vel.Z += 1. / 80;
particle->Acc.Z += 1. / 40;
if (M_Random () & 7)
particle->color = grey2;
else
particle->color = grey1;
particle->size = 3;
} else
break;
}
}
if ((effects & FX_GRENADE) && (cl_rockettrails & 1))
{
// Grenade trail
DVector3 pos = actor->Vec3Angle(-actor->radius * 2, moveangle, -actor->Height * actor->Vel.Z / 8 + actor->Height * (2. / 3));
P_DrawSplash2 (actor->Level, 6, pos, moveangle + 180, 2, 2);
}
if (actor->fountaincolor)
{
// Particle fountain
static const int *fountainColors[16] =
{ &black, &black,
&red, &red1,
&green, &green1,
&blue, &blue1,
&yellow, &yellow1,
&purple, &purple1,
&black, &grey3,
&grey4, &white
};
int color = actor->fountaincolor*2;
MakeFountain (actor, *fountainColors[color], *fountainColors[color+1]);
}
if (effects & FX_RESPAWNINVUL)
{
// Respawn protection
static const int *protectColors[2] = { &yellow1, &white };
for (i = 3; i > 0; i--)
{
particle = JitterParticle (actor->Level, 16);
if (particle != NULL)
{
DAngle ang = M_Random() * (360 / 256.);
DVector3 pos = actor->Vec3Angle(actor->radius, ang, 0);
particle->Pos = pos;
particle->color = *protectColors[M_Random() & 1];
particle->Vel.Z = 1;
particle->Acc.Z = M_Random () / 512.;
particle->size = 1;
if (M_Random () < 128)
{ // make particle fall from top of actor
particle->Pos.Z += actor->Height;
particle->Vel.Z = -particle->Vel.Z;
particle->Acc.Z = -particle->Acc.Z;
}
}
}
}
}
void P_DrawSplash (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int kind)
{
int color1, color2;
switch (kind)
{
case 1: // Spark
color1 = orange;
color2 = yorange;
break;
default:
return;
}
for (; count; count--)
{
particle_t *p = JitterParticle (Level, 10);
if (!p)
break;
p->size = 2;
p->color = M_Random() & 0x80 ? color1 : color2;
p->Vel.Z -= M_Random () / 128.;
p->Acc.Z -= 1./8;
p->Acc.X += (M_Random () - 128) / 8192.;
p->Acc.Y += (M_Random () - 128) / 8192.;
p->Pos.Z = pos.Z - M_Random () / 64.;
angle += M_Random() * (45./256);
p->Pos.X = pos.X + (M_Random() & 15)*angle.Cos();
p->Pos.Y = pos.Y + (M_Random() & 15)*angle.Sin();
}
}
void P_DrawSplash2 (FLevelLocals *Level, int count, const DVector3 &pos, DAngle angle, int updown, int kind)
{
int color1, color2, zadd;
double zvel, zspread;
switch (kind)
{
case 0: // Blood
color1 = blood1;
color2 = blood2;
break;
case 1: // Gunshot
color1 = grey3;
color2 = grey5;
break;
case 2: // Smoke
color1 = grey3;
color2 = grey1;
break;
default: // colorized blood
color1 = ParticleColor(kind);
color2 = ParticleColor(RPART(kind)/3, GPART(kind)/3, BPART(kind)/3);
break;
}
zvel = -1./512.;
zspread = updown ? -6000 / 65536. : 6000 / 65536.;
zadd = (updown == 2) ? -128 : 0;
for (; count; count--)
{
particle_t *p = NewParticle (Level);
DAngle an;
if (!p)
break;
p->ttl = 12;
p->fadestep = FADEFROMTTL(12);
p->alpha = 1.f;
p->size = 4;
p->color = M_Random() & 0x80 ? color1 : color2;
p->Vel.Z = M_Random() * zvel;
p->Acc.Z = -1 / 22.;
if (kind)
{
an = angle + ((M_Random() - 128) * (180 / 256.));
p->Vel.X = M_Random() * an.Cos() / 2048.;
p->Vel.Y = M_Random() * an.Sin() / 2048.;
p->Acc.X = p->Vel.X / 16.;
p->Acc.Y = p->Vel.Y / 16.;
}
an = angle + ((M_Random() - 128) * (90 / 256.));
p->Pos.X = pos.X + ((M_Random() & 31) - 15) * an.Cos();
p->Pos.Y = pos.Y + ((M_Random() & 31) - 15) * an.Sin();
p->Pos.Z = pos.Z + (M_Random() + zadd - 128) * zspread;
}
}
struct TrailSegment
{
DVector3 start;
DVector3 dir;
DVector3 extend;
DVector2 soundpos;
double length;
double sounddist;
};
void P_DrawRailTrail(AActor *source, TArray<SPortalHit> &portalhits, int color1, int color2, double maxdiff, int flags, PClassActor *spawnclass, DAngle angle, int duration, double sparsity, double drift, int SpiralOffset, DAngle pitch)
{
double length = 0;
int steps, i;
TArray<TrailSegment> trail;
TAngle<double> deg;
DVector3 pos;
bool fullbright;
unsigned segment;
double lencount;
for (unsigned i = 0; i < portalhits.Size() - 1; i++)
{
TrailSegment seg;
seg.start = portalhits[i].ContPos;
seg.dir = portalhits[i].OutDir;
seg.length = (portalhits[i + 1].HitPos - seg.start).Length();
//Calculate PerpendicularVector (extend, dir):
double minelem = 1;
int epos;
int ii;
for (epos = 0, ii = 0; ii < 3; ++ii)
{
if (fabs(seg.dir[ii]) < minelem)
{
epos = ii;
minelem = fabs(seg.dir[ii]);
}
}
DVector3 tempvec(0, 0, 0);
tempvec[epos] = 1;
seg.extend = (tempvec - (seg.dir | tempvec) * seg.dir) * 3;
length += seg.length;
auto player = source->Level->GetConsolePlayer();
if (player)
{
// Only consider sound in 2D (for now, anyway)
// [BB] You have to divide by lengthsquared here, not multiply with it.
AActor *mo = player->camera;
double r = ((seg.start.Y - mo->Y()) * (-seg.dir.Y) - (seg.start.X - mo->X()) * (seg.dir.X)) / (seg.length * seg.length);
r = clamp<double>(r, 0., 1.);
seg.soundpos = seg.start + r * seg.dir;
seg.sounddist = (seg.soundpos - mo->Pos()).LengthSquared();
}
else
{
// Set to invalid for secondary levels.
seg.soundpos = {0,0};
seg.sounddist = -1;
}
trail.Push(seg);
}
steps = xs_FloorToInt(length / 3);
fullbright = !!(flags & RAF_FULLBRIGHT);
if (steps)
{
if (!(flags & RAF_SILENT))
{
auto player = source->Level->GetConsolePlayer();
if (player)
{
FSoundID sound;
// Allow other sounds than 'weapons/railgf'!
if (!source->player) sound = source->AttackSound;
else if (source->player->ReadyWeapon) sound = source->player->ReadyWeapon->AttackSound;
else sound = 0;
if (!sound) sound = "weapons/railgf";
// The railgun's sound is special. It gets played from the
// point on the slug's trail that is closest to the hearing player.
AActor *mo = player->camera;
if (fabs(mo->X() - trail[0].start.X) < 20 && fabs(mo->Y() - trail[0].start.Y) < 20)
{ // This player (probably) fired the railgun
S_Sound (mo, CHAN_WEAPON, 0, sound, 1, ATTN_NORM);
}
else
{
TrailSegment *shortest = NULL;
for (auto &seg : trail)
{
if (shortest == NULL || shortest->sounddist > seg.sounddist) shortest = &seg;
}
S_Sound (source->Level, DVector3(shortest->soundpos, r_viewpoint.Pos.Z), CHAN_WEAPON, 0, sound, 1, ATTN_NORM);
}
}
}
}
else
{
// line is 0 length, so nothing to do
return;
}
// Create the outer spiral.
if (color1 != -1 && (!r_rail_smartspiral || color2 == -1) && r_rail_spiralsparsity > 0 && (spawnclass == NULL))
{
double stepsize = 3 * r_rail_spiralsparsity * sparsity;
int spiral_steps = (int)(steps * r_rail_spiralsparsity / sparsity);
segment = 0;
lencount = trail[0].length;
color1 = color1 == 0 ? -1 : ParticleColor(color1);
pos = trail[0].start;
deg = (double)SpiralOffset;
for (i = spiral_steps; i; i--)
{
particle_t *p = NewParticle (source->Level);
DVector3 tempvec;
if (!p)
return;
int spiralduration = (duration == 0) ? TICRATE : duration;
p->alpha = 1.f;
p->ttl = spiralduration;
p->fadestep = FADEFROMTTL(spiralduration);
p->size = 3;
p->bright = fullbright;
tempvec = DMatrix3x3(trail[segment].dir, deg) * trail[segment].extend;
p->Vel = tempvec * drift / 16.;
p->Pos = tempvec + pos;
pos += trail[segment].dir * stepsize;
deg += double(r_rail_spiralsparsity * 14);
lencount -= stepsize;
if (color1 == -1)
{
int rand = M_Random();
if (rand < 155)
p->color = rblue2;
else if (rand < 188)
p->color = rblue1;
else if (rand < 222)
p->color = rblue3;
else
p->color = rblue4;
}
else
{
p->color = color1;
}
if (lencount <= 0)
{
segment++;
if (segment < trail.Size())
{
pos = trail[segment].start - trail[segment].dir * lencount;
lencount += trail[segment].length;
}
else
{
// should never happen but if something goes wrong, just terminate the loop.
break;
}
}
}
}
// Create the inner trail.
if (color2 != -1 && r_rail_trailsparsity > 0 && spawnclass == NULL)
{
double stepsize = 3 * r_rail_trailsparsity * sparsity;
int trail_steps = xs_FloorToInt(steps * r_rail_trailsparsity / sparsity);
color2 = color2 == 0 ? -1 : ParticleColor(color2);
DVector3 diff(0, 0, 0);
pos = trail[0].start;
lencount = trail[0].length;
segment = 0;
for (i = trail_steps; i; i--)
{
// [XA] inner trail uses a different default duration (33).
int innerduration = (duration == 0) ? 33 : duration;
particle_t *p = JitterParticle (source->Level, innerduration, (float)drift);
if (!p)
return;
if (maxdiff > 0)
{
int rnd = M_Random ();
if (rnd & 1)
diff.X = clamp<double>(diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 2)
diff.Y = clamp<double>(diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 4)
diff.Z = clamp<double>(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
}
DVector3 postmp = pos + diff;
p->size = 2;
p->Pos = postmp;
if (color1 != -1)
p->Acc.Z -= 1./4096;
pos += trail[segment].dir * stepsize;
lencount -= stepsize;
p->bright = fullbright;
if (color2 == -1)
{
int rand = M_Random();
if (rand < 85)
p->color = grey4;
else if (rand < 170)
p->color = grey2;
else
p->color = grey1;
}
else
{
p->color = color2;
}
if (lencount <= 0)
{
segment++;
if (segment < trail.Size())
{
pos = trail[segment].start - trail[segment].dir * lencount;
lencount += trail[segment].length;
}
else
{
// should never happen but if something goes wrong, just terminate the loop.
break;
}
}
}
}
// create actors
if (spawnclass != NULL)
{
if (sparsity < 1)
sparsity = 32;
double stepsize = sparsity;
int trail_steps = (int)((steps * 3) / sparsity);
DVector3 diff(0, 0, 0);
pos = trail[0].start;
lencount = trail[0].length;
segment = 0;
for (i = trail_steps; i; i--)
{
if (maxdiff > 0)
{
int rnd = pr_railtrail();
if (rnd & 1)
diff.X = clamp<double>(diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 2)
diff.Y = clamp<double>(diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 4)
diff.Z = clamp<double>(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
}
AActor *thing = Spawn (source->Level, spawnclass, pos + diff, ALLOW_REPLACE);
if (thing)
{
if (source) thing->target = source;
thing->Angles.Pitch = pitch;
thing->Angles.Yaw = angle;
}
pos += trail[segment].dir * stepsize;
lencount -= stepsize;
if (lencount <= 0)
{
segment++;
if (segment < trail.Size())
{
pos = trail[segment].start - trail[segment].dir * lencount;
lencount += trail[segment].length;
}
else
{
// should never happen but if something goes wrong, just terminate the loop.
break;
}
}
}
}
}
void P_DisconnectEffect (AActor *actor)
{
int i;
if (actor == NULL)
return;
for (i = 64; i; i--)
{
particle_t *p = JitterParticle (actor->Level, TICRATE*2);
if (!p)
break;
double xo = (M_Random() - 128)*actor->radius / 128;
double yo = (M_Random() - 128)*actor->radius / 128;
double zo = M_Random()*actor->Height / 256;
DVector3 pos = actor->Vec3Offset(xo, yo, zo);
p->Pos = pos;
p->Acc.Z -= 1./4096;
p->color = M_Random() < 128 ? maroon1 : maroon2;
p->size = 4;
}
}
| 411 | 0.965918 | 1 | 0.965918 | game-dev | MEDIA | 0.649726 | game-dev,graphics-rendering | 0.985275 | 1 | 0.985275 |
DrFlower/TowerDefense-GameFramework-Demo | 1,772 | Assets/GameFramework/Libraries/GameFramework/Resource/PackageVersionList.FileSystem.cs | //------------------------------------------------------------
// Game Framework
// Copyright © 2013-2021 Jiang Yin. All rights reserved.
// Homepage: https://gameframework.cn/
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System.Runtime.InteropServices;
namespace GameFramework.Resource
{
public partial struct PackageVersionList
{
/// <summary>
/// 文件系统。
/// </summary>
[StructLayout(LayoutKind.Auto)]
public struct FileSystem
{
private static readonly int[] EmptyIntArray = new int[] { };
private readonly string m_Name;
private readonly int[] m_ResourceIndexes;
/// <summary>
/// 初始化文件系统的新实例。
/// </summary>
/// <param name="name">文件系统名称。</param>
/// <param name="resourceIndexes">文件系统包含的资源索引集合。</param>
public FileSystem(string name, int[] resourceIndexes)
{
if (name == null)
{
throw new GameFrameworkException("Name is invalid.");
}
m_Name = name;
m_ResourceIndexes = resourceIndexes ?? EmptyIntArray;
}
/// <summary>
/// 获取文件系统名称。
/// </summary>
public string Name
{
get
{
return m_Name;
}
}
/// <summary>
/// 获取文件系统包含的资源索引集合。
/// </summary>
/// <returns>文件系统包含的资源索引集合。</returns>
public int[] GetResourceIndexes()
{
return m_ResourceIndexes;
}
}
}
}
| 411 | 0.699053 | 1 | 0.699053 | game-dev | MEDIA | 0.574089 | game-dev | 0.736628 | 1 | 0.736628 |
vcmi/vcmi | 4,066 | lib/constants/Enumerations.h | /*
* Enumerations.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
VCMI_LIB_NAMESPACE_BEGIN
enum class EAlignment : int8_t
{
ANY = -1,
GOOD = 0,
EVIL,
NEUTRAL
};
namespace BuildingSubID
{
enum EBuildingSubID
{
DEFAULT = -50,
NONE = -1,
CASTLE_GATE,
MYSTIC_POND,
LIBRARY,
PORTAL_OF_SUMMONING,
ESCAPE_TUNNEL,
TREASURY,
BANK
};
}
enum class EMarketMode : int8_t
{
RESOURCE_RESOURCE, RESOURCE_PLAYER, CREATURE_RESOURCE, RESOURCE_ARTIFACT,
ARTIFACT_RESOURCE, ARTIFACT_EXP, CREATURE_EXP, CREATURE_UNDEAD, RESOURCE_SKILL,
MARKET_AFTER_LAST_PLACEHOLDER
};
enum class EAiTactic : int8_t
{
NONE = -1,
RANDOM = 0,
WARRIOR = 1,
BUILDER = 2,
EXPLORER = 3
};
enum class EBuildingState : int8_t
{
HAVE_CAPITAL, NO_WATER, FORBIDDEN, ADD_MAGES_GUILD, ALREADY_PRESENT, CANT_BUILD_TODAY,
NO_RESOURCES, ALLOWED, PREREQUIRES, MISSING_BASE, BUILDING_ERROR, TOWN_NOT_OWNED
};
enum class ESpellCastProblem : int8_t
{
OK, NO_HERO_TO_CAST_SPELL, CASTS_PER_TURN_LIMIT, NO_SPELLBOOK,
HERO_DOESNT_KNOW_SPELL, NOT_ENOUGH_MANA, ADVMAP_SPELL_INSTEAD_OF_BATTLE_SPELL,
SPELL_LEVEL_LIMIT_EXCEEDED, NO_SPELLS_TO_DISPEL,
NO_APPROPRIATE_TARGET, STACK_IMMUNE_TO_SPELL, WRONG_SPELL_TARGET, ONGOING_TACTIC_PHASE,
MAGIC_IS_BLOCKED, //For Orb of Inhibition and similar - no casting at all
INVALID
};
namespace ECommander
{
enum SecondarySkills {ATTACK, DEFENSE, HEALTH, DAMAGE, SPEED, SPELL_POWER, CASTS, RESISTANCE};
const int MAX_SKILL_LEVEL = 5;
}
enum class EWallPart : int8_t
{
INDESTRUCTIBLE_PART_OF_GATE = -3, INDESTRUCTIBLE_PART = -2, INVALID = -1,
KEEP = 0, BOTTOM_TOWER, BOTTOM_WALL, BELOW_GATE, OVER_GATE, UPPER_WALL, UPPER_TOWER, GATE,
PARTS_COUNT /* This constant SHOULD always stay as the last item in the enum. */
};
enum class EWallState : int8_t
{
NONE = -1, //no wall
DESTROYED,
DAMAGED,
INTACT,
REINFORCED, // walls in towns with castle
};
enum class EGateState : int8_t
{
NONE,
CLOSED,
BLOCKED, // gate is blocked in closed state, e.g. by creature
OPENED,
DESTROYED
};
enum class ETileType : int8_t
{
FREE,
POSSIBLE,
BLOCKED,
USED
};
enum class ETeleportChannelType : int8_t
{
IMPASSABLE,
BIDIRECTIONAL,
UNIDIRECTIONAL,
MIXED
};
namespace MasteryLevel
{
enum Type
{
NONE,
BASIC,
ADVANCED,
EXPERT,
LEVELS_SIZE
};
}
enum class Date : int8_t
{
DAY = 0,
DAY_OF_WEEK = 1,
WEEK = 2,
MONTH = 3,
DAY_OF_MONTH
};
enum class EActionType : int8_t
{
NO_ACTION,
END_TACTIC_PHASE,
RETREAT,
SURRENDER,
HERO_SPELL,
WALK,
WAIT,
DEFEND,
WALK_AND_ATTACK,
SHOOT,
CATAPULT,
MONSTER_SPELL,
BAD_MORALE,
STACK_HEAL,
};
enum class EDiggingStatus : int8_t
{
UNKNOWN = -1,
CAN_DIG = 0,
LACK_OF_MOVEMENT,
WRONG_TERRAIN,
TILE_OCCUPIED,
BACKPACK_IS_FULL
};
enum class EPlayerStatus : int8_t
{
WRONG = -1,
INGAME,
LOSER,
WINNER
};
enum class PlayerRelations : int8_t
{
ENEMIES,
ALLIES,
SAME_PLAYER
};
enum class EMetaclass : int8_t
{
INVALID = 0,
ARTIFACT,
CREATURE,
FACTION,
EXPERIENCE,
HERO,
HEROCLASS,
LUCK,
MANA,
MORALE,
MOVEMENT,
OBJECT,
PRIMARY_SKILL,
SECONDARY_SKILL,
SPELL,
RESOURCE
};
enum class EHealLevel: int8_t
{
HEAL,
RESURRECT,
OVERHEAL
};
enum class EHealPower : int8_t
{
ONE_BATTLE,
PERMANENT
};
enum class EBattleResult : int8_t
{
NORMAL = 0,
ESCAPE = 1,
SURRENDER = 2,
};
enum class ETileVisibility : int8_t // Fog of war change
{
HIDDEN,
REVEALED
};
enum class EArmyFormation : int8_t
{
LOOSE,
TIGHT
};
enum class EMovementMode : int8_t
{
STANDARD,
DIMENSION_DOOR,
MONOLITH,
CASTLE_GATE,
TOWN_PORTAL,
};
enum class EMapLevel : int8_t
{
ANY = -1,
SURFACE = 0,
UNDERGROUND = 1
};
enum class EWeekType : int8_t
{
FIRST_WEEK,
NORMAL,
DOUBLE_GROWTH,
BONUS_GROWTH,
DEITYOFFIRE,
PLAGUE
};
enum class ColorScheme : int8_t
{
NONE,
KEEP,
GRAYSCALE,
H2_SCHEME
};
enum class ChangeValueMode : int8_t
{
RELATIVE,
ABSOLUTE
};
VCMI_LIB_NAMESPACE_END
| 411 | 0.950609 | 1 | 0.950609 | game-dev | MEDIA | 0.937362 | game-dev | 0.944511 | 1 | 0.944511 |
MaddyThorson/Ogmo-Editor-v1 | 11,657 | src/editor/ObjectLayer.as | package editor
{
import editor.tools.*;
import editor.tools.object.*;
import editor.ui.*;
import editor.definitions.*;
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.Sprite;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.system.System;
public class ObjectLayer extends Layer
{
public var bg:Sprite;
private var objects:Sprite;
private var _selection:Vector.<GameObject>;
public function ObjectLayer(layerName:String, gridSize:int, gridColor:uint, drawGridSize:uint)
{
super(ToolObjectPaint, layerName, gridSize, gridColor, drawGridSize);
_selection = new Vector.<GameObject>;
bg = new Sprite;
bg.graphics.beginFill( 0x000000, 0 );
bg.graphics.drawRect( 0, 0, Ogmo.level.levelWidth, Ogmo.level.levelHeight );
bg.graphics.endFill();
addChild( bg );
addChild( objects = new Sprite );
objects.mouseChildren = objects.mouseEnabled = false;
}
public function getObjectsAtPoint( x:Number, y:Number ):Vector.<GameObject>
{
var v:Vector.<GameObject> = new Vector.<GameObject>;
for ( var i:int = 0; i < objects.numChildren; i++ )
{
if ((objects.getChildAt( i ) as GameObject).collidesWithPoint( x, y ))
v.push( objects.getChildAt( i ) as GameObject );
}
return v;
}
public function getFirstAtPoint( x:Number, y:Number ):GameObject
{
for ( var i:int = objects.numChildren - 1; i >= 0; i-- )
{
if ((objects.getChildAt( i ) as GameObject).collidesWithPoint( x, y ))
return (objects.getChildAt( i ) as GameObject);
}
return null;
}
public function getObjectsAtRect( rect:Rectangle ):Vector.<GameObject>
{
var v:Vector.<GameObject> = new Vector.<GameObject>;
for ( var i:int = 0; i < objects.numChildren; i++ )
{
if ((objects.getChildAt( i ) as GameObject).collidesWithRectangle( rect ))
v.push( objects.getChildAt( i ) as GameObject );
}
return v;
}
public function getAmountType( name:String ):int
{
var ret:int = 0;
for ( var i:int = 0; i < objects.numChildren; i++ )
{
if ((objects.getChildAt( i ) as GameObject).definition.name == name)
ret++;
}
return ret;
}
private function setSelboxVisibility( to:Boolean ):void
{
for ( var i:int = 0; i < objects.numChildren; i++ )
(objects.getChildAt( i ) as GameObject).selBox.visible = to;
}
public function moveObjects( vec:Vector.<GameObject>, h:int, v:int ):void
{
for each( var o:GameObject in vec )
o.move( h, v );
}
public function resizeObjects( vec:Vector.<GameObject>, w:int, h:int ):void
{
for each ( var o:GameObject in vec )
o.setSize( w, h );
}
public function resizeObjectsRelative( vec:Vector.<GameObject>, w:int, h:int ):void
{
for each ( var o:GameObject in vec )
o.setSize( o.width + w, o.height + h );
}
public function rotateObjects( vec:Vector.<GameObject>, dir:int = 1 ):void
{
for each ( var o:GameObject in vec )
o.rotate( dir );
}
public function resetObjectsRotation( vec:Vector.<GameObject> ):void
{
for each ( var o:GameObject in vec )
o.setAngle( 0 );
}
public function duplicateObjects():void
{
for each ( var o:GameObject in _selection )
addExistingObject( o.deepCopy() );
}
/* ========================== ADDING/REMOVING OBJECTS ========================== */
public function addObject( obj:ObjectDefinition, x:int, y:int ):GameObject
{
var o:GameObject = new GameObject( this, obj );
o.x = x;
o.y = y;
objects.addChild( o );
return o;
}
public function addExistingObject( obj:GameObject ):void
{
objects.addChild( obj );
}
private function addObjectFromXML( xml:XML ):GameObject
{
var o:GameObject = new GameObject( this );
o.xml = xml;
objects.addChild( o );
return o;
}
public function removeObject( obj:GameObject ):void
{
if (obj == null || !objects.contains( obj ))
return;
objects.removeChild( obj );
if (obj.selected)
deselectObject( obj );
}
public function removeObjects( objs:Vector.<GameObject> ):void
{
var o:GameObject;
if (objs == _selection)
{
var v:Vector.<GameObject> = new Vector.<GameObject>;
for each ( o in objs )
v.push( o );
for each ( o in v )
removeObject( o );
}
else
{
for each ( o in objs )
removeObject( o );
}
}
public function removeType( name:String, amount:int = 1 ):void
{
if (amount < 1)
throw new Error( "Cannot remove less than one of an object type." );
for ( var i:int = 0; i < objects.numChildren; i++ )
{
if ((objects.getChildAt( i ) as GameObject).definition.name == name)
{
amount--;
removeObject( objects.getChildAt( i ) as GameObject );
i--;
if (amount <= 0)
return;
}
}
}
/* ========================== SELECTION STUFF ========================== */
public function get selection():Vector.<GameObject>
{
return _selection;
}
private function selectObjectUtility( obj:GameObject ):void
{
if (obj.selected)
return;
obj.selected = true;
_selection.push( obj );
}
public function selectObject( obj:GameObject ):void
{
selectObjectUtility( obj );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
public function selectObjects( objs:Vector.<GameObject> ):void
{
for each ( var o:GameObject in objs )
selectObjectUtility( o );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
public function selectAll():void
{
for ( var i:int = 0; i < objects.numChildren; i++ )
selectObjectUtility( objects.getChildAt( i ) as GameObject );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
public function selectType( name:String ):void
{
for ( var i:int = 0; i < objects.numChildren; i++ )
{
var obj:GameObject = objects.getChildAt( i ) as GameObject;
if (obj.definition.name == name)
selectObjectUtility( obj );
}
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
private function deselectObjectUtility( obj:GameObject ):void
{
if (obj.selected)
{
var index:int = _selection.indexOf( obj );
_selection[ index ].selected = false;
_selection.splice( index, 1 );
}
}
public function deselectObject( obj:GameObject ):void
{
deselectObjectUtility( obj );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
public function deselectObjects( objs:Vector.<GameObject> ):void
{
for each ( var o:GameObject in objs )
deselectObjectUtility( o );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
public function deselectAll():void
{
while( _selection.length > 0)
deselectObjectUtility( _selection[ 0 ] );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
public function deselectType( name:String ):void
{
for ( var i:int = 0; i < _selection.length; i++ )
{
if (_selection[ i ].definition.name == name)
{
deselectObjectUtility( _selection[ i ] );
i--;
}
}
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
private function toggleSelectObjectUtility( obj:GameObject ):void
{
if (obj.selected)
deselectObjectUtility( obj );
else
selectObjectUtility( obj );
}
public function toggleSelectObject( obj:GameObject ):void
{
toggleSelectObjectUtility( obj );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
public function toggleSelectObjects( objs:Vector.<GameObject> ):void
{
for each ( var o:GameObject in objs )
toggleSelectObjectUtility( o );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
Ogmo.windowMenu.refreshState();
}
public function anyObjectSelected( objs:Vector.<GameObject> ):Boolean
{
for each ( var o:GameObject in objs )
{
if (o.selected)
return true;
}
return false;
}
/* ========================== LAYER STUFF ========================== */
override public function resizeLevel( width:int, height:int ):void
{
//Remove objects out of bounds
if (width < Ogmo.level.levelWidth || height < Ogmo.level.levelHeight)
{
for ( var i:int = 0; i < objects.numChildren; i++ )
{
var obj:GameObject = objects.getChildAt( i ) as GameObject;
if (obj.x >= width || obj.y >= height)
{
removeObject( obj );
i--;
}
}
}
//Redraw the background
bg.graphics.clear();
bg.graphics.beginFill( 0x000000, 0 );
bg.graphics.drawRect( 0, 0, width, height );
bg.graphics.endFill();
super.resizeLevel( width, height );
}
override public function clear():void
{
deselectAll();
removeChild( objects );
addChild( objects = new Sprite );
System.gc();
}
override protected function activate():void
{
stage.addEventListener( KeyboardEvent.KEY_DOWN, onKeyDown );
setSelboxVisibility( true );
}
override protected function deactivate():void
{
stage.removeEventListener( KeyboardEvent.KEY_DOWN, onKeyDown );
deselectAll();
setSelboxVisibility( false );
}
/* ========================== GETS/SETS ========================== */
override public function get xml():XML
{
if (objects.numChildren == 0)
return null;
var ret:XML = <layer></layer>;
ret.setName( layerName );
for (var i:int = 0; i < objects.numChildren; i++)
ret.appendChild( (objects.getChildAt( i ) as GameObject).xml );
return ret;
}
override public function set xml( to:XML ):void
{
clear();
for each ( var o:XML in to.children() )
addObjectFromXML( o );
setSelboxVisibility( active );
}
/* ========================== EVENTS ========================== */
private function onKeyDown( e:KeyboardEvent ):void
{
if (Ogmo.missKeys)
return;
if (e.keyCode == 46)
{
//DELETE
if (!(tool is ToolObjectNodes))
removeObjects( _selection );
}
else if (e.keyCode == 37)
{
//LEFT
if (e.ctrlKey)
resizeObjectsRelative( _selection, -gridSize, 0 );
else if (e.shiftKey)
rotateObjects( _selection, -1 );
else
moveObjects( _selection, -gridSize, 0 );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
}
else if (e.keyCode == 38)
{
//UP
if (e.ctrlKey)
resizeObjectsRelative( _selection, 0, -gridSize );
else
moveObjects( _selection, 0, -gridSize );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
}
else if (e.keyCode == 39)
{
//RIGHT
if (e.ctrlKey)
resizeObjectsRelative( _selection, gridSize, 0 );
else if (e.shiftKey)
rotateObjects( _selection, 1 );
else
moveObjects( _selection, gridSize, 0 );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
}
else if (e.keyCode == 40)
{
//DOWN
if (e.ctrlKey)
resizeObjectsRelative( _selection, 0, gridSize );
else if (e.shiftKey)
resetObjectsRotation( _selection );
else
moveObjects( _selection, 0, gridSize );
Ogmo.windows.windowObjectInfo.setTarget( _selection );
}
}
}
} | 411 | 0.794079 | 1 | 0.794079 | game-dev | MEDIA | 0.834615 | game-dev | 0.921266 | 1 | 0.921266 |
glKarin/com.n0n3m4.diii4a | 4,489 | Q3E/src/main/jni/etw/Omnibot/Common/Omni-Bot_Events.h | #ifndef __OMNIBOT_EVENTS_H__
#define __OMNIBOT_EVENTS_H__
// typedef: EventId
// Readable identifier for various events that can be sent to the bot
// and considered for state changes or behavioral modifications.
typedef enum
{
EVENT_ID_UNDEFINED = 0,
SYSTEM_ID_FIRST,
SYSTEM_SCRIPT_CHANGED,
SYSTEM_ID_LAST,
GAME_ID_FIRST,
GAME_STARTGAME,
GAME_ENDGAME,
GAME_NEWROUND,
GAME_ENDROUND,
GAME_CLEARGOALS,
GAME_CLIENTCONNECTED,
GAME_CLIENTDISCONNECTED,
GAME_ENTITYCREATED,
GAME_ENTITYDELETED,
GAME_START_TRAINING,
GAME_GRAVITY,
GAME_CHEATS,
GAME_SCRIPTSIGNAL,
GAME_SOUND,
GAME_ADD_ENTITY_CONNECTION,
GAME_ID_LAST,
EVENT_ID_FIRST,
// Actions
ACTION_ID_FIRST,
ACTION_WEAPON_FIRE,
ACTION_WEAPON_CHANGE,
ACTION_ID_LAST,
GOAL_ID_FIRST,
GOAL_SUCCESS,
GOAL_FAILED,
GOAL_ABORTED,
PATH_SUCCESS,
PATH_FAILED,
AIM_SUCCESS,
GOAL_ID_LAST,
// Messages that are passed around between any objects
MESSAGE_ID_FIRST,
MESSAGE_SPAWN,
MESSAGE_CHANGETEAM,
MESSAGE_INVALIDTEAM,
MESSAGE_INVALIDCLASS,
MESSAGE_CHANGECLASS,
MESSAGE_DEATH,
MESSAGE_HEALED,
MESSAGE_REVIVED,
MESSAGE_KILLEDSOMEONE,
MESSAGE_ADDWEAPON, // gives a weapon to the bot, should add to list to be evaluated for use
MESSAGE_REMOVEWEAPON, // remove a weapon from the bots inventory
MESSAGE_RESETWEAPONS, // tells the bot to clear out all the weapons
MESSAGE_REFRESHWEAPON,
MESSAGE_REFRESHALLWEAPONS,
MESSAGE_SPECTATED,
MESSAGE_AIMCOMPLETED,
MESSAGE_SCRIPTMSG,
MESSAGE_PROXIMITY_TRIGGER,
MESSAGE_DYNAMIC_PATHS_CHANGED,
MESSAGE_ENT_ENTER_RADIUS,
MESSAGE_ENT_LEAVE_RADIUS,
MESSAGE_MG_ENTER_RADIUS,
MESSAGE_MG_LEAVE_RADIUS,
MESSAGE_ID_LAST,
// Percepts (senses: feel, see, hear, smell, )
PERCEPT_ID_FIRST,
PERCEPT_FEEL_PLAYER_USE,
PERCEPT_FEEL_PAIN,
PERCEPT_HEAR_VOICEMACRO,
PERCEPT_HEAR_GLOBALVOICEMACRO,
PERCEPT_HEAR_TEAMVOICEMACRO,
PERCEPT_HEAR_PRIVATEVOICEMACRO,
PERCEPT_HEAR_GLOBALCHATMSG,
PERCEPT_HEAR_TEAMCHATMSG,
PERCEPT_HEAR_PRIVCHATMSG,
PERCEPT_HEAR_GROUPCHATMSG,
PERCEPT_HEAR_SOUND,
PERCEPT_SENSE_ENTITY,
PERCEPT_ID_LAST,
EVENT_ID_LAST,
EVENT_NUM_EVENTS
} EventId;
////////////////////////////////////////////////////////////////////////
// enumerations: GameMessage
// GEN_MSG_NONE - Invalid message reserved as 0.
// GEN_MSG_ADDBOT - Bot adding info.
// GEN_MSG_ISALIVE - Is the entity alive?
// GEN_MSG_ISRELOADING - Is the entity reloading?
// GEN_MSG_ISREADYTOFIRE - Is the entity ready to fire?
// GEN_MSG_ISALLIED - Is the entity allied with another?
// GEN_MSG_ISOUTSIDE - Is this position outdoors?
// GEN_MSG_GETEQUIPPEDWEAPON - Get the currently equipped weapon id for an entity.
// GEN_MSG_GETMOUNTEDWEAPON - Gets the weapon id for any weapon the bot is mounted and controlling.
// GEN_MSG_GETHEALTHARMOR - Get health and armor for an entity.
// GEN_MSG_GETMAXSPEED - Get the max speed of the entity.
// GEN_MSG_GETFLAGSTATE - Get the current state of the flag.
// GEN_MSG_GAMESTATE - Get the current state of the game.
// GEN_MSG_ENTITYSCORE - Get current frags/kills/score of an entity.
// GEN_MSG_TEAMSCORE - Get current team score of a team.
// GEN_MSG_WPCHARGED - Is the weapon charged?
// GEN_MSG_WPHEATLEVEL - Get the weapon heat level.
// GEN_MSG_ENTITYKILL - Kill a passed in entity, cheat protected.
// GEN_MSG_SERVERCOMMAND - Execute a server command.
typedef enum
{
GEN_MSG_NONE = 0,
GEN_MSG_ADDBOT,
GEN_MSG_KICKBOT,
GEN_MSG_ISALIVE,
GEN_MSG_ISRELOADING,
GEN_MSG_ISREADYTOFIRE,
GEN_MSG_ISALLIED,
GEN_MSG_ISOUTSIDE,
GEN_MSG_CHANGENAME,
GEN_MSG_GETEQUIPPEDWEAPON,
GEN_MSG_GETMOUNTEDWEAPON,
GEN_MSG_GETWEAPONLIMITS,
GEN_MSG_GETHEALTHARMOR,
GEN_MSG_GETMAXSPEED,
GEN_MSG_GETFLAGSTATE,
GEN_MSG_GETCONTROLLINGTEAM,
GEN_MSG_GAMESTATE,
GEN_MSG_ENTITYSTAT,
GEN_MSG_TEAMSTAT,
GEN_MSG_WPCHARGED,
GEN_MSG_WPHEATLEVEL,
GEN_MSG_ENTITYKILL,
GEN_MSG_SERVERCOMMAND,
GEN_MSG_PLAYSOUND,
GEN_MSG_STOPSOUND,
GEN_MSG_SCRIPTEVENT,
GEN_MSG_GOTOWAYPOINT,
GEN_MSG_VEHICLEINFO,
GEN_MSG_MOVERAT,
GEN_MSG_SETLOADOUT,
// This must stay last.
GEN_MSG_END
} GEN_GameMessage;
// enumerations: BlackBoard_Key
// bbk_All - Special identifier for ALL keys.
// bbk_DelayGoal - Goal delayed for the duration of this blackboard entry.
typedef enum
{
bbk_All = 0,
bbk_DelayGoal,
bbk_IsTaken,
bbk_RunAway,
// This must stay last.
bbk_LastKey,
bbk_FirstScript,
} BlackBoard_Key;
#endif
| 411 | 0.748611 | 1 | 0.748611 | game-dev | MEDIA | 0.929132 | game-dev | 0.602979 | 1 | 0.602979 |
Cr4sh/ioctlfuzzer | 108,261 | src/dbgsdk/inc/engextcpp.cpp | //----------------------------------------------------------------------------
//
// C++ dbgeng extension framework.
//
// Copyright (C) Microsoft Corporation, 2005-2006.
//
//----------------------------------------------------------------------------
#include <engextcpp.hpp>
#include <strsafe.h>
#include <dbghelp.h>
#if defined(_PREFAST_) || defined(_PREFIX_)
#define PRE_ASSUME(_Cond) __analysis_assume(_Cond)
#else
#define PRE_ASSUME(_Cond)
#endif
#define IsSpace(_Char) isspace((UCHAR)(_Char))
WINDBG_EXTENSION_APIS64 ExtensionApis;
ExtCheckedPointer<ExtExtension>
g_Ext("g_Ext not set, used outside of a command");
//----------------------------------------------------------------------------
//
// ExtException family.
//
//----------------------------------------------------------------------------
void
ExtException::PrintMessageVa(__in_ecount(BufferChars) PSTR Buffer,
__in ULONG BufferChars,
__in PCSTR Format,
__in va_list Args)
{
StringCchVPrintfA(Buffer, BufferChars, Format, Args);
m_Message = Buffer;
}
void WINAPIV
ExtException::PrintMessage(__in_ecount(BufferChars) PSTR Buffer,
__in ULONG BufferChars,
__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
PrintMessageVa(Buffer, BufferChars, Format, Args);
va_end(Args);
}
//----------------------------------------------------------------------------
//
// Holders.
//
//----------------------------------------------------------------------------
void
ExtCurrentThreadHolder::Refresh(void)
{
HRESULT Status;
if ((Status = g_Ext->m_System->
GetCurrentThreadId(&m_ThreadId)) != S_OK)
{
throw ExtStatusException(Status,
"ExtCurrentThreadHolder::Refresh failed");
}
}
void
ExtCurrentThreadHolder::Restore(void)
{
if (m_ThreadId != DEBUG_ANY_ID)
{
PRE_ASSUME(g_Ext.IsSet());
if (g_Ext.IsSet())
{
// Ensure that g_Ext-> operator will not throw exception.
g_Ext->m_System->SetCurrentThreadId(m_ThreadId);
}
m_ThreadId = DEBUG_ANY_ID;
}
}
void
ExtCurrentProcessHolder::Refresh(void)
{
HRESULT Status;
if ((Status = g_Ext->m_System->
GetCurrentProcessId(&m_ProcessId)) != S_OK)
{
throw ExtStatusException(Status,
"ExtCurrentProcessHolder::Refresh failed");
}
}
void
ExtCurrentProcessHolder::Restore(void)
{
if (m_ProcessId != DEBUG_ANY_ID)
{
PRE_ASSUME(g_Ext.IsSet());
if (g_Ext.IsSet())
{
// Ensure that g_Ext-> operator will not throw exception.
g_Ext->m_System->SetCurrentProcessId(m_ProcessId);
}
m_ProcessId = DEBUG_ANY_ID;
}
}
//----------------------------------------------------------------------------
//
// ExtCommandDesc.
//
//----------------------------------------------------------------------------
ExtCommandDesc* ExtCommandDesc::s_Commands;
ULONG ExtCommandDesc::s_LongestCommandName;
ExtCommandDesc::ExtCommandDesc(__in PCSTR Name,
__in ExtCommandMethod Method,
__in PCSTR Desc,
__in_opt PCSTR Args)
{
m_Name = Name;
m_Method = Method;
m_Desc = Desc;
m_ArgDescStr = Args;
ClearArgs();
//
// Add into command list sorted by name.
//
ExtCommandDesc* Cur, *Prev;
Prev = NULL;
for (Cur = s_Commands; Cur; Cur = Cur->m_Next)
{
if (strcmp(Name, Cur->m_Name) < 0)
{
break;
}
Prev = Cur;
}
if (Prev)
{
Prev->m_Next = this;
}
else
{
s_Commands = this;
}
m_Next = Cur;
if (strlen(Name) > s_LongestCommandName)
{
s_LongestCommandName = strlen(Name);
}
}
ExtCommandDesc::~ExtCommandDesc(void)
{
DeleteArgs();
}
void
ExtCommandDesc::ClearArgs(void)
{
m_ArgsInitialized = false;
m_CustomArgParsing = false;
m_CustomArgDescLong = NULL;
m_CustomArgDescShort = NULL;
m_OptionChars = "/-";
m_ArgStrings = NULL;
m_NumArgs = 0;
m_NumUnnamedArgs = 0;
m_Args = NULL;
}
void
ExtCommandDesc::DeleteArgs(void)
{
free(m_ArgStrings);
delete [] m_Args;
ClearArgs();
}
PSTR
ExtCommandDesc::ParseDirective(__in PSTR Scan)
{
//
// Scan to collect the directive name.
//
PSTR Name = Scan;
while (*Scan != ':' && *Scan != '}')
{
if (!*Scan)
{
m_Ext->ThrowInvalidArg("ArgDesc: Improper directive "
"name termination");
}
Scan++;
}
//
// Scan to collect the directive value.
//
PSTR Value = "";
if (*Scan == ':')
{
*Scan++ = 0;
Value = Scan;
while (*Scan != '}' ||
*(Scan + 1) != '}')
{
if (!*Scan)
{
m_Ext->ThrowInvalidArg("ArgDesc: Improper directive "
"value termination");
}
Scan++;
}
}
else if (*(Scan + 1) != '}')
{
m_Ext->ThrowInvalidArg("ArgDesc: Improper directive }} closure");
}
// Terminate name or value.
*Scan = 0;
Scan += 2;
//
// Process directive.
//
bool NoValue = false;
bool NeedValue = false;
if (!strcmp(Name, "custom"))
{
m_CustomArgParsing = true;
NoValue = true;
}
else if (!strcmp(Name, "l"))
{
m_CustomArgDescLong = Value;
NeedValue = true;
}
else if (!strcmp(Name, "opt"))
{
m_OptionChars = Value;
}
else if (!strcmp(Name, "s"))
{
m_CustomArgDescShort = Value;
NeedValue = true;
}
else
{
m_Ext->ThrowInvalidArg("ArgDesc: Unknown directive '%s'", Name);
}
if (!Value[0] && NeedValue)
{
m_Ext->ThrowInvalidArg("ArgDesc: {{%s}} requires an argument", Name);
}
if (Value[0] && NoValue)
{
m_Ext->ThrowInvalidArg("ArgDesc: {{%s}} does not have an argument",
Name);
}
return Scan;
}
void
ExtCommandDesc::ParseArgDesc(void)
{
//
// Parse the argument description.
//
if (!m_ArgDescStr ||
!m_ArgDescStr[0])
{
// No arguments.
return;
}
// First copy the string so we can chop it up.
m_ArgStrings = _strdup(m_ArgDescStr);
if (! m_ArgStrings)
{
m_Ext->ThrowOutOfMemory();
}
//
// Each argument description is
// {<optname>;<type,flags>;<argname>;<descstr>}
//
ArgDesc Args[ExtExtension::s_MaxArgs];
ArgDesc* Arg = Args - 1;
ULONG NumUnOptArgs = 0;
bool RemainderUsed = false;
PSTR Scan = m_ArgStrings;
while (*Scan)
{
if (*Scan != '{')
{
m_Ext->ThrowInvalidArg("ArgDesc: Missing { at '%s'", Scan);
}
Scan++;
if (*Scan == '{')
{
// This is a {{directive}} and not an argument.
Scan = ParseDirective(++Scan);
continue;
}
if (m_NumArgs >= EXT_DIMA(Args))
{
m_Ext->ThrowInvalidArg("ArgDesc: Argument count "
"overflow at '%s'", Scan);
}
m_NumArgs++;
Arg++;
//
// Check for an argument name.
// Arguments can be unnamed.
//
if (*Scan == '}' ||
*Scan == ';')
{
Arg->Name = NULL;
m_NumUnnamedArgs++;
if (*Scan == ';')
{
Scan++;
}
}
else
{
Arg->Name = Scan;
while (*Scan != '}' &&
*Scan != ';')
{
if (!*Scan)
{
m_Ext->ThrowInvalidArg("ArgDesc: Improper argument "
"name termination for '%s'",
Arg->Name);
}
Scan++;
}
if (*Scan != '}')
{
*Scan++ = 0;
}
if (Arg->Name[0] == '?' &&
!Arg->Name[1])
{
m_Ext->ThrowInvalidArg("ArgDesc: /? is automatically "
"provided by the framework");
}
}
//
// Check for a type.
// Type defaults to string.
//
PCSTR TypeName = "ERROR";
Arg->Boolean = false;
Arg->Expression = false;
Arg->String = false;
Arg->StringRemainder = false;
switch(*Scan)
{
case 'x':
Arg->StringRemainder = true;
__fallthrough;
case 's':
Scan++;
__fallthrough;
case '}':
case ';':
case ',':
TypeName = "string";
Arg->String = true;
break;
case 'b':
Scan++;
Arg->Boolean = true;
break;
case 'e':
Scan++;
TypeName = "expr";
Arg->Expression = true;
Arg->ExpressionBits = 64;
Arg->ExpressionSigned = false;
Arg->ExpressionDelimited = false;
for (;;)
{
if (*Scan == 'd')
{
Arg->ExpressionDelimited = true;
}
else if (*Scan == 's')
{
Arg->ExpressionSigned = true;
}
else
{
break;
}
Scan++;
}
if (*Scan >= '0' && *Scan <= '9')
{
Arg->ExpressionBits = strtoul(Scan, &Scan, 10);
if (Arg->ExpressionBits < 1 ||
Arg->ExpressionBits > 64)
{
m_Ext->ThrowInvalidArg("ArgDesc: "
"Invalid expression bit count %u",
Arg->ExpressionBits);
}
}
break;
default:
m_Ext->ThrowInvalidArg("ArgDesc: Unknown argument type at '%s'",
Scan);
break;
}
//
// Check for flags.
//
PSTR NeedTerm = NULL;
Arg->Default = NULL;
Arg->DefaultSilent = false;
// Unnamed arguments default to
// required as a required argument
// tail is a very common pattern.
Arg->Required = Arg->Name == NULL;
while (*Scan == ',')
{
if (NeedTerm)
{
*NeedTerm = 0;
NeedTerm = NULL;
}
Scan++;
switch(*Scan)
{
case 'd':
Scan++;
switch(*Scan)
{
case '=':
if (Arg->Boolean)
{
m_Ext->ThrowInvalidArg("ArgDesc: boolean arguments "
"cannot have defaults");
}
Arg->Default = ++Scan;
while (*Scan &&
*Scan != ',' &&
*Scan != ';' &&
*Scan != '}')
{
Scan++;
}
if (*Scan != '}')
{
NeedTerm = Scan;
}
break;
case 's':
Scan++;
Arg->DefaultSilent = true;
break;
default:
m_Ext->ThrowInvalidArg("ArgDesc: "
"Unknown 'd' argument flag at '%s'",
Scan);
}
break;
case 'o':
Scan++;
Arg->Required = false;
break;
case 'r':
Scan++;
Arg->Required = true;
break;
default:
m_Ext->ThrowInvalidArg("ArgDesc: "
"Unknown argument flag at '%s'",
Scan);
}
}
if (*Scan == ';')
{
Scan++;
}
else if (*Scan != '}')
{
m_Ext->ThrowInvalidArg("ArgDesc: Improper argument "
"type/flags termination at '%s'",
Scan);
}
if (NeedTerm)
{
*NeedTerm = 0;
NeedTerm = NULL;
}
if (!Arg->Name)
{
if (Arg->Boolean)
{
// Not possible to have an unnamed flag
// since the presence/absence of the flag
// is what a boolean is for.
m_Ext->ThrowInvalidArg("ArgDesc: Boolean arguments "
"must be named");
}
// Given the lack of placement identification (a name),
// unnamed arguments are filled in the
// order they appear in the argument string.
// That means that a required argument cannot
// follow an optional argument since there's
// no way of knowing that the optional argument
// should be skipped.
if (!Arg->Required)
{
NumUnOptArgs++;
}
else
{
if (NumUnOptArgs > 0)
{
m_Ext->ThrowInvalidArg("ArgDesc: "
"Required unnamed arguments "
"cannot follow optional "
"unnamed arguments");
}
}
if (RemainderUsed)
{
m_Ext->ThrowInvalidArg("ArgDesc: "
"Unnamed arguments "
"cannot follow remainder usage");
}
if (Arg->StringRemainder)
{
RemainderUsed = true;
}
}
//
// Check for a short descriptive argument name.
//
if (*Scan == '}' ||
*Scan == ';')
{
// Use a default name so there's always
// some short description.
Arg->DescShort = TypeName;
if (*Scan == ';')
{
Scan++;
}
}
else
{
Arg->DescShort = Scan;
while (*Scan != '}' &&
*Scan != ';')
{
if (!*Scan)
{
m_Ext->ThrowInvalidArg("ArgDesc: "
"Improper short description "
"termination for '%s'",
Arg->Name ?
Arg->Name : "<unnamed>");
}
Scan++;
}
if (*Scan != '}')
{
*Scan++ = 0;
}
}
//
// Check for a long argument description.
//
if (*Scan == '}')
{
Arg->DescLong = NULL;
}
else
{
Arg->DescLong = Scan;
while (*Scan != '}')
{
if (!*Scan)
{
m_Ext->ThrowInvalidArg("ArgDesc: "
"Improper long description "
"termination for '%s'",
Arg->Name ?
Arg->Name : "<unnamed>");
}
Scan++;
}
}
//
// Finished.
// Terminate whatever was the last string
// in the description.
//
if (*Scan != '}')
{
m_Ext->ThrowInvalidArg("ArgDesc: Expecting } at '%s'", Scan);
}
*Scan++ = 0;
}
// Copy temporary array to permanent storage.
if (m_NumArgs)
{
m_Args = new ArgDesc[m_NumArgs];
if (! m_Args)
{
m_Ext->ThrowOutOfMemory();
}
memcpy(m_Args, Args, m_NumArgs * sizeof(m_Args[0]));
}
m_ArgsInitialized = true;
}
void
ExtCommandDesc::ExInitialize(__in ExtExtension* Ext)
{
m_Ext = Ext;
if (!m_ArgsInitialized)
{
try
{
ParseArgDesc();
}
catch(...)
{
DeleteArgs();
throw;
}
}
}
ExtCommandDesc::ArgDesc*
ExtCommandDesc::FindArg(__in PCSTR Name)
{
ArgDesc* Check = m_Args;
for (ULONG i = 0; i < m_NumArgs; i++, Check++)
{
if (Check->Name &&
!strcmp(Name, Check->Name))
{
return Check;
}
}
return NULL;
}
ExtCommandDesc::ArgDesc*
ExtCommandDesc::FindUnnamedArg(__in ULONG Index)
{
ArgDesc* Check = m_Args;
for (ULONG i = 0; i < m_NumArgs; i++, Check++)
{
if (!Check->Name &&
Index-- == 0)
{
return Check;
}
}
return NULL;
}
void
ExtCommandDesc::Transfer(__out ExtCommandDesc** Commands,
__out PULONG LongestName)
{
*Commands = s_Commands;
s_Commands = NULL;
*LongestName = ExtCommandDesc::s_LongestCommandName;
s_LongestCommandName = 0;
}
//----------------------------------------------------------------------------
//
// ExtExtension.
//
//----------------------------------------------------------------------------
HMODULE ExtExtension::s_Module;
char ExtExtension::s_String[2000];
char ExtExtension::s_CircleStringBuffer[2000];
char* ExtExtension::s_CircleString = s_CircleStringBuffer;
ExtExtension::ExtExtension(void)
: m_Advanced("The extension did not initialize properly."),
m_Client("The extension did not initialize properly."),
m_Control("The extension did not initialize properly."),
m_Data("The extension did not initialize properly."),
m_Registers("The extension did not initialize properly."),
m_Symbols("The extension did not initialize properly."),
m_System("The extension did not initialize properly."),
m_Advanced2("The extension requires IDebugAdvanced2."),
m_Advanced3("The extension requires IDebugAdvanced3."),
m_Client2("The extension requires IDebugClient2."),
m_Client3("The extension requires IDebugClient3."),
m_Client4("The extension requires IDebugClient4."),
m_Client5("The extension requires IDebugClient5."),
m_Control2("The extension requires IDebugControl2."),
m_Control3("The extension requires IDebugControl3."),
m_Control4("The extension requires IDebugControl4."),
m_Data2("The extension requires IDebugDataSpaces2."),
m_Data3("The extension requires IDebugDataSpaces3."),
m_Data4("The extension requires IDebugDataSpaces4."),
m_Registers2("The extension requires IDebugRegisters2."),
m_Symbols2("The extension requires IDebugSymbols2."),
m_Symbols3("The extension requires IDebugSymbols3."),
m_System2("The extension requires IDebugSystemObjects2."),
m_System3("The extension requires IDebugSystemObjects3."),
m_System4("The extension requires IDebugSystemObjects4.")
{
m_ExtMajorVersion = 1;
m_ExtMinorVersion = 0;
m_ExtInitFlags = DEBUG_EXTINIT_HAS_COMMAND_HELP;
m_KnownStructs = NULL;
m_ProvidedValues = NULL;
m_ExInitialized = false;
m_OutMask = DEBUG_OUTPUT_NORMAL;
m_CurChar = 0;
m_LeftIndent = 0;
m_AllowWrap = true;
m_TestWrap = 0;
m_CurCommand = NULL;
m_AppendBuffer = NULL;
m_AppendBufferChars = 0;
m_AppendAt = NULL;
}
HRESULT
ExtExtension::Initialize(void)
{
return S_OK;
}
void
ExtExtension::Uninitialize(void)
{
// Empty.
}
void
ExtExtension::OnSessionActive(__in ULONG64 Argument)
{
UNREFERENCED_PARAMETER(Argument);
// Empty.
}
void
ExtExtension::OnSessionInactive(__in ULONG64 Argument)
{
UNREFERENCED_PARAMETER(Argument);
// Empty.
}
void
ExtExtension::OnSessionAccessible(__in ULONG64 Argument)
{
UNREFERENCED_PARAMETER(Argument);
// Empty.
}
void
ExtExtension::OnSessionInaccessible(__in ULONG64 Argument)
{
UNREFERENCED_PARAMETER(Argument);
// Empty.
}
void WINAPIV
ExtExtension::Out(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control->OutputVaList(m_OutMask, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Warn(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control->OutputVaList(DEBUG_OUTPUT_WARNING, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Err(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control->OutputVaList(DEBUG_OUTPUT_ERROR, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Verb(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control->OutputVaList(DEBUG_OUTPUT_VERBOSE, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Out(__in PCWSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control4->OutputVaListWide(m_OutMask, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Warn(__in PCWSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control4->OutputVaListWide(DEBUG_OUTPUT_WARNING, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Err(__in PCWSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control4->OutputVaListWide(DEBUG_OUTPUT_ERROR, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Verb(__in PCWSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control4->OutputVaListWide(DEBUG_OUTPUT_VERBOSE, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Dml(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control->ControlledOutputVaList(DEBUG_OUTCTL_AMBIENT_DML,
m_OutMask, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::DmlWarn(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control->ControlledOutputVaList(DEBUG_OUTCTL_AMBIENT_DML,
DEBUG_OUTPUT_WARNING, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::DmlErr(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control->ControlledOutputVaList(DEBUG_OUTCTL_AMBIENT_DML,
DEBUG_OUTPUT_ERROR, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::DmlVerb(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control->ControlledOutputVaList(DEBUG_OUTCTL_AMBIENT_DML,
DEBUG_OUTPUT_VERBOSE, Format, Args);
va_end(Args);
}
void WINAPIV
ExtExtension::Dml(__in PCWSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control4->ControlledOutputVaListWide(DEBUG_OUTCTL_AMBIENT_DML,
m_OutMask,
Format,
Args);
va_end(Args);
}
void WINAPIV
ExtExtension::DmlWarn(__in PCWSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control4->ControlledOutputVaListWide(DEBUG_OUTCTL_AMBIENT_DML,
DEBUG_OUTPUT_WARNING,
Format,
Args);
va_end(Args);
}
void WINAPIV
ExtExtension::DmlErr(__in PCWSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control4->ControlledOutputVaListWide(DEBUG_OUTCTL_AMBIENT_DML,
DEBUG_OUTPUT_ERROR,
Format,
Args);
va_end(Args);
}
void WINAPIV
ExtExtension::DmlVerb(__in PCWSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
m_Control4->ControlledOutputVaListWide(DEBUG_OUTCTL_AMBIENT_DML,
DEBUG_OUTPUT_VERBOSE,
Format,
Args);
va_end(Args);
}
void
ExtExtension::WrapLine(void)
{
if (m_LeftIndent)
{
m_Control->Output(m_OutMask, "\n%*c", m_LeftIndent, ' ');
}
else
{
m_Control->Output(m_OutMask, "\n");
}
m_CurChar = m_LeftIndent;
}
void
ExtExtension::OutWrapStr(__in PCSTR String)
{
if (m_TestWrap)
{
m_TestWrapChars += strlen(String);
return;
}
while (*String)
{
//
// Collect characters until the end or
// until we run out of output width.
//
PCSTR Scan = String;
PCSTR LastSpace = NULL;
while (*Scan &&
*Scan != '\n' &&
(!m_AllowWrap ||
!LastSpace ||
m_CurChar < m_OutputWidth))
{
if (*Scan == ' ')
{
LastSpace = Scan;
}
m_CurChar++;
Scan++;
}
if (m_AllowWrap &&
LastSpace &&
((*Scan && *Scan != '\n') ||
m_CurChar >= m_OutputWidth))
{
// We ran out of room, so dump output up
// to the last space.
Scan = LastSpace;
}
m_Control->Output(m_OutMask, "%.*s", (int)(Scan - String), String);
if (!*Scan)
{
break;
}
//
// Wrap to the next line.
//
WrapLine();
String = Scan + 1;
while (*String == ' ')
{
String++;
}
}
}
void WINAPIV
ExtExtension::OutWrapVa(__in PCSTR Format,
__in va_list Args)
{
StringCbVPrintf(s_String, sizeof(s_String), Format, Args);
OutWrapStr(s_String);
}
void WINAPIV
ExtExtension::OutWrap(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
OutWrapVa(Format, Args);
va_end(Args);
}
PSTR
ExtExtension::RequestCircleString(__in ULONG Chars)
{
if (Chars > EXT_DIMA(s_CircleStringBuffer))
{
ThrowInvalidArg("Circle string buffer overflow, %u chars", Chars);
}
if ((ULONG_PTR)(s_CircleString - s_CircleStringBuffer) >
EXT_DIMA(s_CircleStringBuffer) - Chars)
{
// String is too long to fit in the remainder, wrap around.
s_CircleString = s_CircleStringBuffer;
}
PSTR Str = s_CircleString;
s_CircleString += Chars;
return Str;
}
PSTR
ExtExtension::CopyCircleString(__in PCSTR Str)
{
PSTR Buf;
ULONG Chars;
Chars = strlen(Str) + 1;
Buf = RequestCircleString(Chars);
memcpy(Buf, Str, Chars * sizeof(*Str));
return Buf;
}
PSTR
ExtExtension::PrintCircleStringVa(__in PCSTR Format,
__in va_list Args)
{
StringCbVPrintf(s_String, sizeof(s_String), Format, Args);
return CopyCircleString(s_String);
}
PSTR WINAPIV
ExtExtension::PrintCircleString(__in PCSTR Format,
...)
{
PSTR Str;
va_list Args;
va_start(Args, Format);
Str = PrintCircleStringVa(Format, Args);
va_end(Args);
return Str;
}
void
ExtExtension::SetAppendBuffer(__in_ecount(BufferChars) PSTR Buffer,
__in ULONG BufferChars)
{
m_AppendBuffer = Buffer;
m_AppendBufferChars = BufferChars;
m_AppendAt = Buffer;
}
void
ExtExtension::AppendBufferString(__in PCSTR Str)
{
ULONG Chars;
Chars = strlen(Str) + 1;
if (Chars > m_AppendBufferChars ||
(ULONG_PTR)(m_AppendAt - m_AppendBuffer) > m_AppendBufferChars - Chars)
{
ThrowStatus(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW),
"Append string overflowed");
}
memcpy(m_AppendAt, Str, Chars * sizeof(*Str));
// Position next append where it will overwrite the terminator
// to continue the existing string.
m_AppendAt += Chars - 1;
}
void
ExtExtension::AppendStringVa(__in PCSTR Format,
__in va_list Args)
{
if (m_AppendBuffer >= s_String &&
m_AppendBuffer <= s_String + (EXT_DIMA(s_String) - 1))
{
ThrowInvalidArg("Append string buffer cannot use s_String");
}
StringCbVPrintf(s_String, sizeof(s_String), Format, Args);
AppendBufferString(s_String);
}
void WINAPIV
ExtExtension::AppendString(__in PCSTR Format,
...)
{
va_list Args;
va_start(Args, Format);
AppendStringVa(Format, Args);
va_end(Args);
}
void
ExtExtension::SetCallStatus(__in HRESULT Status)
{
// If an error has already been saved don't override it.
if (!FAILED(m_CallStatus))
{
m_CallStatus = Status;
}
}
ULONG
ExtExtension::GetCachedSymbolTypeId(__inout PULONG64 Cookie,
__in PCSTR Symbol,
__out PULONG64 ModBase)
{
HRESULT Status;
DEBUG_CACHED_SYMBOL_INFO Info;
//
// Check for an existing cache entry.
//
if ((Status = m_Advanced2->
Request(DEBUG_REQUEST_GET_CACHED_SYMBOL_INFO,
Cookie,
sizeof(*Cookie),
&Info,
sizeof(Info),
NULL)) == S_OK)
{
*ModBase = Info.ModBase;
return Info.Id;
}
//
// No entry in cache, find the data the hard way.
//
ZeroMemory(&Info, sizeof(Info));
if ((Status = m_Symbols->
GetSymbolTypeId(Symbol,
&Info.Id,
&Info.ModBase)) != S_OK)
{
ThrowStatus(Status, "Unable to get type ID of '%s'",
Symbol);
}
*ModBase = Info.ModBase;
//
// Add recovered info to cache.
// We don't care if this fails as
// cache addition is not required,
// we just zero the cookie.
//
if (m_Advanced2->
Request(DEBUG_REQUEST_ADD_CACHED_SYMBOL_INFO,
&Info,
sizeof(Info),
Cookie,
sizeof(*Cookie),
NULL) != S_OK)
{
*Cookie = 0;
}
return Info.Id;
}
ULONG
ExtExtension::GetCachedFieldOffset(__inout PULONG64 Cookie,
__in PCSTR Type,
__in PCSTR Field,
__out_opt PULONG64 TypeModBase,
__out_opt PULONG TypeId)
{
HRESULT Status;
DEBUG_CACHED_SYMBOL_INFO Info;
//
// Check for an existing cache entry.
//
if ((Status = m_Advanced2->
Request(DEBUG_REQUEST_GET_CACHED_SYMBOL_INFO,
Cookie,
sizeof(*Cookie),
&Info,
sizeof(Info),
NULL)) == S_OK)
{
if (TypeModBase)
{
*TypeModBase = Info.ModBase;
}
if (TypeId)
{
*TypeId = Info.Id;
}
return Info.Arg3;
}
//
// No entry in cache, find the data the hard way.
//
ZeroMemory(&Info, sizeof(Info));
if ((Status = m_Symbols->
GetSymbolTypeId(Type,
&Info.Id,
&Info.ModBase)) != S_OK)
{
ThrowStatus(Status, "Unable to get type ID of '%s'",
Type);
}
if ((Status = m_Symbols->
GetFieldOffset(Info.ModBase,
Info.Id,
Field,
&Info.Arg3)) != S_OK)
{
ThrowStatus(Status, "Unable to get field '%s.%s'",
Type, Field);
}
if (TypeModBase)
{
*TypeModBase = Info.ModBase;
}
if (TypeId)
{
*TypeId = Info.Id;
}
//
// Add recovered info to cache.
// We don't care if this fails as
// cache addition is not required,
// we just zero the cookie.
//
if (m_Advanced2->
Request(DEBUG_REQUEST_ADD_CACHED_SYMBOL_INFO,
&Info,
sizeof(Info),
Cookie,
sizeof(*Cookie),
NULL) != S_OK)
{
*Cookie = 0;
}
return Info.Arg3;
}
bool
ExtExtension::GetCachedSymbolInfo(__in ULONG64 Cookie,
__out PDEBUG_CACHED_SYMBOL_INFO Info)
{
HRESULT Status;
if ((Status = m_Advanced2->
Request(DEBUG_REQUEST_GET_CACHED_SYMBOL_INFO,
&Cookie,
sizeof(Cookie),
Info,
sizeof(*Info),
NULL)) == S_OK)
{
return true;
}
return false;
}
bool
ExtExtension::AddCachedSymbolInfo(__in PDEBUG_CACHED_SYMBOL_INFO Info,
__in bool ThrowFailure,
__out PULONG64 Cookie)
{
HRESULT Status;
if ((Status = m_Advanced2->
Request(DEBUG_REQUEST_ADD_CACHED_SYMBOL_INFO,
Info,
sizeof(*Info),
Cookie,
sizeof(*Cookie),
NULL)) == S_OK)
{
return true;
}
if (ThrowFailure)
{
ThrowStatus(Status, "Unable to cache symbol info");
}
return false;
}
void
ExtExtension::GetModuleImagehlpInfo(__in ULONG64 ModBase,
__out struct _IMAGEHLP_MODULEW64* Info)
{
HRESULT Status;
ZeroMemory(Info, sizeof(*Info));
Info->SizeOfStruct = sizeof(*Info);
if ((Status = m_Advanced2->
GetSymbolInformation(DEBUG_SYMINFO_IMAGEHLP_MODULEW64,
ModBase,
0,
Info,
Info->SizeOfStruct,
NULL,
NULL,
0,
NULL)) != S_OK)
{
ThrowStatus(Status, "Unable to retrieve module info");
}
}
bool
ExtExtension::ModuleHasGlobalSymbols(__in ULONG64 ModBase)
{
IMAGEHLP_MODULEW64 Info;
GetModuleImagehlpInfo(ModBase, &Info);
return Info.GlobalSymbols != FALSE;
}
bool
ExtExtension::ModuleHasTypeInfo(__in ULONG64 ModBase)
{
IMAGEHLP_MODULEW64 Info;
GetModuleImagehlpInfo(ModBase, &Info);
return Info.TypeInfo != FALSE;
}
PCSTR
ExtExtension::GetUnnamedArgStr(__in ULONG Index)
{
if (Index >= m_NumUnnamedArgs)
{
ThrowInvalidArg("Invalid unnamed argument index %u, only given %u",
Index + 1, m_NumUnnamedArgs);
}
if (!m_Args[Index].StrVal)
{
ThrowInvalidArg("Unnamed argument index %u is not a string",
Index + 1);
}
return m_Args[Index].StrVal;
}
ULONG64
ExtExtension::GetUnnamedArgU64(__in ULONG Index)
{
if (Index >= m_NumUnnamedArgs)
{
ThrowInvalidArg("Invalid unnamed argument index %u, only given %u",
Index + 1, m_NumUnnamedArgs);
}
if (m_Args[Index].StrVal)
{
ThrowInvalidArg("Unnamed argument index %u is not a number",
Index + 1);
}
return m_Args[Index].NumVal;
}
PCSTR
ExtExtension::GetArgStr(__in PCSTR Name,
__in bool Required)
{
ArgVal* Arg = FindArg(Name, Required);
if (!Arg)
{
return NULL;
}
if (!Arg->StrVal)
{
ThrowInvalidArg("Argument /%s is not a string",
Name);
}
return Arg->StrVal;
}
ULONG64
ExtExtension::GetArgU64(__in PCSTR Name,
__in bool Required)
{
ArgVal* Arg = FindArg(Name, Required);
if (!Arg)
{
return 0;
}
if (Arg->StrVal)
{
ThrowInvalidArg("Argument /%s is not a number",
Name);
}
return Arg->NumVal;
}
bool
ExtExtension::SetUnnamedArg(__in ULONG Index,
__in_opt PCSTR StrArg,
__in ULONG64 NumArg,
__in bool OnlyIfUnset)
{
ExtCommandDesc::ArgDesc* Check = m_CurCommand->FindUnnamedArg(Index);
if (!Check)
{
ThrowInvalidArg("Unnamed argument index %u too large", Index);
}
ArgVal* Val = NULL;
if (HasUnnamedArg(Index))
{
if (OnlyIfUnset)
{
return false;
}
Val = &m_Args[Index];
}
SetRawArgVal(Check, Val, true, StrArg, false, NumArg);
return true;
}
bool
ExtExtension::SetArg(__in PCSTR Name,
__in_opt PCSTR StrArg,
__in ULONG64 NumArg,
__in bool OnlyIfUnset)
{
ExtCommandDesc::ArgDesc* Check = m_CurCommand->FindArg(Name);
if (!Check)
{
ThrowInvalidArg("No argument named '%s'", Name);
}
ArgVal* Val = FindArg(Name, false);
if (Val)
{
if (OnlyIfUnset)
{
return false;
}
}
SetRawArgVal(Check, Val, true, StrArg, false, NumArg);
return true;
}
PCSTR
ExtExtension::GetExpr64(__in PCSTR Str,
__in bool Signed,
__in ULONG64 Limit,
__out PULONG64 Val)
{
HRESULT Status;
DEBUG_VALUE FullVal;
ULONG EndIdx;
if ((Status = m_Control->
Evaluate(Str, DEBUG_VALUE_INT64, &FullVal, &EndIdx)) != S_OK)
{
ExtStatusException Ex(Status);
Ex.PrintMessage(s_String, EXT_DIMA(s_String),
"Unable to evaluate expression '%s'", Str);
throw Ex;
}
if ((!Signed &&
FullVal.I64 > Limit) ||
(Signed &&
((LONG64)FullVal.I64 < -(LONG64)Limit ||
(LONG64)FullVal.I64 > (LONG64)Limit)))
{
ThrowInvalidArg("Result overflow in expression '%s'", Str);
}
*Val = FullVal.I64;
Str += EndIdx;
while (IsSpace(*Str))
{
Str++;
}
return Str;
}
void WINAPIV
ExtExtension::ThrowInvalidArg(__in PCSTR Format,
...)
{
ExtInvalidArgumentException Ex("");
va_list Args;
va_start(Args, Format);
Ex.PrintMessageVa(s_String, EXT_DIMA(s_String),
Format, Args);
va_end(Args);
throw Ex;
}
void WINAPIV
ExtExtension::ThrowRemote(__in HRESULT Status,
__in PCSTR Format,
...)
{
ExtRemoteException Ex(Status, "");
va_list Args;
va_start(Args, Format);
Ex.PrintMessageVa(s_String, EXT_DIMA(s_String),
Format, Args);
va_end(Args);
throw Ex;
}
void WINAPIV
ExtExtension::ThrowStatus(__in HRESULT Status,
__in PCSTR Format,
...)
{
ExtStatusException Ex(Status);
va_list Args;
va_start(Args, Format);
Ex.PrintMessageVa(s_String, EXT_DIMA(s_String),
Format, Args);
va_end(Args);
throw Ex;
}
void
ExtExtension::ExInitialize(void)
{
if (m_ExInitialized)
{
return;
}
m_ExInitialized = true;
//
// Special initialization pass that
// is done when output can be produced
// and exceptions thrown.
// This pass allows verbose feedback on
// errors, as opposed to the DLL-load Initialize().
//
}
#define REQ_IF(_If, _Member) \
if ((Status = Start->QueryInterface(__uuidof(_If), \
(PVOID*)&_Member)) != S_OK) \
{ \
goto Exit; \
}
#define OPT_IF(_If, _Member) \
if ((Status = Start->QueryInterface(__uuidof(_If), \
(PVOID*)&_Member)) != S_OK) \
{ \
_Member.Set(NULL); \
}
HRESULT
ExtExtension::Query(__in PDEBUG_CLIENT Start)
{
HRESULT Status;
// We don't support nested queries.
if (*&m_Advanced != NULL)
{
return E_UNEXPECTED;
}
m_ArgCopy = NULL;
REQ_IF(IDebugAdvanced, m_Advanced);
REQ_IF(IDebugClient, m_Client);
REQ_IF(IDebugControl, m_Control);
REQ_IF(IDebugDataSpaces, m_Data);
REQ_IF(IDebugRegisters, m_Registers);
REQ_IF(IDebugSymbols, m_Symbols);
REQ_IF(IDebugSystemObjects, m_System);
OPT_IF(IDebugAdvanced2, m_Advanced2);
OPT_IF(IDebugAdvanced3, m_Advanced3);
OPT_IF(IDebugClient2, m_Client2);
OPT_IF(IDebugClient3, m_Client3);
OPT_IF(IDebugClient4, m_Client4);
OPT_IF(IDebugClient5, m_Client5);
OPT_IF(IDebugControl2, m_Control2);
OPT_IF(IDebugControl3, m_Control3);
OPT_IF(IDebugControl4, m_Control4);
OPT_IF(IDebugDataSpaces2, m_Data2);
OPT_IF(IDebugDataSpaces3, m_Data3);
OPT_IF(IDebugDataSpaces4, m_Data4);
OPT_IF(IDebugRegisters2, m_Registers2);
OPT_IF(IDebugSymbols2, m_Symbols2);
OPT_IF(IDebugSymbols3, m_Symbols3);
OPT_IF(IDebugSystemObjects2, m_System2);
OPT_IF(IDebugSystemObjects3, m_System3);
OPT_IF(IDebugSystemObjects4, m_System4);
// If this isn't a dump target GetDumpFormatFlags
// will fail, so just zero the flags. People
// checking should check the class and qualifier
// first so having them zeroed is not a problem.
if (!m_Control2.IsSet() ||
m_Control2->GetDumpFormatFlags(&m_DumpFormatFlags) != S_OK)
{
m_DumpFormatFlags = 0;
}
if ((Status = m_Control->
GetDebuggeeType(&m_DebuggeeClass,
&m_DebuggeeQual)) != S_OK ||
(Status = m_Client->
GetOutputWidth(&m_OutputWidth)) != S_OK ||
(Status = m_Control->
GetActualProcessorType(&m_ActualMachine)) != S_OK ||
(Status = m_Control->
GetEffectiveProcessorType(&m_Machine)) != S_OK ||
(Status = m_Control->
GetPageSize(&m_PageSize)) != S_OK ||
// IsPointer64Bit check must be last as Status
// is used to compute the pointer size below.
FAILED(Status = m_Control->
IsPointer64Bit()))
{
goto Exit;
}
if (Status == S_OK)
{
m_PtrSize = 8;
m_OffsetMask = 0xffffffffffffffffUI64;
}
else
{
m_PtrSize = 4;
m_OffsetMask = 0xffffffffUI64;
}
// User targets may fail a processor count request.
if (m_Control->GetNumberProcessors(&m_NumProcessors) != S_OK)
{
m_NumProcessors = 0;
}
ExtensionApis.nSize = sizeof(ExtensionApis);
Status = m_Control->GetWindbgExtensionApis64(&ExtensionApis);
if (Status == RPC_E_CALL_REJECTED)
{
// GetWindbgExtensionApis64 is not remotable,
// and this particular failure means we
// are running remotely. Go on without any
// wdbgexts support.
ZeroMemory(&ExtensionApis, sizeof(ExtensionApis));
m_IsRemote = true;
Status = S_OK;
}
else
{
m_IsRemote = false;
}
RefreshOutputCallbackFlags();
Exit:
if (Status != S_OK)
{
if (*&m_Control != NULL)
{
m_Control->Output(DEBUG_OUTPUT_ERROR,
"ERROR: Unable to query interfaces, 0x%08x\n",
Status);
}
Release();
}
return Status;
}
void
ExtExtension::Release(void)
{
EXT_RELEASE(m_Advanced);
EXT_RELEASE(m_Client);
EXT_RELEASE(m_Control);
EXT_RELEASE(m_Data);
EXT_RELEASE(m_Registers);
EXT_RELEASE(m_Symbols);
EXT_RELEASE(m_System);
EXT_RELEASE(m_Advanced2);
EXT_RELEASE(m_Advanced3);
EXT_RELEASE(m_Client2);
EXT_RELEASE(m_Client3);
EXT_RELEASE(m_Client4);
EXT_RELEASE(m_Client5);
EXT_RELEASE(m_Control2);
EXT_RELEASE(m_Control3);
EXT_RELEASE(m_Control4);
EXT_RELEASE(m_Data2);
EXT_RELEASE(m_Data3);
EXT_RELEASE(m_Data4);
EXT_RELEASE(m_Registers2);
EXT_RELEASE(m_Symbols2);
EXT_RELEASE(m_Symbols3);
EXT_RELEASE(m_System2);
EXT_RELEASE(m_System3);
EXT_RELEASE(m_System4);
ZeroMemory(&ExtensionApis, sizeof(ExtensionApis));
free(m_ArgCopy);
m_ArgCopy = NULL;
m_CurCommand = NULL;
}
HRESULT
ExtExtension::CallCommandMethod(__in ExtCommandDesc* Desc,
__in_opt PCSTR Args)
{
HRESULT Status;
try
{
ExInitialize();
Desc->ExInitialize(this);
ParseArgs(Desc, Args);
m_CallStatus = S_OK;
// Release NULLs this out.
m_CurCommand = Desc;
(this->*Desc->m_Method)();
Status = m_CallStatus;
}
catch(ExtInterruptException Ex)
{
m_Control->Output(DEBUG_OUTPUT_ERROR, "!%s: %s.\n",
Desc->m_Name, Ex.GetMessage());
Status = Ex.GetStatus();
}
catch(ExtException Ex)
{
if (Ex.GetMessage())
{
if (FAILED(Ex.GetStatus()))
{
m_Control->
Output(DEBUG_OUTPUT_ERROR,
"ERROR: !%s: extension exception "
"0x%08x.\n \"%s\"\n",
Desc->m_Name, Ex.GetStatus(), Ex.GetMessage());
}
else
{
m_Control->Output(DEBUG_OUTPUT_NORMAL, "!%s: %s\n",
Desc->m_Name, Ex.GetMessage());
}
}
else if (Ex.GetStatus() != DEBUG_EXTENSION_CONTINUE_SEARCH &&
Ex.GetStatus() != DEBUG_EXTENSION_RELOAD_EXTENSION &&
FAILED(Ex.GetStatus()))
{
m_Control->
Output(DEBUG_OUTPUT_ERROR,
"ERROR: !%s: extension exception 0x%08x.\n",
Desc->m_Name, Ex.GetStatus());
}
Status = Ex.GetStatus();
}
return Status;
}
HRESULT
ExtExtension::CallCommand(__in ExtCommandDesc* Desc,
__in PDEBUG_CLIENT Client,
__in_opt PCSTR Args)
{
HRESULT Status = Query(Client);
if (Status != S_OK)
{
return Status;
}
// Use a hard SEH try/finally to guarantee that
// Release always occurs.
__try
{
Status = CallCommandMethod(Desc, Args);
}
__finally
{
Release();
}
return Status;
}
HRESULT
ExtExtension::CallKnownStructMethod(__in ExtKnownStruct* Struct,
__in ULONG Flags,
__in ULONG64 Offset,
__out_ecount(*BufferChars) PSTR Buffer,
__inout PULONG BufferChars)
{
HRESULT Status;
try
{
ExInitialize();
SetAppendBuffer(Buffer, *BufferChars);
m_CallStatus = S_OK;
(this->*Struct->Method)(Struct->TypeName, Flags, Offset);
Status = m_CallStatus;
}
catch(ExtException Ex)
{
Status = Ex.GetStatus();
}
return Status;
}
HRESULT
ExtExtension::CallKnownStruct(__in PDEBUG_CLIENT Client,
__in ExtKnownStruct* Struct,
__in ULONG Flags,
__in ULONG64 Offset,
__out_ecount(*BufferChars) PSTR Buffer,
__inout PULONG BufferChars)
{
HRESULT Status = Query(Client);
if (Status != S_OK)
{
return Status;
}
// Use a hard SEH try/finally to guarantee that
// Release always occurs.
__try
{
Status = CallKnownStructMethod(Struct, Flags, Offset,
Buffer, BufferChars);
}
__finally
{
Release();
}
return Status;
}
HRESULT
ExtExtension::HandleKnownStruct(__in PDEBUG_CLIENT Client,
__in ULONG Flags,
__in ULONG64 Offset,
__in_opt PCSTR TypeName,
__out_ecount_opt(*BufferChars) PSTR Buffer,
__inout_opt PULONG BufferChars)
{
HRESULT Status;
ExtKnownStruct* Struct = m_KnownStructs;
if (Flags == DEBUG_KNOWN_STRUCT_GET_NAMES &&
Buffer != NULL &&
*BufferChars > 0)
{
ULONG CharsNeeded;
//
// Return names of known structs packed in
// the output buffer.
//
// Save a character for the double terminator.
(*BufferChars)--;
CharsNeeded = 1;
Status = S_OK;
while (Struct && Struct->TypeName)
{
ULONG Chars = strlen(Struct->TypeName) + 1;
CharsNeeded += Chars;
if (Status != S_OK || *BufferChars < Chars)
{
Status = S_FALSE;
}
else
{
memcpy(Buffer, Struct->TypeName, Chars * sizeof(*Buffer));
Buffer += Chars;
(*BufferChars) -= Chars;
}
Struct++;
}
*Buffer = 0;
*BufferChars = CharsNeeded;
}
else if (Flags == DEBUG_KNOWN_STRUCT_GET_SINGLE_LINE_OUTPUT &&
Buffer != NULL &&
BufferChars > 0)
{
//
// Dispatch request to method.
//
Status = E_NOINTERFACE;
while (Struct && Struct->TypeName)
{
if (!strcmp(TypeName, Struct->TypeName))
{
Status = CallKnownStruct(Client, Struct, Flags, Offset,
Buffer, BufferChars);
break;
}
Struct++;
}
}
else if (Flags == DEBUG_KNOWN_STRUCT_SUPPRESS_TYPE_NAME)
{
//
// Determine if formatting method suppresses the type name.
//
Status = E_NOINTERFACE;
while (Struct && Struct->TypeName)
{
if (!strcmp(TypeName, Struct->TypeName))
{
Status = Struct->SuppressesTypeName ? S_OK : S_FALSE;
break;
}
Struct++;
}
}
else
{
Status = E_INVALIDARG;
}
return Status;
}
HRESULT
ExtExtension::HandleQueryValueNames(__in PDEBUG_CLIENT Client,
__in ULONG Flags,
__out_ecount(BufferChars) PWSTR Buffer,
__in ULONG BufferChars,
__out PULONG BufferNeeded)
{
HRESULT Status;
UNREFERENCED_PARAMETER(Client);
UNREFERENCED_PARAMETER(Flags);
if (Buffer == NULL ||
BufferChars < 1)
{
return E_INVALIDARG;
}
ExtProvidedValue* ExtVal = m_ProvidedValues;
ULONG CharsNeeded;
//
// Return names of values packed in
// the output buffer.
//
// Save a character for the double terminator.
BufferChars--;
CharsNeeded = 1;
Status = S_OK;
while (ExtVal && ExtVal->ValueName)
{
ULONG Chars = wcslen(ExtVal->ValueName) + 1;
CharsNeeded += Chars;
if (Status != S_OK || BufferChars < Chars)
{
Status = S_FALSE;
}
else
{
memcpy(Buffer, ExtVal->ValueName, Chars * sizeof(*Buffer));
Buffer += Chars;
BufferChars -= Chars;
}
ExtVal++;
}
*Buffer = 0;
*BufferNeeded = CharsNeeded;
return Status;
}
HRESULT
ExtExtension::CallProvideValueMethod(__in ExtProvidedValue* ExtVal,
__in ULONG Flags,
__out PULONG64 Value,
__out PULONG64 TypeModBase,
__out PULONG TypeId,
__out PULONG TypeFlags)
{
HRESULT Status;
try
{
ExInitialize();
m_CallStatus = S_OK;
(this->*ExtVal->Method)(Flags, ExtVal->ValueName,
Value, TypeModBase, TypeId, TypeFlags);
Status = m_CallStatus;
}
catch(ExtException Ex)
{
Status = Ex.GetStatus();
}
return Status;
}
HRESULT
ExtExtension::HandleProvideValue(__in PDEBUG_CLIENT Client,
__in ULONG Flags,
__in PCWSTR Name,
__out PULONG64 Value,
__out PULONG64 TypeModBase,
__out PULONG TypeId,
__out PULONG TypeFlags)
{
HRESULT Status = Query(Client);
if (Status != S_OK)
{
return Status;
}
// Use a hard SEH try/finally to guarantee that
// Release always occurs.
__try
{
ExtProvidedValue* ExtVal = m_ProvidedValues;
while (ExtVal && ExtVal->ValueName)
{
if (wcscmp(Name, ExtVal->ValueName) == 0)
{
break;
}
ExtVal++;
}
if (!ExtVal)
{
Status = E_UNEXPECTED;
}
else
{
Status = CallProvideValueMethod(ExtVal, Flags,
Value, TypeModBase,
TypeId, TypeFlags);
}
}
__finally
{
Release();
}
return Status;
}
ExtExtension::ArgVal*
ExtExtension::FindArg(__in PCSTR Name,
__in bool Required)
{
ULONG i;
for (i = m_FirstNamedArg; i < m_FirstNamedArg + m_NumNamedArgs; i++)
{
if (!strcmp(Name, m_Args[i].Name))
{
return &m_Args[i];
}
}
if (Required)
{
ThrowInvalidArg("No argument /%s was provided", Name);
}
return NULL;
}
PCSTR
ExtExtension::SetRawArgVal(__in ExtCommandDesc::ArgDesc* Check,
__in_opt ArgVal* Val,
__in bool ExplicitVal,
__in_opt PCSTR StrVal,
__in bool StrWritable,
__in ULONG64 NumVal)
{
if (!Val)
{
if (Check->Name)
{
if (m_NumNamedArgs + m_FirstNamedArg >= EXT_DIMA(m_Args))
{
ThrowInvalidArg("Argument overflow on '%s'",
Check->Name);
}
Val = &m_Args[m_NumNamedArgs + m_FirstNamedArg];
m_NumArgs++;
m_NumNamedArgs++;
}
else
{
Val = &m_Args[m_NumUnnamedArgs];
m_NumArgs++;
m_NumUnnamedArgs++;
}
}
Check->Present = true;
Val->Name = Check->Name;
Val->StrVal = NULL;
Val->NumVal = 0;
if (Check->Boolean)
{
return StrVal;
}
if (StrVal)
{
while (IsSpace(*StrVal))
{
StrVal++;
}
if (!*StrVal &&
!ExplicitVal)
{
ThrowInvalidArg("Missing value for argument '%s'",
Check->Name);
}
if (Check->String)
{
Val->StrVal = StrVal;
if (Check->StringRemainder)
{
StrVal += strlen(StrVal);
}
else
{
while (*StrVal && !IsSpace(*StrVal))
{
StrVal++;
}
}
}
else if (Check->Expression)
{
PSTR StrEnd = NULL;
char StrEndChar = 0;
if (Check->ExpressionDelimited)
{
StrEnd = (PSTR)StrVal;
while (*StrEnd && !IsSpace(*StrEnd))
{
StrEnd++;
}
if (IsSpace(*StrEnd))
{
//
// We found some trailing text so we need
// to force a terminator to delimit the
// expression. We can only do this if
// we make a copy of the string or have
// a writable string. As any case where a
// non-writable string is passed in involves
// a caller setting an argument explicitly they
// can provide a properly-terminated expression,
// so don't support copying.
//
if (!StrWritable)
{
ThrowInvalidArg("Delimited expressions can "
"only be parsed from extension "
"command arguments");
}
StrEndChar = *StrEnd;
*StrEnd = 0;
}
else
{
// No trailing text so no need to force
// termination.
StrEnd = NULL;
}
}
StrVal = GetExpr64(StrVal,
Check->ExpressionSigned != 0,
(0xffffffffffffffffUI64 >>
(64 - Check->ExpressionBits)),
&Val->NumVal);
if (StrEnd)
{
*StrEnd = StrEndChar;
}
}
}
else if (Check->String)
{
ThrowInvalidArg("Missing value for argument '%s'",
Check->Name);
}
else
{
Val->NumVal = NumVal;
}
return StrVal;
}
void
ExtExtension::ParseArgs(__in ExtCommandDesc* Desc,
__in_opt PCSTR Args)
{
if (!Args)
{
Args = "";
}
m_RawArgStr = Args;
m_NumArgs = 0;
m_NumNamedArgs = 0;
m_NumUnnamedArgs = 0;
m_FirstNamedArg = Desc->m_NumUnnamedArgs;
//
// First make a copy of the argument string as
// we will need to chop it up when parsing.
// Release() automatically cleans this up.
//
m_ArgCopy = _strdup(Args);
if (!m_ArgCopy)
{
ThrowOutOfMemory();
}
if (Desc->m_CustomArgParsing)
{
return;
}
PSTR Scan = m_ArgCopy;
bool ImplicitNamedArg = false;
ULONG i;
ExtCommandDesc::ArgDesc* Check;
Check = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Check++)
{
Check->Present = false;
}
for (;;)
{
while (IsSpace(*Scan))
{
ImplicitNamedArg = false;
Scan++;
}
if (!*Scan)
{
break;
}
if (ImplicitNamedArg ||
strchr(Desc->m_OptionChars, *Scan) != NULL)
{
//
// Named argument. Collect name and
// see if this is a valid argument.
//
if (!ImplicitNamedArg)
{
Scan++;
// If /? is given at any point immediately
// go help for the command and exit.
if (*Scan == '?' &&
(!*(Scan + 1) || IsSpace(*(Scan + 1))))
{
HelpCommand(Desc);
throw ExtStatusException(S_OK);
}
}
PSTR Start = Scan++;
while (*Scan && !IsSpace(*Scan))
{
Scan++;
}
char Save = *Scan;
*Scan = 0;
//
// First check for a full name match.
//
if (!ImplicitNamedArg)
{
Check = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Check++)
{
if (!Check->Name)
{
continue;
}
if (!strcmp(Start, Check->Name))
{
break;
}
}
}
else
{
i = Desc->m_NumArgs;
}
if (i >= Desc->m_NumArgs)
{
//
// Didn't find it with a full name match,
// so check for a single-character match.
// This is only allowed for single-character
// boolean options.
//
ImplicitNamedArg = false;
Check = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Check++)
{
if (!Check->Name ||
!Check->Boolean)
{
continue;
}
if (*Start == Check->Name[0] &&
!Check->Name[1])
{
// Multiple single-character options
// can be combined with a single slash,
// so the next character should be
// checked as a named option.
ImplicitNamedArg = true;
break;
}
}
}
if (i >= Desc->m_NumArgs)
{
ThrowInvalidArg("Unrecognized argument '%s'",
Start);
}
//
// Found the argument. Validate it.
//
if (Check->Present)
{
ThrowInvalidArg("Duplicate argument '%s'",
Start);
}
//
// Argument is valid, fix up the scan string
// and move to value processing.
//
*Scan = Save;
if (ImplicitNamedArg)
{
Scan = Start + 1;
}
}
else
{
//
// Unnamed argument.
// Find the n'th unnamed argument description
// and use it.
//
Check = Desc->FindUnnamedArg(m_NumUnnamedArgs);
if (! Check)
{
ThrowInvalidArg("Extra unnamed argument at '%s'",
Scan);
}
}
//
// We have an argument description, so
// look for any appropriate value.
//
Scan = (PSTR)SetRawArgVal(Check, NULL, false, Scan, true, 0);
if (Check->String && *Scan)
{
*Scan++ = 0;
}
}
//
// Fill in default values where needed.
//
Check = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Check++)
{
if (!Check->Present &&
Check->Default)
{
SetRawArgVal(Check, NULL, true, Check->Default, false, 0);
}
}
//
// Verify that all required arguments are present.
//
ULONG NumUnPresent = 0;
Check = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Check++)
{
if (!Check->Name)
{
NumUnPresent++;
}
if (Check->Required &&
!Check->Present)
{
if (Check->Name)
{
ThrowInvalidArg("Missing required argument '%s'",
Check->Name);
}
else if (Check->DescShort)
{
ThrowInvalidArg("Missing required argument '<%s>'",
Check->DescShort);
}
else
{
ThrowInvalidArg("Missing unnamed argument %u",
NumUnPresent);
}
}
}
}
void
ExtExtension::OutCommandArg(__in ExtCommandDesc::ArgDesc* Arg,
__in bool Separate)
{
if (Arg->Name)
{
if (Separate)
{
OutWrapStr("/");
}
OutWrapStr(Arg->Name);
if (!Arg->Boolean)
{
OutWrapStr(" ");
}
}
if (!Arg->Boolean)
{
OutWrap("<%s>", Arg->DescShort);
}
}
void
ExtExtension::HelpCommandArgsSummary(__in ExtCommandDesc* Desc)
{
ULONG i;
ExtCommandDesc::ArgDesc* Arg;
bool Hit;
if (Desc->m_CustomArgDescShort)
{
OutWrapStr(Desc->m_CustomArgDescShort);
return;
}
//
// In order to try and make things pretty we make
// several passes over the arguments.
//
//
// Display all optional single-char booleans as a collection.
//
Hit = false;
Arg = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Arg++)
{
if (Arg->Boolean && !Arg->Required && !Arg->Name[1])
{
if (!Hit)
{
OutWrapStr(" [/");
Hit = true;
AllowWrap(false);
}
OutWrapStr(Arg->Name);
}
}
if (Hit)
{
OutWrapStr("]");
AllowWrap(true);
}
//
// Display all optional multi-char booleans.
//
Arg = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Arg++)
{
if (Arg->Boolean && !Arg->Required && Arg->Name[1])
{
OutWrap(" [/%s]", Arg->Name);
}
}
//
// Display all required single-char booleans as a collection.
//
Hit = false;
Arg = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Arg++)
{
if (Arg->Boolean && Arg->Required && !Arg->Name[1])
{
if (!Hit)
{
OutWrapStr(" /");
Hit = true;
AllowWrap(false);
}
OutWrapStr(Arg->Name);
}
}
AllowWrap(true);
//
// Display all required multi-char booleans.
//
Arg = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Arg++)
{
if (Arg->Boolean && Arg->Required && Arg->Name[1])
{
OutWrap(" /%s", Arg->Name);
}
}
//
// Display all optional named non-booleans.
//
Arg = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Arg++)
{
if (!Arg->Boolean && !Arg->Required && Arg->Name)
{
TestWrap(true);
OutCommandArg(Arg, true);
TestWrap(false);
if (!DemandWrap(m_TestWrapChars + 3))
{
OutWrapStr(" ");
}
OutWrapStr("[");
AllowWrap(false);
OutCommandArg(Arg, true);
OutWrapStr("]");
AllowWrap(true);
}
}
//
// Display all required named non-booleans.
//
Arg = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Arg++)
{
if (!Arg->Boolean && Arg->Required && Arg->Name)
{
TestWrap(true);
OutCommandArg(Arg, true);
TestWrap(false);
if (!DemandWrap(m_TestWrapChars + 1))
{
OutWrapStr(" ");
}
AllowWrap(false);
OutCommandArg(Arg, true);
AllowWrap(true);
}
}
//
// Display all unnamed arguments. As any optional
// unnamed argument must be last we can handle both
// optional and required in a single pass.
//
Arg = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++, Arg++)
{
if (!Arg->Boolean && !Arg->Name)
{
TestWrap(true);
OutCommandArg(Arg, true);
TestWrap(false);
if (!Arg->Required)
{
m_TestWrapChars += 2;
}
if (!DemandWrap(m_TestWrapChars + 1))
{
OutWrapStr(" ");
}
if (!Arg->Required)
{
OutWrapStr("[");
}
AllowWrap(false);
OutCommandArg(Arg, true);
if (!Arg->Required)
{
OutWrapStr("]");
}
AllowWrap(true);
}
}
}
void
ExtExtension::HelpCommand(__in ExtCommandDesc* Desc)
{
ULONG i;
Desc->ExInitialize(this);
m_CurChar = 0;
OutWrap("!%s", Desc->m_Name);
m_LeftIndent = m_CurChar + 1;
HelpCommandArgsSummary(Desc);
m_LeftIndent = 0;
OutWrapStr("\n");
if (Desc->m_CustomArgDescLong)
{
OutWrapStr(" ");
m_LeftIndent = m_CurChar;
OutWrapStr(Desc->m_CustomArgDescLong);
m_LeftIndent = 0;
OutWrapStr("\n");
}
else
{
ExtCommandDesc::ArgDesc* Arg = Desc->m_Args;
for (i = 0; i < Desc->m_NumArgs; i++)
{
OutWrapStr(" ");
OutCommandArg(Arg, true);
if (Arg->DescLong)
{
OutWrapStr(" - ");
m_LeftIndent = m_CurChar;
OutWrapStr(Arg->DescLong);
if (Arg->Default &&
!Arg->DefaultSilent)
{
OutWrapStr(" (defaults to ");
OutWrapStr(Arg->Default);
OutWrapStr(")");
}
}
else if (Arg->Default &&
!Arg->DefaultSilent)
{
OutWrapStr(" - ");
m_LeftIndent = m_CurChar;
OutWrapStr("defaults to ");
OutWrapStr(Arg->Default);
}
m_LeftIndent = 0;
OutWrapStr("\n");
Arg++;
}
}
OutWrapStr(Desc->m_Desc);
Out("\n");
}
void
ExtExtension::HelpCommandName(__in PCSTR Name)
{
ExtCommandDesc* Desc = m_Commands;
while (Desc)
{
if (!strcmp(Name, Desc->m_Name))
{
break;
}
Desc = Desc->m_Next;
}
if (!Desc)
{
ThrowInvalidArg("No command named '%s'", Name);
}
HelpCommand(Desc);
}
void
ExtExtension::HelpAll(void)
{
char ModName[2 * MAX_PATH];
if (!GetModuleFileName(s_Module, ModName, EXT_DIMA(ModName)))
{
StringCbCopyA(ModName, sizeof(ModName),
"<Unable to get DLL name>");
}
Out("Commands for %s:\n", ModName);
m_CurChar = 0;
ExtCommandDesc* Desc = m_Commands;
while (Desc)
{
ULONG NameLen = strlen(Desc->m_Name);
OutWrap(" !%s%*c- ",
Desc->m_Name,
m_LongestCommandName - NameLen + 1, ' ');
m_LeftIndent = m_CurChar;
OutWrapStr(Desc->m_Desc);
m_LeftIndent = 0;
OutWrapStr("\n");
Desc = Desc->m_Next;
}
Out("!help <cmd> will give more information for a particular command\n");
}
EXT_CLASS_COMMAND(ExtExtension,
help,
"Displays information on available extension commands",
"{;s,o;command;Command to get information on}")
{
if (HasUnnamedArg(0))
{
HelpCommandName(GetUnnamedArgStr(0));
}
else
{
HelpAll();
SetCallStatus(DEBUG_EXTENSION_CONTINUE_SEARCH);
}
}
//----------------------------------------------------------------------------
//
// Global forwarders for common methods.
//
//----------------------------------------------------------------------------
void WINAPIV
ExtOut(__in PCSTR Format, ...)
{
g_Ext.Throw();
va_list Args;
va_start(Args, Format);
g_Ext->m_Control->
OutputVaList(DEBUG_OUTPUT_NORMAL, Format, Args);
va_end(Args);
}
void WINAPIV
ExtWarn(__in PCSTR Format, ...)
{
g_Ext.Throw();
va_list Args;
va_start(Args, Format);
g_Ext->m_Control->
OutputVaList(DEBUG_OUTPUT_WARNING, Format, Args);
va_end(Args);
}
void WINAPIV
ExtErr(__in PCSTR Format, ...)
{
g_Ext.Throw();
va_list Args;
va_start(Args, Format);
g_Ext->m_Control->
OutputVaList(DEBUG_OUTPUT_ERROR, Format, Args);
va_end(Args);
}
void WINAPIV
ExtVerb(__in PCSTR Format, ...)
{
g_Ext.Throw();
va_list Args;
va_start(Args, Format);
g_Ext->m_Control->
OutputVaList(DEBUG_OUTPUT_VERBOSE, Format, Args);
va_end(Args);
}
//----------------------------------------------------------------------------
//
// ExtRemoteData.
//
//----------------------------------------------------------------------------
void
ExtRemoteData::Set(__in const DEBUG_TYPED_DATA* Typed)
{
m_Offset = Typed->Offset;
m_ValidOffset = (Typed->Flags & DEBUG_TYPED_DATA_IS_IN_MEMORY) != 0;
m_Bytes = Typed->Size;
m_Data = Typed->Data;
m_ValidData = Typed->Size > 0 && Typed->Size <= sizeof(m_Data);
}
void
ExtRemoteData::Read(void)
{
g_Ext->ThrowInterrupt();
// Zero data so that unread bytes have a known state.
ULONG64 NewData = 0;
#pragma prefast(suppress:__WARNING_REDUNDANTTEST, "valid redundancy")
if (m_Bytes > sizeof(m_Data) ||
m_Bytes > sizeof(NewData))
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteData::Read too large");
}
ReadBuffer(&NewData, m_Bytes);
m_Data = NewData;
m_ValidData = true;
}
void
ExtRemoteData::Write(void)
{
g_Ext->ThrowInterrupt();
if (m_Bytes > sizeof(m_Data))
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteData::Write too large");
}
if (!m_ValidData)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteData does not have valid data");
}
WriteBuffer(&m_Data, m_Bytes);
}
ULONG64
ExtRemoteData::GetData(__in ULONG Request)
{
g_Ext->ThrowInterrupt();
if (m_Bytes != Request)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"Invalid ExtRemoteData size");
}
if (!m_ValidData)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteData does not have valid data");
}
return m_Data;
}
ULONG
ExtRemoteData::ReadBuffer(__out_bcount(Bytes) PVOID Buffer,
__in ULONG Bytes,
__in bool MustReadAll)
{
HRESULT Status;
ULONG Done;
g_Ext->ThrowInterrupt();
if (!Bytes)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"Zero-sized ExtRemoteData");
}
if (!m_ValidOffset)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteData does not have a valid address");
}
if (m_Physical)
{
Status = g_Ext->m_Data4->
ReadPhysical2(m_Offset, m_SpaceFlags, Buffer, Bytes, &Done);
}
else
{
Status = g_Ext->m_Data->
ReadVirtual(m_Offset, Buffer, Bytes, &Done);
}
if (Status == S_OK && Done != Bytes && MustReadAll)
{
Status = HRESULT_FROM_WIN32(ERROR_READ_FAULT);
}
if (Status != S_OK)
{
if (m_Name)
{
g_Ext->ThrowRemote(Status, "Unable to read %s at %p",
m_Name, m_Offset);
}
else
{
g_Ext->ThrowRemote(Status, "Unable to read 0x%x bytes at %p",
Bytes, m_Offset);
}
}
return Done;
}
ULONG
ExtRemoteData::WriteBuffer(__in_bcount(Bytes) PVOID Buffer,
__in ULONG Bytes,
__in bool MustReadAll)
{
HRESULT Status;
ULONG Done;
UNREFERENCED_PARAMETER(Buffer);
g_Ext->ThrowInterrupt();
if (!Bytes)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"Zero-sized ExtRemoteData");
}
if (!m_ValidOffset)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteData does not have a valid address");
}
if (m_Physical)
{
Status = g_Ext->m_Data4->
WritePhysical2(m_Offset, m_SpaceFlags, &m_Data, Bytes, &Done);
}
else
{
Status = g_Ext->m_Data->
WriteVirtual(m_Offset, &m_Data, Bytes, &Done);
}
if (Status == S_OK && Done != Bytes && MustReadAll)
{
Status = HRESULT_FROM_WIN32(ERROR_WRITE_FAULT);
}
if (Status != S_OK)
{
if (m_Name)
{
g_Ext->ThrowRemote(Status, "Unable to write %s at %p",
m_Name, m_Offset);
}
else
{
g_Ext->ThrowRemote(Status, "Unable to write 0x%x bytes at %p",
Bytes, m_Offset);
}
}
return Done;
}
PSTR
ExtRemoteData::GetString(__out_ecount(BufferChars) PSTR Buffer,
__in ULONG BufferChars,
__in ULONG MaxChars,
__in bool MustFit)
{
HRESULT Status;
g_Ext->ThrowInterrupt();
if (!m_ValidOffset)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteData does not have a valid address");
}
if (m_Physical)
{
g_Ext->ThrowRemote(E_NOTIMPL,
"ExtRemoteData cannot read strings "
"from physical memory");
}
ULONG Need;
if (FAILED(Status = g_Ext->m_Data4->
ReadMultiByteStringVirtual(m_Offset, MaxChars * sizeof(*Buffer),
Buffer, BufferChars, &Need)))
{
g_Ext->ThrowRemote(Status, "Unable to read string at %p",
m_Offset);
}
if (Status != S_OK && MustFit)
{
g_Ext->ThrowRemote(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW),
"String at %p overflows buffer, need 0x%x chars",
m_Offset, Need);
}
return Buffer;
}
PWSTR
ExtRemoteData::GetString(__out_ecount(BufferChars) PWSTR Buffer,
__in ULONG BufferChars,
__in ULONG MaxChars,
__in bool MustFit)
{
HRESULT Status;
g_Ext->ThrowInterrupt();
if (!m_ValidOffset)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteData does not have a valid address");
}
if (m_Physical)
{
g_Ext->ThrowRemote(E_NOTIMPL,
"ExtRemoteData cannot read strings "
"from physical memory");
}
ULONG Need;
if (FAILED(Status = g_Ext->m_Data4->
ReadUnicodeStringVirtualWide(m_Offset,
MaxChars * sizeof(*Buffer),
Buffer, BufferChars, &Need)))
{
g_Ext->ThrowRemote(Status, "Unable to read string at %p",
m_Offset);
}
if (Status != S_OK && MustFit)
{
g_Ext->ThrowRemote(HRESULT_FROM_WIN32(ERROR_BUFFER_OVERFLOW),
"String at %p overflows buffer, need 0x%x chars",
m_Offset, Need);
}
return Buffer;
}
//----------------------------------------------------------------------------
//
// ExtRemoteTyped.
//
//----------------------------------------------------------------------------
void
ExtRemoteTyped::Copy(__in const DEBUG_TYPED_DATA* Source)
{
m_Typed = *Source;
ErtIoctl("Copy", EXT_TDOP_COPY, ErtUncheckedIn | ErtOut);
}
void
ExtRemoteTyped::Set(__in PCSTR Expr)
{
EXT_TDOP Op;
ULONG Flags = ErtOut;
// If we have a valid value let it be used
// in the expression if desired.
if (m_Release)
{
Op = EXT_TDOP_EVALUATE;
Flags |= ErtIn;
}
else
{
Op = EXT_TDOP_SET_FROM_EXPR;
}
PSTR Msg = g_Ext->
PrintCircleString("Set: unable to evaluate '%s'", Expr);
ErtIoctl(Msg, Op, Flags, Expr);
}
void
ExtRemoteTyped::Set(__in PCSTR Expr,
__in ULONG64 Offset)
{
m_Typed.Offset = Offset;
PSTR Msg = g_Ext->
PrintCircleString("Set: unable to evaluate '%s' for 0x%I64x",
Expr, Offset);
ErtIoctl(Msg, EXT_TDOP_SET_FROM_U64_EXPR, ErtUncheckedIn | ErtOut, Expr);
}
void
ExtRemoteTyped::Set(__in bool PtrTo,
__in ULONG64 TypeModBase,
__in ULONG TypeId,
__in ULONG64 Offset)
{
HRESULT Status;
EXT_TYPED_DATA ExtData;
g_Ext->ThrowInterrupt();
ZeroMemory(&ExtData, sizeof(ExtData));
ExtData.Operation = PtrTo ?
EXT_TDOP_SET_PTR_FROM_TYPE_ID_AND_U64 :
EXT_TDOP_SET_FROM_TYPE_ID_AND_U64;
if (m_Physical)
{
ExtData.Flags |= (m_SpaceFlags + 1) << 1;
}
ExtData.InData.ModBase = TypeModBase;
ExtData.InData.TypeId = TypeId;
ExtData.InData.Offset = Offset;
Status = g_Ext->m_Advanced2->
Request(DEBUG_REQUEST_EXT_TYPED_DATA_ANSI,
&ExtData, sizeof(ExtData),
&ExtData, sizeof(ExtData),
NULL);
if (SUCCEEDED(Status))
{
Status = ExtData.Status;
}
if (FAILED(Status))
{
g_Ext->ThrowRemote(Status,
"ExtRemoteTyped::Set from type and offset");
}
Release();
m_Typed = ExtData.OutData;
ExtRemoteData::Set(&m_Typed);
m_Release = true;
}
void
ExtRemoteTyped::Set(__in PCSTR Type,
__in ULONG64 Offset,
__in bool PtrTo,
__inout_opt PULONG64 CacheCookie,
__in_opt PCSTR LinkField)
{
HRESULT Status;
ULONG64 TypeModBase;
ULONG TypeId;
if (!CacheCookie)
{
if ((Status = g_Ext->m_Symbols->
GetSymbolTypeId(Type,
&TypeId,
&TypeModBase)) != S_OK)
{
g_Ext->ThrowStatus(Status, "Unable to get type ID of '%s'",
Type);
}
}
else
{
if (LinkField)
{
// We don't really need the field offset
// here but it allows us to use cache
// entries that were created for list
// usage and so do have it.
g_Ext->GetCachedFieldOffset(CacheCookie,
Type,
LinkField,
&TypeModBase,
&TypeId);
}
else
{
TypeId = g_Ext->GetCachedSymbolTypeId(CacheCookie,
Type,
&TypeModBase);
}
}
Set(PtrTo, TypeModBase, TypeId, Offset);
}
void WINAPIV
ExtRemoteTyped::SetPrint(__in PCSTR Format,
...)
{
HRESULT Status;
va_list Args;
va_start(Args, Format);
Status = StringCbVPrintfA(g_Ext->s_String, sizeof(g_Ext->s_String),
Format, Args);
va_end(Args);
if (Status != S_OK)
{
g_Ext->ThrowRemote(Status,
"ExtRemoteTyped::SetPrint: overflow on '%s'",
Format);
}
Set(g_Ext->CopyCircleString(g_Ext->s_String));
}
ULONG
ExtRemoteTyped::GetFieldOffset(__in PCSTR Field) throw(...)
{
ULONG Offset;
PSTR Msg = g_Ext->
PrintCircleString("GetFieldOffset: no field '%s'",
Field);
ErtIoctl(Msg, EXT_TDOP_GET_FIELD_OFFSET, ErtIn, Field, 0, NULL,
NULL, 0, &Offset);
return Offset;
}
ExtRemoteTyped
ExtRemoteTyped::Field(__in PCSTR Field)
{
ExtRemoteTyped Ret;
PSTR Msg = g_Ext->
PrintCircleString("Field: unable to retrieve field '%s' at %I64x",
Field, m_Offset);
ErtIoctl(Msg, EXT_TDOP_GET_FIELD, ErtIn | ErtOut, Field, 0, &Ret);
return Ret;
}
ExtRemoteTyped
ExtRemoteTyped::ArrayElement(__in LONG64 Index)
{
ExtRemoteTyped Ret;
PSTR Msg = g_Ext->
PrintCircleString("ArrayElement: unable to retrieve element %I64d",
Index);
ErtIoctl(Msg, EXT_TDOP_GET_ARRAY_ELEMENT,
ErtIn | ErtOut, NULL, Index, &Ret);
return Ret;
}
ExtRemoteTyped
ExtRemoteTyped::Dereference(void)
{
ExtRemoteTyped Ret;
ErtIoctl("Dereference", EXT_TDOP_GET_DEREFERENCE,
ErtIn | ErtOut, NULL, 0, &Ret);
return Ret;
}
ExtRemoteTyped
ExtRemoteTyped::GetPointerTo(void)
{
ExtRemoteTyped Ret;
ErtIoctl("GetPointerTo", EXT_TDOP_GET_POINTER_TO,
ErtIn | ErtOut, NULL, 0, &Ret);
return Ret;
}
ExtRemoteTyped
ExtRemoteTyped::Eval(__in PCSTR Expr)
{
ExtRemoteTyped Ret;
PSTR Msg = g_Ext->
PrintCircleString("Eval: unable to evaluate '%s'",
Expr);
ErtIoctl(Msg, EXT_TDOP_EVALUATE, ErtIn | ErtOut, Expr, 0, &Ret);
return Ret;
}
PSTR
ExtRemoteTyped::GetTypeName(void)
{
ErtIoctl("GetTypeName", EXT_TDOP_GET_TYPE_NAME, ErtIn, NULL, 0, NULL,
g_Ext->s_String, EXT_DIMA(g_Ext->s_String));
return g_Ext->CopyCircleString(g_Ext->s_String);
}
ULONG
ExtRemoteTyped::GetTypeFieldOffset(__in PCSTR Type,
__in PCSTR Field)
{
HRESULT Status;
DEBUG_VALUE Data;
PSTR Expr;
Expr = g_Ext->PrintCircleString("@@c++(#FIELD_OFFSET(%s, %s))",
Type, Field);
if (FAILED(Status = g_Ext->m_Control->
Evaluate(Expr, DEBUG_VALUE_INT64, &Data, NULL)))
{
g_Ext->ThrowRemote(Status,
"Could not find type field %s.%s",
Type, Field);
}
return (ULONG)Data.I64;
}
HRESULT
ExtRemoteTyped::ErtIoctl(__in PCSTR Message,
__in EXT_TDOP Op,
__in ULONG Flags,
__in_opt PCSTR InStr,
__in ULONG64 In64,
__out_opt ExtRemoteTyped* Ret,
__out_ecount_opt(StrBufferChars) PSTR StrBuffer,
__in ULONG StrBufferChars,
__out_opt PULONG Out32)
{
HRESULT Status;
ULONG64 StackExtData[(sizeof(EXT_TYPED_DATA) + 11 * sizeof(ULONG64) - 1) /
sizeof(ULONG64)];
EXT_TYPED_DATA* ExtData;
ULONG ExtDataBytes;
PBYTE ExtraData;
C_ASSERT(EXT_TDF_PHYSICAL_MEMORY == DEBUG_TYPED_DATA_PHYSICAL_MEMORY);
g_Ext->ThrowInterrupt();
ExtDataBytes = sizeof(*ExtData) +
StrBufferChars * sizeof(*StrBuffer);
if (InStr)
{
ExtDataBytes += (strlen(InStr) + 1) * sizeof(*InStr);
}
if (ExtDataBytes > sizeof(StackExtData))
{
ExtData = (EXT_TYPED_DATA*)malloc(ExtDataBytes);
if (!ExtData)
{
return E_OUTOFMEMORY;
}
}
else
{
ExtData = (EXT_TYPED_DATA*)&StackExtData;
}
ExtraData = (PBYTE)(ExtData + 1);
ZeroMemory(ExtData, sizeof(*ExtData));
ExtData->Operation = Op;
if (m_Physical)
{
ExtData->Flags |= (m_SpaceFlags + 1) << 1;
}
if (InStr)
{
ExtData->InStrIndex = (ULONG)(ExtraData - (PBYTE)ExtData);
memcpy(ExtraData, InStr,
(strlen(InStr) + 1) * sizeof(*InStr));
ExtraData += (strlen(InStr) + 1) * sizeof(*InStr);
}
ExtData->In64 = In64;
if (StrBuffer)
{
ExtData->StrBufferIndex = (ULONG)(ExtraData - (PBYTE)ExtData);
ExtData->StrBufferChars = StrBufferChars;
ExtraData += StrBufferChars * sizeof(*StrBuffer);
}
if ((Flags & (ErtIn | ErtUncheckedIn)) != 0)
{
if ((Flags & ErtIn) != 0 && !m_Release)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"ExtRemoteTyped::%s", Message);
}
ExtData->InData = m_Typed;
}
Status = g_Ext->m_Advanced2->
Request(DEBUG_REQUEST_EXT_TYPED_DATA_ANSI,
ExtData, ExtDataBytes,
ExtData, ExtDataBytes,
NULL);
if (SUCCEEDED(Status))
{
Status = ExtData->Status;
}
if ((Flags & ErtIgnoreError) == 0 &&
FAILED(Status))
{
g_Ext->ThrowRemote(Status,
"ExtRemoteTyped::%s", Message);
}
if ((Flags & ErtOut) != 0)
{
if (!Ret)
{
Ret = this;
}
Ret->Release();
Ret->m_Typed = ExtData->OutData;
Ret->ExtRemoteData::Set(&Ret->m_Typed);
Ret->m_Release = true;
}
if (StrBuffer)
{
memcpy(StrBuffer, (PBYTE)ExtData + ExtData->StrBufferIndex,
StrBufferChars * sizeof(*StrBuffer));
}
if (Out32)
{
*Out32 = ExtData->Out32;
}
if ((PULONG64)ExtData != StackExtData)
{
free(ExtData);
}
return Status;
}
void
ExtRemoteTyped::Clear(void)
{
ZeroMemory(&m_Typed, sizeof(m_Typed));
m_Release = false;
ExtRemoteData::Clear();
}
//----------------------------------------------------------------------------
//
// Helpers for handling well-known NT data and types.
//
//----------------------------------------------------------------------------
ULONG64 ExtNtOsInformation::s_KernelLoadedModuleBaseInfoCookie;
ULONG64 ExtNtOsInformation::s_KernelProcessBaseInfoCookie;
ULONG64 ExtNtOsInformation::s_KernelThreadBaseInfoCookie;
ULONG64 ExtNtOsInformation::s_KernelProcessThreadListFieldCookie;
ULONG64 ExtNtOsInformation::s_UserOsLoadedModuleBaseInfoCookie;
ULONG64 ExtNtOsInformation::s_UserAltLoadedModuleBaseInfoCookie;
ULONG64 ExtNtOsInformation::s_OsPebBaseInfoCookie;
ULONG64 ExtNtOsInformation::s_AltPebBaseInfoCookie;
ULONG64 ExtNtOsInformation::s_OsTebBaseInfoCookie;
ULONG64 ExtNtOsInformation::s_AltTebBaseInfoCookie;
ULONG64
ExtNtOsInformation::GetKernelLoadedModuleListHead(void)
{
return GetNtDebuggerData(DEBUG_DATA_PsLoadedModuleListAddr,
"nt!PsLoadedModuleList",
0);
}
ExtRemoteTypedList
ExtNtOsInformation::GetKernelLoadedModuleList(void)
{
ExtRemoteTypedList List(GetKernelLoadedModuleListHead(),
"nt!_KLDR_DATA_TABLE_ENTRY",
"InLoadOrderLinks",
0,
0,
&s_KernelLoadedModuleBaseInfoCookie,
true);
List.m_MaxIter = 1000;
return List;
}
ExtRemoteTyped
ExtNtOsInformation::GetKernelLoadedModule(__in ULONG64 Offset)
{
// We are caching both type and link information
// so provide a link field here to keep the
// cache properly filled out.
return ExtRemoteTyped("nt!_KLDR_DATA_TABLE_ENTRY",
Offset,
true,
&s_KernelLoadedModuleBaseInfoCookie,
"InLoadOrderLinks");
}
ULONG64
ExtNtOsInformation::GetKernelProcessListHead(void)
{
return GetNtDebuggerData(DEBUG_DATA_PsActiveProcessHeadAddr,
"nt!PsActiveProcessHead",
0);
}
ExtRemoteTypedList
ExtNtOsInformation::GetKernelProcessList(void)
{
ExtRemoteTypedList List(GetKernelProcessListHead(),
"nt!_EPROCESS",
"ActiveProcessLinks",
0,
0,
&s_KernelProcessBaseInfoCookie,
true);
List.m_MaxIter = 4000;
return List;
}
ExtRemoteTyped
ExtNtOsInformation::GetKernelProcess(__in ULONG64 Offset)
{
// We are caching both type and link information
// so provide a link field here to keep the
// cache properly filled out.
return ExtRemoteTyped("nt!_EPROCESS",
Offset,
true,
&s_KernelProcessBaseInfoCookie,
"ActiveProcessLinks");
}
ULONG64
ExtNtOsInformation::GetKernelProcessThreadListHead(__in ULONG64 Process)
{
return Process +
g_Ext->GetCachedFieldOffset(&s_KernelProcessThreadListFieldCookie,
"nt!_EPROCESS",
"Pcb.ThreadListHead");
}
ExtRemoteTypedList
ExtNtOsInformation::GetKernelProcessThreadList(__in ULONG64 Process)
{
ExtRemoteTypedList List(GetKernelProcessThreadListHead(Process),
"nt!_ETHREAD",
"Tcb.ThreadListEntry",
0,
0,
&s_KernelThreadBaseInfoCookie,
true);
List.m_MaxIter = 15000;
return List;
}
ExtRemoteTyped
ExtNtOsInformation::GetKernelThread(__in ULONG64 Offset)
{
// We are caching both type and link information
// so provide a link field here to keep the
// cache properly filled out.
return ExtRemoteTyped("nt!_ETHREAD",
Offset,
true,
&s_KernelThreadBaseInfoCookie,
"Tcb.ThreadListEntry");
}
ULONG64
ExtNtOsInformation::GetUserLoadedModuleListHead(__in bool NativeOnly)
{
HRESULT Status;
if (NativeOnly ||
!g_Ext->Is32On64())
{
DEBUG_VALUE Data;
if (FAILED(Status = g_Ext->m_Control->
Evaluate("@@c++(&@$peb->Ldr->InLoadOrderModuleList)",
DEBUG_VALUE_INT64, &Data, NULL)))
{
g_Ext->ThrowRemote(Status,
"Unable to get loader list head from PEB");
}
return Data.I64;
}
else
{
// We're looking at a 32-bit structure so only
// pull out a 32-bit pointer value. We do
// not sign-extend as this is a UM pointer and
// should not get sign-extended.
return GetAltPeb().
Eval("&@$extin->Ldr->InLoadOrderModuleList").GetUlong();
}
}
ExtRemoteTypedList
ExtNtOsInformation::GetUserLoadedModuleList(__in bool NativeOnly)
{
if (NativeOnly ||
!g_Ext->Is32On64())
{
ExtRemoteTypedList List(GetUserLoadedModuleListHead(NativeOnly),
"${$ntnsym}!_LDR_DATA_TABLE_ENTRY",
"InLoadOrderLinks",
0,
0,
&s_UserOsLoadedModuleBaseInfoCookie,
true);
List.m_MaxIter = 1000;
return List;
}
else
{
ExtRemoteTypedList List(GetUserLoadedModuleListHead(NativeOnly),
"${$ntwsym}!_LDR_DATA_TABLE_ENTRY",
"InLoadOrderLinks",
0,
0,
&s_UserAltLoadedModuleBaseInfoCookie,
true);
List.m_MaxIter = 1000;
return List;
}
}
ExtRemoteTyped
ExtNtOsInformation::GetUserLoadedModule(__in ULONG64 Offset,
__in bool NativeOnly)
{
// We are caching both type and link information
// so provide a link field here to keep the
// cache properly filled out.
if (NativeOnly ||
!g_Ext->Is32On64())
{
return ExtRemoteTyped("${$ntnsym}!_LDR_DATA_TABLE_ENTRY",
Offset,
true,
&s_UserOsLoadedModuleBaseInfoCookie,
"InLoadOrderLinks");
}
else
{
return ExtRemoteTyped("${$ntwsym}!_LDR_DATA_TABLE_ENTRY",
Offset,
true,
&s_UserAltLoadedModuleBaseInfoCookie,
"InLoadOrderLinks");
}
}
ULONG64
ExtNtOsInformation::GetOsPebPtr(void)
{
HRESULT Status;
ULONG64 Offset;
if ((Status = g_Ext->m_System->
GetCurrentProcessPeb(&Offset)) != S_OK)
{
g_Ext->ThrowRemote(Status,
"Unable to get OS PEB pointer");
}
return Offset;
}
ExtRemoteTyped
ExtNtOsInformation::GetOsPeb(__in ULONG64 Offset)
{
return ExtRemoteTyped("${$ntnsym}!_PEB",
Offset,
true,
&s_OsPebBaseInfoCookie);
}
ULONG64
ExtNtOsInformation::GetOsTebPtr(void)
{
HRESULT Status;
ULONG64 Offset;
if ((Status = g_Ext->m_System->
GetCurrentThreadTeb(&Offset)) != S_OK)
{
g_Ext->ThrowRemote(Status,
"Unable to get OS TEB pointer");
}
return Offset;
}
ExtRemoteTyped
ExtNtOsInformation::GetOsTeb(__in ULONG64 Offset)
{
return ExtRemoteTyped("${$ntnsym}!_TEB",
Offset,
true,
&s_OsTebBaseInfoCookie);
}
ULONG64
ExtNtOsInformation::GetAltPebPtr(void)
{
ExtRemoteTyped AltTeb = GetAltTeb();
return AltTeb.Field("ProcessEnvironmentBlock").GetUlong();
}
ExtRemoteTyped
ExtNtOsInformation::GetAltPeb(__in ULONG64 Offset)
{
return ExtRemoteTyped("${$ntwsym}!_PEB",
Offset,
true,
&s_AltPebBaseInfoCookie);
}
ULONG64
ExtNtOsInformation::GetAltTebPtr(void)
{
// If this is a 32-bit machine there's no
// WOW64 TEB.
if (!g_Ext->IsMachine64(g_Ext->m_ActualMachine))
{
g_Ext->ThrowRemote(E_INVALIDARG,
"No alternate TEB available");
}
//
// The pointer to the WOW64 TEB is the first pointer of
// the 64-bit TEB.
//
ExtRemoteData OsTeb(GetOsTebPtr(), sizeof(ULONG64));
return OsTeb.GetUlong64();
}
ExtRemoteTyped
ExtNtOsInformation::GetAltTeb(__in ULONG64 Offset)
{
return ExtRemoteTyped("${$ntwsym}!_TEB",
Offset,
true,
&s_AltTebBaseInfoCookie);
}
ULONG64
ExtNtOsInformation::GetCurPebPtr(void)
{
return g_Ext->Is32On64() ?
GetAltPebPtr() : GetOsPebPtr();
}
ExtRemoteTyped
ExtNtOsInformation::GetCurPeb(__in ULONG64 Offset)
{
return g_Ext->Is32On64() ?
GetAltPeb(Offset) : GetOsPeb(Offset);
}
ULONG64
ExtNtOsInformation::GetCurTebPtr(void)
{
return g_Ext->Is32On64() ?
GetAltTebPtr() : GetOsTebPtr();
}
ExtRemoteTyped
ExtNtOsInformation::GetCurTeb(__in ULONG64 Offset)
{
return g_Ext->Is32On64() ?
GetAltTeb(Offset) : GetOsTeb(Offset);
}
ULONG64
ExtNtOsInformation::GetNtDebuggerData(__in ULONG DataOffset,
__in PCSTR Symbol,
__in ULONG Flags)
{
ULONG64 Data;
UNREFERENCED_PARAMETER(Flags);
//
// First check the kernel's data block.
//
if (g_Ext->m_Data->
ReadDebuggerData(DataOffset, &Data, sizeof(Data), NULL) == S_OK)
{
return Data;
}
//
// Fall back on symbols.
//
if (g_Ext->m_Symbols->
GetOffsetByName(Symbol, &Data) != S_OK)
{
g_Ext->ThrowRemote(E_INVALIDARG,
"Unable to find '%s', check your NT kernel symbols",
Symbol);
}
return Data;
}
//----------------------------------------------------------------------------
//
// Number-to-string helpers for things like #define translations.
//
//----------------------------------------------------------------------------
ExtDefine*
ExtDefineMap::Map(__in ULONG64 Value)
{
if ((m_Flags & Bitwise) != 0)
{
for (ExtDefine* Define = m_Defines; Define->Name; Define++)
{
if ((Define->Value & Value) == Define->Value)
{
return Define;
}
}
}
else
{
for (ExtDefine* Define = m_Defines; Define->Name; Define++)
{
if (Define->Value == Value)
{
return Define;
}
}
}
return NULL;
}
PCSTR
ExtDefineMap::MapStr(__in ULONG64 Value,
__in_opt PCSTR InvalidStr)
{
ExtDefine* Define = Map(Value);
if (Define)
{
return Define->Name;
}
if (InvalidStr)
{
return InvalidStr;
}
else
{
return g_Ext->PrintCircleString("<0x%I64x>", Value);
}
}
void
ExtDefineMap::Out(__in ULONG64 Value,
__in ULONG Flags,
__in_opt PCSTR InvalidStr)
{
ULONG OldIndent = g_Ext->m_LeftIndent;
g_Ext->m_LeftIndent = g_Ext->m_CurChar;
if ((Flags & OutValue) != 0)
{
g_Ext->OutWrap("%I64x", Value);
}
else if ((Flags & OutValue32) != 0)
{
g_Ext->OutWrap("%08I64x", Value);
}
else if ((Flags & OutValue64) != 0)
{
g_Ext->OutWrap("%016I64x", Value);
}
if ((m_Flags & Bitwise) != 0)
{
if (!Value)
{
if ((Flags & ValueAny) == 0)
{
g_Ext->OutWrapStr("<zero>");
}
}
else
{
bool First = true;
while (Value)
{
ExtDefine* Define = Map(Value);
if (!Define &&
(Flags & ValueAny) != 0 &&
!InvalidStr)
{
// Value already displayed.
break;
}
if (!First)
{
g_Ext->OutWrapStr(" | ");
}
else
{
if ((Flags & OutValueAny) != 0)
{
g_Ext->OutWrapStr(" ");
}
First = false;
}
if (Define)
{
g_Ext->OutWrapStr(Define->Name);
Value &= ~Define->Value;
}
else
{
if (InvalidStr)
{
g_Ext->OutWrapStr(InvalidStr);
}
else
{
g_Ext->OutWrap("<0x%I64x>", Value);
}
break;
}
}
}
}
else
{
if ((Flags & ValueAny) == 0 ||
InvalidStr)
{
if ((Flags & OutValueAny) != 0)
{
g_Ext->OutWrapStr(" ");
}
g_Ext->OutWrapStr(MapStr(Value, InvalidStr));
}
else
{
ExtDefine* Define = Map(Value);
if (Define)
{
InvalidStr = Define->Name;
}
if (InvalidStr)
{
if ((Flags & OutValueAny) != 0)
{
g_Ext->OutWrapStr(" ");
}
g_Ext->OutWrapStr(InvalidStr);
}
}
}
g_Ext->m_LeftIndent = OldIndent;
}
//----------------------------------------------------------------------------
//
// Extension DLL exports.
//
//----------------------------------------------------------------------------
EXTERN_C BOOL WINAPI
DllMain(HANDLE Instance, ULONG Reason, PVOID Reserved)
{
UNREFERENCED_PARAMETER(Reserved);
switch(Reason)
{
case DLL_PROCESS_ATTACH:
ExtExtension::s_Module = (HMODULE)Instance;
break;
}
return TRUE;
}
EXTERN_C HRESULT CALLBACK
DebugExtensionInitialize(__out PULONG Version,
__out PULONG Flags)
{
HRESULT Status;
// Pick up our global state.
g_Ext = g_ExtInstancePtr;
ExtExtension* Inst = g_Ext;
// Pass registered commands to the extension
// so that further references are confined to
// extension class data.
ExtCommandDesc::Transfer(&Inst->m_Commands,
&Inst->m_LongestCommandName);
if ((Status = Inst->Initialize()) != S_OK)
{
return Status;
}
*Version = DEBUG_EXTENSION_VERSION(Inst->m_ExtMajorVersion,
Inst->m_ExtMinorVersion);
*Flags = Inst->m_ExtInitFlags;
return S_OK;
}
EXTERN_C void CALLBACK
DebugExtensionUninitialize(void)
{
if (!g_Ext.IsSet())
{
return;
}
g_Ext->Uninitialize();
}
EXTERN_C void CALLBACK
DebugExtensionNotify(__in ULONG Notify,
__in ULONG64 Argument)
{
if (!g_Ext.IsSet())
{
return;
}
ExtExtension* Inst = g_Ext;
switch(Notify)
{
case DEBUG_NOTIFY_SESSION_ACTIVE:
Inst->OnSessionActive(Argument);
break;
case DEBUG_NOTIFY_SESSION_INACTIVE:
Inst->OnSessionInactive(Argument);
break;
case DEBUG_NOTIFY_SESSION_ACCESSIBLE:
Inst->OnSessionAccessible(Argument);
break;
case DEBUG_NOTIFY_SESSION_INACCESSIBLE:
Inst->OnSessionInaccessible(Argument);
break;
}
}
EXTERN_C HRESULT CALLBACK
KnownStructOutputEx(__in PDEBUG_CLIENT Client,
__in ULONG Flags,
__in ULONG64 Offset,
__in_opt PCSTR TypeName,
__out_ecount_opt(*BufferChars) PSTR Buffer,
__inout_opt PULONG BufferChars)
{
if (!g_Ext.IsSet())
{
return E_UNEXPECTED;
}
return g_Ext->HandleKnownStruct(Client, Flags, Offset, TypeName,
Buffer, BufferChars);
}
EXTERN_C HRESULT CALLBACK
DebugExtensionQueryValueNames(__in PDEBUG_CLIENT Client,
__in ULONG Flags,
__out_ecount(BufferChars) PWSTR Buffer,
__in ULONG BufferChars,
__out PULONG BufferNeeded)
{
if (!g_Ext.IsSet())
{
return E_UNEXPECTED;
}
return g_Ext->HandleQueryValueNames(Client, Flags,
Buffer, BufferChars, BufferNeeded);
}
EXTERN_C HRESULT CALLBACK
DebugExtensionProvideValue(__in PDEBUG_CLIENT Client,
__in ULONG Flags,
__in PCWSTR Name,
__out PULONG64 Value,
__out PULONG64 TypeModBase,
__out PULONG TypeId,
__out PULONG TypeFlags)
{
if (!g_Ext.IsSet())
{
return E_UNEXPECTED;
}
return g_Ext->HandleProvideValue(Client, Flags, Name,
Value, TypeModBase, TypeId, TypeFlags);
}
| 411 | 0.953172 | 1 | 0.953172 | game-dev | MEDIA | 0.792024 | game-dev | 0.935781 | 1 | 0.935781 |
mosa/MOSA-Project | 1,150 | Source/Mosa.TinyCoreLib/System.Diagnostics/DistributedContextPropagator.cs | using System.Collections.Generic;
namespace System.Diagnostics;
public abstract class DistributedContextPropagator
{
public delegate void PropagatorGetterCallback(object? carrier, string fieldName, out string? fieldValue, out IEnumerable<string>? fieldValues);
public delegate void PropagatorSetterCallback(object? carrier, string fieldName, string fieldValue);
public abstract IReadOnlyCollection<string> Fields { get; }
public static DistributedContextPropagator Current { get; set; }
public abstract void Inject(Activity? activity, object? carrier, PropagatorSetterCallback? setter);
public abstract void ExtractTraceIdAndState(object? carrier, PropagatorGetterCallback? getter, out string? traceId, out string? traceState);
public abstract IEnumerable<KeyValuePair<string, string?>>? ExtractBaggage(object? carrier, PropagatorGetterCallback? getter);
public static DistributedContextPropagator CreateDefaultPropagator()
{
throw null;
}
public static DistributedContextPropagator CreatePassThroughPropagator()
{
throw null;
}
public static DistributedContextPropagator CreateNoOutputPropagator()
{
throw null;
}
}
| 411 | 0.667164 | 1 | 0.667164 | game-dev | MEDIA | 0.227593 | game-dev | 0.728174 | 1 | 0.728174 |
breineng/InfinityCraftAIUnity | 2,120 | Assets/TextMesh Pro/Examples & Extras/Scripts/TMP_ExampleScript_01.cs | using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using TMPro;
namespace TMPro.Examples
{
public class TMP_ExampleScript_01 : MonoBehaviour
{
public enum objectType { TextMeshPro = 0, TextMeshProUGUI = 1 };
public objectType ObjectType;
public bool isStatic;
private TMP_Text m_text;
//private TMP_InputField m_inputfield;
private const string k_label = "The count is <#0080ff>{0}</color>";
private int count;
void Awake()
{
// Get a reference to the TMP text component if one already exists otherwise add one.
// This example show the convenience of having both TMP components derive from TMP_Text.
if (ObjectType == 0)
m_text = GetComponent<TextMeshPro>() ?? gameObject.AddComponent<TextMeshPro>();
else
m_text = GetComponent<TextMeshProUGUI>() ?? gameObject.AddComponent<TextMeshProUGUI>();
// Load a new font asset and assign it to the text object.
m_text.font = Resources.Load<TMP_FontAsset>("Fonts & Materials/Anton SDF");
// Load a new material preset which was created with the context menu duplicate.
m_text.fontSharedMaterial = Resources.Load<Material>("Fonts & Materials/Anton SDF - Drop Shadow");
// Set the size of the font.
m_text.fontSize = 120;
// Set the text
m_text.text = "A <#0080ff>simple</color> line of text.";
// Get the preferred width and height based on the supplied width and height as opposed to the actual size of the current text container.
Vector2 size = m_text.GetPreferredValues(Mathf.Infinity, Mathf.Infinity);
// Set the size of the RectTransform based on the new calculated values.
m_text.rectTransform.sizeDelta = new Vector2(size.x, size.y);
}
void Update()
{
if (!isStatic)
{
m_text.SetText(k_label, count % 1000);
count += 1;
}
}
}
}
| 411 | 0.842883 | 1 | 0.842883 | game-dev | MEDIA | 0.660553 | game-dev | 0.9756 | 1 | 0.9756 |
tukkek/javelin | 5,440 | javelin/controller/action/world/WorldMove.java | package javelin.controller.action.world;
import java.util.ArrayList;
import java.util.List;
import javelin.Javelin;
import javelin.JavelinApp;
import javelin.controller.exception.RepeatTurn;
import javelin.controller.exception.battle.StartBattle;
import javelin.controller.terrain.Terrain;
import javelin.controller.terrain.hazard.Hazard;
import javelin.model.unit.Combatant;
import javelin.model.unit.Monster;
import javelin.model.unit.Squad;
import javelin.model.world.World;
import javelin.model.world.WorldActor;
import javelin.model.world.location.Location;
import javelin.model.world.location.dungeon.Dungeon;
import javelin.model.world.location.dungeon.temple.Temple;
import javelin.view.screen.DungeonScreen;
import javelin.view.screen.WorldScreen;
import tyrant.mikera.engine.Thing;
/**
* Makes a movement on the overworld or {@link Dungeon}.
*
* TODO {@link WorldScreen} hierarchy should be refactored into proper Battle /
* Dungeon / World screens.
*
* TODO {@link #perform(WorldScreen)} needs refactoring after 2.0
*
* @see Javelin#getDayPeriod()
* @author alex
*/
public class WorldMove extends WorldAction {
/**
* Represents time spent on resting, eating, sleeping, etc.
*
* TODO forced march
*/
public static final float NORMALMARCH = 4f / 5f;
/**
* Ideally a move should always be 6 hours in a worst-case scenario (the
* time of a period), so as to avoid a move taking longer than a period,
* which could confuse {@link Hazard}s.
*
* @see #TIMECOST
*/
public static final float MOVETARGET = 6f;
/**
* How much time it takes to walk a single square with speed 30 (~30mph,
* normal human speed).
*
* Calculation of worst case scenario (which should take 6 hours): 6 *
* 15/30ft (slow races) * .5 (bad terrain)
*
* @see Monster#gettopspeed()
* @see #MOVETARGET
* @see #NORMALMARCH
*/
public static final float TIMECOST =
NORMALMARCH * (MOVETARGET * 15f / 30f) / 2f;
/** TODO remove, hack */
public static boolean isleavingplace = false;//
private final int deltax;
private final int deltay;
/**
* Constructor
*
* @param keycodes
* Integer/char keys.
* @param deltax
* Direction of x movement.
* @param deltay
* Direction of y movement.
* @param keys
* Text keys.
*/
public WorldMove(final int[] keycodes, final int deltax, final int deltay,
final String[] keys) {
super("Move (" + keys[1].charAt(0) + ")", keycodes, keys);
this.deltax = deltax;
this.deltay = deltay;
}
@Override
public void perform(final WorldScreen s) {
Squad.active.lastterrain = Terrain.current();
final Thing t = JavelinApp.context.gethero();
int tox = t.x + deltax;
int toy = t.y + deltay;
if (!World.validatecoordinate(tox, toy) || (Dungeon.active == null
&& !World.seed.map[tox][toy].enter(tox, toy))) {
throw new RepeatTurn();
}
float hours = Dungeon.active == null ? Squad.active.move(false) : 0;
try {
WorldActor actor =
Dungeon.active == null ? WorldActor.get(tox, toy) : null;
Location place =
actor instanceof Location ? (Location) actor : null;
try {
if (JavelinApp.context.react(actor, tox, toy)) {
if (Dungeon.active != null) {
if (DungeonScreen.dontmove) {
DungeonScreen.dontmove = false;
return;
}
place(t, deltax, deltay);
} else if (place != null) {
if (place.allowentry && place.garrison.isEmpty()) {
place(t, deltax, deltay);
}
/* TODO */
if (place instanceof Dungeon) {
((Dungeon) place).activate(false);
} else if (place instanceof Temple) {
Temple temple = (Temple) place;
if (temple.open) {
temple.floors.get(0).activate(false);
}
}
}
return;
}
if (place != null && !place.allowentry) {
return;
}
} catch (StartBattle e) {
if (place != null && place.allowentry) {
place(t, deltax, deltay);
}
throw e;
}
if (s instanceof DungeonScreen && (DungeonScreen.dontmove
|| t.getMap() != Javelin.app.context.map)) {
DungeonScreen.dontmove = false;
return;// TODO hack
}
if (!place(t, deltax, deltay)) {
return;
}
if (WorldMove.walk(t)) {
JavelinApp.context.explore(hours);
}
heal();
} finally {
if (Squad.active != null) {
Squad.active.ellapse(Math.round(hours));
}
}
}
static boolean place(final Thing t, final int deltax, final int deltay) {
JavelinApp.context.map.removeThing(t);
t.x += deltax;
t.y += deltay;
if (!JavelinApp.context.allowmove(t.x, t.y)) {
t.x -= deltax;
t.y -= deltay;
JavelinApp.context.map.addThing(t, t.x, t.y);
return false;
}
if (t.x < 0 || t.x >= JavelinApp.context.map.width || t.y < 0
|| t.y >= JavelinApp.context.map.height) {
t.x -= deltax;
t.y -= deltay;
}
JavelinApp.context.updatelocation(t.x, t.y);
JavelinApp.context.map.addThing(t, t.x, t.y);
return true;
}
static void heal() {
for (final Combatant m : Squad.active.members) {
if (m.source.fasthealing != 0) {
m.hp = m.maxhp;
}
}
}
static boolean walk(final Thing t) {
final List<Squad> here = new ArrayList<Squad>();
for (final WorldActor p : Squad.getall(Squad.class)) {
Squad s = (Squad) p;
if (s.x == t.x && s.y == t.y) {
here.add(s);
}
}
if (here.size() <= 1) {
return true;
}
here.get(0).join(here.get(1));
return false;
}
}
| 411 | 0.962896 | 1 | 0.962896 | game-dev | MEDIA | 0.98732 | game-dev | 0.989303 | 1 | 0.989303 |
Arakne/Araknemu | 4,838 | src/main/java/fr/quatrevieux/araknemu/game/handler/object/UseObject.java | /*
* This file is part of Araknemu.
*
* Araknemu is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Araknemu is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Araknemu. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (c) 2017-2019 Vincent Quatrevieux
*/
package fr.quatrevieux.araknemu.game.handler.object;
import fr.quatrevieux.araknemu.core.network.exception.ErrorPacket;
import fr.quatrevieux.araknemu.game.exploration.ExplorationPlayer;
import fr.quatrevieux.araknemu.game.exploration.creature.ExplorationCreature;
import fr.quatrevieux.araknemu.game.exploration.creature.Operation;
import fr.quatrevieux.araknemu.game.exploration.map.ExplorationMap;
import fr.quatrevieux.araknemu.game.exploration.map.cell.ExplorationMapCell;
import fr.quatrevieux.araknemu.game.handler.AbstractExploringPacketHandler;
import fr.quatrevieux.araknemu.game.item.type.UsableItem;
import fr.quatrevieux.araknemu.game.player.GamePlayer;
import fr.quatrevieux.araknemu.game.player.inventory.InventoryEntry;
import fr.quatrevieux.araknemu.network.game.GameSession;
import fr.quatrevieux.araknemu.network.game.in.object.ObjectUseRequest;
import fr.quatrevieux.araknemu.network.game.out.basic.Noop;
import fr.quatrevieux.araknemu.network.game.out.info.Error;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.checker.nullness.util.NullnessUtil;
/**
* Use an object
*/
public final class UseObject extends AbstractExploringPacketHandler<ObjectUseRequest> {
@Override
public void handle(GameSession session, ExplorationPlayer exploration, ObjectUseRequest packet) throws Exception {
final GamePlayer player = exploration.player();
if (!player.restrictions().canUseObject()) {
throw new ErrorPacket(Error.cantDoOnCurrentState());
}
final InventoryEntry entry = player.inventory().get(packet.objectId());
final UsableItem item = UsableItem.class.cast(entry.item());
boolean result = true;
try {
result = packet.isTarget()
? handleForTarget(exploration, item, packet)
: handleForSelf(exploration, item)
;
} finally {
if (result) {
entry.remove(1);
} else {
session.send(new Noop());
}
}
}
@Override
public Class<ObjectUseRequest> packet() {
return ObjectUseRequest.class;
}
private boolean handleForSelf(ExplorationPlayer exploration, UsableItem item) {
if (!item.check(exploration)) {
return false;
}
item.apply(exploration);
return true;
}
private boolean handleForTarget(ExplorationPlayer exploration, UsableItem item, ObjectUseRequest packet) {
final ExplorationMap map = exploration.map();
if (map == null || packet.cell() >= map.size()) {
return false;
}
final ExplorationMapCell cell = packet.cell() != -1 ? map.get(packet.cell()) : null;
final ApplyItemOperation operation = new ApplyItemOperation(item, exploration, cell);
return map.has(packet.target())
? NullnessUtil.castNonNull(map.creature(packet.target()).apply(operation)) // The implementation ensure that the return value is never null
: operation.onNull()
;
}
private static class ApplyItemOperation implements Operation<Boolean> {
private final UsableItem item;
private final ExplorationPlayer caster;
private final @Nullable ExplorationMapCell targetCell;
public ApplyItemOperation(UsableItem item, ExplorationPlayer caster, @Nullable ExplorationMapCell targetCell) {
this.item = item;
this.caster = caster;
this.targetCell = targetCell;
}
@Override
public Boolean onExplorationPlayer(@Nullable ExplorationPlayer target) {
if (!item.checkTarget(caster, target, targetCell)) {
return false;
}
item.applyToTarget(caster, target, targetCell);
return true;
}
@Override
public Boolean onCreature(ExplorationCreature creature) {
return onNull();
}
public Boolean onNull() {
return onExplorationPlayer(null);
}
}
}
| 411 | 0.907191 | 1 | 0.907191 | game-dev | MEDIA | 0.936779 | game-dev | 0.956489 | 1 | 0.956489 |
EOS-team/EOS | 7,221 | src/embodied-intelligence/src/3D_human_pose_recognition/ios_sdk/UnityDEBUG/ForDebug/Library/PackageCache/com.unity.ugui@1.0.0/Tests/Runtime/NestedLayout/SceneWithNestedLayoutElementsLoads.cs | using System;
using UnityEngine.UI;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEditor;
[TestFixture]
[Category("RegressionTest")]
public class SceneWithNestedLayoutElementsLoad : IPrebuildSetup
{
Scene m_InitScene;
const string aspectRatioFitterSceneName = "AspectRatioFitter";
const string contentSizeFitterSceneName = "ContentSizeFitter";
const string layoutGroupSceneName = "LayoutGroup";
public void Setup()
{
#if UNITY_EDITOR
Action aspectRatioFitterSceneCreation = delegate()
{
var canvasGO = new GameObject("Canvas", typeof(Canvas), typeof(CanvasScaler));
var panelGO = new GameObject("Panel", typeof(UnityEngine.UI.Image), typeof(AspectRatioFitter));
var imageGO = new GameObject("Image", typeof(UnityEngine.UI.RawImage), typeof(AspectRatioFitter));
panelGO.transform.SetParent(canvasGO.transform);
imageGO.transform.SetParent(panelGO.transform);
var panelARF = panelGO.GetComponent<AspectRatioFitter>();
panelARF.aspectMode = AspectRatioFitter.AspectMode.EnvelopeParent;
panelARF.aspectRatio = 1.98f;
var iamgeARF = imageGO.GetComponent<AspectRatioFitter>();
iamgeARF.aspectMode = AspectRatioFitter.AspectMode.None;
iamgeARF.aspectRatio = 1f;
new GameObject("GameObject", typeof(SceneWithNestedLayoutElementsLoadScript));
};
CreateSceneUtility.CreateScene(aspectRatioFitterSceneName, aspectRatioFitterSceneCreation);
Action contentSizeFitterSceneCreation = delegate()
{
var canvasGO = new GameObject("Canvas", typeof(Canvas), typeof(CanvasScaler));
var panelGO = new GameObject("Panel", typeof(UnityEngine.UI.Image), typeof(ContentSizeFitter), typeof(LayoutElement));
var imageGO = new GameObject("Image", typeof(UnityEngine.UI.RawImage), typeof(ContentSizeFitter), typeof(LayoutElement));
panelGO.transform.SetParent(canvasGO.transform);
imageGO.transform.SetParent(panelGO.transform);
var panelCSF = panelGO.GetComponent<ContentSizeFitter>();
panelCSF.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
panelCSF.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
var panelLE = panelGO.GetComponent<LayoutElement>();
panelLE.preferredWidth = 200f;
panelLE.preferredHeight = 200f;
var imageCSF = imageGO.GetComponent<ContentSizeFitter>();
imageCSF.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
imageCSF.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
var imageLE = imageGO.GetComponent<LayoutElement>();
imageLE.preferredWidth = 100f;
imageLE.preferredHeight = 100f;
new GameObject("GameObject", typeof(SceneWithNestedLayoutElementsLoadScript));
};
CreateSceneUtility.CreateScene(contentSizeFitterSceneName, contentSizeFitterSceneCreation);
Action layoutGroupSceneCreation = delegate()
{
var canvasGO = new GameObject("Canvas", typeof(Canvas), typeof(CanvasScaler), typeof(GridLayoutGroup));
var panelGO = new GameObject("Panel (0)", typeof(UnityEngine.UI.Image), typeof(GridLayoutGroup), typeof(LayoutElement));
var imageGOOne = new GameObject("Image", typeof(UnityEngine.UI.RawImage), typeof(LayoutElement));
var imageGOTwo = new GameObject("Image", typeof(UnityEngine.UI.RawImage), typeof(LayoutElement));
panelGO.transform.SetParent(canvasGO.transform);
imageGOOne.transform.SetParent(panelGO.transform);
imageGOTwo.transform.SetParent(panelGO.transform);
var panelLE = panelGO.GetComponent<LayoutElement>();
panelLE.preferredWidth = 100f;
panelLE.preferredHeight = 100f;
var imageOneLE = imageGOOne.GetComponent<LayoutElement>();
imageOneLE.preferredWidth = 100f;
imageOneLE.preferredHeight = 100f;
var imageTwoLE = imageGOOne.GetComponent<LayoutElement>();
imageTwoLE.preferredWidth = 100f;
imageTwoLE.preferredHeight = 100f;
// Duplicate the first panel we created.
GameObject.Instantiate(panelGO, canvasGO.transform);
new GameObject("GameObject", typeof(SceneWithNestedLayoutElementsLoadScript));
};
CreateSceneUtility.CreateScene(layoutGroupSceneName, layoutGroupSceneCreation);
#endif
}
[UnityTest]
public IEnumerator SceneWithNestedAspectRatioFitterLoads()
{
AsyncOperation operation = SceneManager.LoadSceneAsync(aspectRatioFitterSceneName, LoadSceneMode.Additive);
yield return operation;
SceneManager.SetActiveScene(SceneManager.GetSceneByName(aspectRatioFitterSceneName));
var go = GameObject.Find("GameObject");
var component = go.GetComponent<SceneWithNestedLayoutElementsLoadScript>();
yield return new WaitUntil(() => component.isStartCalled);
operation = SceneManager.UnloadSceneAsync(aspectRatioFitterSceneName);
yield return operation;
}
[UnityTest]
public IEnumerator SceneWithNestedContentSizeFitterLoads()
{
AsyncOperation operation = SceneManager.LoadSceneAsync(contentSizeFitterSceneName, LoadSceneMode.Additive);
yield return operation;
SceneManager.SetActiveScene(SceneManager.GetSceneByName(contentSizeFitterSceneName));
var go = GameObject.Find("GameObject");
var component = go.GetComponent<SceneWithNestedLayoutElementsLoadScript>();
yield return new WaitUntil(() => component.isStartCalled);
operation = SceneManager.UnloadSceneAsync(contentSizeFitterSceneName);
yield return operation;
}
[UnityTest]
public IEnumerator SceneWithNestedLayoutGroupLoads()
{
AsyncOperation operation = SceneManager.LoadSceneAsync(layoutGroupSceneName, LoadSceneMode.Additive);
yield return operation;
SceneManager.SetActiveScene(SceneManager.GetSceneByName(layoutGroupSceneName));
var go = GameObject.Find("GameObject");
var component = go.GetComponent<SceneWithNestedLayoutElementsLoadScript>();
yield return new WaitUntil(() => component.isStartCalled);
operation = SceneManager.UnloadSceneAsync(layoutGroupSceneName);
yield return operation;
}
[SetUp]
public void TestSetup()
{
m_InitScene = SceneManager.GetActiveScene();
}
[TearDown]
public void TearDown()
{
SceneManager.SetActiveScene(m_InitScene);
}
[OneTimeTearDown]
public void OnTimeTearDown()
{
//Manually add Assets/ and .unity as CreateSceneUtility does that for you.
#if UNITY_EDITOR
AssetDatabase.DeleteAsset("Assets/" + aspectRatioFitterSceneName + ".unity");
AssetDatabase.DeleteAsset("Assets/" + contentSizeFitterSceneName + ".unity");
AssetDatabase.DeleteAsset("Assets/" + layoutGroupSceneName + ".unity");
#endif
}
}
| 411 | 0.728123 | 1 | 0.728123 | game-dev | MEDIA | 0.789965 | game-dev,graphics-rendering | 0.920552 | 1 | 0.920552 |
Magix-Archive/GC-Universe | 4,219 | grasscutter/0001-Hide-lua-debug-messages.patch | Subject: [PATCH] misc: Hide Lua debugging messages
while we should demote the Lua messages to verbose, this will do for now
---
Index: src/main/java/emu/grasscutter/scripts/ScriptLib.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/emu/grasscutter/scripts/ScriptLib.java b/src/main/java/emu/grasscutter/scripts/ScriptLib.java
--- a/src/main/java/emu/grasscutter/scripts/ScriptLib.java (revision f9d46ace7ff6a0ed248adf2bb3a5eb80dda864b0)
+++ b/src/main/java/emu/grasscutter/scripts/ScriptLib.java (date 1720476681181)
@@ -31,7 +31,9 @@
@SuppressWarnings("unused")
public class ScriptLib {
- public static final Logger logger = Grasscutter.getLogger();
+ // GC-Universe - Separate Lua logger
+ private final Logger logger = LoggerFactory.getLogger("Lua Engine");
+
private final FastThreadLocal<SceneScriptManager> sceneScriptManager;
private final FastThreadLocal<SceneGroup> currentGroup;
private final FastThreadLocal<ScriptArgs> callParams;
@@ -42,6 +44,12 @@
this.currentGroup = new FastThreadLocal<>();
this.callParams = new FastThreadLocal<>();
this.currentEntity = new FastThreadLocal<>();
+
+ // GC-Universe start - Lua logger debug constant
+ if (emu.grasscutter.DebugConstants.LOG_LUA_SCRIPTS) {
+ io.grasscutter.Log.apply(this.logger);
+ }
+ // GC-Universe end
}
public void setSceneScriptManager(SceneScriptManager sceneScriptManager) {
Index: src/main/java/emu/grasscutter/scripts/SceneScriptManager.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java
--- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java (revision f9d46ace7ff6a0ed248adf2bb3a5eb80dda864b0)
+++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java (date 1720476630900)
@@ -1008,7 +1008,8 @@
try {
return func.call(ScriptLoader.getScriptLibLua(), args);
} catch (LuaError error) {
- ScriptLib.logger.error(
+ // GC-Universe - Use Grasscutter#getLogger
+ Grasscutter.getLogger().error(
"[LUA] call trigger failed in group {} with {},{}", group.id, name, args, error);
return LuaValue.valueOf(-1);
}
Index: src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java b/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java
--- a/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java (revision f9d46ace7ff6a0ed248adf2bb3a5eb80dda864b0)
+++ b/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java (date 1720476716882)
@@ -85,7 +85,8 @@
.invoke(new LuaValue[] {ScriptLoader.getScriptLibLua(), arg1, arg2, arg3})
.arg1();
} catch (LuaError error) {
- ScriptLib.logger.error(
+ // GC-Universe - Use Grasscutter#getLogger
+ Grasscutter.getLogger().error(
"[LUA] call function failed in gadget {} with {} {} {},{}",
entity.getEntityTypeId(),
funcName,
@@ -96,7 +97,8 @@
ret = LuaValue.valueOf(-1);
}
} else if (funcName != null && !SERVER_CALLED.contains(funcName)) {
- ScriptLib.logger.error(
+ // GC-Universe - Use Grasscutter#getLogger
+ Grasscutter.getLogger().error(
"[LUA] unknown func in gadget {} with {} {} {} {}",
entity.getEntityTypeId(),
funcName,
| 411 | 0.687346 | 1 | 0.687346 | game-dev | MEDIA | 0.639734 | game-dev | 0.86984 | 1 | 0.86984 |
nelemans1971/AudioFingerprinting | 10,073 | AudioFingerprint/Lucene.Net.3.03/Index/MultiLevelSkipListReader.cs | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using BufferedIndexInput = Lucene.Net.Store.BufferedIndexInput;
using IndexInput = Lucene.Net.Store.IndexInput;
namespace Lucene.Net.Index
{
/// <summary> This abstract class reads skip lists with multiple levels.
///
/// See <see cref="MultiLevelSkipListWriter" /> for the information about the encoding
/// of the multi level skip lists.
///
/// Subclasses must implement the abstract method <see cref="ReadSkipData(int, IndexInput)" />
/// which defines the actual format of the skip data.
/// </summary>
abstract class MultiLevelSkipListReader : IDisposable
{
// the maximum number of skip levels possible for this index
private readonly int maxNumberOfSkipLevels;
// number of levels in this skip list
private int numberOfSkipLevels;
// Expert: defines the number of top skip levels to buffer in memory.
// Reducing this number results in less memory usage, but possibly
// slower performance due to more random I/Os.
// Please notice that the space each level occupies is limited by
// the skipInterval. The top level can not contain more than
// skipLevel entries, the second top level can not contain more
// than skipLevel^2 entries and so forth.
private const int numberOfLevelsToBuffer = 1;
private int docCount;
private bool haveSkipped;
private bool isDisposed;
private readonly IndexInput[] skipStream; // skipStream for each level
private readonly long[] skipPointer; // the start pointer of each skip level
private readonly int[] skipInterval; // skipInterval of each level
private readonly int[] numSkipped; // number of docs skipped per level
private readonly int[] skipDoc; // doc id of current skip entry per level
private int lastDoc; // doc id of last read skip entry with docId <= target
private readonly long[] childPointer; // child pointer of current skip entry per level
private long lastChildPointer; // childPointer of last read skip entry with docId <= target
private readonly bool inputIsBuffered;
protected MultiLevelSkipListReader(IndexInput skipStream, int maxSkipLevels, int skipInterval)
{
this.skipStream = new IndexInput[maxSkipLevels];
this.skipPointer = new long[maxSkipLevels];
this.childPointer = new long[maxSkipLevels];
this.numSkipped = new int[maxSkipLevels];
this.maxNumberOfSkipLevels = maxSkipLevels;
this.skipInterval = new int[maxSkipLevels];
this.skipStream[0] = skipStream;
this.inputIsBuffered = (skipStream is BufferedIndexInput);
this.skipInterval[0] = skipInterval;
for (int i = 1; i < maxSkipLevels; i++)
{
// cache skip intervals
this.skipInterval[i] = this.skipInterval[i - 1] * skipInterval;
}
skipDoc = new int[maxSkipLevels];
}
/// <summary>Returns the id of the doc to which the last call of <see cref="SkipTo(int)" />
/// has skipped.
/// </summary>
internal virtual int GetDoc()
{
return lastDoc;
}
/// <summary>Skips entries to the first beyond the current whose document number is
/// greater than or equal to <i>target</i>. Returns the current doc count.
/// </summary>
internal virtual int SkipTo(int target)
{
if (!haveSkipped)
{
// first time, load skip levels
LoadSkipLevels();
haveSkipped = true;
}
// walk up the levels until highest level is found that has a skip
// for this target
int level = 0;
while (level < numberOfSkipLevels - 1 && target > skipDoc[level + 1])
{
level++;
}
while (level >= 0)
{
if (target > skipDoc[level])
{
if (!LoadNextSkip(level))
{
continue;
}
}
else
{
// no more skips on this level, go down one level
if (level > 0 && lastChildPointer > skipStream[level - 1].FilePointer)
{
SeekChild(level - 1);
}
level--;
}
}
return numSkipped[0] - skipInterval[0] - 1;
}
private bool LoadNextSkip(int level)
{
// we have to skip, the target document is greater than the current
// skip list entry
SetLastSkipData(level);
numSkipped[level] += skipInterval[level];
if (numSkipped[level] > docCount)
{
// this skip list is exhausted
skipDoc[level] = System.Int32.MaxValue;
if (numberOfSkipLevels > level)
numberOfSkipLevels = level;
return false;
}
// read next skip entry
skipDoc[level] += ReadSkipData(level, skipStream[level]);
if (level != 0)
{
// read the child pointer if we are not on the leaf level
childPointer[level] = skipStream[level].ReadVLong() + skipPointer[level - 1];
}
return true;
}
/// <summary>Seeks the skip entry on the given level </summary>
protected internal virtual void SeekChild(int level)
{
skipStream[level].Seek(lastChildPointer);
numSkipped[level] = numSkipped[level + 1] - skipInterval[level + 1];
skipDoc[level] = lastDoc;
if (level > 0)
{
childPointer[level] = skipStream[level].ReadVLong() + skipPointer[level - 1];
}
}
public void Dispose()
{
Dispose(true);
}
protected virtual void Dispose(bool disposing)
{
if (isDisposed) return;
if (disposing)
{
for (int i = 1; i < skipStream.Length; i++)
{
if (skipStream[i] != null)
{
skipStream[i].Close();
}
}
}
isDisposed = true;
}
/// <summary>initializes the reader </summary>
internal virtual void Init(long skipPointer, int df)
{
this.skipPointer[0] = skipPointer;
this.docCount = df;
System.Array.Clear(skipDoc, 0, skipDoc.Length);
System.Array.Clear(numSkipped, 0, numSkipped.Length);
System.Array.Clear(childPointer, 0, childPointer.Length);
haveSkipped = false;
for (int i = 1; i < numberOfSkipLevels; i++)
{
skipStream[i] = null;
}
}
/// <summary>Loads the skip levels </summary>
private void LoadSkipLevels()
{
numberOfSkipLevels = docCount == 0?0:(int) System.Math.Floor(System.Math.Log(docCount) / System.Math.Log(skipInterval[0]));
if (numberOfSkipLevels > maxNumberOfSkipLevels)
{
numberOfSkipLevels = maxNumberOfSkipLevels;
}
skipStream[0].Seek(skipPointer[0]);
int toBuffer = numberOfLevelsToBuffer;
for (int i = numberOfSkipLevels - 1; i > 0; i--)
{
// the length of the current level
long length = skipStream[0].ReadVLong();
// the start pointer of the current level
skipPointer[i] = skipStream[0].FilePointer;
if (toBuffer > 0)
{
// buffer this level
skipStream[i] = new SkipBuffer(skipStream[0], (int) length);
toBuffer--;
}
else
{
// clone this stream, it is already at the start of the current level
skipStream[i] = (IndexInput) skipStream[0].Clone();
if (inputIsBuffered && length < BufferedIndexInput.BUFFER_SIZE)
{
((BufferedIndexInput) skipStream[i]).SetBufferSize((int) length);
}
// move base stream beyond the current level
skipStream[0].Seek(skipStream[0].FilePointer + length);
}
}
// use base stream for the lowest level
skipPointer[0] = skipStream[0].FilePointer;
}
/// <summary> Subclasses must implement the actual skip data encoding in this method.
///
/// </summary>
/// <param name="level">the level skip data shall be read from
/// </param>
/// <param name="skipStream">the skip stream to read from
/// </param>
protected internal abstract int ReadSkipData(int level, IndexInput skipStream);
/// <summary>Copies the values of the last read skip entry on this level </summary>
protected internal virtual void SetLastSkipData(int level)
{
lastDoc = skipDoc[level];
lastChildPointer = childPointer[level];
}
/// <summary>used to buffer the top skip levels </summary>
private sealed class SkipBuffer : IndexInput
{
private byte[] data;
private readonly long pointer;
private int pos;
private bool isDisposed;
internal SkipBuffer(IndexInput input, int length)
{
data = new byte[length];
pointer = input.FilePointer;
input.ReadBytes(data, 0, length);
}
protected override void Dispose(bool disposing)
{
if (isDisposed) return;
if (disposing)
{
data = null;
}
isDisposed = true;
}
public override long FilePointer
{
get { return pointer + pos; }
}
public override long Length()
{
return data.Length;
}
public override byte ReadByte()
{
return data[pos++];
}
public override void ReadBytes(byte[] b, int offset, int len)
{
Array.Copy(data, pos, b, offset, len);
pos += len;
}
public override void Seek(long pos)
{
this.pos = (int) (pos - pointer);
}
override public System.Object Clone()
{
System.Diagnostics.Debug.Fail("Port issue:", "Lets see if we need this FilterIndexReader.Clone()"); // {{Aroush-2.9}}
return null;
}
}
}
} | 411 | 0.821304 | 1 | 0.821304 | game-dev | MEDIA | 0.323044 | game-dev | 0.895713 | 1 | 0.895713 |
magefree/mage | 1,189 | Mage.Sets/src/mage/cards/t/ThromokTheInsatiable.java | package mage.cards.t;
import mage.MageInt;
import mage.abilities.keyword.DevourAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SuperType;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class ThromokTheInsatiable extends CardImpl {
public ThromokTheInsatiable(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{G}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.HELLION);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Devour X, where X is the number of creatures devoured this way (As this enters the battlefield, you may sacrifice any number of creatures. This creature enters the battlefield with X +1/+1 counters on it for each of those creatures.)
this.addAbility(DevourAbility.devourX());
}
private ThromokTheInsatiable(final ThromokTheInsatiable card) {
super(card);
}
@Override
public ThromokTheInsatiable copy() {
return new ThromokTheInsatiable(this);
}
}
| 411 | 0.973102 | 1 | 0.973102 | game-dev | MEDIA | 0.957867 | game-dev | 0.974505 | 1 | 0.974505 |
ikaros-dev/ikaros | 2,199 | server/src/main/java/run/ikaros/server/plugin/YamlPluginDescriptorFinder.java | package run.ikaros.server.plugin;
import java.nio.file.Files;
import java.nio.file.Path;
import lombok.extern.slf4j.Slf4j;
import org.pf4j.PluginDependency;
import org.pf4j.PluginDescriptor;
import org.pf4j.PluginDescriptorFinder;
import org.pf4j.util.FileUtils;
import run.ikaros.api.plugin.custom.Plugin;
@Slf4j
public class YamlPluginDescriptorFinder implements PluginDescriptorFinder {
private final YamlPluginFinder yamlPluginFinder;
private final IkarosPluginManager pluginManager;
public YamlPluginDescriptorFinder(IkarosPluginManager pluginManager) {
this.yamlPluginFinder = new YamlPluginFinder(pluginManager);
this.pluginManager = pluginManager;
}
@Override
public boolean isApplicable(Path pluginPath) {
return Files.exists(pluginPath)
&& (Files.isDirectory(pluginPath)
|| FileUtils.isJarFile(pluginPath));
}
@Override
public PluginDescriptor find(Path pluginPath) {
Plugin plugin = yamlPluginFinder.find(pluginPath);
return convert(plugin);
}
private IkarosPluginDescriptor convert(Plugin plugin) {
IkarosPluginDescriptor pluginDescriptor =
new IkarosPluginDescriptor(plugin.getName(),
plugin.getDescription(),
plugin.getClazz(),
plugin.getVersion(),
plugin.getRequires(),
plugin.getAuthor().getName(),
plugin.getLicense());
pluginDescriptor.setAuthor(plugin.getAuthor());
pluginDescriptor.setLogo(plugin.getLogo());
pluginDescriptor.setHomepage(plugin.getHomepage());
pluginDescriptor.setDisplayName(plugin.getDisplayName());
pluginDescriptor.setLoadLocation(plugin.getLoadLocation());
pluginDescriptor.setConfigMapSchemas(plugin.getConfigMapSchemas());
// add dependencies
plugin.getDependencies().forEach((pluginDepName, versionRequire) -> {
PluginDependency dependency =
new PluginDependency(String.format("%s@%s", pluginDepName, versionRequire));
pluginDescriptor.addDependency(dependency);
});
return pluginDescriptor;
}
}
| 411 | 0.787206 | 1 | 0.787206 | game-dev | MEDIA | 0.370723 | game-dev | 0.845479 | 1 | 0.845479 |
Citadel-Station-13/Citadel-Station-13 | 20,259 | code/game/turfs/turf.dm | GLOBAL_LIST_EMPTY(station_turfs)
/// Any floor or wall. What makes up the station and the rest of the map.
/turf
icon = 'icons/turf/floors.dmi'
flags_1 = CAN_BE_DIRTY_1
vis_flags = VIS_INHERIT_ID|VIS_INHERIT_PLANE // Important for interaction with and visualization of openspace.
luminosity = 1
var/intact = 1
// baseturfs can be either a list or a single turf type.
// In class definition like here it should always be a single type.
// A list will be created in initialization that figures out the baseturf's baseturf etc.
// In the case of a list it is sorted from bottom layer to top.
// This shouldn't be modified directly, use the helper procs.
var/list/baseturfs = /turf/baseturf_bottom
var/initial_temperature = T20C
var/to_be_destroyed = 0 //Used for fire, if a melting temperature was reached, it will be destroyed
var/max_fire_temperature_sustained = 0 //The max temperature of the fire which it was subjected to
var/blocks_air = FALSE
var/list/image/blueprint_data //for the station blueprints, images of objects eg: pipes
var/explosion_level = 0 //for preventing explosion dodging
var/explosion_id = 0
var/requires_activation //add to air processing after initialize?
var/changing_turf = FALSE
var/bullet_bounce_sound = 'sound/weapons/bulletremove.ogg' //sound played when a shell casing is ejected ontop of the turf.
var/bullet_sizzle = FALSE //used by ammo_casing/bounce_away() to determine if the shell casing should make a sizzle sound when it's ejected over the turf
//IE if the turf is supposed to be water, set TRUE.
var/tiled_dirt = FALSE // use smooth tiled dirt decal
/turf/vv_edit_var(var_name, new_value)
var/static/list/banned_edits = list("x", "y", "z")
if(var_name in banned_edits)
return FALSE
. = ..()
/**
* Turf Initialize
*
* Doesn't call parent, see [/atom/proc/Initialize]
*/
/turf/Initialize(mapload)
SHOULD_CALL_PARENT(FALSE)
if(flags_1 & INITIALIZED_1)
stack_trace("Warning: [src]([type]) initialized multiple times!")
flags_1 |= INITIALIZED_1
// by default, vis_contents is inherited from the turf that was here before
vis_contents.Cut()
if(color) // is this being used? This is here because parent isn't being called
add_atom_colour(color, FIXED_COLOUR_PRIORITY)
assemble_baseturfs()
levelupdate()
if(smooth)
queue_smooth(src)
visibilityChanged()
for(var/atom/movable/AM in src)
Entered(AM)
var/area/A = loc
if(!IS_DYNAMIC_LIGHTING(src) && IS_DYNAMIC_LIGHTING(A))
add_overlay(/obj/effect/fullbright)
if(requires_activation)
ImmediateCalculateAdjacentTurfs()
if (light_power && light_range)
update_light()
var/turf/T = SSmapping.get_turf_above(src)
if(T)
T.multiz_turf_new(src, DOWN)
T = SSmapping.get_turf_below(src)
if(T)
T.multiz_turf_new(src, UP)
if (opacity)
has_opaque_atom = TRUE
// apply materials properly from the default custom_materials value
set_custom_materials(custom_materials)
ComponentInitialize()
if(isopenturf(src))
var/turf/open/O = src
__auxtools_update_turf_temp_info(isspaceturf(get_z_base_turf()) && !O.planetary_atmos)
else
update_air_ref(-1)
__auxtools_update_turf_temp_info(isspaceturf(get_z_base_turf()))
return INITIALIZE_HINT_NORMAL
/turf/proc/__auxtools_update_turf_temp_info()
/turf/return_temperature()
/turf/proc/set_temperature()
/turf/proc/Initalize_Atmos(times_fired)
ImmediateCalculateAdjacentTurfs()
/turf/Destroy(force)
. = QDEL_HINT_IWILLGC
if(!changing_turf)
stack_trace("Incorrect turf deletion")
changing_turf = FALSE
var/turf/T = SSmapping.get_turf_above(src)
if(T)
T.multiz_turf_del(src, DOWN)
T = SSmapping.get_turf_below(src)
if(T)
T.multiz_turf_del(src, UP)
if(force)
..()
//this will completely wipe turf state
var/turf/B = new world.turf(src)
for(var/A in B.contents)
qdel(A)
return
visibilityChanged()
QDEL_LIST(blueprint_data)
flags_1 &= ~INITIALIZED_1
requires_activation = FALSE
..()
vis_contents.Cut()
/turf/on_attack_hand(mob/user)
user.Move_Pulled(src)
/turf/proc/multiz_turf_del(turf/T, dir)
SEND_SIGNAL(src, COMSIG_TURF_MULTIZ_DEL, T, dir)
/turf/proc/multiz_turf_new(turf/T, dir)
SEND_SIGNAL(src, COMSIG_TURF_MULTIZ_NEW, T, dir)
//zPassIn doesn't necessarily pass an atom!
//direction is direction of travel of air
/turf/proc/zPassIn(atom/movable/A, direction, turf/source)
return FALSE
//direction is direction of travel of air
/turf/proc/zPassOut(atom/movable/A, direction, turf/destination)
return FALSE
//direction is direction of travel of air
/turf/proc/zAirIn(direction, turf/source)
return FALSE
//direction is direction of travel of air
/turf/proc/zAirOut(direction, turf/source)
return FALSE
/turf/proc/zImpact(atom/movable/A, levels = 1, turf/prev_turf)
var/flags = NONE
var/mov_name = A.name
for(var/i in contents)
var/atom/thing = i
flags |= thing.intercept_zImpact(A, levels)
if(flags & FALL_STOP_INTERCEPTING)
break
if(prev_turf && !(flags & FALL_NO_MESSAGE))
prev_turf.visible_message("<span class='danger'>[mov_name] falls through [prev_turf]!</span>")
if(flags & FALL_INTERCEPTED)
return
if(zFall(A, levels + 1))
return FALSE
A.visible_message("<span class='danger'>[A] crashes into [src]!</span>")
A.onZImpact(src, levels)
return TRUE
/turf/proc/can_zFall(atom/movable/A, levels = 1, turf/target)
SHOULD_BE_PURE(TRUE)
return zPassOut(A, DOWN, target) && target.zPassIn(A, DOWN, src)
/turf/proc/zFall(atom/movable/A, levels = 1, force = FALSE)
var/turf/target = get_step_multiz(src, DOWN)
if(!target || (!isobj(A) && !ismob(A)))
return FALSE
if(!force && (!can_zFall(A, levels, target) || !A.can_zFall(src, levels, target, DOWN)))
return FALSE
A.zfalling = TRUE
A.forceMove(target)
A.zfalling = FALSE
target.zImpact(A, levels, src)
return TRUE
/turf/proc/handleRCL(obj/item/rcl/C, mob/user)
if(C.loaded)
for(var/obj/structure/cable/LC in src)
if(!LC.d1 || !LC.d2)
LC.handlecable(C, user)
return
C.loaded.place_turf(src, user)
if(C.wiring_gui_menu)
C.wiringGuiUpdate(user)
C.is_empty(user)
/turf/attackby(obj/item/C, mob/user, params)
if(..())
return TRUE
if(can_lay_cable() && istype(C, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = C
for(var/obj/structure/cable/LC in src)
if(!LC.d1 || !LC.d2)
LC.attackby(C,user)
return
coil.place_turf(src, user)
return TRUE
else if(istype(C, /obj/item/rcl))
handleRCL(C, user)
return FALSE
//There's a lot of QDELETED() calls here if someone can figure out how to optimize this but not runtime when something gets deleted by a Bump/CanPass/Cross call, lemme know or go ahead and fix this mess - kevinz000
/turf/Enter(atom/movable/mover, atom/oldloc)
// Do not call ..()
// Byond's default turf/Enter() doesn't have the behaviour we want with Bump()
// By default byond will call Bump() on the first dense object in contents
// Here's hoping it doesn't stay like this for years before we finish conversion to step_
var/atom/firstbump
var/canPassSelf = CanPass(mover, src)
if(canPassSelf || (mover.movement_type & PHASING))
for(var/i in contents)
if(QDELETED(mover))
return FALSE //We were deleted, do not attempt to proceed with movement.
if(i == mover || i == mover.loc) // Multi tile objects and moving out of other objects
continue
var/atom/movable/thing = i
if(!thing.Cross(mover))
if(QDELETED(mover)) //Mover deleted from Cross/CanPass, do not proceed.
return FALSE
if((mover.movement_type & PHASING))
mover.Bump(thing)
continue
else
if(!firstbump || ((thing.layer > firstbump.layer || thing.flags_1 & ON_BORDER_1) && !(firstbump.flags_1 & ON_BORDER_1)))
firstbump = thing
if(QDELETED(mover)) //Mover deleted from Cross/CanPass/Bump, do not proceed.
return FALSE
if(!canPassSelf) //Even if mover is unstoppable they need to bump us.
firstbump = src
if(firstbump)
mover.Bump(firstbump)
return (mover.movement_type & PHASING)
return TRUE
/turf/Exit(atom/movable/mover, atom/newloc)
. = ..()
if(!. || QDELETED(mover))
return FALSE
for(var/i in contents)
if(i == mover)
continue
var/atom/movable/thing = i
if(!thing.Uncross(mover, newloc))
if(thing.flags_1 & ON_BORDER_1)
mover.Bump(thing)
if(!(mover.movement_type & PHASING))
return FALSE
if(QDELETED(mover))
return FALSE //We were deleted.
/turf/Entered(atom/movable/AM)
..()
if(explosion_level && AM.ex_check(explosion_id))
AM.ex_act(explosion_level)
// If an opaque movable atom moves around we need to potentially update visibility.
if (AM.opacity)
has_opaque_atom = TRUE // Make sure to do this before reconsider_lights(), incase we're on instant updates. Guaranteed to be on in this case.
reconsider_lights()
/turf/open/Entered(atom/movable/AM)
..()
//melting
if(isobj(AM) && air && air.return_temperature() > T0C)
var/obj/O = AM
if(O.obj_flags & FROZEN)
O.make_unfrozen()
if(!AM.zfalling)
zFall(AM)
/turf/proc/is_plasteel_floor()
return FALSE
// A proc in case it needs to be recreated or badmins want to change the baseturfs
/turf/proc/assemble_baseturfs(turf/fake_baseturf_type)
var/static/list/created_baseturf_lists = list()
var/turf/current_target
if(fake_baseturf_type)
if(length(fake_baseturf_type)) // We were given a list, just apply it and move on
baseturfs = fake_baseturf_type
return
current_target = fake_baseturf_type
else
if(length(baseturfs))
return // No replacement baseturf has been given and the current baseturfs value is already a list/assembled
if(!baseturfs)
current_target = initial(baseturfs) || type // This should never happen but just in case...
stack_trace("baseturfs var was null for [type]. Failsafe activated and it has been given a new baseturfs value of [current_target].")
else
current_target = baseturfs
// If we've made the output before we don't need to regenerate it
if(created_baseturf_lists[current_target])
var/list/premade_baseturfs = created_baseturf_lists[current_target]
if(length(premade_baseturfs))
baseturfs = premade_baseturfs.Copy()
else
baseturfs = premade_baseturfs
return baseturfs
var/turf/next_target = initial(current_target.baseturfs)
//Most things only have 1 baseturf so this loop won't run in most cases
if(current_target == next_target)
baseturfs = current_target
created_baseturf_lists[current_target] = current_target
return current_target
var/list/new_baseturfs = list(current_target)
for(var/i=0;current_target != next_target;i++)
if(i > 100)
// A baseturfs list over 100 members long is silly
// Because of how this is all structured it will only runtime/message once per type
stack_trace("A turf <[type]> created a baseturfs list over 100 members long. This is most likely an infinite loop.")
message_admins("A turf <[type]> created a baseturfs list over 100 members long. This is most likely an infinite loop.")
break
new_baseturfs.Insert(1, next_target)
current_target = next_target
next_target = initial(current_target.baseturfs)
baseturfs = new_baseturfs
created_baseturf_lists[new_baseturfs[new_baseturfs.len]] = new_baseturfs.Copy()
return new_baseturfs
/turf/proc/levelupdate()
for(var/obj/O in src)
if(O.flags_1 & INITIALIZED_1)
// SEND_SIGNAL(O, COMSIG_OBJ_HIDE, intact)
O.hide(intact)
// override for space turfs, since they should never hide anything
/turf/open/space/levelupdate()
return
// Removes all signs of lattice on the pos of the turf -Donkieyo
/turf/proc/RemoveLattice()
var/obj/structure/lattice/L = locate(/obj/structure/lattice, src)
if(L && (L.flags_1 & INITIALIZED_1))
qdel(L)
/turf/proc/phase_damage_creatures(damage,mob/U = null)//>Ninja Code. Hurts and knocks out creatures on this turf //NINJACODE
for(var/mob/living/M in src)
if(M==U)
continue//Will not harm U. Since null != M, can be excluded to kill everyone.
M.adjustBruteLoss(damage)
M.Unconscious(damage * 4)
for(var/obj/vehicle/sealed/mecha/M in src)
M.take_damage(damage*2, BRUTE, MELEE, 1)
/turf/proc/Bless()
new /obj/effect/blessing(src)
/turf/storage_contents_dump_act(datum/component/storage/src_object, mob/user)
. = ..()
if(.)
return
if(length(src_object.contents()))
to_chat(usr, "<span class='notice'>You start dumping out the contents...</span>")
if(!do_after(usr,20,target=src_object.parent))
return FALSE
var/list/things = src_object.contents()
var/datum/progressbar/progress = new(user, things.len, src)
while (do_after(usr, 1 SECONDS, src, NONE, FALSE, CALLBACK(src_object, TYPE_PROC_REF(/datum/component/storage, mass_remove_from_storage), src, things, progress, TRUE, user)))
stoplag(1)
progress.end_progress()
return TRUE
//////////////////////////////
//Distance procs
//////////////////////////////
//Distance associates with all directions movement
/turf/proc/Distance(var/turf/T)
return get_dist(src,T)
// This Distance proc assumes that only cardinal movement is
// possible. It results in more efficient (CPU-wise) pathing
// for bots and anything else that only moves in cardinal dirs.
/turf/proc/Distance_cardinal(turf/T)
if(!src || !T)
return FALSE
return abs(x - T.x) + abs(y - T.y)
////////////////////////////////////////////////////
/turf/singularity_act()
if(intact)
for(var/obj/O in contents) //this is for deleting things like wires contained in the turf
if(O.level != 1)
continue
if(O.invisibility == INVISIBILITY_MAXIMUM)
O.singularity_act()
ScrapeAway(flags = CHANGETURF_INHERIT_AIR)
return(2)
/turf/proc/can_have_cabling()
return TRUE
/turf/proc/can_lay_cable()
return can_have_cabling() & !intact
/turf/proc/visibilityChanged()
GLOB.cameranet.updateVisibility(src)
// The cameranet usually handles this for us, but if we've just been
// recreated we should make sure we have the cameranet vis_contents.
var/datum/camerachunk/C = GLOB.cameranet.chunkGenerated(x, y, z)
if(C)
if(C.obscuredTurfs[src])
vis_contents += GLOB.cameranet.vis_contents_objects
else
vis_contents -= GLOB.cameranet.vis_contents_objects
/turf/proc/burn_tile()
/turf/proc/is_shielded()
/turf/contents_explosion(severity, target, origin)
var/affecting_level
if(severity == 1)
affecting_level = 1
else if(is_shielded())
affecting_level = 3
else if(intact)
affecting_level = 2
else
affecting_level = 1
for(var/V in contents)
var/atom/A = V
if(!QDELETED(A) && A.level >= affecting_level)
if(ismovable(A))
var/atom/movable/AM = A
if(!AM.ex_check(explosion_id))
continue
A.ex_act(severity, target, origin)
CHECK_TICK
/turf/wave_ex_act(power, datum/wave_explosion/explosion, dir)
. = ..()
var/affecting_level
if(is_shielded())
affecting_level = 3
else if(intact)
affecting_level = 2
else
affecting_level = 1
var/atom/A
for(var/i in contents)
if(. <= 0)
return FALSE
A = i
if(!QDELETED(A) && A.level >= affecting_level)
. = A.wave_explode(., explosion, dir)
maptext = MAPTEXT("[.]")
/turf/narsie_act(force, ignore_mobs, probability = 20)
. = (prob(probability) || force)
for(var/I in src)
var/atom/A = I
if(ignore_mobs && ismob(A))
continue
if(ismob(A) || .)
A.narsie_act()
/turf/ratvar_act(force, ignore_mobs, probability = 40)
. = (prob(probability) || force)
for(var/I in src)
var/atom/A = I
if(ignore_mobs && ismob(A))
continue
if(ismob(A) || .)
A.ratvar_act()
//called on /datum/species/proc/altdisarm()
/turf/shove_act(mob/living/target, mob/living/user, pre_act = FALSE)
var/list/possibilities
for(var/obj/O in contents)
if((O.obj_flags & SHOVABLE_ONTO))
LAZYADD(possibilities, O)
else if(!O.CanPass(target, src))
return FALSE
if(possibilities)
var/obj/O = pick(possibilities)
return O.shove_act(target, user)
return FALSE
/turf/proc/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir)
underlay_appearance.icon = icon
underlay_appearance.icon_state = icon_state
underlay_appearance.dir = adjacency_dir
return TRUE
/turf/proc/add_blueprints(atom/movable/AM)
var/image/I = new
I.appearance = AM.appearance
I.appearance_flags = RESET_COLOR|RESET_ALPHA|RESET_TRANSFORM
I.loc = src
I.setDir(AM.dir)
I.alpha = 128
LAZYADD(blueprint_data, I)
/turf/proc/add_blueprints_preround(atom/movable/AM)
if(!SSticker.HasRoundStarted())
add_blueprints(AM)
/turf/proc/is_transition_turf()
return
/turf/acid_act(acidpwr, acid_volume)
. = 1
var/acid_type = /obj/effect/acid
if(acidpwr >= 200) //alien acid power
acid_type = /obj/effect/acid/alien
var/has_acid_effect = FALSE
for(var/obj/O in src)
if(intact && O.level == 1) //hidden under the floor
continue
if(istype(O, acid_type))
var/obj/effect/acid/A = O
A.acid_level = min(A.level + acid_volume * acidpwr, 12000)//capping acid level to limit power of the acid
has_acid_effect = 1
continue
O.acid_act(acidpwr, acid_volume)
if(!has_acid_effect)
new acid_type(src, acidpwr, acid_volume)
/turf/proc/acid_melt()
return
/turf/handle_fall(mob/faller, forced)
faller.lying = pick(90, 270)
if(!forced)
return
if(has_gravity(src))
playsound(src, "bodyfall", 50, TRUE)
faller.drop_all_held_items()
/turf/proc/photograph(limit=20)
var/image/I = new()
I.add_overlay(src)
for(var/V in contents)
var/atom/A = V
if(A.invisibility)
continue
I.add_overlay(A)
if(limit)
limit--
else
return I
return I
/turf/AllowDrop()
return TRUE
/turf/proc/add_vomit_floor(mob/living/M, toxvomit = NONE, purge_ratio = 0.1)
var/obj/effect/decal/cleanable/vomit/V = new /obj/effect/decal/cleanable/vomit(src, M.get_static_viruses())
//if the vomit combined, apply toxicity and reagents to the old vomit
if (QDELETED(V))
V = locate() in src
if(!V) //the decal was spawned on a wall or groundless turf and promptly qdeleted.
return
// Apply the proper icon set based on vomit type
if(toxvomit == VOMIT_PURPLE)
V.icon_state = "vomitpurp_[pick(1,4)]"
else if (toxvomit == VOMIT_TOXIC)
V.icon_state = "vomittox_[pick(1,4)]"
else if (toxvomit == VOMIT_NANITE)
V.name = "metallic slurry"
V.desc = "A puddle of metallic slurry that looks vaguely like very fine sand. It almost seems like it's moving..."
V.icon_state = "vomitnanite_[pick(1,4)]"
if (purge_ratio && iscarbon(M))
clear_reagents_to_vomit_pool(M, V, purge_ratio)
/proc/clear_reagents_to_vomit_pool(mob/living/carbon/M, obj/effect/decal/cleanable/vomit/V, purge_ratio = 0.1)
for(var/datum/reagent/consumable/R in M.reagents.reagent_list) //clears the stomach of anything that might be digested as food
if(R.nutriment_factor > 0)
M.reagents.del_reagent(R.type)
var/chemicals_lost = M.reagents.total_volume * purge_ratio
M.reagents.trans_to(V, chemicals_lost)
//Whatever happens after high temperature fire dies out or thermite reaction works.
//Should return new turf
/turf/proc/Melt()
return ScrapeAway(flags = CHANGETURF_INHERIT_AIR)
/turf/proc/get_yelling_resistance(power)
. = 0
// don't bother checking fulltile, we don't need accuracy
var/obj/window = locate(/obj/structure/window) in src
if(!window)
window = locate(/obj/machinery/door/window) in src
if(window)
. += 4 // windows are minimally resistant
// if there's more than one someone fucked up as that shouldn't happen
var/obj/machinery/door/D = locate() in src
if(D?.density)
. += D.opacity? 29 : 19 // glass doors are slightly more resistant to screaming
/**
* Returns adjacent turfs to this turf that are reachable, in all cardinal directions
*
* Arguments:
* * caller: The movable, if one exists, being used for mobility checks to see what tiles it can reach
* * ID: An ID card that decides if we can gain access to doors that would otherwise block a turf
* * simulated_only: Do we only worry about turfs with simulated atmos, most notably things that aren't space?
*/
/turf/proc/reachableAdjacentTurfs(caller, ID, simulated_only)
var/static/space_type_cache = typecacheof(/turf/open/space)
. = list()
for(var/iter_dir in GLOB.cardinals)
var/turf/turf_to_check = get_step(src,iter_dir)
if(!turf_to_check || (simulated_only && space_type_cache[turf_to_check.type]))
continue
if(turf_to_check.density || LinkBlockedWithAccess(turf_to_check, caller, ID))
continue
. += turf_to_check
| 411 | 0.940838 | 1 | 0.940838 | game-dev | MEDIA | 0.484611 | game-dev | 0.956294 | 1 | 0.956294 |
sgi-demos/sgi-demos | 9,364 | demos/flight/main.c | /**************************************************************************
* *
* Copyright (C) 1988 Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
/**************************************************************************
* *
* Copyright (C) 1983, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#include <stdlib.h> /* NULL */
#include "flight.h"
#include "EM_CHILD_APP.h"
Plane planes[MAX_PLANES];
int main (int argc, char **argv)
{
flight(argc,argv);
}
reset_meters ()
{
makeobj (RADAR);
closeobj ();
clear_report_card ();
if (!hud) {
callobj (CLEAR_TEXT_DISPLAY);
callobj (CLEAR_METERS); /* clear all the meters */
callobj (CLEAR_FUEL_METER);
editobj (HORIZON_METER);
objreplace (HORIZON_EDIT);
rotate (0,'z');
translate (0.0,0.0,0.0);
objreplace (YAW_EDIT);
translate (0.0,0.0,0.0);
closeobj ();
callobj (HORIZON_METER);
}
}
reset_fov (fov)
int fov;
{
float ar,sin,cos;
editobj (SETUP_WORLD);
objreplace (FOV_EDIT);
if (hud)
then ar = (XMAXSCREEN+1.0)/(YMAXSCREEN+1.0);
else ar = (XMAXSCREEN-1.0)/(YMAXSCREEN-YMIDDLE);
perspective (fov,ar,2.0,1.0e6);
closeobj ();
fov >>= 1; /* half field of view */
gl_sincos (fov,&sin,&cos);
dist_for_lines = 25 * 200/3 * cos/sin;
if (hud) then dist_for_lines *= 2;
dist_for_lines >>= 5;
dist_for_lines *= dist_for_lines;
}
display_score ()
{
char *plane_name, **msg;
int i;
Plane p,*pp;
static char *score_msg[MAX_PLANES+6];
/* init the array first */
if (score_msg[0] == NULL) {
msg = score_msg;
*msg++ = " Score Board";
*msg++ = " ";
*msg++ = " Name Plane Won Lost Score";
*msg++ = "---------------- ----- --- ---- -----";
for (i=0; i < MAX_PLANES+2; i++)
*msg++ = (char *) malloc (strlen(score_msg[2])+1);
};
msg = &score_msg[4];
FOR_EACH_PLANE (p,pp) {
switch (p -> type) {
case C150:
plane_name = C150_NAME;
break;
case B747:
plane_name = B747_NAME;
break;
case F15:
plane_name = F15_NAME;
break;
case F16:
case F16W:
plane_name = F16_NAME;
break;
case F18:
plane_name = F18_NAME;
break;
case P38:
case P38W:
plane_name = P38_NAME;
break;
}
sprintf (*msg++,"%16s %5s %3d %4d %5d",
p -> myname, plane_name,
p -> won, p -> lost, p -> won - p -> lost);
}
sprintf (*msg++," ");
sprintf (*msg++,"Press any character to continue.");
**msg = '\0';
display_message (score_msg);
}
#define DY 14
void
make_crash (msg)
char *msg;
{
int y;
Plane p;
p = planes[0]; /* a bold assumption */
if (p -> status <= MEXPLODE) then return;
p -> lost++; /* increment my lost count */
p -> status = MEXPLODE;
y = METER_LLY-40-DY;
if (hud) {
makeobj (CLEAR_TEXT_DISPLAY);
color (white);
cmov2s (50,y);
charstr (msg); /* crash message */
closeobj ();
}
else {
cursoff ();
frontbuffer (TRUE);
pushmatrix ();
pushviewport ();
callobj (CLEAR_REPORT_CARD); /* just in case, also set up */
color (white);
cmov2s (50,y);
charstr (msg);
popmatrix ();
popviewport ();
frontbuffer (FALSE);
curson ();
}
}
clear_report_card ()
{
if (hud) {
if (isobj(CLEAR_TEXT_DISPLAY))
delobj(CLEAR_TEXT_DISPLAY); /* delete all text messages */
}
else {
cursoff ();
frontbuffer (TRUE); /* clear report card from both buffers */
callobj (CLEAR_REPORT_CARD);
frontbuffer (FALSE);
curson ();
}
}
int report_card (descent, roll, vx, vz, wheels, p)
int descent, vx, vz;
int roll, wheels;
Plane p;
{
short on_runway;
int azimuth,rating,y;
float xdist,zdist;
char charbuf[80];
azimuth = p -> azimuth;
on_runway = IN_BOX (p, -100.0, 100.0, -8500.0, 0.0);
roll /= 10;
if (roll > 180) roll -= 360;
rating = 1;
if (hud) makeobj (CLEAR_TEXT_DISPLAY); /* put text in object */
else {
cursoff ();
frontbuffer (TRUE);
callobj (CLEAR_REPORT_CARD); /* just in case, also set up */
}
color (white);
y = METER_LLY-40-DY;
cmov2s (50,y);
charstr ("Landing Report Card:");
sprintf (charbuf,"Rate of descent: %d fpm", descent * 60);
cmov2s (50,y-DY);
charstr (charbuf);
sprintf (charbuf,"Roll angle: %d", roll);
cmov2s (50,y-2*DY);
charstr (charbuf);
sprintf (charbuf,"Air speed: %d knots", vz);
cmov2s (50,y-3*DY);
charstr (charbuf);
if (!wheels) {
cmov2s (500,y);
charstr ("*** Landed with the landing gear up!");
rating = 0;
}
if (descent > 10) {
cmov2s (350,y-DY);
charstr ("*** Descending too fast!");
rating = 0;
}
if (roll < 0) then roll = -roll;
if (roll > 10) {
cmov2s (350,y-2*DY);
charstr ("*** Too much roll!");
rating = 0;
}
if (!on_runway) {
sprintf (charbuf,"*** Landed off the runway!");
cmov2s (350,y-3*DY);
charstr (charbuf);
rating = 0;
}
else if (vx > 10 || vx < -10) {
sprintf (charbuf,"*** Too much drifting: %d fps",vx);
cmov2s (350,y-3*DY);
charstr (charbuf);
rating = 0;
}
if (roll > 20 || descent > 20 || vx > 20 || vx < -20) then rating = -1;
cmov2s (250,y);
if (rating == 1) { /* good landing => rate it */
sprintf (charbuf,"Sideways speed: %d fps",vx);
cmov2s (650,y);
charstr (charbuf);
if (azimuth < 900 || azimuth > 2700)
then zdist = -1075.0 - p -> z;
else zdist = -7425.0 - p -> z;
xdist = fabs(p -> x);
sprintf (charbuf,"Distance from centerline: %d",(int)xdist);
cmov2s (650,y-DY);
charstr (charbuf);
zdist = fabs(zdist);
sprintf (charbuf,"Distance from touchdown: %d",(int)zdist);
cmov2s (650,y-2*DY);
charstr (charbuf);
if (azimuth > 2700) then azimuth = 3600-azimuth;
else if (azimuth > 900) then azimuth = 1800 - azimuth;
if (azimuth < 0) then azimuth = -azimuth;
azimuth /=10;
sprintf (charbuf,"Heading error: %d degrees",azimuth);
cmov2s (650,y-3*DY);
charstr (charbuf);
if (vx < 0) then vx = -vx;
rating = 100 - descent - roll - azimuth - (vx>>1)
-(int)(.01 * zdist) - (int)(.1 * xdist);
if (rating < 0) then rating = 0;
cmov2s (250,y);
sprintf (charbuf, "Nice landing! (%d/100)", rating);
charstr (charbuf);
}
else if (rating == 0) then charstr ("CRASH LANDING! (0/100)");
else {
charstr ("EXPLODED ON IMPACT!");
broadcast ("exploded on impact");
}
if (hud) then closeobj();
else {
frontbuffer (FALSE);
curson ();
}
return (rating);
}
/* check my missile against other planes */
void
check_missile (p)
Plane p;
{
char buf[NAME_LENGTH+32];
Plane ptest,*pp;
long last_kill;
last_kill = p -> mkill;
FOR_EACH_PLANE (ptest,pp)
if (p != ptest && test_blow_up (p,ptest)) {
p -> mkill = PLANE_ID (ptest);
if (last_kill == NULL_PLANE_ID) {
p -> mx = .2 * p -> mx + .8 * ptest -> x;
p -> my = .2 * p -> my + .8 * ptest -> y;
p -> mz = .2 * p -> mz + .8 * ptest -> z;
}
if (p -> mkill != last_kill) { /* debounce */
extern char *WEAPON_NAME[];
p -> won++;
sprintf (buf,"destroyed %s with a %s",
ptest -> myname,WEAPON_NAME[p -> mtype]);
broadcast (buf);
}
return;
}
}
int test_blow_up (m,p)
Plane m,p;
{
int dx,dy,dz;
static int MDIST[] = {250,350,150};
/* if the plane is not exploding */
if (p -> status > MEXPLODE) {
dx = m -> mx - p -> x;
dy = m -> my - p -> y;
dz = m -> mz - p -> z;
if (dx < 0) then dx = -dx;
if (dy < 0) then dy = -dy;
if (dz < 0) then dz = -dz;
if (dx + dy + dz < MDIST[m -> mtype]) {
if (m -> mstatus > MEXPLODE) then m -> mstatus = MEXPLODE;
return (TRUE);
}
}
return (FALSE);
}
/* find and return the closest plane to me */
Plane find_closest_plane (myp)
Plane myp;
{
float myx,myy,myz;
float dx,dy,dz, d,dbest;
Plane p,*pp,pbest;
pbest = NULL;
dbest = 1e30;
myx = my_ptw[2][0];
myy = my_ptw[2][1];
myz = my_ptw[2][2];
FOR_EACH_PLANE (p,pp) /* for each plane */
/* if its not me, not exploding, above 150 feet, not C150 */
if (p != myp && p -> status > MEXPLODE &&
p -> y > 150.0 && p -> type != C150)
{
dx = myp -> x - p -> x; /* compute distance */
dy = myp -> y - p -> y;
dz = myp -> z - p -> z;
d = sqrt(dx*dx + dy*dy + dz*dz);
if ((myx*dx + myy*dy + myz*dz)/d > .988) {
if (d < dbest) { /* and compare with best */
dbest = d;
pbest = p;
}
}
}
return (pbest);
}
| 411 | 0.599542 | 1 | 0.599542 | game-dev | MEDIA | 0.638202 | game-dev | 0.976155 | 1 | 0.976155 |
JetBoom/zombiesurvival | 3,416 | gamemodes/zombiesurvival/entities/weapons/weapon_zs_bloodsucker_headcrab.lua | AddCSLuaFile()
SWEP.Base = "weapon_zs_headcrab"
SWEP.PrintName = "Bloodsucker Headcrab"
SWEP.PounceDamage = 6
SWEP.NoHitRecovery = 0.6
SWEP.HitRecovery = 0.75
function SWEP:Initialize()
self:HideViewAndWorldModel()
end
if SERVER then SWEP.NextHeal = 0 end
function SWEP:Think()
local curtime = CurTime()
local owner = self:GetOwner()
if self:GetBurrowTime() > 0 and curtime >= self:GetBurrowTime() then
if not self:CanBurrow() then
self:SetBurrowTime(-(curtime + self.BurrowTime))
else
owner:DrawShadow(false)
if SERVER and curtime >= self.NextHeal then
self.NextHeal = curtime + 0.333
if owner:GetVelocity():LengthSqr() > 8 then
local effectdata = EffectData()
effectdata:SetOrigin(owner:GetPos() % 2)
util.Effect("headcrab_dust", effectdata, true, true)
end
if owner:Health() < owner:GetMaxHealth() then
owner:SetHealth(owner:Health() + 1)
end
end
end
elseif self:GetBurrowTime() < 0 and curtime >= -self:GetBurrowTime() then
self:SetBurrowTime(0)
elseif self:GetPouncing() then
if owner:IsOnGround() or 1 < owner:WaterLevel() then
self:SetPouncing(false)
self:SetNextPrimaryFire(curtime + self.NoHitRecovery)
else
--owner:LagCompensation(true)
local shootpos = owner:GetShootPos()
local trace = owner:CompensatedMeleeTrace(8, 12, shootpos, owner:GetForward())
local ent = trace.Entity
if trace.Hit then
self:SetPouncing(false)
self:SetNextPrimaryFire(curtime + self.HitRecovery)
end
if ent:IsValid() then
self:SetPouncing(false)
local damage = self.PounceDamage
local phys = ent:GetPhysicsObject()
if ent:IsPlayer() then
ent:MeleeViewPunch(damage)
if SERVER then
local nearest = ent:NearestPoint(shootpos)
util.Blood(nearest, math.Rand(damage * 0.5, damage * 0.75), (nearest - shootpos):GetNormalized(), math.Rand(damage * 5, damage * 10), true)
end
owner:AirBrake()
elseif phys:IsValid() and phys:IsMoveable() then
phys:ApplyForceOffset(damage * 600 * owner:EyeAngles():Forward(), (ent:NearestPoint(shootpos) + ent:GetPos() * 2) / 3)
ent:SetPhysicsAttacker(owner)
end
ent:TakeSpecialDamage(damage, self.PounceDamageType, owner, self, trace.HitPos)
if ent:IsPlayer() then
if SERVER then
self:EmitBiteSound()
ent:AddLegDamage(7.2)
end
if owner:Health() < owner:GetMaxHealth() then
owner:SetHealth(math.min(owner:Health() + self.PounceDamage, owner:GetMaxHealth()))
end
ent:GiveStatus("sickness", 5)
elseif SERVER then
self:EmitBiteObjectSound()
end
owner:ViewPunch(Angle(math.Rand(-20, 20), math.Rand(-20, 20), math.Rand(-20, 20)))
elseif trace.HitWorld then
if SERVER then
self:EmitHitSound()
end
end
--owner:LagCompensation(false)
end
end
self:NextThink(curtime)
return true
end
function SWEP:EmitBiteSound()
self:GetOwner():EmitSound("NPC_FastHeadcrab.Bite")
self:GetOwner():EmitSound("npc/barnacle/barnacle_gulp"..math.random(2)..".wav", 70, math.random(125, 130))
end
function SWEP:EmitBiteObjectSound()
self:GetOwner():EmitSound("NPC_FastHeadcrab.Bite")
end
function SWEP:EmitIdleSound()
self:GetOwner():EmitSound("NPC_FastHeadcrab.Idle")
end
function SWEP:EmitAttackSound()
self:GetOwner():EmitSound("npc/headcrab_fast/attack"..math.random(3)..".wav", 70, math.random(215,220))
end
function SWEP:Reload()
end
| 411 | 0.795572 | 1 | 0.795572 | game-dev | MEDIA | 0.950937 | game-dev | 0.978233 | 1 | 0.978233 |
pmret/papermario | 3,225 | src/world/common/atomic/ToadHouse.data.inc.c | #include "common.h"
#include "sprite/npc/Toad.h"
// to use this include, you must also define these
extern EvtScript N(EVS_ToadHouse_SetDialogue);
extern EvtScript N(EVS_ToadHouse_ReturnFromRest);
extern EvtScript N(EVS_ToadHouse_GetInBed);
EvtScript N(EVS_ToadHouse_Unk1) = {
Call(EnableModel, LVar4, false)
Call(EnableModel, LVar5, true)
Call(RotateModel, LVar6, 0, 0, 0, 1)
Call(RotateModel, LVar7, 0, 0, 0, 1)
Return
End
};
EvtScript N(EVS_ToadHouse_Unk2) = {
Set(LVar9, LVar7)
Set(LVar8, LVar6)
Set(LVar7, LVar5)
Set(LVar6, LVar4)
Wait(70)
Call(EnableModel, LVar6, false)
Thread
Wait(5)
Call(EnableModel, LVar6, true)
EndThread
Call(MakeLerp, 0, 180, 20, EASING_CUBIC_IN)
Label(1)
Call(UpdateLerp)
Call(RotateModel, LVar8, LVar0, 0, 0, -1)
Call(RotateModel, LVar9, LVar0, 0, 0, -1)
IfEq(LVar1, 1)
Wait(1)
Goto(1)
EndIf
Call(EnableModel, LVar7, false)
Return
End
};
#ifndef TOADHOUSE_ANIM_TALK
#define TOADHOUSE_ANIM_TALK ANIM_Toad_Red_Talk
#endif
#ifndef TOADHOUSE_ANIM_IDLE
#define TOADHOUSE_ANIM_IDLE ANIM_Toad_Red_Idle
#endif
EvtScript N(EVS_NpcInteract_ToadHouseKeeper) = {
Call(N(ToadHouse_InitScreenOverlay), 0, 0, 0)
ExecWait(N(EVS_ToadHouse_SetDialogue))
IfEq(LVar0, 0)
Return
EndIf
Set(LVar9, LVar1)
Set(LVarA, LVar2)
Set(LVarB, LVar3)
Call(N(ToadHouse_DoesPlayerNeedSleep))
IfEq(LVar1, 0)
Set(LVar8, LVar0)
EndIf
Call(SpeakToPlayer, NPC_SELF, TOADHOUSE_ANIM_TALK, TOADHOUSE_ANIM_IDLE, 0, LVar8)
Call(ShowChoice, MSG_Choice_0006)
Wait(3)
IfEq(LVar0, 1)
Call(ContinueSpeech, NPC_SELF, TOADHOUSE_ANIM_TALK, TOADHOUSE_ANIM_IDLE, 0, LVar9)
Return
EndIf
Call(ContinueSpeech, NPC_SELF, TOADHOUSE_ANIM_TALK, TOADHOUSE_ANIM_IDLE, 0, LVarA)
Call(SetPlayerJumpscale, 1)
Call(DisablePlayerPhysics, true)
Call(SetNpcFlagBits, NPC_SELF, NPC_FLAG_IGNORE_PLAYER_COLLISION, true)
Call(N(ToadHouse_DisableStatusBar))
IfNe(LVar4, 0)
Exec(N(EVS_ToadHouse_Unk2))
EndIf
Call(N(ToadHouse_PutPartnerAway), LVarA)
Wait(20)
ExecWait(N(EVS_ToadHouse_GetInBed))
Thread
Call(MakeLerp, 0, 255, 60, EASING_LINEAR)
Label(0)
Call(UpdateLerp)
Call(N(ToadHouse_UpdateScreenOverlay), 3, LVar0)
Wait(1)
IfEq(LVar1, 1)
Goto(0)
EndIf
Call(FullyRestoreHPandFP)
Call(FullyRestoreSP)
IfNe(LVar4, 0)
Exec(N(EVS_ToadHouse_Unk1))
EndIf
Call(N(ToadHouse_GetPartnerBackOut), LVarA)
Wait(45)
Call(MakeLerp, 255, 0, 30, EASING_LINEAR)
Label(1)
Call(UpdateLerp)
Call(N(ToadHouse_UpdateScreenOverlay), 0, LVar0)
Wait(1)
IfEq(LVar1, 1)
Goto(1)
EndIf
EndThread
Wait(105)
ExecWait(N(EVS_ToadHouse_ReturnFromRest))
Call(DisablePlayerPhysics, false)
Call(SetNpcFlagBits, NPC_SELF, NPC_FLAG_IGNORE_PLAYER_COLLISION, false)
Call(SpeakToPlayer, NPC_SELF, TOADHOUSE_ANIM_TALK, TOADHOUSE_ANIM_IDLE, 0, LVarB)
Call(N(ToadHouse_ShowWorldStatusBar))
Return
End
};
| 411 | 0.832838 | 1 | 0.832838 | game-dev | MEDIA | 0.97277 | game-dev | 0.835348 | 1 | 0.835348 |
kettingpowered/Ketting-1-20-x | 3,834 | patches/minecraft/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java.patch | --- a/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java
+++ b/net/minecraft/data/tags/IntrinsicHolderTagsProvider.java
@@ -13,26 +_,40 @@
public abstract class IntrinsicHolderTagsProvider<T> extends TagsProvider<T> {
private final Function<T, ResourceKey<T>> keyExtractor;
+ /**
+ * @deprecated Forge: Use the {@linkplain #IntrinsicHolderTagsProvider(PackOutput, ResourceKey, CompletableFuture, Function, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant}
+ */
+ @Deprecated
public IntrinsicHolderTagsProvider(PackOutput p_256164_, ResourceKey<? extends Registry<T>> p_256155_, CompletableFuture<HolderLookup.Provider> p_256488_, Function<T, ResourceKey<T>> p_256168_) {
- super(p_256164_, p_256155_, p_256488_);
+ this(p_256164_, p_256155_, p_256488_, p_256168_, "vanilla", null);
+ }
+ public IntrinsicHolderTagsProvider(PackOutput p_256164_, ResourceKey<? extends Registry<T>> p_256155_, CompletableFuture<HolderLookup.Provider> p_256488_, Function<T, ResourceKey<T>> p_256168_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) {
+ super(p_256164_, p_256155_, p_256488_, modId, existingFileHelper);
this.keyExtractor = p_256168_;
}
+ /**
+ * @deprecated Forge: Use the {@linkplain #IntrinsicHolderTagsProvider(PackOutput, ResourceKey, CompletableFuture, CompletableFuture, Function, String, net.minecraftforge.common.data.ExistingFileHelper) mod id variant}
+ */
+ @Deprecated
public IntrinsicHolderTagsProvider(PackOutput p_275304_, ResourceKey<? extends Registry<T>> p_275709_, CompletableFuture<HolderLookup.Provider> p_275227_, CompletableFuture<TagsProvider.TagLookup<T>> p_275311_, Function<T, ResourceKey<T>> p_275566_) {
- super(p_275304_, p_275709_, p_275227_, p_275311_);
+ this(p_275304_, p_275709_, p_275227_, p_275311_, p_275566_, "vanilla", null);
+ }
+ public IntrinsicHolderTagsProvider(PackOutput p_275304_, ResourceKey<? extends Registry<T>> p_275709_, CompletableFuture<HolderLookup.Provider> p_275227_, CompletableFuture<TagsProvider.TagLookup<T>> p_275311_, Function<T, ResourceKey<T>> p_275566_, String modId, @org.jetbrains.annotations.Nullable net.minecraftforge.common.data.ExistingFileHelper existingFileHelper) {
+ super(p_275304_, p_275709_, p_275227_, p_275311_, modId, existingFileHelper);
this.keyExtractor = p_275566_;
}
protected IntrinsicHolderTagsProvider.IntrinsicTagAppender<T> tag(TagKey<T> p_255730_) {
TagBuilder tagbuilder = this.getOrCreateRawBuilder(p_255730_);
- return new IntrinsicHolderTagsProvider.IntrinsicTagAppender<>(tagbuilder, this.keyExtractor);
+ return new IntrinsicHolderTagsProvider.IntrinsicTagAppender<>(tagbuilder, this.keyExtractor, this.modId);
}
- public static class IntrinsicTagAppender<T> extends TagsProvider.TagAppender<T> {
+ public static class IntrinsicTagAppender<T> extends TagsProvider.TagAppender<T> implements net.minecraftforge.common.extensions.IForgeIntrinsicHolderTagAppender<T> {
private final Function<T, ResourceKey<T>> keyExtractor;
- IntrinsicTagAppender(TagBuilder p_256108_, Function<T, ResourceKey<T>> p_256433_) {
- super(p_256108_);
+ IntrinsicTagAppender(TagBuilder p_256108_, Function<T, ResourceKey<T>> p_256433_, String modId) {
+ super(p_256108_, modId);
this.keyExtractor = p_256433_;
}
@@ -50,6 +_,11 @@
public final IntrinsicHolderTagsProvider.IntrinsicTagAppender<T> add(T... p_255868_) {
Stream.<T>of(p_255868_).map(this.keyExtractor).forEach(this::add);
return this;
+ }
+
+ @Override
+ public final ResourceKey<T> getKey(T value) {
+ return this.keyExtractor.apply(value);
}
}
}
| 411 | 0.629045 | 1 | 0.629045 | game-dev | MEDIA | 0.567575 | game-dev | 0.736197 | 1 | 0.736197 |
FirestormViewer/phoenix-firestorm | 1,109 | indra/newview/fsfloaterposestand.h | /*
* @file fsfloaterposestand.h
* @brief Pose stand definitions
*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* Cinder Roxley wrote this file. As long as you retain this notice you can do
* whatever you want with this stuff. If we meet some day, and you think this
* stuff is worth it, you can buy me a beer in return <cinder.roxley@phoenixviewer.com>
* ----------------------------------------------------------------------------
*/
#ifndef FS_FLOATERPOSESTAND_H
#define FS_FLOATERPOSESTAND_H
#include "llfloater.h"
#include "llcombobox.h"
class FSFloaterPoseStand
: public LLFloater
{
LOG_CLASS(FSFloaterPoseStand);
public:
FSFloaterPoseStand(const LLSD& key);
bool postBuild() override;
void setLock(bool enabled);
void onCommitCombo();
private:
~FSFloaterPoseStand();
void onOpen(const LLSD& key) override;
void onClose(bool app_quitting) override;
void loadPoses();
bool mAOPaused;
bool mPoseStandLock;
LLComboBox* mComboPose;
};
#endif // FS_FLOATERPOSESTAND_H
| 411 | 0.777132 | 1 | 0.777132 | game-dev | MEDIA | 0.326897 | game-dev | 0.602504 | 1 | 0.602504 |
Jukoz/middle-earth | 4,805 | src/main/java/net/jukoz/me/block/special/bellows/BellowsBlockEntity.java | package net.jukoz.me.block.special.bellows;
import net.jukoz.me.block.ModBlockEntities;
import net.jukoz.me.block.ModDecorativeBlocks;
import net.jukoz.me.block.special.forge.ForgeBlockEntity;
import net.jukoz.me.sound.ModSounds;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.listener.ClientPlayPacketListener;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
import net.minecraft.world.World;
import net.minecraft.world.event.GameEvent;
import org.jetbrains.annotations.Nullable;
import java.util.Random;
public class BellowsBlockEntity extends BlockEntity {
public static final int MAX_TICKS = 30;
public static final int AVERAGE_PARTICLES = 3;
public static final int PARTICLE_AMOUNT_MODIFIER = 2;
public static Random RANDOM;
public int animationProgress;
private static final String ID = "bellows";
public boolean pumping;
public BellowsBlockEntity(BlockPos pos, BlockState state) {
super(ModBlockEntities.BELLOWS, pos, state);
if(RANDOM == null)
RANDOM = new Random();
}
@Nullable
@Override
public Packet<ClientPlayPacketListener> toUpdatePacket() {
return BlockEntityUpdateS2CPacket.create(this);
}
public boolean tryPumpingBellow(BlockState state, World world, BlockPos pos, BellowsBlockEntity blockEntity, Direction direction, Entity entity) {
if(blockEntity.animationProgress == 0) {
if (!world.isClient){
if(blockEntity.activate(direction)){
BlockPos forgePos = pos.offset(state.get(BellowsBlock.FACING));
if(world.getBlockState(forgePos).getBlock() == ModDecorativeBlocks.FORGE) {
ForgeBlockEntity forgeBlockEntity = (ForgeBlockEntity) world.getBlockEntity(forgePos);
if(forgeBlockEntity != null) {
forgeBlockEntity.bellowsBoost();
}
}
world.playSound((PlayerEntity)null, pos, ModSounds.BELLOWS_PUSH, SoundCategory.BLOCKS, 2.0F, 1.0F);
world.emitGameEvent(entity, GameEvent.BLOCK_CHANGE, pos);
return true;
}
}
}
return false;
}
public boolean activate(Direction direction) {
if (!this.pumping) {
this.pumping = true;
this.animationProgress = 0;
if(this.world != null){
BlockPos blockPos = this.getPos();
this.world.addSyncedBlockEvent(blockPos, this.getCachedState().getBlock(), 1, direction.getId());
}
return true;
}
return false;
}
@Override
public boolean onSyncedBlockEvent(int type, int data) {
if (type == 1) {
this.pumping = true;
this.animationProgress = 0;
return true;
} else {
return super.onSyncedBlockEvent(type, data);
}
}
private static void tick(BellowsBlockEntity blockEntity) {
if(blockEntity.pumping) {
++blockEntity.animationProgress;
if(blockEntity.animationProgress > MAX_TICKS) {
blockEntity.pumping = false;
blockEntity.animationProgress = 0;
}
}
}
public static void clientTick(World world, BlockPos pos, BlockState state, BellowsBlockEntity blockEntity) {
// Only occurs if it's the initial tick
if(blockEntity.pumping && blockEntity.animationProgress == 0)
{
Vec3i directionVec = state.get(BellowsBlock.FACING).getVector();
Vec3d center = pos.toCenterPos();
int particleAmount = RANDOM.nextInt(AVERAGE_PARTICLES - PARTICLE_AMOUNT_MODIFIER, AVERAGE_PARTICLES + PARTICLE_AMOUNT_MODIFIER);
for(int i = 0; i < particleAmount; i++){
world.addParticle(ParticleTypes.POOF,
center.getX() + directionVec.getX() * 0.4f,
center.getY() - 0.2f,
center.getZ() + directionVec.getZ() * 0.4f,
0, 0, 0);
}
}
tick(blockEntity);
}
public static void serverTick(World world, BlockPos pos, BlockState state, BellowsBlockEntity blockEntity) {
tick(blockEntity);
}
}
| 411 | 0.91595 | 1 | 0.91595 | game-dev | MEDIA | 0.99226 | game-dev | 0.907323 | 1 | 0.907323 |
DigitalDesignDude/DS-Game-Maker-5-Setup | 2,141 | devkitPro/insight/share/iwidgets4.0.1/demos/notebook | # ----------------------------------------------------------------------
# DEMO: notebook in [incr Widgets]
# ----------------------------------------------------------------------
package require Iwidgets 4.0
option add *textBackground seashell
option add *Scale.width 8
. configure -background white
iwidgets::optionmenu .pages -labeltext "Page:" -command {
.nb view [.pages get]
}
pack .pages -padx 4 -pady 4
.pages insert end "Personal Info" "Favorite Color" "Blank Page"
iwidgets::notebook .nb -width 3i -height 2.6i
pack .nb -padx 4 -pady 4
# Page #1
# ----------------------------------------------------------------------
set page [.nb add -label "Personal Info"]
iwidgets::entryfield $page.name -labeltext "Name:" -labelpos nw
pack $page.name
iwidgets::entryfield $page.addr -labeltext "Address:" -labelpos nw
pack $page.addr
iwidgets::entryfield $page.addr2 -labeltext "City, State:" -labelpos nw
pack $page.addr2
iwidgets::entryfield $page.email -labeltext "E-mail:" -labelpos nw
pack $page.email
# Page #2
# ----------------------------------------------------------------------
set page [.nb add -label "Favorite Color"]
frame $page.sample -width 20 -height 20 \
-borderwidth 2 -relief raised
pack $page.sample -fill both -pady 4
scale $page.r -label "Red" -orient horizontal \
-from 0 -to 255 -command "set_color $page"
pack $page.r -fill x
scale $page.g -label "Green" -orient horizontal \
-from 0 -to 255 -command "set_color $page"
pack $page.g -fill x
scale $page.b -label "Blue" -orient horizontal \
-from 0 -to 255 -command "set_color $page"
pack $page.b -fill x
proc set_color {page {val 0}} {
set r [$page.r get]
set g [$page.g get]
set b [$page.b get]
set color [format "#%.2x%.2x%.2x" $r $g $b]
$page.sample configure -background $color
}
set_color $page
# Page #3
# ----------------------------------------------------------------------
set page [.nb add -label "Blank Page"]
label $page.title -text "(put your widgets here)" \
-background black -foreground white \
-width 25 -height 3
pack $page.title -expand yes -fill both
.nb view "Personal Info"
| 411 | 0.971884 | 1 | 0.971884 | game-dev | MEDIA | 0.257943 | game-dev | 0.817809 | 1 | 0.817809 |
fholger/thedarkmodvr | 1,990 | game/ai/EAS/RouteNode.h | /*****************************************************************************
The Dark Mod GPL Source Code
This file is part of the The Dark Mod Source Code, originally based
on the Doom 3 GPL Source Code as published in 2011.
The Dark Mod Source Code is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version. For details, see LICENSE.TXT.
Project: The Dark Mod (http://www.thedarkmod.com/)
******************************************************************************/
#ifndef __AI_EAS_ROUTENODE_H__
#define __AI_EAS_ROUTENODE_H__
#include <list>
namespace eas {
enum ActionType {
ACTION_WALK = 0, // AI just needs to walk to the target
ACTION_USE_ELEVATOR, // AI needs to use an elevator
NUM_ACTIONS,
};
struct RouteNode
{
ActionType type; // what needs to be done in this route section (walk?, use elevator?)
int toArea; // the target AAS area number
int toCluster; // the target AAS cluster number
int elevator; // the elevator number (is -1 if no elevator to be used in this node)
int elevatorStation; // The elevator station number of this position (-1 if unused)
int nodeTravelTime; // grayman #3029 - walking time or time to travel from elevator station to elevator station
// Default constructor
RouteNode();
// Specialised constructor
RouteNode(ActionType t, int goalArea, int goalCluster, int elevatorNum = -1, int elevatorStationNum = -1, int nodeTravelTime = 0); // grayman #3029
// Copy constructor
RouteNode(const RouteNode& other);
bool operator==(const RouteNode& other) const;
bool operator!=(const RouteNode& other) const;
void Save(idSaveGame* savefile) const;
void Restore(idRestoreGame* savefile);
};
typedef std::shared_ptr<RouteNode> RouteNodePtr;
typedef std::list<RouteNodePtr> RouteNodeList;
} // namespace eas
#endif /* __AI_EAS_ROUTENODE_H__ */
| 411 | 0.933233 | 1 | 0.933233 | game-dev | MEDIA | 0.482425 | game-dev | 0.777474 | 1 | 0.777474 |
I-asked/downbge | 4,630 | source/gameengine/GameLogic/SCA_ILogicBrick.h | /*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
* All rights reserved.
*
* The Original Code is: all of this file.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
/** \file SCA_ILogicBrick.h
* \ingroup gamelogic
*/
#ifndef __SCA_ILOGICBRICK_H__
#define __SCA_ILOGICBRICK_H__
#include "EXP_Value.h"
#include "SCA_IObject.h"
#include "EXP_BoolValue.h"
#include "CTR_Map.h"
#include "CTR_HashedPtr.h"
class NG_NetworkScene;
class SCA_IScene;
class SCA_ILogicBrick : public CValue
{
Py_Header
protected:
SCA_IObject* m_gameobj;
int m_Execute_Priority;
int m_Execute_Ueber_Priority;
bool m_bActive;
CValue* m_eventval;
STR_String m_text;
STR_String m_name;
//unsigned long m_drawcolor;
void RegisterEvent(CValue* eventval);
void RemoveEvent();
CValue* GetEvent();
public:
SCA_ILogicBrick(SCA_IObject* gameobj);
virtual ~SCA_ILogicBrick();
void SetExecutePriority(int execute_Priority);
void SetUeberExecutePriority(int execute_Priority);
SCA_IObject* GetParent() { return m_gameobj; }
virtual void ReParent(SCA_IObject* parent);
virtual void Relink(CTR_Map<CTR_HashedPtr, void*> *obj_map);
virtual void Delete() { Release(); }
// act as a BoolValue (with value IsPositiveTrigger)
virtual CValue* Calc(VALUE_OPERATOR op, CValue *val);
virtual CValue* CalcFinal(VALUE_DATA_TYPE dtype, VALUE_OPERATOR op, CValue *val);
virtual const STR_String & GetText();
virtual double GetNumber();
virtual STR_String& GetName();
virtual void SetName(const char *);
bool IsActive()
{
return m_bActive;
}
void SetActive(bool active)
{
m_bActive=active;
}
// insert in a QList at position corresponding to m_Execute_Priority
void InsertActiveQList(SG_QList& head)
{
SG_QList::iterator<SCA_ILogicBrick> it(head);
for (it.begin(); !it.end() && m_Execute_Priority > (*it)->m_Execute_Priority; ++it);
it.add_back(this);
}
// insert in a QList at position corresponding to m_Execute_Priority
// inside a longer list that contains elements of other objects.
// Sorting is done only between the elements of the same object.
// head is the head of the combined list
// current points to the first element of the object in the list, NULL if none yet
void InsertSelfActiveQList(SG_QList& head, SG_QList** current)
{
if (!*current)
{
// first element can be put anywhere
head.QAddBack(this);
*current = this;
return;
}
// note: we assume current points actually to one o our element, skip the tests
SG_QList::iterator<SCA_ILogicBrick> it(head,*current);
if (m_Execute_Priority <= (*it)->m_Execute_Priority)
{
// this element comes before the first
*current = this;
}
else {
for (++it; !it.end() && (*it)->m_gameobj == m_gameobj && m_Execute_Priority > (*it)->m_Execute_Priority; ++it);
}
it.add_back(this);
}
virtual bool LessComparedTo(SCA_ILogicBrick* other);
/* runtime variable, set when Triggering the python controller */
static class SCA_LogicManager* m_sCurrentLogicManager;
/* for moving logic bricks between scenes */
virtual void Replace_IScene(SCA_IScene *val) {}
virtual void Replace_NetworkScene(NG_NetworkScene *val) {}
#ifdef WITH_PYTHON
// python methods
static PyObject* pyattr_get_owner(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
// check that attribute is a property
static int CheckProperty(void *self, const PyAttributeDef *attrdef);
enum KX_BOOL_TYPE {
KX_BOOL_NODEF = 0,
KX_TRUE,
KX_FALSE,
KX_BOOL_MAX
};
protected:
/* Some conversions to go with the bool type. */
/** Convert a KX_TRUE, KX_FALSE in Python to a c++ value. */
bool PyArgToBool(int boolArg);
/** Convert a a c++ value to KX_TRUE, KX_FALSE in Python. */
PyObject *BoolToPyArg(bool);
#endif /* WITH_PYTHON */
};
#endif /* __SCA_ILOGICBRICK_H__ */
| 411 | 0.962185 | 1 | 0.962185 | game-dev | MEDIA | 0.211473 | game-dev | 0.885649 | 1 | 0.885649 |
Angel-ML/angel | 3,344 | angel-ps/core/src/main/java/com/tencent/angel/ml/math2/ufuncs/expression/AdamDelta.java | /*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*
*/
package com.tencent.angel.ml.math2.ufuncs.expression;
import com.tencent.angel.ml.math2.utils.Constant;
public class AdamDelta extends Binary {
private double powBeta;
private double powGamma;
private double esp = 1e-8;
public AdamDelta(boolean inplace, double powBeta, double powGamma) {
setInplace(inplace);
setKeepStorage(Constant.keepStorage);
this.powBeta = powBeta;
this.powGamma = powGamma;
}
@Override
public OpType getOpType() {
return OpType.INTERSECTION;
}
@Override
public double apply(double ele1, double ele2) {
if (ele1 * ele2 == 0) {
return 0;
} else {
return ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp));
}
}
@Override
public double apply(double ele1, float ele2) {
if (ele1 * ele2 == 0) {
return 0;
} else {
return ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp));
}
}
@Override
public double apply(double ele1, long ele2) {
if (ele1 * ele2 == 0) {
return 0;
} else {
return ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp));
}
}
@Override
public double apply(double ele1, int ele2) {
if (ele1 * ele2 == 0) {
return 0;
} else {
return ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp));
}
}
@Override
public float apply(float ele1, float ele2) {
if (ele1 * ele2 == 0) {
return 0f;
} else {
return (float) (ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma)) + esp));
}
}
@Override
public float apply(float ele1, long ele2) {
if (ele1 * ele2 == 0) {
return 0f;
} else {
return (float) (ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp)));
}
}
@Override
public float apply(float ele1, int ele2) {
if (ele1 * ele2 == 0) {
return 0f;
} else {
return (float) (ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp)));
}
}
@Override
public long apply(long ele1, long ele2) {
if (ele1 * ele2 == 0) {
return 0L;
} else {
return (long) (ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp)));
}
}
@Override
public long apply(long ele1, int ele2) {
if (ele1 * ele2 == 0) {
return 0L;
} else {
return (long) (ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp)));
}
}
@Override
public int apply(int ele1, int ele2) {
if (ele1 * ele2 == 0) {
return 0;
} else {
return (int) (ele1 / (1 - powBeta) / (Math.sqrt(ele2 / (1 - powGamma) + esp)));
}
}
} | 411 | 0.586931 | 1 | 0.586931 | game-dev | MEDIA | 0.54791 | game-dev | 0.553297 | 1 | 0.553297 |
doughtmw/display-calibration-hololens | 1,485 | unity-sandbox/HoloLens2-Display-Calibration/Assets/MRTK/SDK/Experimental/ServiceManagers/Teleport/Scripts/TeleportSystemManager.cs | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using Microsoft.MixedReality.Toolkit.Teleport;
using Microsoft.MixedReality.Toolkit.Utilities;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Experimental.Teleport
{
/// <summary>
/// Service manager supporting running the teleport system, without requiring the MixedRealityToolkit object.
/// </summary>
[AddComponentMenu("Scripts/MRTK/SDK/TeleportSystemManager")]
public class TeleportSystemManager : BaseServiceManager
{
[SerializeField]
[Tooltip("The teleport system type that will be instantiated.")]
[Implements(typeof(IMixedRealityTeleportSystem), TypeGrouping.ByNamespaceFlat)]
private SystemType TeleportSystemType = null;
private void Awake()
{
InitializeManager();
}
protected override void OnDestroy()
{
UninitializeManager();
base.OnDestroy();
}
/// <summary>
/// Initialize the manager.
/// </summary>
private void InitializeManager()
{
// The teleport system class takes no arguments.
Initialize<IMixedRealityTeleportSystem>(TeleportSystemType.Type);
}
/// <summary>
/// Uninitialize the manager.
/// </summary>
private void UninitializeManager()
{
Uninitialize<IMixedRealityTeleportSystem>();
}
}
} | 411 | 0.811224 | 1 | 0.811224 | game-dev | MEDIA | 0.785723 | game-dev | 0.776254 | 1 | 0.776254 |
Hiro420/WuwaTools | 7,747 | WWParser/Defs/SkillLevel.cs | // <auto-generated>
// automatically generated by the FlatBuffers compiler, do not modify
// </auto-generated>
namespace WWParser.Defs
{
using global::System;
using global::System.Collections.Generic;
using global::Google.FlatBuffers;
public struct SkillLevel : IFlatbufferObject
{
private Table __p;
public ByteBuffer ByteBuffer { get { return __p.bb; } }
public static void ValidateVersion() { FlatBufferConstants.FLATBUFFERS_25_2_10(); }
public static SkillLevel GetRootAsSkillLevel(ByteBuffer _bb) { return GetRootAsSkillLevel(_bb, new SkillLevel()); }
public static SkillLevel GetRootAsSkillLevel(ByteBuffer _bb, SkillLevel obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
public void __init(int _i, ByteBuffer _bb) { __p = new Table(_i, _bb); }
public SkillLevel __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }
public int Id { get { int o = __p.__offset(4); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
public int SkillLevelGroupId { get { int o = __p.__offset(6); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
public int SkillId { get { int o = __p.__offset(8); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
public string LevelNewDescribe { get { int o = __p.__offset(10); return o != 0 ? __p.__string(o + __p.bb_pos) : null; } }
#if ENABLE_SPAN_T
public Span<byte> GetLevelNewDescribeBytes() { return __p.__vector_as_span<byte>(10, 1); }
#else
public ArraySegment<byte>? GetLevelNewDescribeBytes() { return __p.__vector_as_arraysegment(10); }
#endif
public byte[] GetLevelNewDescribeArray() { return __p.__vector_as_array<byte>(10); }
public WWParser.Defs.DicIntInt? Consume(int j) { int o = __p.__offset(12); return o != 0 ? (WWParser.Defs.DicIntInt?)(new WWParser.Defs.DicIntInt()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; }
public int ConsumeLength { get { int o = __p.__offset(12); return o != 0 ? __p.__vector_len(o) : 0; } }
public int Condition { get { int o = __p.__offset(14); return o != 0 ? __p.bb.GetInt(o + __p.bb_pos) : (int)0; } }
public static Offset<WWParser.Defs.SkillLevel> CreateSkillLevel(FlatBufferBuilder builder,
int id = 0,
int skill_level_group_id = 0,
int skill_id = 0,
StringOffset level_new_describeOffset = default(StringOffset),
VectorOffset consumeOffset = default(VectorOffset),
int condition = 0) {
builder.StartTable(6);
SkillLevel.AddCondition(builder, condition);
SkillLevel.AddConsume(builder, consumeOffset);
SkillLevel.AddLevelNewDescribe(builder, level_new_describeOffset);
SkillLevel.AddSkillId(builder, skill_id);
SkillLevel.AddSkillLevelGroupId(builder, skill_level_group_id);
SkillLevel.AddId(builder, id);
return SkillLevel.EndSkillLevel(builder);
}
public static void StartSkillLevel(FlatBufferBuilder builder) { builder.StartTable(6); }
public static void AddId(FlatBufferBuilder builder, int id) { builder.AddInt(0, id, 0); }
public static void AddSkillLevelGroupId(FlatBufferBuilder builder, int skillLevelGroupId) { builder.AddInt(1, skillLevelGroupId, 0); }
public static void AddSkillId(FlatBufferBuilder builder, int skillId) { builder.AddInt(2, skillId, 0); }
public static void AddLevelNewDescribe(FlatBufferBuilder builder, StringOffset levelNewDescribeOffset) { builder.AddOffset(3, levelNewDescribeOffset.Value, 0); }
public static void AddConsume(FlatBufferBuilder builder, VectorOffset consumeOffset) { builder.AddOffset(4, consumeOffset.Value, 0); }
public static VectorOffset CreateConsumeVector(FlatBufferBuilder builder, Offset<WWParser.Defs.DicIntInt>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
public static VectorOffset CreateConsumeVectorBlock(FlatBufferBuilder builder, Offset<WWParser.Defs.DicIntInt>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
public static VectorOffset CreateConsumeVectorBlock(FlatBufferBuilder builder, ArraySegment<Offset<WWParser.Defs.DicIntInt>> data) { builder.StartVector(4, data.Count, 4); builder.Add(data); return builder.EndVector(); }
public static VectorOffset CreateConsumeVectorBlock(FlatBufferBuilder builder, IntPtr dataPtr, int sizeInBytes) { builder.StartVector(1, sizeInBytes, 1); builder.Add<Offset<WWParser.Defs.DicIntInt>>(dataPtr, sizeInBytes); return builder.EndVector(); }
public static void StartConsumeVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
public static void AddCondition(FlatBufferBuilder builder, int condition) { builder.AddInt(5, condition, 0); }
public static Offset<WWParser.Defs.SkillLevel> EndSkillLevel(FlatBufferBuilder builder) {
int o = builder.EndTable();
return new Offset<WWParser.Defs.SkillLevel>(o);
}
public SkillLevelT UnPack() {
var _o = new SkillLevelT();
this.UnPackTo(_o);
return _o;
}
public void UnPackTo(SkillLevelT _o) {
_o.Id = this.Id;
_o.SkillLevelGroupId = this.SkillLevelGroupId;
_o.SkillId = this.SkillId;
_o.LevelNewDescribe = this.LevelNewDescribe;
_o.Consume = new List<WWParser.Defs.DicIntIntT>();
for (var _j = 0; _j < this.ConsumeLength; ++_j) {_o.Consume.Add(this.Consume(_j).HasValue ? this.Consume(_j).Value.UnPack() : null);}
_o.Condition = this.Condition;
}
public static Offset<WWParser.Defs.SkillLevel> Pack(FlatBufferBuilder builder, SkillLevelT _o) {
if (_o == null) return default(Offset<WWParser.Defs.SkillLevel>);
var _level_new_describe = _o.LevelNewDescribe == null ? default(StringOffset) : builder.CreateString(_o.LevelNewDescribe);
var _consume = default(VectorOffset);
if (_o.Consume != null) {
var __consume = new Offset<WWParser.Defs.DicIntInt>[_o.Consume.Count];
for (var _j = 0; _j < __consume.Length; ++_j) { __consume[_j] = WWParser.Defs.DicIntInt.Pack(builder, _o.Consume[_j]); }
_consume = CreateConsumeVector(builder, __consume);
}
return CreateSkillLevel(
builder,
_o.Id,
_o.SkillLevelGroupId,
_o.SkillId,
_level_new_describe,
_consume,
_o.Condition);
}
}
public class SkillLevelT
{
[Newtonsoft.Json.JsonProperty("id")]
public int Id { get; set; }
[Newtonsoft.Json.JsonProperty("skill_level_group_id")]
public int SkillLevelGroupId { get; set; }
[Newtonsoft.Json.JsonProperty("skill_id")]
public int SkillId { get; set; }
[Newtonsoft.Json.JsonProperty("level_new_describe")]
public string LevelNewDescribe { get; set; }
[Newtonsoft.Json.JsonProperty("consume")]
public List<WWParser.Defs.DicIntIntT> Consume { get; set; }
[Newtonsoft.Json.JsonProperty("condition")]
public int Condition { get; set; }
public SkillLevelT() {
this.Id = 0;
this.SkillLevelGroupId = 0;
this.SkillId = 0;
this.LevelNewDescribe = null;
this.Consume = null;
this.Condition = 0;
}
}
static public class SkillLevelVerify
{
static public bool Verify(Google.FlatBuffers.Verifier verifier, uint tablePos)
{
return verifier.VerifyTableStart(tablePos)
&& verifier.VerifyField(tablePos, 4 /*Id*/, 4 /*int*/, 4, false)
&& verifier.VerifyField(tablePos, 6 /*SkillLevelGroupId*/, 4 /*int*/, 4, false)
&& verifier.VerifyField(tablePos, 8 /*SkillId*/, 4 /*int*/, 4, false)
&& verifier.VerifyString(tablePos, 10 /*LevelNewDescribe*/, false)
&& verifier.VerifyVectorOfTables(tablePos, 12 /*Consume*/, WWParser.Defs.DicIntIntVerify.Verify, false)
&& verifier.VerifyField(tablePos, 14 /*Condition*/, 4 /*int*/, 4, false)
&& verifier.VerifyTableEnd(tablePos);
}
}
}
| 411 | 0.673343 | 1 | 0.673343 | game-dev | MEDIA | 0.336886 | game-dev | 0.575842 | 1 | 0.575842 |
Auxilor/libreforge | 1,026 | core/common/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterFullyGrown.kt | package com.willfp.libreforge.filters.impl
import com.willfp.eco.core.config.interfaces.Config
import com.willfp.libreforge.NoCompileData
import com.willfp.libreforge.filters.Filter
import com.willfp.libreforge.triggers.TriggerData
import org.bukkit.block.data.Ageable
import org.bukkit.block.data.type.CaveVinesPlant
object FilterFullyGrown : Filter<NoCompileData, Boolean>("fully_grown") {
override fun getValue(config: Config, data: TriggerData?, key: String): Boolean {
return config.getBool(key)
}
override fun isMet(data: TriggerData, value: Boolean, compileData: NoCompileData): Boolean {
val block = data.block ?: return true
val isFullyGrown = when(val blockData = block.blockData) {
is Ageable -> {
blockData.age == blockData.maximumAge
}
is CaveVinesPlant -> {
blockData.isBerries
}
else -> {
true
}
}
return isFullyGrown == value
}
}
| 411 | 0.695721 | 1 | 0.695721 | game-dev | MEDIA | 0.779563 | game-dev | 0.569529 | 1 | 0.569529 |
neoforged/NeoForge | 4,738 | tests/src/main/java/net/neoforged/neoforge/oldtest/misc/ContainerTypeTest.java | /*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.neoforged.neoforge.oldtest.misc;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.SimpleContainer;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.inventory.MenuType;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension;
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.RegisterEvent;
@Mod("containertypetest")
public class ContainerTypeTest {
public static final DeferredHolder<MenuType<?>, MenuType<TestContainer>> TYPE = DeferredHolder.create(Registries.MENU, ResourceLocation.fromNamespaceAndPath("containertypetest", "container"));
public static class TestContainer extends AbstractContainerMenu {
private final String text;
protected TestContainer(int windowId, Inventory playerInv, FriendlyByteBuf extraData) {
this(windowId, new SimpleContainer(9), extraData.readUtf(128));
}
public TestContainer(int windowId, SimpleContainer inv, String text) {
super(TYPE.get(), windowId);
this.text = text;
for (int i = 0; i < 9; i++) {
this.addSlot(new Slot(inv, i, (i % 3) * 18, (i / 3) * 18));
}
}
@Override
public ItemStack quickMoveStack(Player p_38941_, int p_38942_) {
return ItemStack.EMPTY;
}
@Override
public boolean stillValid(Player playerIn) {
return true;
}
}
public class TestGui extends AbstractContainerScreen<TestContainer> {
public TestGui(TestContainer container, Inventory inv, Component name) {
super(container, inv, name);
}
@Override
protected void renderBg(GuiGraphics graphics, float partialTick, int mouseX, int mouseY) {
graphics.drawString(this.font, getMenu().text, mouseX, mouseY, -1);
}
}
public ContainerTypeTest(IEventBus modEventBus) {
modEventBus.addListener(this::registerContainers);
modEventBus.addListener(this::registerMenuScreens);
NeoForge.EVENT_BUS.addListener(this::onRightClick);
}
private void registerContainers(final RegisterEvent event) {
event.register(Registries.MENU, helper -> helper.register(ResourceLocation.fromNamespaceAndPath("containertypetest", "container"), IMenuTypeExtension.create(TestContainer::new)));
}
private void registerMenuScreens(RegisterMenuScreensEvent event) {
event.register(TYPE.get(), TestGui::new);
}
private void onRightClick(PlayerInteractEvent.RightClickBlock event) {
if (!event.getLevel().isClientSide() && event.getHand() == InteractionHand.MAIN_HAND) {
if (event.getLevel().getBlockState(event.getPos()).getBlock() == Blocks.SPONGE) {
String text = "Hello World!";
event.getEntity().openMenu(new MenuProvider() {
@Override
public AbstractContainerMenu createMenu(int p_createMenu_1_, Inventory p_createMenu_2_, Player p_createMenu_3_) {
SimpleContainer inv = new SimpleContainer(9);
for (int i = 0; i < inv.getContainerSize(); i++) {
inv.setItem(i, new ItemStack(Items.DIAMOND));
}
return new TestContainer(p_createMenu_1_, inv, text);
}
@Override
public Component getDisplayName() {
return Component.literal("Test");
}
}, extraData -> {
extraData.writeUtf(text);
});
}
}
}
}
| 411 | 0.839218 | 1 | 0.839218 | game-dev | MEDIA | 0.979618 | game-dev | 0.841229 | 1 | 0.841229 |
overreactjs/engine | 3,034 | src/components/Physics.tsx | import React, { useCallback, useEffect, useMemo, useRef } from "react";
import { Engine, Composite, Events, Body } from "matter-js";
import { PhysicsContext } from "../context";
import { useEventListeners, useProperty, useUpdate } from "../hooks";
import { PhysicsEvent, PhysicsEventType, PhysicsUpdateFunction, Position, Velocity } from "../types";
type PhysicsProps = {
children: React.ReactNode;
}
/**
* Physics
* -------
*
* Setup the physics engine (using matter-js), and provide functions for registering new physical
* bodies via context.
*/
export const Physics: React.FC<PhysicsProps> = ({ children }) => {
const engine = useProperty(Engine.create());
const updaters = useRef<Map<Matter.Body, PhysicsUpdateFunction>>(new Map());
/**
* Register function is used to add (and remove) physics bodies to (and from) the system. Each
* body is paired with an update function, which is called each time the body moves, allowing
* its properties (such as position and rotation) to be synced with other elements.
*/
const register = useCallback((body: Matter.Body, fn: PhysicsUpdateFunction) => {
Composite.add(engine.current.world, body);
updaters.current.set(body, fn);
return () => {
Composite.remove(engine.current.world, body)
updaters.current.delete(body);
};
}, [engine]);
/**
* Set the angle of gravity.
*/
const setGravity = useCallback(([x, y]: Velocity) => {
engine.current.gravity.x = x;
engine.current.gravity.y = y;
}, [engine]);
/**
* Set the velocity of a physics body.
*/
const setVelocity = useCallback((body: Matter.Body, [x, y]: Velocity) => {
Body.setVelocity(body, { x, y });
}, []);
/**
* Apply a force to a physics body.
*/
const applyForce = useCallback((body: Matter.Body, [px, py]: Position, [vx, vy]: Velocity) => {
Body.applyForce(body, { x: px, y: py }, { x: vx, y: vy });
}, []);
/**
*
*/
const { addEventListener, removeEventListener, fireEvent } = useEventListeners<PhysicsEventType, PhysicsEvent>();
const handleCollision = useCallback((event: Matter.IEventCollision<Engine>) => {
fireEvent('collision', event);
}, [fireEvent]);
/**
*
*/
useEffect(() => {
const e = engine.current;
Events.on(e, 'collisionStart', handleCollision);
return () => Events.off(e, 'collisionStart', handleCollision);
}, [engine, handleCollision]);
/**
* Each frame, play the physics system forwards, then call all of the update functions.
*/
useUpdate((delta) => {
Engine.update(engine.current, delta);
for (const [body, update] of updaters.current) {
update(body);
}
});
const context = useMemo(() => ({
engine, register, setGravity, setVelocity, applyForce, addEventListener, removeEventListener
}), [engine, register, setGravity, setVelocity, applyForce, addEventListener, removeEventListener]);
return (
<PhysicsContext.Provider value={context}>
{children}
</PhysicsContext.Provider>
);
};
| 411 | 0.531207 | 1 | 0.531207 | game-dev | MEDIA | 0.966816 | game-dev | 0.716406 | 1 | 0.716406 |
polkadot-evm/frontier | 3,337 | client/rpc-v2/types/src/filter/utility.rs | // This file is part of Frontier.
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use std::collections::BTreeSet;
use serde::{Deserialize, Serialize};
/// Union type for representing a single value or a list of values inside a filter.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ValueOrArray<T> {
/// A single value.
Value(T),
/// A list of values.
Array(Vec<T>),
}
impl<T> From<T> for ValueOrArray<T> {
fn from(value: T) -> Self {
Self::Value(value)
}
}
impl<T> From<Vec<T>> for ValueOrArray<T> {
fn from(array: Vec<T>) -> Self {
Self::Array(array)
}
}
/// FilterSet is a set of values that will be used to filter addresses and topics.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct FilterSet<T: Eq + Ord>(BTreeSet<T>);
impl<T: Eq + Ord> From<T> for FilterSet<T> {
fn from(value: T) -> Self {
Self(BTreeSet::from([value]))
}
}
impl<T: Eq + Ord> From<Vec<T>> for FilterSet<T> {
fn from(value: Vec<T>) -> Self {
Self(value.into_iter().collect())
}
}
impl<T: Eq + Ord> From<ValueOrArray<T>> for FilterSet<T> {
fn from(value: ValueOrArray<T>) -> Self {
match value {
ValueOrArray::Value(value) => value.into(),
ValueOrArray::Array(array) => array.into(),
}
}
}
impl<T: Eq + Ord> From<ValueOrArray<Option<T>>> for FilterSet<T> {
fn from(src: ValueOrArray<Option<T>>) -> Self {
match src {
ValueOrArray::Value(None) => Self(BTreeSet::new()),
ValueOrArray::Value(Some(value)) => value.into(),
ValueOrArray::Array(array) => {
// If the array contains at least one `null` (i.e. None), as it's considered
// a "wildcard" value, the whole filter should be treated as matching everything,
// thus is empty.
if array.contains(&None) {
Self(BTreeSet::new())
} else {
// Otherwise, we flatten the array, knowing there are no `None` values
array.into_iter().flatten().collect::<Vec<T>>().into()
}
}
}
}
}
impl<T: Clone + Eq + Ord> FilterSet<T> {
/// Returns whether the filter is empty.
pub fn is_empty(&self) -> bool {
self.0.is_empty()
}
/// Returns a [`ValueOrArray`] inside an Option:
/// - If the filter is empty, it returns `None`
/// - If the filter has only 1 value, it returns the single value
/// - Otherwise it returns an array of values
pub fn to_value_or_array(&self) -> Option<ValueOrArray<T>> {
let values_len = self.0.len();
match values_len {
0 => None,
1 => Some(ValueOrArray::Value(
self.0.iter().next().cloned().expect("at least one item"),
)),
_ => Some(ValueOrArray::Array(self.0.iter().cloned().collect())),
}
}
}
| 411 | 0.932431 | 1 | 0.932431 | game-dev | MEDIA | 0.485089 | game-dev | 0.960664 | 1 | 0.960664 |
microsoft/vsminecraft | 3,525 | minecraftpkg/MekanismModSample/src/api/java/buildcraft/api/core/Position.java | /**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.api.core;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
public class Position {
@NetworkData
public double x, y, z;
@NetworkData
public ForgeDirection orientation;
public Position() {
x = 0;
y = 0;
z = 0;
orientation = ForgeDirection.UNKNOWN;
}
public Position(double ci, double cj, double ck) {
x = ci;
y = cj;
z = ck;
orientation = ForgeDirection.UNKNOWN;
}
public Position(double ci, double cj, double ck, ForgeDirection corientation) {
x = ci;
y = cj;
z = ck;
orientation = corientation;
if (orientation == null) {
orientation = ForgeDirection.UNKNOWN;
}
}
public Position(Position p) {
x = p.x;
y = p.y;
z = p.z;
orientation = p.orientation;
}
public Position(NBTTagCompound nbttagcompound) {
readFromNBT(nbttagcompound);
}
public Position(TileEntity tile) {
x = tile.xCoord;
y = tile.yCoord;
z = tile.zCoord;
orientation = ForgeDirection.UNKNOWN;
}
public Position(BlockIndex index) {
x = index.x;
y = index.y;
z = index.z;
orientation = ForgeDirection.UNKNOWN;
}
public void moveRight(double step) {
switch (orientation) {
case SOUTH:
x = x - step;
break;
case NORTH:
x = x + step;
break;
case EAST:
z = z + step;
break;
case WEST:
z = z - step;
break;
default:
}
}
public void moveLeft(double step) {
moveRight(-step);
}
public void moveForwards(double step) {
switch (orientation) {
case UP:
y = y + step;
break;
case DOWN:
y = y - step;
break;
case SOUTH:
z = z + step;
break;
case NORTH:
z = z - step;
break;
case EAST:
x = x + step;
break;
case WEST:
x = x - step;
break;
default:
}
}
public void moveBackwards(double step) {
moveForwards(-step);
}
public void moveUp(double step) {
switch (orientation) {
case SOUTH:
case NORTH:
case EAST:
case WEST:
y = y + step;
break;
default:
}
}
public void moveDown(double step) {
moveUp(-step);
}
public void writeToNBT(NBTTagCompound nbttagcompound) {
if (orientation == null) {
orientation = ForgeDirection.UNKNOWN;
}
nbttagcompound.setDouble("i", x);
nbttagcompound.setDouble("j", y);
nbttagcompound.setDouble("k", z);
nbttagcompound.setByte("orientation", (byte) orientation.ordinal());
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
x = nbttagcompound.getDouble("i");
y = nbttagcompound.getDouble("j");
z = nbttagcompound.getDouble("k");
orientation = ForgeDirection.values() [nbttagcompound.getByte("orientation")];
}
@Override
public String toString() {
return "{" + x + ", " + y + ", " + z + "}";
}
public Position min(Position p) {
return new Position(p.x > x ? x : p.x, p.y > y ? y : p.y, p.z > z ? z : p.z);
}
public Position max(Position p) {
return new Position(p.x < x ? x : p.x, p.y < y ? y : p.y, p.z < z ? z : p.z);
}
public boolean isClose(Position newPosition, float f) {
double dx = x - newPosition.x;
double dy = y - newPosition.y;
double dz = z - newPosition.z;
double sqrDis = dx * dx + dy * dy + dz * dz;
return !(sqrDis > f * f);
}
}
| 411 | 0.782877 | 1 | 0.782877 | game-dev | MEDIA | 0.708663 | game-dev | 0.676342 | 1 | 0.676342 |
gamingdotme/opensource-casino-v10 | 990 | casino/app/Games/PyramidBonanza/PragmaticLib/BuyFreeSpins.php | <?php
namespace VanguardLTE\Games\PyramidBonanza\PragmaticLib;
class BuyFreeSpins
{
public static function getFreeSpin(&$slotArea, $gameSettings){
$scatterTmp = explode('~',$gameSettings['scatters']);
$scatter = $scatterTmp[0];
$scatterPositions = array_keys($slotArea, $scatter);
if (count($scatterPositions) < $gameSettings['settings_needfs']){ // Если скаттеров меньше чем нужно - то генерим еще скаттеры
newRand:
$rand_keys = (array)array_rand($slotArea, ($gameSettings['settings_needfs'] - count($scatterPositions))); // получаем рандомные позиции
// если вернулся массив а не одно число
if (array_intersect($scatterPositions, $rand_keys)) goto newRand; // если есть пересечения позиций символов - то делаем новое рандомное размещение
foreach ($rand_keys as $rand_key) {
$slotArea[$rand_key] = $scatter; // присваиваем рандомно скаттеры
}
}
}
}
| 411 | 0.508046 | 1 | 0.508046 | game-dev | MEDIA | 0.525923 | game-dev | 0.79336 | 1 | 0.79336 |
BRAINSia/BRAINSTools | 4,294 | Utilities/build_configs/Darwin/BRAINSTools-llvm10-Release.cmake | # mkdir -p BRAINSTools-RelWithDebInfo && cmake -S BRAINSTools -B BRAINSTools-RelWithDebInfo -C BRAINSTools-llvm10-RelWithDebInfo.cmake
# set(CMAKE_CXX_STANDARD 14 CACHE STRING "The language standard to use." FORCE)
set(EXTERNAL_PROJECT_BUILD_TYPE Release CACHE STRING "The requested build type" FORCE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "The requested build type" FORCE)
set(BUILD_EXAMPLES OFF CACHE BOOL "If examples are built" FORCE)
set(BUILD_TESTING ON CACHE BOOL "If testing is used" FORCE)
set(BRAINSToools_C_OPTIMIZATION_FLAGS
-mtune=native -march=native
-Wtautological-overlap-compare -Wtautological-compare
-Wtautological-bitwise-compare
-Wbitwise-conditional-parentheses
-Wrange-loop-analysis
-Wmisleading-indentation
-Wc99-designator -Wreorder-init-list
-Wsizeof-array-div
-Wxor-used-as-pow
-Wfinal-dtor-non-final-class
CACHE STRING "ITK optimation flags for C compiler" FORCE)
set(BRAINSToools_CXX_OPTIMIZATION_FLAGS
-mtune=native -march=native
-Wtautological-overlap-compare -Wtautological-compare
-Wtautological-bitwise-compare
-Wbitwise-conditional-parentheses
-Wrange-loop-analysis
-Wmisleading-indentation
-Wc99-designator -Wreorder-init-list
-Wsizeof-array-div
-Wxor-used-as-pow
-Wfinal-dtor-non-final-class
CACHE STRING "ITK optimation flags for CXX compiler" FORCE)
set(BRAINSTools_REQUIRES_VTK OFF CACHE BOOL "bld optional component" FORCE)
set(BRAINSTools_BUILD_DICOM_SUPPORT ON CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSCreateLabelMapFromProbabilityMaps ON CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSMultiModeSegment ON CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSMultiSTAPLE ON CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSMush ON CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSPosteriorToContinuousClass ON CACHE BOOL "bld optional component" FORCE)
set(USE_DWIConvert ON CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSLandmarkInitializer OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSROIAuto OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSResample OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSSnapShotWriter OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSStripRotation OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSTransformConvert OFF CACHE BOOL "bld optional component" FORCE)
set(USE_ConvertBetweenFileFormats OFF CACHE BOOL "bld optional component" FORCE)
set(USE_ImageCalculator OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSCreateLabelMapFromProbabilityMaps OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSMultiModeSegment OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSMultiSTAPLE OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSMush OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSPosteriorToContinuousClass OFF CACHE BOOL "bld optional component" FORCE)
set(USE_DWIConvert OFF CACHE BOOL "bld optional component" FORCE)
set(USE_GTRACT OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSTalairach OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSSuperResolution OFF CACHE BOOL "bld optional component" FORCE)
set(USE_DebugImageViewer OFF CACHE BOOL "bld optional component" FORCE)
set(USE_ITKMatlabIO OFF CACHE BOOL "bld optional component" FORCE)
set(USE_BRAINSConstellationDetectorGUI OFF CACHE BOOL "bld optional component" FORCE)
# -- Fixup ITK remote branch info
#set(USE BRAINSTools_ITKv5_GIT_REPOSITORY git@github.com:hjmjohnson/ITK.git to override CACHE STRING "Alternate git repo" FORCE)
#set(USE BRAINSTools_ITKv5_GIT_TAG fix-some-error-pr-request CACHE STRING "Alternate git tag" FORCE)
| 411 | 0.884373 | 1 | 0.884373 | game-dev | MEDIA | 0.816645 | game-dev | 0.834953 | 1 | 0.834953 |
lzk228/space-axolotl-14 | 3,194 | Content.Server/Tabletop/TabletopSystem.Map.cs | using System.Numerics;
using Content.Shared.GameTicking;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Tabletop
{
public sealed partial class TabletopSystem
{
/// <summary>
/// Separation between tabletops in the tabletop map.
/// </summary>
private const int TabletopSeparation = 100;
/// <summary>
/// Map where all tabletops reside.
/// </summary>
public MapId TabletopMap { get; private set; } = MapId.Nullspace;
/// <summary>
/// The number of tabletops created in the map.
/// Used for calculating the position of the next one.
/// </summary>
private int _tabletops = 0;
/// <summary>
/// Despite the name, this method is only used to subscribe to events.
/// </summary>
private void InitializeMap()
{
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
}
/// <summary>
/// Gets the next available position for a tabletop, and increments the tabletop count.
/// </summary>
/// <returns></returns>
private Vector2 GetNextTabletopPosition()
{
return UlamSpiral(++_tabletops) * TabletopSeparation;
}
/// <summary>
/// Ensures that the tabletop map exists. Creates it if it doesn't.
/// </summary>
private void EnsureTabletopMap()
{
if (TabletopMap != MapId.Nullspace && _map.MapExists(TabletopMap))
return;
var mapUid = _map.CreateMap(out var mapId);
TabletopMap = mapId;
_tabletops = 0;
var mapComp = Comp<MapComponent>(mapUid);
// Lighting is always disabled in tabletop world.
mapComp.LightingEnabled = false;
Dirty(mapUid, mapComp);
}
/// <summary>
/// Algorithm for mapping scalars to 2D positions in the same pattern as an Ulam Spiral.
/// </summary>
/// <param name="n">Scalar to map to a 2D position. Must be greater than or equal to 1.</param>
/// <returns>The mapped 2D position for the scalar.</returns>
private Vector2i UlamSpiral(int n)
{
var k = (int)MathF.Ceiling((MathF.Sqrt(n) - 1) / 2);
var t = 2 * k + 1;
var m = (int)MathF.Pow(t, 2);
t--;
if (n >= m - t)
return new Vector2i(k - (m - n), -k);
m -= t;
if (n >= m - t)
return new Vector2i(-k, -k + (m - n));
m -= t;
if (n >= m - t)
return new Vector2i(-k + (m - n), k);
return new Vector2i(k, k - (m - n - t));
}
private void OnRoundRestart(RoundRestartCleanupEvent _)
{
if (TabletopMap == MapId.Nullspace || !_map.MapExists(TabletopMap))
return;
// This will usually *not* be the case, but better make sure.
_map.DeleteMap(TabletopMap);
// Reset tabletop count.
_tabletops = 0;
}
}
}
| 411 | 0.895036 | 1 | 0.895036 | game-dev | MEDIA | 0.606232 | game-dev | 0.738297 | 1 | 0.738297 |
GTNewHorizons/GT-New-Horizons-Modpack | 2,593 | config/StevesCarts.cfg | # Configuration file
enabledmodules {
B:AdvancedControlSystem=true
B:AdvancedCrafter=true
B:AdvancedShooter=true
B:AdvancedSmelter=true
B:AdvancedTank=true
B:AdvancedThermalEngine=true
B:BasicDrill=true
B:BasicFarmer=true
B:BasicSolarEngine=true
B:BasicWoodCutter=true
B:BrakeHandle=true
B:BridgeBuilder=true
B:Cage=true
B:CakeServer=true
B:ChunkLoader=true
B:CleaningMachine=true
B:CoalEngine=true
B:ColorRandomizer=true
B:Colorizer=true
B:CompactSolarEngine=true
B:Crafter=true
B:CreativeEngine=true
B:CreativeHull=true
B:CreativeIncinerator=true
B:CreativeSupplies=true
B:CreativeTank=true
B:Crop_Exotic=true
B:Crop_NetherWart=true
B:DivineShield=true
B:DrillIntelligence=true
B:DynamiteCarrier=true
B:Enchanter=true
B:EntityDetector_Animal=true
B:EntityDetector_Monster=true
B:EntityDetector_Player=true
B:EntityDetector_Villager=true
B:ExperienceBank=true
B:ExtractingChests=true
B:ExtremeMelter=true
B:Fertilizer=true
B:Fireworkdisplay=true
B:FrontChest=true
B:FrontTank=true
B:GalgadorianDrill=true
B:GalgadorianFarmer=true
B:GalgadorianHull=true
B:GalgadorianMinecartHull=true
B:GalgadorianWoodCutter=true
B:HardenedDrill=true
B:HardenedWoodCutter=true
B:HeightController=true
B:Hydrator=true
B:Incinerator=true
B:InfinityEngine=true
B:InformationProvider=true
B:InternalStorage=true
B:InternalTank=true
B:InvisibilityCore=true
B:IronDrill=true
B:LargeRailer=true
B:LawnMower=true
B:LiquidCleaner=true
B:LiquidSensors=true
B:MechanicalPig=true
B:Melter=true
B:Milker=true
B:NoteSequencer=true
B:OpenTank=true
B:OreExtractor=true
B:PlanterRangeExtender=true
B:PowerObserver=true
B:Projectile_Egg=true
B:Projectile_FireCharge=true
B:Projectile_Potion=true
B:QuantumMinecartHull=true
B:Railer=true
B:ReinforcedHull=true
B:ReinforcedMinecartHull=true
B:Seat=true
B:Shooter=true
B:SideChests=true
B:SideTanks=true
B:Smelter=true
B:SolarEngine=true
B:StandardHull=true
B:StandardMinecartHull=true
B:"Steve'sArcade"=true
B:ThermalEngine=true
B:TinyCoalEngine=true
B:TopChest=true
B:TopTank=true
B:TorchPlacer=true
B:TrackRemover=true
B:Tree_Exotic=true
B:WoodenHull=true
B:WoodenMinecartHull=true
}
settings {
I:MaximumNumberOfDynamites=50
B:useArcadeSounds=true
B:useTetrisMobSounds=true
}
| 411 | 0.507344 | 1 | 0.507344 | game-dev | MEDIA | 0.585867 | game-dev | 0.503526 | 1 | 0.503526 |
cluster-lab/panotree | 14,652 | unityproject/Assets/Plugins/Zenject/Source/Factories/Pooling/Static/StaticMemoryPool.cs | using System;
using System.Collections.Generic;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public abstract class StaticMemoryPoolBaseBase<TValue> : IDespawnableMemoryPool<TValue>, IDisposable
where TValue : class
{
// I also tried using ConcurrentBag instead of Stack + lock here but that performed much much worse
readonly Stack<TValue> _stack = new Stack<TValue>();
Action<TValue> _onDespawnedMethod;
int _activeCount;
#if ZEN_MULTITHREADING
protected readonly object _locker = new object();
#endif
public StaticMemoryPoolBaseBase(Action<TValue> onDespawnedMethod)
{
_onDespawnedMethod = onDespawnedMethod;
#if UNITY_EDITOR
StaticMemoryPoolRegistry.Add(this);
#endif
}
public Action<TValue> OnDespawnedMethod
{
set { _onDespawnedMethod = value; }
}
public int NumTotal
{
get { return NumInactive + NumActive; }
}
public int NumActive
{
get
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
return _activeCount;
}
}
}
public int NumInactive
{
get
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
return _stack.Count;
}
}
}
public Type ItemType
{
get { return typeof(TValue); }
}
public void Resize(int desiredPoolSize)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
ResizeInternal(desiredPoolSize);
}
}
// We assume here that we're in a lock
void ResizeInternal(int desiredPoolSize)
{
Assert.That(desiredPoolSize >= 0, "Attempted to resize the pool to a negative amount");
while (_stack.Count > desiredPoolSize)
{
_stack.Pop();
}
while (desiredPoolSize > _stack.Count)
{
_stack.Push(Alloc());
}
Assert.IsEqual(_stack.Count, desiredPoolSize);
}
public void Dispose()
{
#if UNITY_EDITOR
StaticMemoryPoolRegistry.Remove(this);
#endif
}
public void ClearActiveCount()
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
_activeCount = 0;
}
}
public void Clear()
{
Resize(0);
}
public void ShrinkBy(int numToRemove)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
ResizeInternal(_stack.Count - numToRemove);
}
}
public void ExpandBy(int numToAdd)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
ResizeInternal(_stack.Count + numToAdd);
}
}
// We assume here that we're in a lock
protected TValue SpawnInternal()
{
TValue element;
if (_stack.Count == 0)
{
element = Alloc();
}
else
{
element = _stack.Pop();
}
_activeCount++;
return element;
}
void IMemoryPool.Despawn(object item)
{
Despawn((TValue)item);
}
public void Despawn(TValue element)
{
if (_onDespawnedMethod != null)
{
_onDespawnedMethod(element);
}
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
Assert.That(!_stack.Contains(element), "Attempted to despawn element twice!");
_activeCount--;
_stack.Push(element);
}
}
protected abstract TValue Alloc();
}
[NoReflectionBaking]
public abstract class StaticMemoryPoolBase<TValue> : StaticMemoryPoolBaseBase<TValue>
where TValue : class, new()
{
public StaticMemoryPoolBase(Action<TValue> onDespawnedMethod)
: base(onDespawnedMethod)
{
}
protected override TValue Alloc()
{
return new TValue();
}
}
// Zero parameters
[NoReflectionBaking]
public class StaticMemoryPool<TValue> : StaticMemoryPoolBase<TValue>, IMemoryPool<TValue>
where TValue : class, new()
{
Action<TValue> _onSpawnMethod;
public StaticMemoryPool(
Action<TValue> onSpawnMethod = null, Action<TValue> onDespawnedMethod = null)
: base(onDespawnedMethod)
{
_onSpawnMethod = onSpawnMethod;
}
public Action<TValue> OnSpawnMethod
{
set { _onSpawnMethod = value; }
}
public TValue Spawn()
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
var item = SpawnInternal();
if (_onSpawnMethod != null)
{
_onSpawnMethod(item);
}
return item;
}
}
}
// One parameter
[NoReflectionBaking]
public class StaticMemoryPool<TParam1, TValue> : StaticMemoryPoolBase<TValue>, IMemoryPool<TParam1, TValue>
where TValue : class, new()
{
Action<TParam1, TValue> _onSpawnMethod;
public StaticMemoryPool(
Action<TParam1, TValue> onSpawnMethod, Action<TValue> onDespawnedMethod = null)
: base(onDespawnedMethod)
{
// What's the point of having a param otherwise?
Assert.IsNotNull(onSpawnMethod);
_onSpawnMethod = onSpawnMethod;
}
public Action<TParam1, TValue> OnSpawnMethod
{
set { _onSpawnMethod = value; }
}
public TValue Spawn(TParam1 param)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
var item = SpawnInternal();
if (_onSpawnMethod != null)
{
_onSpawnMethod(param, item);
}
return item;
}
}
}
// Two parameter
[NoReflectionBaking]
public class StaticMemoryPool<TParam1, TParam2, TValue> : StaticMemoryPoolBase<TValue>, IMemoryPool<TParam1, TParam2, TValue>
where TValue : class, new()
{
Action<TParam1, TParam2, TValue> _onSpawnMethod;
public StaticMemoryPool(
Action<TParam1, TParam2, TValue> onSpawnMethod, Action<TValue> onDespawnedMethod = null)
: base(onDespawnedMethod)
{
// What's the point of having a param otherwise?
Assert.IsNotNull(onSpawnMethod);
_onSpawnMethod = onSpawnMethod;
}
public Action<TParam1, TParam2, TValue> OnSpawnMethod
{
set { _onSpawnMethod = value; }
}
public TValue Spawn(TParam1 p1, TParam2 p2)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
var item = SpawnInternal();
if (_onSpawnMethod != null)
{
_onSpawnMethod(p1, p2, item);
}
return item;
}
}
}
// Three parameters
[NoReflectionBaking]
public class StaticMemoryPool<TParam1, TParam2, TParam3, TValue> : StaticMemoryPoolBase<TValue>, IMemoryPool<TParam1, TParam2, TParam3, TValue>
where TValue : class, new()
{
Action<TParam1, TParam2, TParam3, TValue> _onSpawnMethod;
public StaticMemoryPool(
Action<TParam1, TParam2, TParam3, TValue> onSpawnMethod, Action<TValue> onDespawnedMethod = null)
: base(onDespawnedMethod)
{
// What's the point of having a param otherwise?
Assert.IsNotNull(onSpawnMethod);
_onSpawnMethod = onSpawnMethod;
}
public Action<TParam1, TParam2, TParam3, TValue> OnSpawnMethod
{
set { _onSpawnMethod = value; }
}
public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
var item = SpawnInternal();
if (_onSpawnMethod != null)
{
_onSpawnMethod(p1, p2, p3, item);
}
return item;
}
}
}
// Four parameters
[NoReflectionBaking]
public class StaticMemoryPool<TParam1, TParam2, TParam3, TParam4, TValue> : StaticMemoryPoolBase<TValue>, IMemoryPool<TParam1, TParam2, TParam3, TParam4, TValue>
where TValue : class, new()
{
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TValue> _onSpawnMethod;
public StaticMemoryPool(
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TValue> onSpawnMethod, Action<TValue> onDespawnedMethod = null)
: base(onDespawnedMethod)
{
// What's the point of having a param otherwise?
Assert.IsNotNull(onSpawnMethod);
_onSpawnMethod = onSpawnMethod;
}
public
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TValue> OnSpawnMethod
{
set { _onSpawnMethod = value; }
}
public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
var item = SpawnInternal();
if (_onSpawnMethod != null)
{
_onSpawnMethod(p1, p2, p3, p4, item);
}
return item;
}
}
}
// Five parameters
[NoReflectionBaking]
public class StaticMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TValue> : StaticMemoryPoolBase<TValue>, IMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TValue>
where TValue : class, new()
{
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TValue> _onSpawnMethod;
public StaticMemoryPool(
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TValue> onSpawnMethod, Action<TValue> onDespawnedMethod = null)
: base(onDespawnedMethod)
{
// What's the point of having a param otherwise?
Assert.IsNotNull(onSpawnMethod);
_onSpawnMethod = onSpawnMethod;
}
public
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TValue> OnSpawnMethod
{
set { _onSpawnMethod = value; }
}
public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4, TParam5 p5)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
var item = SpawnInternal();
if (_onSpawnMethod != null)
{
_onSpawnMethod(p1, p2, p3, p4, p5, item);
}
return item;
}
}
}
// Six parameters
[NoReflectionBaking]
public class StaticMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TValue> : StaticMemoryPoolBase<TValue>, IMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TValue>
where TValue : class, new()
{
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TValue> _onSpawnMethod;
public StaticMemoryPool(
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TValue> onSpawnMethod, Action<TValue> onDespawnedMethod = null)
: base(onDespawnedMethod)
{
// What's the point of having a param otherwise?
Assert.IsNotNull(onSpawnMethod);
_onSpawnMethod = onSpawnMethod;
}
public
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TValue> OnSpawnMethod
{
set { _onSpawnMethod = value; }
}
public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4, TParam5 p5, TParam6 p6)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
var item = SpawnInternal();
if (_onSpawnMethod != null)
{
_onSpawnMethod(p1, p2, p3, p4, p5, p6, item);
}
return item;
}
}
}
// Seven parameters
[NoReflectionBaking]
public class StaticMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TValue> : StaticMemoryPoolBase<TValue>, IMemoryPool<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TValue>
where TValue : class, new()
{
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TValue> _onSpawnMethod;
public StaticMemoryPool(
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TValue> onSpawnMethod, Action<TValue> onDespawnedMethod = null)
: base(onDespawnedMethod)
{
// What's the point of having a param otherwise?
Assert.IsNotNull(onSpawnMethod);
_onSpawnMethod = onSpawnMethod;
}
public
#if !NET_4_6
ModestTree.Util.
#endif
Action<TParam1, TParam2, TParam3, TParam4, TParam5, TParam6, TParam7, TValue> OnSpawnMethod
{
set { _onSpawnMethod = value; }
}
public TValue Spawn(TParam1 p1, TParam2 p2, TParam3 p3, TParam4 p4, TParam5 p5, TParam6 p6, TParam7 p7)
{
#if ZEN_MULTITHREADING
lock (_locker)
#endif
{
var item = SpawnInternal();
if (_onSpawnMethod != null)
{
_onSpawnMethod(p1, p2, p3, p4, p5, p6, p7, item);
}
return item;
}
}
}
}
| 411 | 0.711124 | 1 | 0.711124 | game-dev | MEDIA | 0.847238 | game-dev | 0.618586 | 1 | 0.618586 |
PlayFab/PlayFab-Samples | 350,994 | Recipes/SimpleCrossPromotion/Example-Unity3d/SimpleCrossPromotion/Assets/PlayFabSdk/Shared/Public/PlayFabEvents.cs | using PlayFab.SharedModels;
using PlayFab.Internal;
namespace PlayFab.Events
{
public partial class PlayFabEvents
{
public delegate void PlayFabErrorEvent(PlayFabRequestCommon request, PlayFabError error);
public delegate void PlayFabResultEvent<in TResult>(TResult result) where TResult : PlayFabResultCommon;
public delegate void PlayFabRequestEvent<in TRequest>(TRequest request) where TRequest : PlayFabRequestCommon;
public event PlayFabErrorEvent OnGlobalErrorEvent;
private static PlayFabEvents _instance;
/// <summary>
/// Private constructor because we call PlayFabEvents.init();
/// </summary>
private PlayFabEvents() { }
public static PlayFabEvents Init()
{
if (_instance == null)
{
_instance = new PlayFabEvents();
}
PlayFabHttp.ApiProcessingEventHandler += _instance.OnProcessingEvent;
PlayFabHttp.ApiProcessingErrorEventHandler += _instance.OnProcessingErrorEvent;
return _instance;
}
public void UnregisterInstance(object instance)
{
#if !DISABLE_PLAYFABCLIENT_API
if (OnLoginResultEvent != null) { foreach (var each in OnLoginResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginResultEvent -= (PlayFabResultEvent<ClientModels.LoginResult>)each; } } }
#endif
#if ENABLE_PLAYFABADMIN_API
if (OnAdminBanUsersRequestEvent != null) { foreach (var each in OnAdminBanUsersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminBanUsersRequestEvent -= (PlayFabRequestEvent<AdminModels.BanUsersRequest>)each; } } }
if (OnAdminBanUsersResultEvent != null) { foreach (var each in OnAdminBanUsersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminBanUsersResultEvent -= (PlayFabResultEvent<AdminModels.BanUsersResult>)each; } } }
if (OnAdminGetUserAccountInfoRequestEvent != null) { foreach (var each in OnAdminGetUserAccountInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserAccountInfoRequestEvent -= (PlayFabRequestEvent<AdminModels.LookupUserAccountInfoRequest>)each; } } }
if (OnAdminGetUserAccountInfoResultEvent != null) { foreach (var each in OnAdminGetUserAccountInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserAccountInfoResultEvent -= (PlayFabResultEvent<AdminModels.LookupUserAccountInfoResult>)each; } } }
if (OnAdminGetUserBansRequestEvent != null) { foreach (var each in OnAdminGetUserBansRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserBansRequestEvent -= (PlayFabRequestEvent<AdminModels.GetUserBansRequest>)each; } } }
if (OnAdminGetUserBansResultEvent != null) { foreach (var each in OnAdminGetUserBansResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserBansResultEvent -= (PlayFabResultEvent<AdminModels.GetUserBansResult>)each; } } }
if (OnAdminResetUsersRequestEvent != null) { foreach (var each in OnAdminResetUsersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminResetUsersRequestEvent -= (PlayFabRequestEvent<AdminModels.ResetUsersRequest>)each; } } }
if (OnAdminResetUsersResultEvent != null) { foreach (var each in OnAdminResetUsersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminResetUsersResultEvent -= (PlayFabResultEvent<AdminModels.BlankResult>)each; } } }
if (OnAdminRevokeAllBansForUserRequestEvent != null) { foreach (var each in OnAdminRevokeAllBansForUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRevokeAllBansForUserRequestEvent -= (PlayFabRequestEvent<AdminModels.RevokeAllBansForUserRequest>)each; } } }
if (OnAdminRevokeAllBansForUserResultEvent != null) { foreach (var each in OnAdminRevokeAllBansForUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRevokeAllBansForUserResultEvent -= (PlayFabResultEvent<AdminModels.RevokeAllBansForUserResult>)each; } } }
if (OnAdminRevokeBansRequestEvent != null) { foreach (var each in OnAdminRevokeBansRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRevokeBansRequestEvent -= (PlayFabRequestEvent<AdminModels.RevokeBansRequest>)each; } } }
if (OnAdminRevokeBansResultEvent != null) { foreach (var each in OnAdminRevokeBansResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRevokeBansResultEvent -= (PlayFabResultEvent<AdminModels.RevokeBansResult>)each; } } }
if (OnAdminSendAccountRecoveryEmailRequestEvent != null) { foreach (var each in OnAdminSendAccountRecoveryEmailRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSendAccountRecoveryEmailRequestEvent -= (PlayFabRequestEvent<AdminModels.SendAccountRecoveryEmailRequest>)each; } } }
if (OnAdminSendAccountRecoveryEmailResultEvent != null) { foreach (var each in OnAdminSendAccountRecoveryEmailResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSendAccountRecoveryEmailResultEvent -= (PlayFabResultEvent<AdminModels.SendAccountRecoveryEmailResult>)each; } } }
if (OnAdminUpdateBansRequestEvent != null) { foreach (var each in OnAdminUpdateBansRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateBansRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateBansRequest>)each; } } }
if (OnAdminUpdateBansResultEvent != null) { foreach (var each in OnAdminUpdateBansResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateBansResultEvent -= (PlayFabResultEvent<AdminModels.UpdateBansResult>)each; } } }
if (OnAdminUpdateUserTitleDisplayNameRequestEvent != null) { foreach (var each in OnAdminUpdateUserTitleDisplayNameRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserTitleDisplayNameRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateUserTitleDisplayNameRequest>)each; } } }
if (OnAdminUpdateUserTitleDisplayNameResultEvent != null) { foreach (var each in OnAdminUpdateUserTitleDisplayNameResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserTitleDisplayNameResultEvent -= (PlayFabResultEvent<AdminModels.UpdateUserTitleDisplayNameResult>)each; } } }
if (OnAdminCreatePlayerStatisticDefinitionRequestEvent != null) { foreach (var each in OnAdminCreatePlayerStatisticDefinitionRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminCreatePlayerStatisticDefinitionRequestEvent -= (PlayFabRequestEvent<AdminModels.CreatePlayerStatisticDefinitionRequest>)each; } } }
if (OnAdminCreatePlayerStatisticDefinitionResultEvent != null) { foreach (var each in OnAdminCreatePlayerStatisticDefinitionResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminCreatePlayerStatisticDefinitionResultEvent -= (PlayFabResultEvent<AdminModels.CreatePlayerStatisticDefinitionResult>)each; } } }
if (OnAdminDeleteUsersRequestEvent != null) { foreach (var each in OnAdminDeleteUsersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminDeleteUsersRequestEvent -= (PlayFabRequestEvent<AdminModels.DeleteUsersRequest>)each; } } }
if (OnAdminDeleteUsersResultEvent != null) { foreach (var each in OnAdminDeleteUsersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminDeleteUsersResultEvent -= (PlayFabResultEvent<AdminModels.DeleteUsersResult>)each; } } }
if (OnAdminGetDataReportRequestEvent != null) { foreach (var each in OnAdminGetDataReportRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetDataReportRequestEvent -= (PlayFabRequestEvent<AdminModels.GetDataReportRequest>)each; } } }
if (OnAdminGetDataReportResultEvent != null) { foreach (var each in OnAdminGetDataReportResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetDataReportResultEvent -= (PlayFabResultEvent<AdminModels.GetDataReportResult>)each; } } }
if (OnAdminGetPlayerStatisticDefinitionsRequestEvent != null) { foreach (var each in OnAdminGetPlayerStatisticDefinitionsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayerStatisticDefinitionsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetPlayerStatisticDefinitionsRequest>)each; } } }
if (OnAdminGetPlayerStatisticDefinitionsResultEvent != null) { foreach (var each in OnAdminGetPlayerStatisticDefinitionsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayerStatisticDefinitionsResultEvent -= (PlayFabResultEvent<AdminModels.GetPlayerStatisticDefinitionsResult>)each; } } }
if (OnAdminGetPlayerStatisticVersionsRequestEvent != null) { foreach (var each in OnAdminGetPlayerStatisticVersionsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayerStatisticVersionsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetPlayerStatisticVersionsRequest>)each; } } }
if (OnAdminGetPlayerStatisticVersionsResultEvent != null) { foreach (var each in OnAdminGetPlayerStatisticVersionsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayerStatisticVersionsResultEvent -= (PlayFabResultEvent<AdminModels.GetPlayerStatisticVersionsResult>)each; } } }
if (OnAdminGetUserDataRequestEvent != null) { foreach (var each in OnAdminGetUserDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetUserDataRequest>)each; } } }
if (OnAdminGetUserDataResultEvent != null) { foreach (var each in OnAdminGetUserDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserDataResultEvent -= (PlayFabResultEvent<AdminModels.GetUserDataResult>)each; } } }
if (OnAdminGetUserInternalDataRequestEvent != null) { foreach (var each in OnAdminGetUserInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserInternalDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetUserDataRequest>)each; } } }
if (OnAdminGetUserInternalDataResultEvent != null) { foreach (var each in OnAdminGetUserInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserInternalDataResultEvent -= (PlayFabResultEvent<AdminModels.GetUserDataResult>)each; } } }
if (OnAdminGetUserPublisherDataRequestEvent != null) { foreach (var each in OnAdminGetUserPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserPublisherDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetUserDataRequest>)each; } } }
if (OnAdminGetUserPublisherDataResultEvent != null) { foreach (var each in OnAdminGetUserPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserPublisherDataResultEvent -= (PlayFabResultEvent<AdminModels.GetUserDataResult>)each; } } }
if (OnAdminGetUserPublisherInternalDataRequestEvent != null) { foreach (var each in OnAdminGetUserPublisherInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserPublisherInternalDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetUserDataRequest>)each; } } }
if (OnAdminGetUserPublisherInternalDataResultEvent != null) { foreach (var each in OnAdminGetUserPublisherInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserPublisherInternalDataResultEvent -= (PlayFabResultEvent<AdminModels.GetUserDataResult>)each; } } }
if (OnAdminGetUserPublisherReadOnlyDataRequestEvent != null) { foreach (var each in OnAdminGetUserPublisherReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserPublisherReadOnlyDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetUserDataRequest>)each; } } }
if (OnAdminGetUserPublisherReadOnlyDataResultEvent != null) { foreach (var each in OnAdminGetUserPublisherReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserPublisherReadOnlyDataResultEvent -= (PlayFabResultEvent<AdminModels.GetUserDataResult>)each; } } }
if (OnAdminGetUserReadOnlyDataRequestEvent != null) { foreach (var each in OnAdminGetUserReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserReadOnlyDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetUserDataRequest>)each; } } }
if (OnAdminGetUserReadOnlyDataResultEvent != null) { foreach (var each in OnAdminGetUserReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserReadOnlyDataResultEvent -= (PlayFabResultEvent<AdminModels.GetUserDataResult>)each; } } }
if (OnAdminIncrementPlayerStatisticVersionRequestEvent != null) { foreach (var each in OnAdminIncrementPlayerStatisticVersionRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminIncrementPlayerStatisticVersionRequestEvent -= (PlayFabRequestEvent<AdminModels.IncrementPlayerStatisticVersionRequest>)each; } } }
if (OnAdminIncrementPlayerStatisticVersionResultEvent != null) { foreach (var each in OnAdminIncrementPlayerStatisticVersionResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminIncrementPlayerStatisticVersionResultEvent -= (PlayFabResultEvent<AdminModels.IncrementPlayerStatisticVersionResult>)each; } } }
if (OnAdminRefundPurchaseRequestEvent != null) { foreach (var each in OnAdminRefundPurchaseRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRefundPurchaseRequestEvent -= (PlayFabRequestEvent<AdminModels.RefundPurchaseRequest>)each; } } }
if (OnAdminRefundPurchaseResultEvent != null) { foreach (var each in OnAdminRefundPurchaseResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRefundPurchaseResultEvent -= (PlayFabResultEvent<AdminModels.RefundPurchaseResponse>)each; } } }
if (OnAdminResetUserStatisticsRequestEvent != null) { foreach (var each in OnAdminResetUserStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminResetUserStatisticsRequestEvent -= (PlayFabRequestEvent<AdminModels.ResetUserStatisticsRequest>)each; } } }
if (OnAdminResetUserStatisticsResultEvent != null) { foreach (var each in OnAdminResetUserStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminResetUserStatisticsResultEvent -= (PlayFabResultEvent<AdminModels.ResetUserStatisticsResult>)each; } } }
if (OnAdminResolvePurchaseDisputeRequestEvent != null) { foreach (var each in OnAdminResolvePurchaseDisputeRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminResolvePurchaseDisputeRequestEvent -= (PlayFabRequestEvent<AdminModels.ResolvePurchaseDisputeRequest>)each; } } }
if (OnAdminResolvePurchaseDisputeResultEvent != null) { foreach (var each in OnAdminResolvePurchaseDisputeResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminResolvePurchaseDisputeResultEvent -= (PlayFabResultEvent<AdminModels.ResolvePurchaseDisputeResponse>)each; } } }
if (OnAdminUpdatePlayerStatisticDefinitionRequestEvent != null) { foreach (var each in OnAdminUpdatePlayerStatisticDefinitionRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdatePlayerStatisticDefinitionRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdatePlayerStatisticDefinitionRequest>)each; } } }
if (OnAdminUpdatePlayerStatisticDefinitionResultEvent != null) { foreach (var each in OnAdminUpdatePlayerStatisticDefinitionResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdatePlayerStatisticDefinitionResultEvent -= (PlayFabResultEvent<AdminModels.UpdatePlayerStatisticDefinitionResult>)each; } } }
if (OnAdminUpdateUserDataRequestEvent != null) { foreach (var each in OnAdminUpdateUserDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserDataRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateUserDataRequest>)each; } } }
if (OnAdminUpdateUserDataResultEvent != null) { foreach (var each in OnAdminUpdateUserDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserDataResultEvent -= (PlayFabResultEvent<AdminModels.UpdateUserDataResult>)each; } } }
if (OnAdminUpdateUserInternalDataRequestEvent != null) { foreach (var each in OnAdminUpdateUserInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserInternalDataRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateUserInternalDataRequest>)each; } } }
if (OnAdminUpdateUserInternalDataResultEvent != null) { foreach (var each in OnAdminUpdateUserInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserInternalDataResultEvent -= (PlayFabResultEvent<AdminModels.UpdateUserDataResult>)each; } } }
if (OnAdminUpdateUserPublisherDataRequestEvent != null) { foreach (var each in OnAdminUpdateUserPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserPublisherDataRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateUserDataRequest>)each; } } }
if (OnAdminUpdateUserPublisherDataResultEvent != null) { foreach (var each in OnAdminUpdateUserPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserPublisherDataResultEvent -= (PlayFabResultEvent<AdminModels.UpdateUserDataResult>)each; } } }
if (OnAdminUpdateUserPublisherInternalDataRequestEvent != null) { foreach (var each in OnAdminUpdateUserPublisherInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserPublisherInternalDataRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateUserInternalDataRequest>)each; } } }
if (OnAdminUpdateUserPublisherInternalDataResultEvent != null) { foreach (var each in OnAdminUpdateUserPublisherInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserPublisherInternalDataResultEvent -= (PlayFabResultEvent<AdminModels.UpdateUserDataResult>)each; } } }
if (OnAdminUpdateUserPublisherReadOnlyDataRequestEvent != null) { foreach (var each in OnAdminUpdateUserPublisherReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserPublisherReadOnlyDataRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateUserDataRequest>)each; } } }
if (OnAdminUpdateUserPublisherReadOnlyDataResultEvent != null) { foreach (var each in OnAdminUpdateUserPublisherReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserPublisherReadOnlyDataResultEvent -= (PlayFabResultEvent<AdminModels.UpdateUserDataResult>)each; } } }
if (OnAdminUpdateUserReadOnlyDataRequestEvent != null) { foreach (var each in OnAdminUpdateUserReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserReadOnlyDataRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateUserDataRequest>)each; } } }
if (OnAdminUpdateUserReadOnlyDataResultEvent != null) { foreach (var each in OnAdminUpdateUserReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateUserReadOnlyDataResultEvent -= (PlayFabResultEvent<AdminModels.UpdateUserDataResult>)each; } } }
if (OnAdminAddNewsRequestEvent != null) { foreach (var each in OnAdminAddNewsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddNewsRequestEvent -= (PlayFabRequestEvent<AdminModels.AddNewsRequest>)each; } } }
if (OnAdminAddNewsResultEvent != null) { foreach (var each in OnAdminAddNewsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddNewsResultEvent -= (PlayFabResultEvent<AdminModels.AddNewsResult>)each; } } }
if (OnAdminAddVirtualCurrencyTypesRequestEvent != null) { foreach (var each in OnAdminAddVirtualCurrencyTypesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddVirtualCurrencyTypesRequestEvent -= (PlayFabRequestEvent<AdminModels.AddVirtualCurrencyTypesRequest>)each; } } }
if (OnAdminAddVirtualCurrencyTypesResultEvent != null) { foreach (var each in OnAdminAddVirtualCurrencyTypesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddVirtualCurrencyTypesResultEvent -= (PlayFabResultEvent<AdminModels.BlankResult>)each; } } }
if (OnAdminDeleteStoreRequestEvent != null) { foreach (var each in OnAdminDeleteStoreRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminDeleteStoreRequestEvent -= (PlayFabRequestEvent<AdminModels.DeleteStoreRequest>)each; } } }
if (OnAdminDeleteStoreResultEvent != null) { foreach (var each in OnAdminDeleteStoreResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminDeleteStoreResultEvent -= (PlayFabResultEvent<AdminModels.DeleteStoreResult>)each; } } }
if (OnAdminGetCatalogItemsRequestEvent != null) { foreach (var each in OnAdminGetCatalogItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetCatalogItemsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetCatalogItemsRequest>)each; } } }
if (OnAdminGetCatalogItemsResultEvent != null) { foreach (var each in OnAdminGetCatalogItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetCatalogItemsResultEvent -= (PlayFabResultEvent<AdminModels.GetCatalogItemsResult>)each; } } }
if (OnAdminGetPublisherDataRequestEvent != null) { foreach (var each in OnAdminGetPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPublisherDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetPublisherDataRequest>)each; } } }
if (OnAdminGetPublisherDataResultEvent != null) { foreach (var each in OnAdminGetPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPublisherDataResultEvent -= (PlayFabResultEvent<AdminModels.GetPublisherDataResult>)each; } } }
if (OnAdminGetRandomResultTablesRequestEvent != null) { foreach (var each in OnAdminGetRandomResultTablesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetRandomResultTablesRequestEvent -= (PlayFabRequestEvent<AdminModels.GetRandomResultTablesRequest>)each; } } }
if (OnAdminGetRandomResultTablesResultEvent != null) { foreach (var each in OnAdminGetRandomResultTablesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetRandomResultTablesResultEvent -= (PlayFabResultEvent<AdminModels.GetRandomResultTablesResult>)each; } } }
if (OnAdminGetStoreItemsRequestEvent != null) { foreach (var each in OnAdminGetStoreItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetStoreItemsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetStoreItemsRequest>)each; } } }
if (OnAdminGetStoreItemsResultEvent != null) { foreach (var each in OnAdminGetStoreItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetStoreItemsResultEvent -= (PlayFabResultEvent<AdminModels.GetStoreItemsResult>)each; } } }
if (OnAdminGetTitleDataRequestEvent != null) { foreach (var each in OnAdminGetTitleDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetTitleDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetTitleDataRequest>)each; } } }
if (OnAdminGetTitleDataResultEvent != null) { foreach (var each in OnAdminGetTitleDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetTitleDataResultEvent -= (PlayFabResultEvent<AdminModels.GetTitleDataResult>)each; } } }
if (OnAdminGetTitleInternalDataRequestEvent != null) { foreach (var each in OnAdminGetTitleInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetTitleInternalDataRequestEvent -= (PlayFabRequestEvent<AdminModels.GetTitleDataRequest>)each; } } }
if (OnAdminGetTitleInternalDataResultEvent != null) { foreach (var each in OnAdminGetTitleInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetTitleInternalDataResultEvent -= (PlayFabResultEvent<AdminModels.GetTitleDataResult>)each; } } }
if (OnAdminListVirtualCurrencyTypesRequestEvent != null) { foreach (var each in OnAdminListVirtualCurrencyTypesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminListVirtualCurrencyTypesRequestEvent -= (PlayFabRequestEvent<AdminModels.ListVirtualCurrencyTypesRequest>)each; } } }
if (OnAdminListVirtualCurrencyTypesResultEvent != null) { foreach (var each in OnAdminListVirtualCurrencyTypesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminListVirtualCurrencyTypesResultEvent -= (PlayFabResultEvent<AdminModels.ListVirtualCurrencyTypesResult>)each; } } }
if (OnAdminRemoveVirtualCurrencyTypesRequestEvent != null) { foreach (var each in OnAdminRemoveVirtualCurrencyTypesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRemoveVirtualCurrencyTypesRequestEvent -= (PlayFabRequestEvent<AdminModels.RemoveVirtualCurrencyTypesRequest>)each; } } }
if (OnAdminRemoveVirtualCurrencyTypesResultEvent != null) { foreach (var each in OnAdminRemoveVirtualCurrencyTypesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRemoveVirtualCurrencyTypesResultEvent -= (PlayFabResultEvent<AdminModels.BlankResult>)each; } } }
if (OnAdminSetCatalogItemsRequestEvent != null) { foreach (var each in OnAdminSetCatalogItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetCatalogItemsRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateCatalogItemsRequest>)each; } } }
if (OnAdminSetCatalogItemsResultEvent != null) { foreach (var each in OnAdminSetCatalogItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetCatalogItemsResultEvent -= (PlayFabResultEvent<AdminModels.UpdateCatalogItemsResult>)each; } } }
if (OnAdminSetStoreItemsRequestEvent != null) { foreach (var each in OnAdminSetStoreItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetStoreItemsRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateStoreItemsRequest>)each; } } }
if (OnAdminSetStoreItemsResultEvent != null) { foreach (var each in OnAdminSetStoreItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetStoreItemsResultEvent -= (PlayFabResultEvent<AdminModels.UpdateStoreItemsResult>)each; } } }
if (OnAdminSetTitleDataRequestEvent != null) { foreach (var each in OnAdminSetTitleDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetTitleDataRequestEvent -= (PlayFabRequestEvent<AdminModels.SetTitleDataRequest>)each; } } }
if (OnAdminSetTitleDataResultEvent != null) { foreach (var each in OnAdminSetTitleDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetTitleDataResultEvent -= (PlayFabResultEvent<AdminModels.SetTitleDataResult>)each; } } }
if (OnAdminSetTitleInternalDataRequestEvent != null) { foreach (var each in OnAdminSetTitleInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetTitleInternalDataRequestEvent -= (PlayFabRequestEvent<AdminModels.SetTitleDataRequest>)each; } } }
if (OnAdminSetTitleInternalDataResultEvent != null) { foreach (var each in OnAdminSetTitleInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetTitleInternalDataResultEvent -= (PlayFabResultEvent<AdminModels.SetTitleDataResult>)each; } } }
if (OnAdminSetupPushNotificationRequestEvent != null) { foreach (var each in OnAdminSetupPushNotificationRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetupPushNotificationRequestEvent -= (PlayFabRequestEvent<AdminModels.SetupPushNotificationRequest>)each; } } }
if (OnAdminSetupPushNotificationResultEvent != null) { foreach (var each in OnAdminSetupPushNotificationResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetupPushNotificationResultEvent -= (PlayFabResultEvent<AdminModels.SetupPushNotificationResult>)each; } } }
if (OnAdminUpdateCatalogItemsRequestEvent != null) { foreach (var each in OnAdminUpdateCatalogItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateCatalogItemsRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateCatalogItemsRequest>)each; } } }
if (OnAdminUpdateCatalogItemsResultEvent != null) { foreach (var each in OnAdminUpdateCatalogItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateCatalogItemsResultEvent -= (PlayFabResultEvent<AdminModels.UpdateCatalogItemsResult>)each; } } }
if (OnAdminUpdateRandomResultTablesRequestEvent != null) { foreach (var each in OnAdminUpdateRandomResultTablesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateRandomResultTablesRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateRandomResultTablesRequest>)each; } } }
if (OnAdminUpdateRandomResultTablesResultEvent != null) { foreach (var each in OnAdminUpdateRandomResultTablesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateRandomResultTablesResultEvent -= (PlayFabResultEvent<AdminModels.UpdateRandomResultTablesResult>)each; } } }
if (OnAdminUpdateStoreItemsRequestEvent != null) { foreach (var each in OnAdminUpdateStoreItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateStoreItemsRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateStoreItemsRequest>)each; } } }
if (OnAdminUpdateStoreItemsResultEvent != null) { foreach (var each in OnAdminUpdateStoreItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateStoreItemsResultEvent -= (PlayFabResultEvent<AdminModels.UpdateStoreItemsResult>)each; } } }
if (OnAdminAddUserVirtualCurrencyRequestEvent != null) { foreach (var each in OnAdminAddUserVirtualCurrencyRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddUserVirtualCurrencyRequestEvent -= (PlayFabRequestEvent<AdminModels.AddUserVirtualCurrencyRequest>)each; } } }
if (OnAdminAddUserVirtualCurrencyResultEvent != null) { foreach (var each in OnAdminAddUserVirtualCurrencyResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddUserVirtualCurrencyResultEvent -= (PlayFabResultEvent<AdminModels.ModifyUserVirtualCurrencyResult>)each; } } }
if (OnAdminGetUserInventoryRequestEvent != null) { foreach (var each in OnAdminGetUserInventoryRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserInventoryRequestEvent -= (PlayFabRequestEvent<AdminModels.GetUserInventoryRequest>)each; } } }
if (OnAdminGetUserInventoryResultEvent != null) { foreach (var each in OnAdminGetUserInventoryResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetUserInventoryResultEvent -= (PlayFabResultEvent<AdminModels.GetUserInventoryResult>)each; } } }
if (OnAdminGrantItemsToUsersRequestEvent != null) { foreach (var each in OnAdminGrantItemsToUsersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGrantItemsToUsersRequestEvent -= (PlayFabRequestEvent<AdminModels.GrantItemsToUsersRequest>)each; } } }
if (OnAdminGrantItemsToUsersResultEvent != null) { foreach (var each in OnAdminGrantItemsToUsersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGrantItemsToUsersResultEvent -= (PlayFabResultEvent<AdminModels.GrantItemsToUsersResult>)each; } } }
if (OnAdminRevokeInventoryItemRequestEvent != null) { foreach (var each in OnAdminRevokeInventoryItemRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRevokeInventoryItemRequestEvent -= (PlayFabRequestEvent<AdminModels.RevokeInventoryItemRequest>)each; } } }
if (OnAdminRevokeInventoryItemResultEvent != null) { foreach (var each in OnAdminRevokeInventoryItemResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRevokeInventoryItemResultEvent -= (PlayFabResultEvent<AdminModels.RevokeInventoryResult>)each; } } }
if (OnAdminSubtractUserVirtualCurrencyRequestEvent != null) { foreach (var each in OnAdminSubtractUserVirtualCurrencyRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSubtractUserVirtualCurrencyRequestEvent -= (PlayFabRequestEvent<AdminModels.SubtractUserVirtualCurrencyRequest>)each; } } }
if (OnAdminSubtractUserVirtualCurrencyResultEvent != null) { foreach (var each in OnAdminSubtractUserVirtualCurrencyResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSubtractUserVirtualCurrencyResultEvent -= (PlayFabResultEvent<AdminModels.ModifyUserVirtualCurrencyResult>)each; } } }
if (OnAdminGetMatchmakerGameInfoRequestEvent != null) { foreach (var each in OnAdminGetMatchmakerGameInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetMatchmakerGameInfoRequestEvent -= (PlayFabRequestEvent<AdminModels.GetMatchmakerGameInfoRequest>)each; } } }
if (OnAdminGetMatchmakerGameInfoResultEvent != null) { foreach (var each in OnAdminGetMatchmakerGameInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetMatchmakerGameInfoResultEvent -= (PlayFabResultEvent<AdminModels.GetMatchmakerGameInfoResult>)each; } } }
if (OnAdminGetMatchmakerGameModesRequestEvent != null) { foreach (var each in OnAdminGetMatchmakerGameModesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetMatchmakerGameModesRequestEvent -= (PlayFabRequestEvent<AdminModels.GetMatchmakerGameModesRequest>)each; } } }
if (OnAdminGetMatchmakerGameModesResultEvent != null) { foreach (var each in OnAdminGetMatchmakerGameModesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetMatchmakerGameModesResultEvent -= (PlayFabResultEvent<AdminModels.GetMatchmakerGameModesResult>)each; } } }
if (OnAdminModifyMatchmakerGameModesRequestEvent != null) { foreach (var each in OnAdminModifyMatchmakerGameModesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminModifyMatchmakerGameModesRequestEvent -= (PlayFabRequestEvent<AdminModels.ModifyMatchmakerGameModesRequest>)each; } } }
if (OnAdminModifyMatchmakerGameModesResultEvent != null) { foreach (var each in OnAdminModifyMatchmakerGameModesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminModifyMatchmakerGameModesResultEvent -= (PlayFabResultEvent<AdminModels.ModifyMatchmakerGameModesResult>)each; } } }
if (OnAdminAddServerBuildRequestEvent != null) { foreach (var each in OnAdminAddServerBuildRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddServerBuildRequestEvent -= (PlayFabRequestEvent<AdminModels.AddServerBuildRequest>)each; } } }
if (OnAdminAddServerBuildResultEvent != null) { foreach (var each in OnAdminAddServerBuildResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddServerBuildResultEvent -= (PlayFabResultEvent<AdminModels.AddServerBuildResult>)each; } } }
if (OnAdminGetServerBuildInfoRequestEvent != null) { foreach (var each in OnAdminGetServerBuildInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetServerBuildInfoRequestEvent -= (PlayFabRequestEvent<AdminModels.GetServerBuildInfoRequest>)each; } } }
if (OnAdminGetServerBuildInfoResultEvent != null) { foreach (var each in OnAdminGetServerBuildInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetServerBuildInfoResultEvent -= (PlayFabResultEvent<AdminModels.GetServerBuildInfoResult>)each; } } }
if (OnAdminGetServerBuildUploadUrlRequestEvent != null) { foreach (var each in OnAdminGetServerBuildUploadUrlRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetServerBuildUploadUrlRequestEvent -= (PlayFabRequestEvent<AdminModels.GetServerBuildUploadURLRequest>)each; } } }
if (OnAdminGetServerBuildUploadUrlResultEvent != null) { foreach (var each in OnAdminGetServerBuildUploadUrlResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetServerBuildUploadUrlResultEvent -= (PlayFabResultEvent<AdminModels.GetServerBuildUploadURLResult>)each; } } }
if (OnAdminListServerBuildsRequestEvent != null) { foreach (var each in OnAdminListServerBuildsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminListServerBuildsRequestEvent -= (PlayFabRequestEvent<AdminModels.ListBuildsRequest>)each; } } }
if (OnAdminListServerBuildsResultEvent != null) { foreach (var each in OnAdminListServerBuildsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminListServerBuildsResultEvent -= (PlayFabResultEvent<AdminModels.ListBuildsResult>)each; } } }
if (OnAdminModifyServerBuildRequestEvent != null) { foreach (var each in OnAdminModifyServerBuildRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminModifyServerBuildRequestEvent -= (PlayFabRequestEvent<AdminModels.ModifyServerBuildRequest>)each; } } }
if (OnAdminModifyServerBuildResultEvent != null) { foreach (var each in OnAdminModifyServerBuildResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminModifyServerBuildResultEvent -= (PlayFabResultEvent<AdminModels.ModifyServerBuildResult>)each; } } }
if (OnAdminRemoveServerBuildRequestEvent != null) { foreach (var each in OnAdminRemoveServerBuildRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRemoveServerBuildRequestEvent -= (PlayFabRequestEvent<AdminModels.RemoveServerBuildRequest>)each; } } }
if (OnAdminRemoveServerBuildResultEvent != null) { foreach (var each in OnAdminRemoveServerBuildResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRemoveServerBuildResultEvent -= (PlayFabResultEvent<AdminModels.RemoveServerBuildResult>)each; } } }
if (OnAdminSetPublisherDataRequestEvent != null) { foreach (var each in OnAdminSetPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetPublisherDataRequestEvent -= (PlayFabRequestEvent<AdminModels.SetPublisherDataRequest>)each; } } }
if (OnAdminSetPublisherDataResultEvent != null) { foreach (var each in OnAdminSetPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetPublisherDataResultEvent -= (PlayFabResultEvent<AdminModels.SetPublisherDataResult>)each; } } }
if (OnAdminGetCloudScriptRevisionRequestEvent != null) { foreach (var each in OnAdminGetCloudScriptRevisionRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetCloudScriptRevisionRequestEvent -= (PlayFabRequestEvent<AdminModels.GetCloudScriptRevisionRequest>)each; } } }
if (OnAdminGetCloudScriptRevisionResultEvent != null) { foreach (var each in OnAdminGetCloudScriptRevisionResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetCloudScriptRevisionResultEvent -= (PlayFabResultEvent<AdminModels.GetCloudScriptRevisionResult>)each; } } }
if (OnAdminGetCloudScriptVersionsRequestEvent != null) { foreach (var each in OnAdminGetCloudScriptVersionsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetCloudScriptVersionsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetCloudScriptVersionsRequest>)each; } } }
if (OnAdminGetCloudScriptVersionsResultEvent != null) { foreach (var each in OnAdminGetCloudScriptVersionsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetCloudScriptVersionsResultEvent -= (PlayFabResultEvent<AdminModels.GetCloudScriptVersionsResult>)each; } } }
if (OnAdminSetPublishedRevisionRequestEvent != null) { foreach (var each in OnAdminSetPublishedRevisionRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetPublishedRevisionRequestEvent -= (PlayFabRequestEvent<AdminModels.SetPublishedRevisionRequest>)each; } } }
if (OnAdminSetPublishedRevisionResultEvent != null) { foreach (var each in OnAdminSetPublishedRevisionResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminSetPublishedRevisionResultEvent -= (PlayFabResultEvent<AdminModels.SetPublishedRevisionResult>)each; } } }
if (OnAdminUpdateCloudScriptRequestEvent != null) { foreach (var each in OnAdminUpdateCloudScriptRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateCloudScriptRequestEvent -= (PlayFabRequestEvent<AdminModels.UpdateCloudScriptRequest>)each; } } }
if (OnAdminUpdateCloudScriptResultEvent != null) { foreach (var each in OnAdminUpdateCloudScriptResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminUpdateCloudScriptResultEvent -= (PlayFabResultEvent<AdminModels.UpdateCloudScriptResult>)each; } } }
if (OnAdminDeleteContentRequestEvent != null) { foreach (var each in OnAdminDeleteContentRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminDeleteContentRequestEvent -= (PlayFabRequestEvent<AdminModels.DeleteContentRequest>)each; } } }
if (OnAdminDeleteContentResultEvent != null) { foreach (var each in OnAdminDeleteContentResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminDeleteContentResultEvent -= (PlayFabResultEvent<AdminModels.BlankResult>)each; } } }
if (OnAdminGetContentListRequestEvent != null) { foreach (var each in OnAdminGetContentListRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetContentListRequestEvent -= (PlayFabRequestEvent<AdminModels.GetContentListRequest>)each; } } }
if (OnAdminGetContentListResultEvent != null) { foreach (var each in OnAdminGetContentListResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetContentListResultEvent -= (PlayFabResultEvent<AdminModels.GetContentListResult>)each; } } }
if (OnAdminGetContentUploadUrlRequestEvent != null) { foreach (var each in OnAdminGetContentUploadUrlRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetContentUploadUrlRequestEvent -= (PlayFabRequestEvent<AdminModels.GetContentUploadUrlRequest>)each; } } }
if (OnAdminGetContentUploadUrlResultEvent != null) { foreach (var each in OnAdminGetContentUploadUrlResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetContentUploadUrlResultEvent -= (PlayFabResultEvent<AdminModels.GetContentUploadUrlResult>)each; } } }
if (OnAdminResetCharacterStatisticsRequestEvent != null) { foreach (var each in OnAdminResetCharacterStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminResetCharacterStatisticsRequestEvent -= (PlayFabRequestEvent<AdminModels.ResetCharacterStatisticsRequest>)each; } } }
if (OnAdminResetCharacterStatisticsResultEvent != null) { foreach (var each in OnAdminResetCharacterStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminResetCharacterStatisticsResultEvent -= (PlayFabResultEvent<AdminModels.ResetCharacterStatisticsResult>)each; } } }
if (OnAdminAddPlayerTagRequestEvent != null) { foreach (var each in OnAdminAddPlayerTagRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddPlayerTagRequestEvent -= (PlayFabRequestEvent<AdminModels.AddPlayerTagRequest>)each; } } }
if (OnAdminAddPlayerTagResultEvent != null) { foreach (var each in OnAdminAddPlayerTagResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminAddPlayerTagResultEvent -= (PlayFabResultEvent<AdminModels.AddPlayerTagResult>)each; } } }
if (OnAdminGetAllActionGroupsRequestEvent != null) { foreach (var each in OnAdminGetAllActionGroupsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetAllActionGroupsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetAllActionGroupsRequest>)each; } } }
if (OnAdminGetAllActionGroupsResultEvent != null) { foreach (var each in OnAdminGetAllActionGroupsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetAllActionGroupsResultEvent -= (PlayFabResultEvent<AdminModels.GetAllActionGroupsResult>)each; } } }
if (OnAdminGetAllSegmentsRequestEvent != null) { foreach (var each in OnAdminGetAllSegmentsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetAllSegmentsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetAllSegmentsRequest>)each; } } }
if (OnAdminGetAllSegmentsResultEvent != null) { foreach (var each in OnAdminGetAllSegmentsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetAllSegmentsResultEvent -= (PlayFabResultEvent<AdminModels.GetAllSegmentsResult>)each; } } }
if (OnAdminGetPlayerSegmentsRequestEvent != null) { foreach (var each in OnAdminGetPlayerSegmentsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayerSegmentsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetPlayersSegmentsRequest>)each; } } }
if (OnAdminGetPlayerSegmentsResultEvent != null) { foreach (var each in OnAdminGetPlayerSegmentsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayerSegmentsResultEvent -= (PlayFabResultEvent<AdminModels.GetPlayerSegmentsResult>)each; } } }
if (OnAdminGetPlayersInSegmentRequestEvent != null) { foreach (var each in OnAdminGetPlayersInSegmentRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayersInSegmentRequestEvent -= (PlayFabRequestEvent<AdminModels.GetPlayersInSegmentRequest>)each; } } }
if (OnAdminGetPlayersInSegmentResultEvent != null) { foreach (var each in OnAdminGetPlayersInSegmentResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayersInSegmentResultEvent -= (PlayFabResultEvent<AdminModels.GetPlayersInSegmentResult>)each; } } }
if (OnAdminGetPlayerTagsRequestEvent != null) { foreach (var each in OnAdminGetPlayerTagsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayerTagsRequestEvent -= (PlayFabRequestEvent<AdminModels.GetPlayerTagsRequest>)each; } } }
if (OnAdminGetPlayerTagsResultEvent != null) { foreach (var each in OnAdminGetPlayerTagsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminGetPlayerTagsResultEvent -= (PlayFabResultEvent<AdminModels.GetPlayerTagsResult>)each; } } }
if (OnAdminRemovePlayerTagRequestEvent != null) { foreach (var each in OnAdminRemovePlayerTagRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRemovePlayerTagRequestEvent -= (PlayFabRequestEvent<AdminModels.RemovePlayerTagRequest>)each; } } }
if (OnAdminRemovePlayerTagResultEvent != null) { foreach (var each in OnAdminRemovePlayerTagResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAdminRemovePlayerTagResultEvent -= (PlayFabResultEvent<AdminModels.RemovePlayerTagResult>)each; } } }
#endif
#if ENABLE_PLAYFABSERVER_API
if (OnMatchmakerAuthUserRequestEvent != null) { foreach (var each in OnMatchmakerAuthUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerAuthUserRequestEvent -= (PlayFabRequestEvent<MatchmakerModels.AuthUserRequest>)each; } } }
if (OnMatchmakerAuthUserResultEvent != null) { foreach (var each in OnMatchmakerAuthUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerAuthUserResultEvent -= (PlayFabResultEvent<MatchmakerModels.AuthUserResponse>)each; } } }
if (OnMatchmakerPlayerJoinedRequestEvent != null) { foreach (var each in OnMatchmakerPlayerJoinedRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerPlayerJoinedRequestEvent -= (PlayFabRequestEvent<MatchmakerModels.PlayerJoinedRequest>)each; } } }
if (OnMatchmakerPlayerJoinedResultEvent != null) { foreach (var each in OnMatchmakerPlayerJoinedResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerPlayerJoinedResultEvent -= (PlayFabResultEvent<MatchmakerModels.PlayerJoinedResponse>)each; } } }
if (OnMatchmakerPlayerLeftRequestEvent != null) { foreach (var each in OnMatchmakerPlayerLeftRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerPlayerLeftRequestEvent -= (PlayFabRequestEvent<MatchmakerModels.PlayerLeftRequest>)each; } } }
if (OnMatchmakerPlayerLeftResultEvent != null) { foreach (var each in OnMatchmakerPlayerLeftResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerPlayerLeftResultEvent -= (PlayFabResultEvent<MatchmakerModels.PlayerLeftResponse>)each; } } }
if (OnMatchmakerStartGameRequestEvent != null) { foreach (var each in OnMatchmakerStartGameRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerStartGameRequestEvent -= (PlayFabRequestEvent<MatchmakerModels.StartGameRequest>)each; } } }
if (OnMatchmakerStartGameResultEvent != null) { foreach (var each in OnMatchmakerStartGameResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerStartGameResultEvent -= (PlayFabResultEvent<MatchmakerModels.StartGameResponse>)each; } } }
if (OnMatchmakerUserInfoRequestEvent != null) { foreach (var each in OnMatchmakerUserInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerUserInfoRequestEvent -= (PlayFabRequestEvent<MatchmakerModels.UserInfoRequest>)each; } } }
if (OnMatchmakerUserInfoResultEvent != null) { foreach (var each in OnMatchmakerUserInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakerUserInfoResultEvent -= (PlayFabResultEvent<MatchmakerModels.UserInfoResponse>)each; } } }
#endif
#if ENABLE_PLAYFABSERVER_API
if (OnServerAuthenticateSessionTicketRequestEvent != null) { foreach (var each in OnServerAuthenticateSessionTicketRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAuthenticateSessionTicketRequestEvent -= (PlayFabRequestEvent<ServerModels.AuthenticateSessionTicketRequest>)each; } } }
if (OnServerAuthenticateSessionTicketResultEvent != null) { foreach (var each in OnServerAuthenticateSessionTicketResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAuthenticateSessionTicketResultEvent -= (PlayFabResultEvent<ServerModels.AuthenticateSessionTicketResult>)each; } } }
if (OnServerBanUsersRequestEvent != null) { foreach (var each in OnServerBanUsersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerBanUsersRequestEvent -= (PlayFabRequestEvent<ServerModels.BanUsersRequest>)each; } } }
if (OnServerBanUsersResultEvent != null) { foreach (var each in OnServerBanUsersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerBanUsersResultEvent -= (PlayFabResultEvent<ServerModels.BanUsersResult>)each; } } }
if (OnServerGetPlayFabIDsFromFacebookIDsRequestEvent != null) { foreach (var each in OnServerGetPlayFabIDsFromFacebookIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayFabIDsFromFacebookIDsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPlayFabIDsFromFacebookIDsRequest>)each; } } }
if (OnServerGetPlayFabIDsFromFacebookIDsResultEvent != null) { foreach (var each in OnServerGetPlayFabIDsFromFacebookIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayFabIDsFromFacebookIDsResultEvent -= (PlayFabResultEvent<ServerModels.GetPlayFabIDsFromFacebookIDsResult>)each; } } }
if (OnServerGetPlayFabIDsFromSteamIDsRequestEvent != null) { foreach (var each in OnServerGetPlayFabIDsFromSteamIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayFabIDsFromSteamIDsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPlayFabIDsFromSteamIDsRequest>)each; } } }
if (OnServerGetPlayFabIDsFromSteamIDsResultEvent != null) { foreach (var each in OnServerGetPlayFabIDsFromSteamIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayFabIDsFromSteamIDsResultEvent -= (PlayFabResultEvent<ServerModels.GetPlayFabIDsFromSteamIDsResult>)each; } } }
if (OnServerGetUserAccountInfoRequestEvent != null) { foreach (var each in OnServerGetUserAccountInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserAccountInfoRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserAccountInfoRequest>)each; } } }
if (OnServerGetUserAccountInfoResultEvent != null) { foreach (var each in OnServerGetUserAccountInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserAccountInfoResultEvent -= (PlayFabResultEvent<ServerModels.GetUserAccountInfoResult>)each; } } }
if (OnServerGetUserBansRequestEvent != null) { foreach (var each in OnServerGetUserBansRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserBansRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserBansRequest>)each; } } }
if (OnServerGetUserBansResultEvent != null) { foreach (var each in OnServerGetUserBansResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserBansResultEvent -= (PlayFabResultEvent<ServerModels.GetUserBansResult>)each; } } }
if (OnServerRevokeAllBansForUserRequestEvent != null) { foreach (var each in OnServerRevokeAllBansForUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRevokeAllBansForUserRequestEvent -= (PlayFabRequestEvent<ServerModels.RevokeAllBansForUserRequest>)each; } } }
if (OnServerRevokeAllBansForUserResultEvent != null) { foreach (var each in OnServerRevokeAllBansForUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRevokeAllBansForUserResultEvent -= (PlayFabResultEvent<ServerModels.RevokeAllBansForUserResult>)each; } } }
if (OnServerRevokeBansRequestEvent != null) { foreach (var each in OnServerRevokeBansRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRevokeBansRequestEvent -= (PlayFabRequestEvent<ServerModels.RevokeBansRequest>)each; } } }
if (OnServerRevokeBansResultEvent != null) { foreach (var each in OnServerRevokeBansResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRevokeBansResultEvent -= (PlayFabResultEvent<ServerModels.RevokeBansResult>)each; } } }
if (OnServerSendPushNotificationRequestEvent != null) { foreach (var each in OnServerSendPushNotificationRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSendPushNotificationRequestEvent -= (PlayFabRequestEvent<ServerModels.SendPushNotificationRequest>)each; } } }
if (OnServerSendPushNotificationResultEvent != null) { foreach (var each in OnServerSendPushNotificationResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSendPushNotificationResultEvent -= (PlayFabResultEvent<ServerModels.SendPushNotificationResult>)each; } } }
if (OnServerUpdateBansRequestEvent != null) { foreach (var each in OnServerUpdateBansRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateBansRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateBansRequest>)each; } } }
if (OnServerUpdateBansResultEvent != null) { foreach (var each in OnServerUpdateBansResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateBansResultEvent -= (PlayFabResultEvent<ServerModels.UpdateBansResult>)each; } } }
if (OnServerDeleteUsersRequestEvent != null) { foreach (var each in OnServerDeleteUsersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerDeleteUsersRequestEvent -= (PlayFabRequestEvent<ServerModels.DeleteUsersRequest>)each; } } }
if (OnServerDeleteUsersResultEvent != null) { foreach (var each in OnServerDeleteUsersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerDeleteUsersResultEvent -= (PlayFabResultEvent<ServerModels.DeleteUsersResult>)each; } } }
if (OnServerGetFriendLeaderboardRequestEvent != null) { foreach (var each in OnServerGetFriendLeaderboardRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetFriendLeaderboardRequestEvent -= (PlayFabRequestEvent<ServerModels.GetFriendLeaderboardRequest>)each; } } }
if (OnServerGetFriendLeaderboardResultEvent != null) { foreach (var each in OnServerGetFriendLeaderboardResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetFriendLeaderboardResultEvent -= (PlayFabResultEvent<ServerModels.GetLeaderboardResult>)each; } } }
if (OnServerGetLeaderboardRequestEvent != null) { foreach (var each in OnServerGetLeaderboardRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetLeaderboardRequestEvent -= (PlayFabRequestEvent<ServerModels.GetLeaderboardRequest>)each; } } }
if (OnServerGetLeaderboardResultEvent != null) { foreach (var each in OnServerGetLeaderboardResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetLeaderboardResultEvent -= (PlayFabResultEvent<ServerModels.GetLeaderboardResult>)each; } } }
if (OnServerGetLeaderboardAroundUserRequestEvent != null) { foreach (var each in OnServerGetLeaderboardAroundUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetLeaderboardAroundUserRequestEvent -= (PlayFabRequestEvent<ServerModels.GetLeaderboardAroundUserRequest>)each; } } }
if (OnServerGetLeaderboardAroundUserResultEvent != null) { foreach (var each in OnServerGetLeaderboardAroundUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetLeaderboardAroundUserResultEvent -= (PlayFabResultEvent<ServerModels.GetLeaderboardAroundUserResult>)each; } } }
if (OnServerGetPlayerCombinedInfoRequestEvent != null) { foreach (var each in OnServerGetPlayerCombinedInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerCombinedInfoRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPlayerCombinedInfoRequest>)each; } } }
if (OnServerGetPlayerCombinedInfoResultEvent != null) { foreach (var each in OnServerGetPlayerCombinedInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerCombinedInfoResultEvent -= (PlayFabResultEvent<ServerModels.GetPlayerCombinedInfoResult>)each; } } }
if (OnServerGetPlayerStatisticsRequestEvent != null) { foreach (var each in OnServerGetPlayerStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerStatisticsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPlayerStatisticsRequest>)each; } } }
if (OnServerGetPlayerStatisticsResultEvent != null) { foreach (var each in OnServerGetPlayerStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerStatisticsResultEvent -= (PlayFabResultEvent<ServerModels.GetPlayerStatisticsResult>)each; } } }
if (OnServerGetPlayerStatisticVersionsRequestEvent != null) { foreach (var each in OnServerGetPlayerStatisticVersionsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerStatisticVersionsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPlayerStatisticVersionsRequest>)each; } } }
if (OnServerGetPlayerStatisticVersionsResultEvent != null) { foreach (var each in OnServerGetPlayerStatisticVersionsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerStatisticVersionsResultEvent -= (PlayFabResultEvent<ServerModels.GetPlayerStatisticVersionsResult>)each; } } }
if (OnServerGetUserDataRequestEvent != null) { foreach (var each in OnServerGetUserDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserDataRequest>)each; } } }
if (OnServerGetUserDataResultEvent != null) { foreach (var each in OnServerGetUserDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserDataResultEvent -= (PlayFabResultEvent<ServerModels.GetUserDataResult>)each; } } }
if (OnServerGetUserInternalDataRequestEvent != null) { foreach (var each in OnServerGetUserInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserInternalDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserDataRequest>)each; } } }
if (OnServerGetUserInternalDataResultEvent != null) { foreach (var each in OnServerGetUserInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserInternalDataResultEvent -= (PlayFabResultEvent<ServerModels.GetUserDataResult>)each; } } }
if (OnServerGetUserPublisherDataRequestEvent != null) { foreach (var each in OnServerGetUserPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserPublisherDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserDataRequest>)each; } } }
if (OnServerGetUserPublisherDataResultEvent != null) { foreach (var each in OnServerGetUserPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserPublisherDataResultEvent -= (PlayFabResultEvent<ServerModels.GetUserDataResult>)each; } } }
if (OnServerGetUserPublisherInternalDataRequestEvent != null) { foreach (var each in OnServerGetUserPublisherInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserPublisherInternalDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserDataRequest>)each; } } }
if (OnServerGetUserPublisherInternalDataResultEvent != null) { foreach (var each in OnServerGetUserPublisherInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserPublisherInternalDataResultEvent -= (PlayFabResultEvent<ServerModels.GetUserDataResult>)each; } } }
if (OnServerGetUserPublisherReadOnlyDataRequestEvent != null) { foreach (var each in OnServerGetUserPublisherReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserPublisherReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserDataRequest>)each; } } }
if (OnServerGetUserPublisherReadOnlyDataResultEvent != null) { foreach (var each in OnServerGetUserPublisherReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserPublisherReadOnlyDataResultEvent -= (PlayFabResultEvent<ServerModels.GetUserDataResult>)each; } } }
if (OnServerGetUserReadOnlyDataRequestEvent != null) { foreach (var each in OnServerGetUserReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserDataRequest>)each; } } }
if (OnServerGetUserReadOnlyDataResultEvent != null) { foreach (var each in OnServerGetUserReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserReadOnlyDataResultEvent -= (PlayFabResultEvent<ServerModels.GetUserDataResult>)each; } } }
if (OnServerGetUserStatisticsRequestEvent != null) { foreach (var each in OnServerGetUserStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserStatisticsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserStatisticsRequest>)each; } } }
if (OnServerGetUserStatisticsResultEvent != null) { foreach (var each in OnServerGetUserStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserStatisticsResultEvent -= (PlayFabResultEvent<ServerModels.GetUserStatisticsResult>)each; } } }
if (OnServerUpdatePlayerStatisticsRequestEvent != null) { foreach (var each in OnServerUpdatePlayerStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdatePlayerStatisticsRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdatePlayerStatisticsRequest>)each; } } }
if (OnServerUpdatePlayerStatisticsResultEvent != null) { foreach (var each in OnServerUpdatePlayerStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdatePlayerStatisticsResultEvent -= (PlayFabResultEvent<ServerModels.UpdatePlayerStatisticsResult>)each; } } }
if (OnServerUpdateUserDataRequestEvent != null) { foreach (var each in OnServerUpdateUserDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateUserDataRequest>)each; } } }
if (OnServerUpdateUserDataResultEvent != null) { foreach (var each in OnServerUpdateUserDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateUserDataResult>)each; } } }
if (OnServerUpdateUserInternalDataRequestEvent != null) { foreach (var each in OnServerUpdateUserInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserInternalDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateUserInternalDataRequest>)each; } } }
if (OnServerUpdateUserInternalDataResultEvent != null) { foreach (var each in OnServerUpdateUserInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserInternalDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateUserDataResult>)each; } } }
if (OnServerUpdateUserPublisherDataRequestEvent != null) { foreach (var each in OnServerUpdateUserPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserPublisherDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateUserDataRequest>)each; } } }
if (OnServerUpdateUserPublisherDataResultEvent != null) { foreach (var each in OnServerUpdateUserPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserPublisherDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateUserDataResult>)each; } } }
if (OnServerUpdateUserPublisherInternalDataRequestEvent != null) { foreach (var each in OnServerUpdateUserPublisherInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserPublisherInternalDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateUserInternalDataRequest>)each; } } }
if (OnServerUpdateUserPublisherInternalDataResultEvent != null) { foreach (var each in OnServerUpdateUserPublisherInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserPublisherInternalDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateUserDataResult>)each; } } }
if (OnServerUpdateUserPublisherReadOnlyDataRequestEvent != null) { foreach (var each in OnServerUpdateUserPublisherReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserPublisherReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateUserDataRequest>)each; } } }
if (OnServerUpdateUserPublisherReadOnlyDataResultEvent != null) { foreach (var each in OnServerUpdateUserPublisherReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserPublisherReadOnlyDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateUserDataResult>)each; } } }
if (OnServerUpdateUserReadOnlyDataRequestEvent != null) { foreach (var each in OnServerUpdateUserReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateUserDataRequest>)each; } } }
if (OnServerUpdateUserReadOnlyDataResultEvent != null) { foreach (var each in OnServerUpdateUserReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserReadOnlyDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateUserDataResult>)each; } } }
if (OnServerUpdateUserStatisticsRequestEvent != null) { foreach (var each in OnServerUpdateUserStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserStatisticsRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateUserStatisticsRequest>)each; } } }
if (OnServerUpdateUserStatisticsResultEvent != null) { foreach (var each in OnServerUpdateUserStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserStatisticsResultEvent -= (PlayFabResultEvent<ServerModels.UpdateUserStatisticsResult>)each; } } }
if (OnServerGetCatalogItemsRequestEvent != null) { foreach (var each in OnServerGetCatalogItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCatalogItemsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetCatalogItemsRequest>)each; } } }
if (OnServerGetCatalogItemsResultEvent != null) { foreach (var each in OnServerGetCatalogItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCatalogItemsResultEvent -= (PlayFabResultEvent<ServerModels.GetCatalogItemsResult>)each; } } }
if (OnServerGetPublisherDataRequestEvent != null) { foreach (var each in OnServerGetPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPublisherDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPublisherDataRequest>)each; } } }
if (OnServerGetPublisherDataResultEvent != null) { foreach (var each in OnServerGetPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPublisherDataResultEvent -= (PlayFabResultEvent<ServerModels.GetPublisherDataResult>)each; } } }
if (OnServerGetTimeRequestEvent != null) { foreach (var each in OnServerGetTimeRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetTimeRequestEvent -= (PlayFabRequestEvent<ServerModels.GetTimeRequest>)each; } } }
if (OnServerGetTimeResultEvent != null) { foreach (var each in OnServerGetTimeResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetTimeResultEvent -= (PlayFabResultEvent<ServerModels.GetTimeResult>)each; } } }
if (OnServerGetTitleDataRequestEvent != null) { foreach (var each in OnServerGetTitleDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetTitleDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetTitleDataRequest>)each; } } }
if (OnServerGetTitleDataResultEvent != null) { foreach (var each in OnServerGetTitleDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetTitleDataResultEvent -= (PlayFabResultEvent<ServerModels.GetTitleDataResult>)each; } } }
if (OnServerGetTitleInternalDataRequestEvent != null) { foreach (var each in OnServerGetTitleInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetTitleInternalDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetTitleDataRequest>)each; } } }
if (OnServerGetTitleInternalDataResultEvent != null) { foreach (var each in OnServerGetTitleInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetTitleInternalDataResultEvent -= (PlayFabResultEvent<ServerModels.GetTitleDataResult>)each; } } }
if (OnServerGetTitleNewsRequestEvent != null) { foreach (var each in OnServerGetTitleNewsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetTitleNewsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetTitleNewsRequest>)each; } } }
if (OnServerGetTitleNewsResultEvent != null) { foreach (var each in OnServerGetTitleNewsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetTitleNewsResultEvent -= (PlayFabResultEvent<ServerModels.GetTitleNewsResult>)each; } } }
if (OnServerSetPublisherDataRequestEvent != null) { foreach (var each in OnServerSetPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetPublisherDataRequestEvent -= (PlayFabRequestEvent<ServerModels.SetPublisherDataRequest>)each; } } }
if (OnServerSetPublisherDataResultEvent != null) { foreach (var each in OnServerSetPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetPublisherDataResultEvent -= (PlayFabResultEvent<ServerModels.SetPublisherDataResult>)each; } } }
if (OnServerSetTitleDataRequestEvent != null) { foreach (var each in OnServerSetTitleDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetTitleDataRequestEvent -= (PlayFabRequestEvent<ServerModels.SetTitleDataRequest>)each; } } }
if (OnServerSetTitleDataResultEvent != null) { foreach (var each in OnServerSetTitleDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetTitleDataResultEvent -= (PlayFabResultEvent<ServerModels.SetTitleDataResult>)each; } } }
if (OnServerSetTitleInternalDataRequestEvent != null) { foreach (var each in OnServerSetTitleInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetTitleInternalDataRequestEvent -= (PlayFabRequestEvent<ServerModels.SetTitleDataRequest>)each; } } }
if (OnServerSetTitleInternalDataResultEvent != null) { foreach (var each in OnServerSetTitleInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetTitleInternalDataResultEvent -= (PlayFabResultEvent<ServerModels.SetTitleDataResult>)each; } } }
if (OnServerAddCharacterVirtualCurrencyRequestEvent != null) { foreach (var each in OnServerAddCharacterVirtualCurrencyRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddCharacterVirtualCurrencyRequestEvent -= (PlayFabRequestEvent<ServerModels.AddCharacterVirtualCurrencyRequest>)each; } } }
if (OnServerAddCharacterVirtualCurrencyResultEvent != null) { foreach (var each in OnServerAddCharacterVirtualCurrencyResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddCharacterVirtualCurrencyResultEvent -= (PlayFabResultEvent<ServerModels.ModifyCharacterVirtualCurrencyResult>)each; } } }
if (OnServerAddUserVirtualCurrencyRequestEvent != null) { foreach (var each in OnServerAddUserVirtualCurrencyRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddUserVirtualCurrencyRequestEvent -= (PlayFabRequestEvent<ServerModels.AddUserVirtualCurrencyRequest>)each; } } }
if (OnServerAddUserVirtualCurrencyResultEvent != null) { foreach (var each in OnServerAddUserVirtualCurrencyResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddUserVirtualCurrencyResultEvent -= (PlayFabResultEvent<ServerModels.ModifyUserVirtualCurrencyResult>)each; } } }
if (OnServerConsumeItemRequestEvent != null) { foreach (var each in OnServerConsumeItemRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerConsumeItemRequestEvent -= (PlayFabRequestEvent<ServerModels.ConsumeItemRequest>)each; } } }
if (OnServerConsumeItemResultEvent != null) { foreach (var each in OnServerConsumeItemResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerConsumeItemResultEvent -= (PlayFabResultEvent<ServerModels.ConsumeItemResult>)each; } } }
if (OnServerEvaluateRandomResultTableRequestEvent != null) { foreach (var each in OnServerEvaluateRandomResultTableRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerEvaluateRandomResultTableRequestEvent -= (PlayFabRequestEvent<ServerModels.EvaluateRandomResultTableRequest>)each; } } }
if (OnServerEvaluateRandomResultTableResultEvent != null) { foreach (var each in OnServerEvaluateRandomResultTableResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerEvaluateRandomResultTableResultEvent -= (PlayFabResultEvent<ServerModels.EvaluateRandomResultTableResult>)each; } } }
if (OnServerGetCharacterInventoryRequestEvent != null) { foreach (var each in OnServerGetCharacterInventoryRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterInventoryRequestEvent -= (PlayFabRequestEvent<ServerModels.GetCharacterInventoryRequest>)each; } } }
if (OnServerGetCharacterInventoryResultEvent != null) { foreach (var each in OnServerGetCharacterInventoryResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterInventoryResultEvent -= (PlayFabResultEvent<ServerModels.GetCharacterInventoryResult>)each; } } }
if (OnServerGetRandomResultTablesRequestEvent != null) { foreach (var each in OnServerGetRandomResultTablesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetRandomResultTablesRequestEvent -= (PlayFabRequestEvent<ServerModels.GetRandomResultTablesRequest>)each; } } }
if (OnServerGetRandomResultTablesResultEvent != null) { foreach (var each in OnServerGetRandomResultTablesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetRandomResultTablesResultEvent -= (PlayFabResultEvent<ServerModels.GetRandomResultTablesResult>)each; } } }
if (OnServerGetUserInventoryRequestEvent != null) { foreach (var each in OnServerGetUserInventoryRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserInventoryRequestEvent -= (PlayFabRequestEvent<ServerModels.GetUserInventoryRequest>)each; } } }
if (OnServerGetUserInventoryResultEvent != null) { foreach (var each in OnServerGetUserInventoryResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetUserInventoryResultEvent -= (PlayFabResultEvent<ServerModels.GetUserInventoryResult>)each; } } }
if (OnServerGrantItemsToCharacterRequestEvent != null) { foreach (var each in OnServerGrantItemsToCharacterRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGrantItemsToCharacterRequestEvent -= (PlayFabRequestEvent<ServerModels.GrantItemsToCharacterRequest>)each; } } }
if (OnServerGrantItemsToCharacterResultEvent != null) { foreach (var each in OnServerGrantItemsToCharacterResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGrantItemsToCharacterResultEvent -= (PlayFabResultEvent<ServerModels.GrantItemsToCharacterResult>)each; } } }
if (OnServerGrantItemsToUserRequestEvent != null) { foreach (var each in OnServerGrantItemsToUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGrantItemsToUserRequestEvent -= (PlayFabRequestEvent<ServerModels.GrantItemsToUserRequest>)each; } } }
if (OnServerGrantItemsToUserResultEvent != null) { foreach (var each in OnServerGrantItemsToUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGrantItemsToUserResultEvent -= (PlayFabResultEvent<ServerModels.GrantItemsToUserResult>)each; } } }
if (OnServerGrantItemsToUsersRequestEvent != null) { foreach (var each in OnServerGrantItemsToUsersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGrantItemsToUsersRequestEvent -= (PlayFabRequestEvent<ServerModels.GrantItemsToUsersRequest>)each; } } }
if (OnServerGrantItemsToUsersResultEvent != null) { foreach (var each in OnServerGrantItemsToUsersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGrantItemsToUsersResultEvent -= (PlayFabResultEvent<ServerModels.GrantItemsToUsersResult>)each; } } }
if (OnServerModifyItemUsesRequestEvent != null) { foreach (var each in OnServerModifyItemUsesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerModifyItemUsesRequestEvent -= (PlayFabRequestEvent<ServerModels.ModifyItemUsesRequest>)each; } } }
if (OnServerModifyItemUsesResultEvent != null) { foreach (var each in OnServerModifyItemUsesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerModifyItemUsesResultEvent -= (PlayFabResultEvent<ServerModels.ModifyItemUsesResult>)each; } } }
if (OnServerMoveItemToCharacterFromCharacterRequestEvent != null) { foreach (var each in OnServerMoveItemToCharacterFromCharacterRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerMoveItemToCharacterFromCharacterRequestEvent -= (PlayFabRequestEvent<ServerModels.MoveItemToCharacterFromCharacterRequest>)each; } } }
if (OnServerMoveItemToCharacterFromCharacterResultEvent != null) { foreach (var each in OnServerMoveItemToCharacterFromCharacterResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerMoveItemToCharacterFromCharacterResultEvent -= (PlayFabResultEvent<ServerModels.MoveItemToCharacterFromCharacterResult>)each; } } }
if (OnServerMoveItemToCharacterFromUserRequestEvent != null) { foreach (var each in OnServerMoveItemToCharacterFromUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerMoveItemToCharacterFromUserRequestEvent -= (PlayFabRequestEvent<ServerModels.MoveItemToCharacterFromUserRequest>)each; } } }
if (OnServerMoveItemToCharacterFromUserResultEvent != null) { foreach (var each in OnServerMoveItemToCharacterFromUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerMoveItemToCharacterFromUserResultEvent -= (PlayFabResultEvent<ServerModels.MoveItemToCharacterFromUserResult>)each; } } }
if (OnServerMoveItemToUserFromCharacterRequestEvent != null) { foreach (var each in OnServerMoveItemToUserFromCharacterRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerMoveItemToUserFromCharacterRequestEvent -= (PlayFabRequestEvent<ServerModels.MoveItemToUserFromCharacterRequest>)each; } } }
if (OnServerMoveItemToUserFromCharacterResultEvent != null) { foreach (var each in OnServerMoveItemToUserFromCharacterResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerMoveItemToUserFromCharacterResultEvent -= (PlayFabResultEvent<ServerModels.MoveItemToUserFromCharacterResult>)each; } } }
if (OnServerRedeemCouponRequestEvent != null) { foreach (var each in OnServerRedeemCouponRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRedeemCouponRequestEvent -= (PlayFabRequestEvent<ServerModels.RedeemCouponRequest>)each; } } }
if (OnServerRedeemCouponResultEvent != null) { foreach (var each in OnServerRedeemCouponResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRedeemCouponResultEvent -= (PlayFabResultEvent<ServerModels.RedeemCouponResult>)each; } } }
if (OnServerReportPlayerRequestEvent != null) { foreach (var each in OnServerReportPlayerRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerReportPlayerRequestEvent -= (PlayFabRequestEvent<ServerModels.ReportPlayerServerRequest>)each; } } }
if (OnServerReportPlayerResultEvent != null) { foreach (var each in OnServerReportPlayerResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerReportPlayerResultEvent -= (PlayFabResultEvent<ServerModels.ReportPlayerServerResult>)each; } } }
if (OnServerRevokeInventoryItemRequestEvent != null) { foreach (var each in OnServerRevokeInventoryItemRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRevokeInventoryItemRequestEvent -= (PlayFabRequestEvent<ServerModels.RevokeInventoryItemRequest>)each; } } }
if (OnServerRevokeInventoryItemResultEvent != null) { foreach (var each in OnServerRevokeInventoryItemResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRevokeInventoryItemResultEvent -= (PlayFabResultEvent<ServerModels.RevokeInventoryResult>)each; } } }
if (OnServerSubtractCharacterVirtualCurrencyRequestEvent != null) { foreach (var each in OnServerSubtractCharacterVirtualCurrencyRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSubtractCharacterVirtualCurrencyRequestEvent -= (PlayFabRequestEvent<ServerModels.SubtractCharacterVirtualCurrencyRequest>)each; } } }
if (OnServerSubtractCharacterVirtualCurrencyResultEvent != null) { foreach (var each in OnServerSubtractCharacterVirtualCurrencyResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSubtractCharacterVirtualCurrencyResultEvent -= (PlayFabResultEvent<ServerModels.ModifyCharacterVirtualCurrencyResult>)each; } } }
if (OnServerSubtractUserVirtualCurrencyRequestEvent != null) { foreach (var each in OnServerSubtractUserVirtualCurrencyRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSubtractUserVirtualCurrencyRequestEvent -= (PlayFabRequestEvent<ServerModels.SubtractUserVirtualCurrencyRequest>)each; } } }
if (OnServerSubtractUserVirtualCurrencyResultEvent != null) { foreach (var each in OnServerSubtractUserVirtualCurrencyResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSubtractUserVirtualCurrencyResultEvent -= (PlayFabResultEvent<ServerModels.ModifyUserVirtualCurrencyResult>)each; } } }
if (OnServerUnlockContainerInstanceRequestEvent != null) { foreach (var each in OnServerUnlockContainerInstanceRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUnlockContainerInstanceRequestEvent -= (PlayFabRequestEvent<ServerModels.UnlockContainerInstanceRequest>)each; } } }
if (OnServerUnlockContainerInstanceResultEvent != null) { foreach (var each in OnServerUnlockContainerInstanceResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUnlockContainerInstanceResultEvent -= (PlayFabResultEvent<ServerModels.UnlockContainerItemResult>)each; } } }
if (OnServerUnlockContainerItemRequestEvent != null) { foreach (var each in OnServerUnlockContainerItemRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUnlockContainerItemRequestEvent -= (PlayFabRequestEvent<ServerModels.UnlockContainerItemRequest>)each; } } }
if (OnServerUnlockContainerItemResultEvent != null) { foreach (var each in OnServerUnlockContainerItemResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUnlockContainerItemResultEvent -= (PlayFabResultEvent<ServerModels.UnlockContainerItemResult>)each; } } }
if (OnServerUpdateUserInventoryItemCustomDataRequestEvent != null) { foreach (var each in OnServerUpdateUserInventoryItemCustomDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserInventoryItemCustomDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateUserInventoryItemDataRequest>)each; } } }
if (OnServerUpdateUserInventoryItemCustomDataResultEvent != null) { foreach (var each in OnServerUpdateUserInventoryItemCustomDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateUserInventoryItemCustomDataResultEvent -= (PlayFabResultEvent<ServerModels.EmptyResult>)each; } } }
if (OnServerAddFriendRequestEvent != null) { foreach (var each in OnServerAddFriendRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddFriendRequestEvent -= (PlayFabRequestEvent<ServerModels.AddFriendRequest>)each; } } }
if (OnServerAddFriendResultEvent != null) { foreach (var each in OnServerAddFriendResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddFriendResultEvent -= (PlayFabResultEvent<ServerModels.EmptyResult>)each; } } }
if (OnServerGetFriendsListRequestEvent != null) { foreach (var each in OnServerGetFriendsListRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetFriendsListRequestEvent -= (PlayFabRequestEvent<ServerModels.GetFriendsListRequest>)each; } } }
if (OnServerGetFriendsListResultEvent != null) { foreach (var each in OnServerGetFriendsListResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetFriendsListResultEvent -= (PlayFabResultEvent<ServerModels.GetFriendsListResult>)each; } } }
if (OnServerRemoveFriendRequestEvent != null) { foreach (var each in OnServerRemoveFriendRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRemoveFriendRequestEvent -= (PlayFabRequestEvent<ServerModels.RemoveFriendRequest>)each; } } }
if (OnServerRemoveFriendResultEvent != null) { foreach (var each in OnServerRemoveFriendResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRemoveFriendResultEvent -= (PlayFabResultEvent<ServerModels.EmptyResult>)each; } } }
if (OnServerDeregisterGameRequestEvent != null) { foreach (var each in OnServerDeregisterGameRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerDeregisterGameRequestEvent -= (PlayFabRequestEvent<ServerModels.DeregisterGameRequest>)each; } } }
if (OnServerDeregisterGameResultEvent != null) { foreach (var each in OnServerDeregisterGameResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerDeregisterGameResultEvent -= (PlayFabResultEvent<ServerModels.DeregisterGameResponse>)each; } } }
if (OnServerNotifyMatchmakerPlayerLeftRequestEvent != null) { foreach (var each in OnServerNotifyMatchmakerPlayerLeftRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerNotifyMatchmakerPlayerLeftRequestEvent -= (PlayFabRequestEvent<ServerModels.NotifyMatchmakerPlayerLeftRequest>)each; } } }
if (OnServerNotifyMatchmakerPlayerLeftResultEvent != null) { foreach (var each in OnServerNotifyMatchmakerPlayerLeftResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerNotifyMatchmakerPlayerLeftResultEvent -= (PlayFabResultEvent<ServerModels.NotifyMatchmakerPlayerLeftResult>)each; } } }
if (OnServerRedeemMatchmakerTicketRequestEvent != null) { foreach (var each in OnServerRedeemMatchmakerTicketRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRedeemMatchmakerTicketRequestEvent -= (PlayFabRequestEvent<ServerModels.RedeemMatchmakerTicketRequest>)each; } } }
if (OnServerRedeemMatchmakerTicketResultEvent != null) { foreach (var each in OnServerRedeemMatchmakerTicketResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRedeemMatchmakerTicketResultEvent -= (PlayFabResultEvent<ServerModels.RedeemMatchmakerTicketResult>)each; } } }
if (OnServerRefreshGameServerInstanceHeartbeatRequestEvent != null) { foreach (var each in OnServerRefreshGameServerInstanceHeartbeatRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRefreshGameServerInstanceHeartbeatRequestEvent -= (PlayFabRequestEvent<ServerModels.RefreshGameServerInstanceHeartbeatRequest>)each; } } }
if (OnServerRefreshGameServerInstanceHeartbeatResultEvent != null) { foreach (var each in OnServerRefreshGameServerInstanceHeartbeatResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRefreshGameServerInstanceHeartbeatResultEvent -= (PlayFabResultEvent<ServerModels.RefreshGameServerInstanceHeartbeatResult>)each; } } }
if (OnServerRegisterGameRequestEvent != null) { foreach (var each in OnServerRegisterGameRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRegisterGameRequestEvent -= (PlayFabRequestEvent<ServerModels.RegisterGameRequest>)each; } } }
if (OnServerRegisterGameResultEvent != null) { foreach (var each in OnServerRegisterGameResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRegisterGameResultEvent -= (PlayFabResultEvent<ServerModels.RegisterGameResponse>)each; } } }
if (OnServerSetGameServerInstanceDataRequestEvent != null) { foreach (var each in OnServerSetGameServerInstanceDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetGameServerInstanceDataRequestEvent -= (PlayFabRequestEvent<ServerModels.SetGameServerInstanceDataRequest>)each; } } }
if (OnServerSetGameServerInstanceDataResultEvent != null) { foreach (var each in OnServerSetGameServerInstanceDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetGameServerInstanceDataResultEvent -= (PlayFabResultEvent<ServerModels.SetGameServerInstanceDataResult>)each; } } }
if (OnServerSetGameServerInstanceStateRequestEvent != null) { foreach (var each in OnServerSetGameServerInstanceStateRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetGameServerInstanceStateRequestEvent -= (PlayFabRequestEvent<ServerModels.SetGameServerInstanceStateRequest>)each; } } }
if (OnServerSetGameServerInstanceStateResultEvent != null) { foreach (var each in OnServerSetGameServerInstanceStateResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetGameServerInstanceStateResultEvent -= (PlayFabResultEvent<ServerModels.SetGameServerInstanceStateResult>)each; } } }
if (OnServerSetGameServerInstanceTagsRequestEvent != null) { foreach (var each in OnServerSetGameServerInstanceTagsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetGameServerInstanceTagsRequestEvent -= (PlayFabRequestEvent<ServerModels.SetGameServerInstanceTagsRequest>)each; } } }
if (OnServerSetGameServerInstanceTagsResultEvent != null) { foreach (var each in OnServerSetGameServerInstanceTagsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerSetGameServerInstanceTagsResultEvent -= (PlayFabResultEvent<ServerModels.SetGameServerInstanceTagsResult>)each; } } }
if (OnServerAwardSteamAchievementRequestEvent != null) { foreach (var each in OnServerAwardSteamAchievementRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAwardSteamAchievementRequestEvent -= (PlayFabRequestEvent<ServerModels.AwardSteamAchievementRequest>)each; } } }
if (OnServerAwardSteamAchievementResultEvent != null) { foreach (var each in OnServerAwardSteamAchievementResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAwardSteamAchievementResultEvent -= (PlayFabResultEvent<ServerModels.AwardSteamAchievementResult>)each; } } }
if (OnServerLogEventRequestEvent != null) { foreach (var each in OnServerLogEventRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerLogEventRequestEvent -= (PlayFabRequestEvent<ServerModels.LogEventRequest>)each; } } }
if (OnServerLogEventResultEvent != null) { foreach (var each in OnServerLogEventResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerLogEventResultEvent -= (PlayFabResultEvent<ServerModels.LogEventResult>)each; } } }
if (OnServerWriteCharacterEventRequestEvent != null) { foreach (var each in OnServerWriteCharacterEventRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerWriteCharacterEventRequestEvent -= (PlayFabRequestEvent<ServerModels.WriteServerCharacterEventRequest>)each; } } }
if (OnServerWriteCharacterEventResultEvent != null) { foreach (var each in OnServerWriteCharacterEventResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerWriteCharacterEventResultEvent -= (PlayFabResultEvent<ServerModels.WriteEventResponse>)each; } } }
if (OnServerWritePlayerEventRequestEvent != null) { foreach (var each in OnServerWritePlayerEventRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerWritePlayerEventRequestEvent -= (PlayFabRequestEvent<ServerModels.WriteServerPlayerEventRequest>)each; } } }
if (OnServerWritePlayerEventResultEvent != null) { foreach (var each in OnServerWritePlayerEventResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerWritePlayerEventResultEvent -= (PlayFabResultEvent<ServerModels.WriteEventResponse>)each; } } }
if (OnServerWriteTitleEventRequestEvent != null) { foreach (var each in OnServerWriteTitleEventRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerWriteTitleEventRequestEvent -= (PlayFabRequestEvent<ServerModels.WriteTitleEventRequest>)each; } } }
if (OnServerWriteTitleEventResultEvent != null) { foreach (var each in OnServerWriteTitleEventResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerWriteTitleEventResultEvent -= (PlayFabResultEvent<ServerModels.WriteEventResponse>)each; } } }
if (OnServerAddSharedGroupMembersRequestEvent != null) { foreach (var each in OnServerAddSharedGroupMembersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddSharedGroupMembersRequestEvent -= (PlayFabRequestEvent<ServerModels.AddSharedGroupMembersRequest>)each; } } }
if (OnServerAddSharedGroupMembersResultEvent != null) { foreach (var each in OnServerAddSharedGroupMembersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddSharedGroupMembersResultEvent -= (PlayFabResultEvent<ServerModels.AddSharedGroupMembersResult>)each; } } }
if (OnServerCreateSharedGroupRequestEvent != null) { foreach (var each in OnServerCreateSharedGroupRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerCreateSharedGroupRequestEvent -= (PlayFabRequestEvent<ServerModels.CreateSharedGroupRequest>)each; } } }
if (OnServerCreateSharedGroupResultEvent != null) { foreach (var each in OnServerCreateSharedGroupResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerCreateSharedGroupResultEvent -= (PlayFabResultEvent<ServerModels.CreateSharedGroupResult>)each; } } }
if (OnServerDeleteSharedGroupRequestEvent != null) { foreach (var each in OnServerDeleteSharedGroupRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerDeleteSharedGroupRequestEvent -= (PlayFabRequestEvent<ServerModels.DeleteSharedGroupRequest>)each; } } }
if (OnServerDeleteSharedGroupResultEvent != null) { foreach (var each in OnServerDeleteSharedGroupResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerDeleteSharedGroupResultEvent -= (PlayFabResultEvent<ServerModels.EmptyResult>)each; } } }
if (OnServerGetSharedGroupDataRequestEvent != null) { foreach (var each in OnServerGetSharedGroupDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetSharedGroupDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetSharedGroupDataRequest>)each; } } }
if (OnServerGetSharedGroupDataResultEvent != null) { foreach (var each in OnServerGetSharedGroupDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetSharedGroupDataResultEvent -= (PlayFabResultEvent<ServerModels.GetSharedGroupDataResult>)each; } } }
if (OnServerRemoveSharedGroupMembersRequestEvent != null) { foreach (var each in OnServerRemoveSharedGroupMembersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRemoveSharedGroupMembersRequestEvent -= (PlayFabRequestEvent<ServerModels.RemoveSharedGroupMembersRequest>)each; } } }
if (OnServerRemoveSharedGroupMembersResultEvent != null) { foreach (var each in OnServerRemoveSharedGroupMembersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRemoveSharedGroupMembersResultEvent -= (PlayFabResultEvent<ServerModels.RemoveSharedGroupMembersResult>)each; } } }
if (OnServerUpdateSharedGroupDataRequestEvent != null) { foreach (var each in OnServerUpdateSharedGroupDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateSharedGroupDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateSharedGroupDataRequest>)each; } } }
if (OnServerUpdateSharedGroupDataResultEvent != null) { foreach (var each in OnServerUpdateSharedGroupDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateSharedGroupDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateSharedGroupDataResult>)each; } } }
if (OnServerExecuteCloudScriptRequestEvent != null) { foreach (var each in OnServerExecuteCloudScriptRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerExecuteCloudScriptRequestEvent -= (PlayFabRequestEvent<ServerModels.ExecuteCloudScriptServerRequest>)each; } } }
if (OnServerExecuteCloudScriptResultEvent != null) { foreach (var each in OnServerExecuteCloudScriptResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerExecuteCloudScriptResultEvent -= (PlayFabResultEvent<ServerModels.ExecuteCloudScriptResult>)each; } } }
if (OnServerGetContentDownloadUrlRequestEvent != null) { foreach (var each in OnServerGetContentDownloadUrlRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetContentDownloadUrlRequestEvent -= (PlayFabRequestEvent<ServerModels.GetContentDownloadUrlRequest>)each; } } }
if (OnServerGetContentDownloadUrlResultEvent != null) { foreach (var each in OnServerGetContentDownloadUrlResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetContentDownloadUrlResultEvent -= (PlayFabResultEvent<ServerModels.GetContentDownloadUrlResult>)each; } } }
if (OnServerDeleteCharacterFromUserRequestEvent != null) { foreach (var each in OnServerDeleteCharacterFromUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerDeleteCharacterFromUserRequestEvent -= (PlayFabRequestEvent<ServerModels.DeleteCharacterFromUserRequest>)each; } } }
if (OnServerDeleteCharacterFromUserResultEvent != null) { foreach (var each in OnServerDeleteCharacterFromUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerDeleteCharacterFromUserResultEvent -= (PlayFabResultEvent<ServerModels.DeleteCharacterFromUserResult>)each; } } }
if (OnServerGetAllUsersCharactersRequestEvent != null) { foreach (var each in OnServerGetAllUsersCharactersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetAllUsersCharactersRequestEvent -= (PlayFabRequestEvent<ServerModels.ListUsersCharactersRequest>)each; } } }
if (OnServerGetAllUsersCharactersResultEvent != null) { foreach (var each in OnServerGetAllUsersCharactersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetAllUsersCharactersResultEvent -= (PlayFabResultEvent<ServerModels.ListUsersCharactersResult>)each; } } }
if (OnServerGetCharacterLeaderboardRequestEvent != null) { foreach (var each in OnServerGetCharacterLeaderboardRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterLeaderboardRequestEvent -= (PlayFabRequestEvent<ServerModels.GetCharacterLeaderboardRequest>)each; } } }
if (OnServerGetCharacterLeaderboardResultEvent != null) { foreach (var each in OnServerGetCharacterLeaderboardResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterLeaderboardResultEvent -= (PlayFabResultEvent<ServerModels.GetCharacterLeaderboardResult>)each; } } }
if (OnServerGetCharacterStatisticsRequestEvent != null) { foreach (var each in OnServerGetCharacterStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterStatisticsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetCharacterStatisticsRequest>)each; } } }
if (OnServerGetCharacterStatisticsResultEvent != null) { foreach (var each in OnServerGetCharacterStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterStatisticsResultEvent -= (PlayFabResultEvent<ServerModels.GetCharacterStatisticsResult>)each; } } }
if (OnServerGetLeaderboardAroundCharacterRequestEvent != null) { foreach (var each in OnServerGetLeaderboardAroundCharacterRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetLeaderboardAroundCharacterRequestEvent -= (PlayFabRequestEvent<ServerModels.GetLeaderboardAroundCharacterRequest>)each; } } }
if (OnServerGetLeaderboardAroundCharacterResultEvent != null) { foreach (var each in OnServerGetLeaderboardAroundCharacterResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetLeaderboardAroundCharacterResultEvent -= (PlayFabResultEvent<ServerModels.GetLeaderboardAroundCharacterResult>)each; } } }
if (OnServerGetLeaderboardForUserCharactersRequestEvent != null) { foreach (var each in OnServerGetLeaderboardForUserCharactersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetLeaderboardForUserCharactersRequestEvent -= (PlayFabRequestEvent<ServerModels.GetLeaderboardForUsersCharactersRequest>)each; } } }
if (OnServerGetLeaderboardForUserCharactersResultEvent != null) { foreach (var each in OnServerGetLeaderboardForUserCharactersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetLeaderboardForUserCharactersResultEvent -= (PlayFabResultEvent<ServerModels.GetLeaderboardForUsersCharactersResult>)each; } } }
if (OnServerGrantCharacterToUserRequestEvent != null) { foreach (var each in OnServerGrantCharacterToUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGrantCharacterToUserRequestEvent -= (PlayFabRequestEvent<ServerModels.GrantCharacterToUserRequest>)each; } } }
if (OnServerGrantCharacterToUserResultEvent != null) { foreach (var each in OnServerGrantCharacterToUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGrantCharacterToUserResultEvent -= (PlayFabResultEvent<ServerModels.GrantCharacterToUserResult>)each; } } }
if (OnServerUpdateCharacterStatisticsRequestEvent != null) { foreach (var each in OnServerUpdateCharacterStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateCharacterStatisticsRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateCharacterStatisticsRequest>)each; } } }
if (OnServerUpdateCharacterStatisticsResultEvent != null) { foreach (var each in OnServerUpdateCharacterStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateCharacterStatisticsResultEvent -= (PlayFabResultEvent<ServerModels.UpdateCharacterStatisticsResult>)each; } } }
if (OnServerGetCharacterDataRequestEvent != null) { foreach (var each in OnServerGetCharacterDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetCharacterDataRequest>)each; } } }
if (OnServerGetCharacterDataResultEvent != null) { foreach (var each in OnServerGetCharacterDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterDataResultEvent -= (PlayFabResultEvent<ServerModels.GetCharacterDataResult>)each; } } }
if (OnServerGetCharacterInternalDataRequestEvent != null) { foreach (var each in OnServerGetCharacterInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterInternalDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetCharacterDataRequest>)each; } } }
if (OnServerGetCharacterInternalDataResultEvent != null) { foreach (var each in OnServerGetCharacterInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterInternalDataResultEvent -= (PlayFabResultEvent<ServerModels.GetCharacterDataResult>)each; } } }
if (OnServerGetCharacterReadOnlyDataRequestEvent != null) { foreach (var each in OnServerGetCharacterReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ServerModels.GetCharacterDataRequest>)each; } } }
if (OnServerGetCharacterReadOnlyDataResultEvent != null) { foreach (var each in OnServerGetCharacterReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetCharacterReadOnlyDataResultEvent -= (PlayFabResultEvent<ServerModels.GetCharacterDataResult>)each; } } }
if (OnServerUpdateCharacterDataRequestEvent != null) { foreach (var each in OnServerUpdateCharacterDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateCharacterDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateCharacterDataRequest>)each; } } }
if (OnServerUpdateCharacterDataResultEvent != null) { foreach (var each in OnServerUpdateCharacterDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateCharacterDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateCharacterDataResult>)each; } } }
if (OnServerUpdateCharacterInternalDataRequestEvent != null) { foreach (var each in OnServerUpdateCharacterInternalDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateCharacterInternalDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateCharacterDataRequest>)each; } } }
if (OnServerUpdateCharacterInternalDataResultEvent != null) { foreach (var each in OnServerUpdateCharacterInternalDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateCharacterInternalDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateCharacterDataResult>)each; } } }
if (OnServerUpdateCharacterReadOnlyDataRequestEvent != null) { foreach (var each in OnServerUpdateCharacterReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateCharacterReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ServerModels.UpdateCharacterDataRequest>)each; } } }
if (OnServerUpdateCharacterReadOnlyDataResultEvent != null) { foreach (var each in OnServerUpdateCharacterReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerUpdateCharacterReadOnlyDataResultEvent -= (PlayFabResultEvent<ServerModels.UpdateCharacterDataResult>)each; } } }
if (OnServerAddPlayerTagRequestEvent != null) { foreach (var each in OnServerAddPlayerTagRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddPlayerTagRequestEvent -= (PlayFabRequestEvent<ServerModels.AddPlayerTagRequest>)each; } } }
if (OnServerAddPlayerTagResultEvent != null) { foreach (var each in OnServerAddPlayerTagResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerAddPlayerTagResultEvent -= (PlayFabResultEvent<ServerModels.AddPlayerTagResult>)each; } } }
if (OnServerGetAllActionGroupsRequestEvent != null) { foreach (var each in OnServerGetAllActionGroupsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetAllActionGroupsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetAllActionGroupsRequest>)each; } } }
if (OnServerGetAllActionGroupsResultEvent != null) { foreach (var each in OnServerGetAllActionGroupsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetAllActionGroupsResultEvent -= (PlayFabResultEvent<ServerModels.GetAllActionGroupsResult>)each; } } }
if (OnServerGetAllSegmentsRequestEvent != null) { foreach (var each in OnServerGetAllSegmentsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetAllSegmentsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetAllSegmentsRequest>)each; } } }
if (OnServerGetAllSegmentsResultEvent != null) { foreach (var each in OnServerGetAllSegmentsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetAllSegmentsResultEvent -= (PlayFabResultEvent<ServerModels.GetAllSegmentsResult>)each; } } }
if (OnServerGetPlayerSegmentsRequestEvent != null) { foreach (var each in OnServerGetPlayerSegmentsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerSegmentsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPlayersSegmentsRequest>)each; } } }
if (OnServerGetPlayerSegmentsResultEvent != null) { foreach (var each in OnServerGetPlayerSegmentsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerSegmentsResultEvent -= (PlayFabResultEvent<ServerModels.GetPlayerSegmentsResult>)each; } } }
if (OnServerGetPlayersInSegmentRequestEvent != null) { foreach (var each in OnServerGetPlayersInSegmentRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayersInSegmentRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPlayersInSegmentRequest>)each; } } }
if (OnServerGetPlayersInSegmentResultEvent != null) { foreach (var each in OnServerGetPlayersInSegmentResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayersInSegmentResultEvent -= (PlayFabResultEvent<ServerModels.GetPlayersInSegmentResult>)each; } } }
if (OnServerGetPlayerTagsRequestEvent != null) { foreach (var each in OnServerGetPlayerTagsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerTagsRequestEvent -= (PlayFabRequestEvent<ServerModels.GetPlayerTagsRequest>)each; } } }
if (OnServerGetPlayerTagsResultEvent != null) { foreach (var each in OnServerGetPlayerTagsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerGetPlayerTagsResultEvent -= (PlayFabResultEvent<ServerModels.GetPlayerTagsResult>)each; } } }
if (OnServerRemovePlayerTagRequestEvent != null) { foreach (var each in OnServerRemovePlayerTagRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRemovePlayerTagRequestEvent -= (PlayFabRequestEvent<ServerModels.RemovePlayerTagRequest>)each; } } }
if (OnServerRemovePlayerTagResultEvent != null) { foreach (var each in OnServerRemovePlayerTagResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnServerRemovePlayerTagResultEvent -= (PlayFabResultEvent<ServerModels.RemovePlayerTagResult>)each; } } }
#endif
#if !DISABLE_PLAYFABCLIENT_API
if (OnGetPhotonAuthenticationTokenRequestEvent != null) { foreach (var each in OnGetPhotonAuthenticationTokenRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPhotonAuthenticationTokenRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPhotonAuthenticationTokenRequest>)each; } } }
if (OnGetPhotonAuthenticationTokenResultEvent != null) { foreach (var each in OnGetPhotonAuthenticationTokenResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPhotonAuthenticationTokenResultEvent -= (PlayFabResultEvent<ClientModels.GetPhotonAuthenticationTokenResult>)each; } } }
if (OnLoginWithAndroidDeviceIDRequestEvent != null) { foreach (var each in OnLoginWithAndroidDeviceIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithAndroidDeviceIDRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithAndroidDeviceIDRequest>)each; } } }
if (OnLoginWithCustomIDRequestEvent != null) { foreach (var each in OnLoginWithCustomIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithCustomIDRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithCustomIDRequest>)each; } } }
if (OnLoginWithEmailAddressRequestEvent != null) { foreach (var each in OnLoginWithEmailAddressRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithEmailAddressRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithEmailAddressRequest>)each; } } }
if (OnLoginWithFacebookRequestEvent != null) { foreach (var each in OnLoginWithFacebookRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithFacebookRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithFacebookRequest>)each; } } }
if (OnLoginWithGameCenterRequestEvent != null) { foreach (var each in OnLoginWithGameCenterRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithGameCenterRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithGameCenterRequest>)each; } } }
if (OnLoginWithGoogleAccountRequestEvent != null) { foreach (var each in OnLoginWithGoogleAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithGoogleAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithGoogleAccountRequest>)each; } } }
if (OnLoginWithIOSDeviceIDRequestEvent != null) { foreach (var each in OnLoginWithIOSDeviceIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithIOSDeviceIDRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithIOSDeviceIDRequest>)each; } } }
if (OnLoginWithKongregateRequestEvent != null) { foreach (var each in OnLoginWithKongregateRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithKongregateRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithKongregateRequest>)each; } } }
if (OnLoginWithPlayFabRequestEvent != null) { foreach (var each in OnLoginWithPlayFabRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithPlayFabRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithPlayFabRequest>)each; } } }
if (OnLoginWithSteamRequestEvent != null) { foreach (var each in OnLoginWithSteamRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithSteamRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithSteamRequest>)each; } } }
if (OnLoginWithTwitchRequestEvent != null) { foreach (var each in OnLoginWithTwitchRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLoginWithTwitchRequestEvent -= (PlayFabRequestEvent<ClientModels.LoginWithTwitchRequest>)each; } } }
if (OnRegisterPlayFabUserRequestEvent != null) { foreach (var each in OnRegisterPlayFabUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRegisterPlayFabUserRequestEvent -= (PlayFabRequestEvent<ClientModels.RegisterPlayFabUserRequest>)each; } } }
if (OnRegisterPlayFabUserResultEvent != null) { foreach (var each in OnRegisterPlayFabUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRegisterPlayFabUserResultEvent -= (PlayFabResultEvent<ClientModels.RegisterPlayFabUserResult>)each; } } }
if (OnAddGenericIDRequestEvent != null) { foreach (var each in OnAddGenericIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddGenericIDRequestEvent -= (PlayFabRequestEvent<ClientModels.AddGenericIDRequest>)each; } } }
if (OnAddGenericIDResultEvent != null) { foreach (var each in OnAddGenericIDResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddGenericIDResultEvent -= (PlayFabResultEvent<ClientModels.AddGenericIDResult>)each; } } }
if (OnAddUsernamePasswordRequestEvent != null) { foreach (var each in OnAddUsernamePasswordRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddUsernamePasswordRequestEvent -= (PlayFabRequestEvent<ClientModels.AddUsernamePasswordRequest>)each; } } }
if (OnAddUsernamePasswordResultEvent != null) { foreach (var each in OnAddUsernamePasswordResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddUsernamePasswordResultEvent -= (PlayFabResultEvent<ClientModels.AddUsernamePasswordResult>)each; } } }
if (OnGetAccountInfoRequestEvent != null) { foreach (var each in OnGetAccountInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetAccountInfoRequestEvent -= (PlayFabRequestEvent<ClientModels.GetAccountInfoRequest>)each; } } }
if (OnGetAccountInfoResultEvent != null) { foreach (var each in OnGetAccountInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetAccountInfoResultEvent -= (PlayFabResultEvent<ClientModels.GetAccountInfoResult>)each; } } }
if (OnGetPlayerCombinedInfoRequestEvent != null) { foreach (var each in OnGetPlayerCombinedInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerCombinedInfoRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayerCombinedInfoRequest>)each; } } }
if (OnGetPlayerCombinedInfoResultEvent != null) { foreach (var each in OnGetPlayerCombinedInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerCombinedInfoResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayerCombinedInfoResult>)each; } } }
if (OnGetPlayFabIDsFromFacebookIDsRequestEvent != null) { foreach (var each in OnGetPlayFabIDsFromFacebookIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromFacebookIDsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayFabIDsFromFacebookIDsRequest>)each; } } }
if (OnGetPlayFabIDsFromFacebookIDsResultEvent != null) { foreach (var each in OnGetPlayFabIDsFromFacebookIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromFacebookIDsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayFabIDsFromFacebookIDsResult>)each; } } }
if (OnGetPlayFabIDsFromGameCenterIDsRequestEvent != null) { foreach (var each in OnGetPlayFabIDsFromGameCenterIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromGameCenterIDsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayFabIDsFromGameCenterIDsRequest>)each; } } }
if (OnGetPlayFabIDsFromGameCenterIDsResultEvent != null) { foreach (var each in OnGetPlayFabIDsFromGameCenterIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromGameCenterIDsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayFabIDsFromGameCenterIDsResult>)each; } } }
if (OnGetPlayFabIDsFromGenericIDsRequestEvent != null) { foreach (var each in OnGetPlayFabIDsFromGenericIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromGenericIDsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayFabIDsFromGenericIDsRequest>)each; } } }
if (OnGetPlayFabIDsFromGenericIDsResultEvent != null) { foreach (var each in OnGetPlayFabIDsFromGenericIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromGenericIDsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayFabIDsFromGenericIDsResult>)each; } } }
if (OnGetPlayFabIDsFromGoogleIDsRequestEvent != null) { foreach (var each in OnGetPlayFabIDsFromGoogleIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromGoogleIDsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayFabIDsFromGoogleIDsRequest>)each; } } }
if (OnGetPlayFabIDsFromGoogleIDsResultEvent != null) { foreach (var each in OnGetPlayFabIDsFromGoogleIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromGoogleIDsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayFabIDsFromGoogleIDsResult>)each; } } }
if (OnGetPlayFabIDsFromKongregateIDsRequestEvent != null) { foreach (var each in OnGetPlayFabIDsFromKongregateIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromKongregateIDsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayFabIDsFromKongregateIDsRequest>)each; } } }
if (OnGetPlayFabIDsFromKongregateIDsResultEvent != null) { foreach (var each in OnGetPlayFabIDsFromKongregateIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromKongregateIDsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayFabIDsFromKongregateIDsResult>)each; } } }
if (OnGetPlayFabIDsFromSteamIDsRequestEvent != null) { foreach (var each in OnGetPlayFabIDsFromSteamIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromSteamIDsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayFabIDsFromSteamIDsRequest>)each; } } }
if (OnGetPlayFabIDsFromSteamIDsResultEvent != null) { foreach (var each in OnGetPlayFabIDsFromSteamIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromSteamIDsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayFabIDsFromSteamIDsResult>)each; } } }
if (OnGetPlayFabIDsFromTwitchIDsRequestEvent != null) { foreach (var each in OnGetPlayFabIDsFromTwitchIDsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromTwitchIDsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayFabIDsFromTwitchIDsRequest>)each; } } }
if (OnGetPlayFabIDsFromTwitchIDsResultEvent != null) { foreach (var each in OnGetPlayFabIDsFromTwitchIDsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayFabIDsFromTwitchIDsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayFabIDsFromTwitchIDsResult>)each; } } }
if (OnGetUserCombinedInfoRequestEvent != null) { foreach (var each in OnGetUserCombinedInfoRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserCombinedInfoRequestEvent -= (PlayFabRequestEvent<ClientModels.GetUserCombinedInfoRequest>)each; } } }
if (OnGetUserCombinedInfoResultEvent != null) { foreach (var each in OnGetUserCombinedInfoResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserCombinedInfoResultEvent -= (PlayFabResultEvent<ClientModels.GetUserCombinedInfoResult>)each; } } }
if (OnLinkAndroidDeviceIDRequestEvent != null) { foreach (var each in OnLinkAndroidDeviceIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkAndroidDeviceIDRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkAndroidDeviceIDRequest>)each; } } }
if (OnLinkAndroidDeviceIDResultEvent != null) { foreach (var each in OnLinkAndroidDeviceIDResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkAndroidDeviceIDResultEvent -= (PlayFabResultEvent<ClientModels.LinkAndroidDeviceIDResult>)each; } } }
if (OnLinkCustomIDRequestEvent != null) { foreach (var each in OnLinkCustomIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkCustomIDRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkCustomIDRequest>)each; } } }
if (OnLinkCustomIDResultEvent != null) { foreach (var each in OnLinkCustomIDResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkCustomIDResultEvent -= (PlayFabResultEvent<ClientModels.LinkCustomIDResult>)each; } } }
if (OnLinkFacebookAccountRequestEvent != null) { foreach (var each in OnLinkFacebookAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkFacebookAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkFacebookAccountRequest>)each; } } }
if (OnLinkFacebookAccountResultEvent != null) { foreach (var each in OnLinkFacebookAccountResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkFacebookAccountResultEvent -= (PlayFabResultEvent<ClientModels.LinkFacebookAccountResult>)each; } } }
if (OnLinkGameCenterAccountRequestEvent != null) { foreach (var each in OnLinkGameCenterAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkGameCenterAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkGameCenterAccountRequest>)each; } } }
if (OnLinkGameCenterAccountResultEvent != null) { foreach (var each in OnLinkGameCenterAccountResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkGameCenterAccountResultEvent -= (PlayFabResultEvent<ClientModels.LinkGameCenterAccountResult>)each; } } }
if (OnLinkGoogleAccountRequestEvent != null) { foreach (var each in OnLinkGoogleAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkGoogleAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkGoogleAccountRequest>)each; } } }
if (OnLinkGoogleAccountResultEvent != null) { foreach (var each in OnLinkGoogleAccountResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkGoogleAccountResultEvent -= (PlayFabResultEvent<ClientModels.LinkGoogleAccountResult>)each; } } }
if (OnLinkIOSDeviceIDRequestEvent != null) { foreach (var each in OnLinkIOSDeviceIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkIOSDeviceIDRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkIOSDeviceIDRequest>)each; } } }
if (OnLinkIOSDeviceIDResultEvent != null) { foreach (var each in OnLinkIOSDeviceIDResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkIOSDeviceIDResultEvent -= (PlayFabResultEvent<ClientModels.LinkIOSDeviceIDResult>)each; } } }
if (OnLinkKongregateRequestEvent != null) { foreach (var each in OnLinkKongregateRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkKongregateRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkKongregateAccountRequest>)each; } } }
if (OnLinkKongregateResultEvent != null) { foreach (var each in OnLinkKongregateResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkKongregateResultEvent -= (PlayFabResultEvent<ClientModels.LinkKongregateAccountResult>)each; } } }
if (OnLinkSteamAccountRequestEvent != null) { foreach (var each in OnLinkSteamAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkSteamAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkSteamAccountRequest>)each; } } }
if (OnLinkSteamAccountResultEvent != null) { foreach (var each in OnLinkSteamAccountResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkSteamAccountResultEvent -= (PlayFabResultEvent<ClientModels.LinkSteamAccountResult>)each; } } }
if (OnLinkTwitchRequestEvent != null) { foreach (var each in OnLinkTwitchRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkTwitchRequestEvent -= (PlayFabRequestEvent<ClientModels.LinkTwitchAccountRequest>)each; } } }
if (OnLinkTwitchResultEvent != null) { foreach (var each in OnLinkTwitchResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLinkTwitchResultEvent -= (PlayFabResultEvent<ClientModels.LinkTwitchAccountResult>)each; } } }
if (OnRemoveGenericIDRequestEvent != null) { foreach (var each in OnRemoveGenericIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRemoveGenericIDRequestEvent -= (PlayFabRequestEvent<ClientModels.RemoveGenericIDRequest>)each; } } }
if (OnRemoveGenericIDResultEvent != null) { foreach (var each in OnRemoveGenericIDResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRemoveGenericIDResultEvent -= (PlayFabResultEvent<ClientModels.RemoveGenericIDResult>)each; } } }
if (OnReportPlayerRequestEvent != null) { foreach (var each in OnReportPlayerRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnReportPlayerRequestEvent -= (PlayFabRequestEvent<ClientModels.ReportPlayerClientRequest>)each; } } }
if (OnReportPlayerResultEvent != null) { foreach (var each in OnReportPlayerResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnReportPlayerResultEvent -= (PlayFabResultEvent<ClientModels.ReportPlayerClientResult>)each; } } }
if (OnSendAccountRecoveryEmailRequestEvent != null) { foreach (var each in OnSendAccountRecoveryEmailRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnSendAccountRecoveryEmailRequestEvent -= (PlayFabRequestEvent<ClientModels.SendAccountRecoveryEmailRequest>)each; } } }
if (OnSendAccountRecoveryEmailResultEvent != null) { foreach (var each in OnSendAccountRecoveryEmailResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnSendAccountRecoveryEmailResultEvent -= (PlayFabResultEvent<ClientModels.SendAccountRecoveryEmailResult>)each; } } }
if (OnUnlinkAndroidDeviceIDRequestEvent != null) { foreach (var each in OnUnlinkAndroidDeviceIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkAndroidDeviceIDRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkAndroidDeviceIDRequest>)each; } } }
if (OnUnlinkAndroidDeviceIDResultEvent != null) { foreach (var each in OnUnlinkAndroidDeviceIDResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkAndroidDeviceIDResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkAndroidDeviceIDResult>)each; } } }
if (OnUnlinkCustomIDRequestEvent != null) { foreach (var each in OnUnlinkCustomIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkCustomIDRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkCustomIDRequest>)each; } } }
if (OnUnlinkCustomIDResultEvent != null) { foreach (var each in OnUnlinkCustomIDResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkCustomIDResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkCustomIDResult>)each; } } }
if (OnUnlinkFacebookAccountRequestEvent != null) { foreach (var each in OnUnlinkFacebookAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkFacebookAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkFacebookAccountRequest>)each; } } }
if (OnUnlinkFacebookAccountResultEvent != null) { foreach (var each in OnUnlinkFacebookAccountResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkFacebookAccountResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkFacebookAccountResult>)each; } } }
if (OnUnlinkGameCenterAccountRequestEvent != null) { foreach (var each in OnUnlinkGameCenterAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkGameCenterAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkGameCenterAccountRequest>)each; } } }
if (OnUnlinkGameCenterAccountResultEvent != null) { foreach (var each in OnUnlinkGameCenterAccountResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkGameCenterAccountResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkGameCenterAccountResult>)each; } } }
if (OnUnlinkGoogleAccountRequestEvent != null) { foreach (var each in OnUnlinkGoogleAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkGoogleAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkGoogleAccountRequest>)each; } } }
if (OnUnlinkGoogleAccountResultEvent != null) { foreach (var each in OnUnlinkGoogleAccountResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkGoogleAccountResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkGoogleAccountResult>)each; } } }
if (OnUnlinkIOSDeviceIDRequestEvent != null) { foreach (var each in OnUnlinkIOSDeviceIDRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkIOSDeviceIDRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkIOSDeviceIDRequest>)each; } } }
if (OnUnlinkIOSDeviceIDResultEvent != null) { foreach (var each in OnUnlinkIOSDeviceIDResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkIOSDeviceIDResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkIOSDeviceIDResult>)each; } } }
if (OnUnlinkKongregateRequestEvent != null) { foreach (var each in OnUnlinkKongregateRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkKongregateRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkKongregateAccountRequest>)each; } } }
if (OnUnlinkKongregateResultEvent != null) { foreach (var each in OnUnlinkKongregateResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkKongregateResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkKongregateAccountResult>)each; } } }
if (OnUnlinkSteamAccountRequestEvent != null) { foreach (var each in OnUnlinkSteamAccountRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkSteamAccountRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkSteamAccountRequest>)each; } } }
if (OnUnlinkSteamAccountResultEvent != null) { foreach (var each in OnUnlinkSteamAccountResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkSteamAccountResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkSteamAccountResult>)each; } } }
if (OnUnlinkTwitchRequestEvent != null) { foreach (var each in OnUnlinkTwitchRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkTwitchRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlinkTwitchAccountRequest>)each; } } }
if (OnUnlinkTwitchResultEvent != null) { foreach (var each in OnUnlinkTwitchResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlinkTwitchResultEvent -= (PlayFabResultEvent<ClientModels.UnlinkTwitchAccountResult>)each; } } }
if (OnUpdateUserTitleDisplayNameRequestEvent != null) { foreach (var each in OnUpdateUserTitleDisplayNameRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateUserTitleDisplayNameRequestEvent -= (PlayFabRequestEvent<ClientModels.UpdateUserTitleDisplayNameRequest>)each; } } }
if (OnUpdateUserTitleDisplayNameResultEvent != null) { foreach (var each in OnUpdateUserTitleDisplayNameResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateUserTitleDisplayNameResultEvent -= (PlayFabResultEvent<ClientModels.UpdateUserTitleDisplayNameResult>)each; } } }
if (OnGetFriendLeaderboardRequestEvent != null) { foreach (var each in OnGetFriendLeaderboardRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetFriendLeaderboardRequestEvent -= (PlayFabRequestEvent<ClientModels.GetFriendLeaderboardRequest>)each; } } }
if (OnGetFriendLeaderboardResultEvent != null) { foreach (var each in OnGetFriendLeaderboardResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetFriendLeaderboardResultEvent -= (PlayFabResultEvent<ClientModels.GetLeaderboardResult>)each; } } }
if (OnGetFriendLeaderboardAroundCurrentUserRequestEvent != null) { foreach (var each in OnGetFriendLeaderboardAroundCurrentUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetFriendLeaderboardAroundCurrentUserRequestEvent -= (PlayFabRequestEvent<ClientModels.GetFriendLeaderboardAroundCurrentUserRequest>)each; } } }
if (OnGetFriendLeaderboardAroundCurrentUserResultEvent != null) { foreach (var each in OnGetFriendLeaderboardAroundCurrentUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetFriendLeaderboardAroundCurrentUserResultEvent -= (PlayFabResultEvent<ClientModels.GetFriendLeaderboardAroundCurrentUserResult>)each; } } }
if (OnGetFriendLeaderboardAroundPlayerRequestEvent != null) { foreach (var each in OnGetFriendLeaderboardAroundPlayerRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetFriendLeaderboardAroundPlayerRequestEvent -= (PlayFabRequestEvent<ClientModels.GetFriendLeaderboardAroundPlayerRequest>)each; } } }
if (OnGetFriendLeaderboardAroundPlayerResultEvent != null) { foreach (var each in OnGetFriendLeaderboardAroundPlayerResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetFriendLeaderboardAroundPlayerResultEvent -= (PlayFabResultEvent<ClientModels.GetFriendLeaderboardAroundPlayerResult>)each; } } }
if (OnGetLeaderboardRequestEvent != null) { foreach (var each in OnGetLeaderboardRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardRequestEvent -= (PlayFabRequestEvent<ClientModels.GetLeaderboardRequest>)each; } } }
if (OnGetLeaderboardResultEvent != null) { foreach (var each in OnGetLeaderboardResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardResultEvent -= (PlayFabResultEvent<ClientModels.GetLeaderboardResult>)each; } } }
if (OnGetLeaderboardAroundCurrentUserRequestEvent != null) { foreach (var each in OnGetLeaderboardAroundCurrentUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardAroundCurrentUserRequestEvent -= (PlayFabRequestEvent<ClientModels.GetLeaderboardAroundCurrentUserRequest>)each; } } }
if (OnGetLeaderboardAroundCurrentUserResultEvent != null) { foreach (var each in OnGetLeaderboardAroundCurrentUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardAroundCurrentUserResultEvent -= (PlayFabResultEvent<ClientModels.GetLeaderboardAroundCurrentUserResult>)each; } } }
if (OnGetLeaderboardAroundPlayerRequestEvent != null) { foreach (var each in OnGetLeaderboardAroundPlayerRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardAroundPlayerRequestEvent -= (PlayFabRequestEvent<ClientModels.GetLeaderboardAroundPlayerRequest>)each; } } }
if (OnGetLeaderboardAroundPlayerResultEvent != null) { foreach (var each in OnGetLeaderboardAroundPlayerResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardAroundPlayerResultEvent -= (PlayFabResultEvent<ClientModels.GetLeaderboardAroundPlayerResult>)each; } } }
if (OnGetPlayerStatisticsRequestEvent != null) { foreach (var each in OnGetPlayerStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerStatisticsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayerStatisticsRequest>)each; } } }
if (OnGetPlayerStatisticsResultEvent != null) { foreach (var each in OnGetPlayerStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerStatisticsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayerStatisticsResult>)each; } } }
if (OnGetPlayerStatisticVersionsRequestEvent != null) { foreach (var each in OnGetPlayerStatisticVersionsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerStatisticVersionsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayerStatisticVersionsRequest>)each; } } }
if (OnGetPlayerStatisticVersionsResultEvent != null) { foreach (var each in OnGetPlayerStatisticVersionsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerStatisticVersionsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayerStatisticVersionsResult>)each; } } }
if (OnGetUserDataRequestEvent != null) { foreach (var each in OnGetUserDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetUserDataRequest>)each; } } }
if (OnGetUserDataResultEvent != null) { foreach (var each in OnGetUserDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserDataResultEvent -= (PlayFabResultEvent<ClientModels.GetUserDataResult>)each; } } }
if (OnGetUserPublisherDataRequestEvent != null) { foreach (var each in OnGetUserPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserPublisherDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetUserDataRequest>)each; } } }
if (OnGetUserPublisherDataResultEvent != null) { foreach (var each in OnGetUserPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserPublisherDataResultEvent -= (PlayFabResultEvent<ClientModels.GetUserDataResult>)each; } } }
if (OnGetUserPublisherReadOnlyDataRequestEvent != null) { foreach (var each in OnGetUserPublisherReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserPublisherReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetUserDataRequest>)each; } } }
if (OnGetUserPublisherReadOnlyDataResultEvent != null) { foreach (var each in OnGetUserPublisherReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserPublisherReadOnlyDataResultEvent -= (PlayFabResultEvent<ClientModels.GetUserDataResult>)each; } } }
if (OnGetUserReadOnlyDataRequestEvent != null) { foreach (var each in OnGetUserReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetUserDataRequest>)each; } } }
if (OnGetUserReadOnlyDataResultEvent != null) { foreach (var each in OnGetUserReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserReadOnlyDataResultEvent -= (PlayFabResultEvent<ClientModels.GetUserDataResult>)each; } } }
if (OnGetUserStatisticsRequestEvent != null) { foreach (var each in OnGetUserStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserStatisticsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetUserStatisticsRequest>)each; } } }
if (OnGetUserStatisticsResultEvent != null) { foreach (var each in OnGetUserStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserStatisticsResultEvent -= (PlayFabResultEvent<ClientModels.GetUserStatisticsResult>)each; } } }
if (OnUpdatePlayerStatisticsRequestEvent != null) { foreach (var each in OnUpdatePlayerStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdatePlayerStatisticsRequestEvent -= (PlayFabRequestEvent<ClientModels.UpdatePlayerStatisticsRequest>)each; } } }
if (OnUpdatePlayerStatisticsResultEvent != null) { foreach (var each in OnUpdatePlayerStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdatePlayerStatisticsResultEvent -= (PlayFabResultEvent<ClientModels.UpdatePlayerStatisticsResult>)each; } } }
if (OnUpdateUserDataRequestEvent != null) { foreach (var each in OnUpdateUserDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateUserDataRequestEvent -= (PlayFabRequestEvent<ClientModels.UpdateUserDataRequest>)each; } } }
if (OnUpdateUserDataResultEvent != null) { foreach (var each in OnUpdateUserDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateUserDataResultEvent -= (PlayFabResultEvent<ClientModels.UpdateUserDataResult>)each; } } }
if (OnUpdateUserPublisherDataRequestEvent != null) { foreach (var each in OnUpdateUserPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateUserPublisherDataRequestEvent -= (PlayFabRequestEvent<ClientModels.UpdateUserDataRequest>)each; } } }
if (OnUpdateUserPublisherDataResultEvent != null) { foreach (var each in OnUpdateUserPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateUserPublisherDataResultEvent -= (PlayFabResultEvent<ClientModels.UpdateUserDataResult>)each; } } }
if (OnUpdateUserStatisticsRequestEvent != null) { foreach (var each in OnUpdateUserStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateUserStatisticsRequestEvent -= (PlayFabRequestEvent<ClientModels.UpdateUserStatisticsRequest>)each; } } }
if (OnUpdateUserStatisticsResultEvent != null) { foreach (var each in OnUpdateUserStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateUserStatisticsResultEvent -= (PlayFabResultEvent<ClientModels.UpdateUserStatisticsResult>)each; } } }
if (OnGetCatalogItemsRequestEvent != null) { foreach (var each in OnGetCatalogItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCatalogItemsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetCatalogItemsRequest>)each; } } }
if (OnGetCatalogItemsResultEvent != null) { foreach (var each in OnGetCatalogItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCatalogItemsResultEvent -= (PlayFabResultEvent<ClientModels.GetCatalogItemsResult>)each; } } }
if (OnGetPublisherDataRequestEvent != null) { foreach (var each in OnGetPublisherDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPublisherDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPublisherDataRequest>)each; } } }
if (OnGetPublisherDataResultEvent != null) { foreach (var each in OnGetPublisherDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPublisherDataResultEvent -= (PlayFabResultEvent<ClientModels.GetPublisherDataResult>)each; } } }
if (OnGetStoreItemsRequestEvent != null) { foreach (var each in OnGetStoreItemsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetStoreItemsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetStoreItemsRequest>)each; } } }
if (OnGetStoreItemsResultEvent != null) { foreach (var each in OnGetStoreItemsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetStoreItemsResultEvent -= (PlayFabResultEvent<ClientModels.GetStoreItemsResult>)each; } } }
if (OnGetTimeRequestEvent != null) { foreach (var each in OnGetTimeRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetTimeRequestEvent -= (PlayFabRequestEvent<ClientModels.GetTimeRequest>)each; } } }
if (OnGetTimeResultEvent != null) { foreach (var each in OnGetTimeResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetTimeResultEvent -= (PlayFabResultEvent<ClientModels.GetTimeResult>)each; } } }
if (OnGetTitleDataRequestEvent != null) { foreach (var each in OnGetTitleDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetTitleDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetTitleDataRequest>)each; } } }
if (OnGetTitleDataResultEvent != null) { foreach (var each in OnGetTitleDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetTitleDataResultEvent -= (PlayFabResultEvent<ClientModels.GetTitleDataResult>)each; } } }
if (OnGetTitleNewsRequestEvent != null) { foreach (var each in OnGetTitleNewsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetTitleNewsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetTitleNewsRequest>)each; } } }
if (OnGetTitleNewsResultEvent != null) { foreach (var each in OnGetTitleNewsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetTitleNewsResultEvent -= (PlayFabResultEvent<ClientModels.GetTitleNewsResult>)each; } } }
if (OnAddUserVirtualCurrencyRequestEvent != null) { foreach (var each in OnAddUserVirtualCurrencyRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddUserVirtualCurrencyRequestEvent -= (PlayFabRequestEvent<ClientModels.AddUserVirtualCurrencyRequest>)each; } } }
if (OnAddUserVirtualCurrencyResultEvent != null) { foreach (var each in OnAddUserVirtualCurrencyResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddUserVirtualCurrencyResultEvent -= (PlayFabResultEvent<ClientModels.ModifyUserVirtualCurrencyResult>)each; } } }
if (OnConfirmPurchaseRequestEvent != null) { foreach (var each in OnConfirmPurchaseRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnConfirmPurchaseRequestEvent -= (PlayFabRequestEvent<ClientModels.ConfirmPurchaseRequest>)each; } } }
if (OnConfirmPurchaseResultEvent != null) { foreach (var each in OnConfirmPurchaseResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnConfirmPurchaseResultEvent -= (PlayFabResultEvent<ClientModels.ConfirmPurchaseResult>)each; } } }
if (OnConsumeItemRequestEvent != null) { foreach (var each in OnConsumeItemRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnConsumeItemRequestEvent -= (PlayFabRequestEvent<ClientModels.ConsumeItemRequest>)each; } } }
if (OnConsumeItemResultEvent != null) { foreach (var each in OnConsumeItemResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnConsumeItemResultEvent -= (PlayFabResultEvent<ClientModels.ConsumeItemResult>)each; } } }
if (OnGetCharacterInventoryRequestEvent != null) { foreach (var each in OnGetCharacterInventoryRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterInventoryRequestEvent -= (PlayFabRequestEvent<ClientModels.GetCharacterInventoryRequest>)each; } } }
if (OnGetCharacterInventoryResultEvent != null) { foreach (var each in OnGetCharacterInventoryResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterInventoryResultEvent -= (PlayFabResultEvent<ClientModels.GetCharacterInventoryResult>)each; } } }
if (OnGetPurchaseRequestEvent != null) { foreach (var each in OnGetPurchaseRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPurchaseRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPurchaseRequest>)each; } } }
if (OnGetPurchaseResultEvent != null) { foreach (var each in OnGetPurchaseResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPurchaseResultEvent -= (PlayFabResultEvent<ClientModels.GetPurchaseResult>)each; } } }
if (OnGetUserInventoryRequestEvent != null) { foreach (var each in OnGetUserInventoryRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserInventoryRequestEvent -= (PlayFabRequestEvent<ClientModels.GetUserInventoryRequest>)each; } } }
if (OnGetUserInventoryResultEvent != null) { foreach (var each in OnGetUserInventoryResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetUserInventoryResultEvent -= (PlayFabResultEvent<ClientModels.GetUserInventoryResult>)each; } } }
if (OnPayForPurchaseRequestEvent != null) { foreach (var each in OnPayForPurchaseRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnPayForPurchaseRequestEvent -= (PlayFabRequestEvent<ClientModels.PayForPurchaseRequest>)each; } } }
if (OnPayForPurchaseResultEvent != null) { foreach (var each in OnPayForPurchaseResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnPayForPurchaseResultEvent -= (PlayFabResultEvent<ClientModels.PayForPurchaseResult>)each; } } }
if (OnPurchaseItemRequestEvent != null) { foreach (var each in OnPurchaseItemRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnPurchaseItemRequestEvent -= (PlayFabRequestEvent<ClientModels.PurchaseItemRequest>)each; } } }
if (OnPurchaseItemResultEvent != null) { foreach (var each in OnPurchaseItemResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnPurchaseItemResultEvent -= (PlayFabResultEvent<ClientModels.PurchaseItemResult>)each; } } }
if (OnRedeemCouponRequestEvent != null) { foreach (var each in OnRedeemCouponRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRedeemCouponRequestEvent -= (PlayFabRequestEvent<ClientModels.RedeemCouponRequest>)each; } } }
if (OnRedeemCouponResultEvent != null) { foreach (var each in OnRedeemCouponResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRedeemCouponResultEvent -= (PlayFabResultEvent<ClientModels.RedeemCouponResult>)each; } } }
if (OnStartPurchaseRequestEvent != null) { foreach (var each in OnStartPurchaseRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnStartPurchaseRequestEvent -= (PlayFabRequestEvent<ClientModels.StartPurchaseRequest>)each; } } }
if (OnStartPurchaseResultEvent != null) { foreach (var each in OnStartPurchaseResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnStartPurchaseResultEvent -= (PlayFabResultEvent<ClientModels.StartPurchaseResult>)each; } } }
if (OnSubtractUserVirtualCurrencyRequestEvent != null) { foreach (var each in OnSubtractUserVirtualCurrencyRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnSubtractUserVirtualCurrencyRequestEvent -= (PlayFabRequestEvent<ClientModels.SubtractUserVirtualCurrencyRequest>)each; } } }
if (OnSubtractUserVirtualCurrencyResultEvent != null) { foreach (var each in OnSubtractUserVirtualCurrencyResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnSubtractUserVirtualCurrencyResultEvent -= (PlayFabResultEvent<ClientModels.ModifyUserVirtualCurrencyResult>)each; } } }
if (OnUnlockContainerInstanceRequestEvent != null) { foreach (var each in OnUnlockContainerInstanceRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlockContainerInstanceRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlockContainerInstanceRequest>)each; } } }
if (OnUnlockContainerInstanceResultEvent != null) { foreach (var each in OnUnlockContainerInstanceResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlockContainerInstanceResultEvent -= (PlayFabResultEvent<ClientModels.UnlockContainerItemResult>)each; } } }
if (OnUnlockContainerItemRequestEvent != null) { foreach (var each in OnUnlockContainerItemRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlockContainerItemRequestEvent -= (PlayFabRequestEvent<ClientModels.UnlockContainerItemRequest>)each; } } }
if (OnUnlockContainerItemResultEvent != null) { foreach (var each in OnUnlockContainerItemResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUnlockContainerItemResultEvent -= (PlayFabResultEvent<ClientModels.UnlockContainerItemResult>)each; } } }
if (OnAddFriendRequestEvent != null) { foreach (var each in OnAddFriendRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddFriendRequestEvent -= (PlayFabRequestEvent<ClientModels.AddFriendRequest>)each; } } }
if (OnAddFriendResultEvent != null) { foreach (var each in OnAddFriendResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddFriendResultEvent -= (PlayFabResultEvent<ClientModels.AddFriendResult>)each; } } }
if (OnGetFriendsListRequestEvent != null) { foreach (var each in OnGetFriendsListRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetFriendsListRequestEvent -= (PlayFabRequestEvent<ClientModels.GetFriendsListRequest>)each; } } }
if (OnGetFriendsListResultEvent != null) { foreach (var each in OnGetFriendsListResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetFriendsListResultEvent -= (PlayFabResultEvent<ClientModels.GetFriendsListResult>)each; } } }
if (OnRemoveFriendRequestEvent != null) { foreach (var each in OnRemoveFriendRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRemoveFriendRequestEvent -= (PlayFabRequestEvent<ClientModels.RemoveFriendRequest>)each; } } }
if (OnRemoveFriendResultEvent != null) { foreach (var each in OnRemoveFriendResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRemoveFriendResultEvent -= (PlayFabResultEvent<ClientModels.RemoveFriendResult>)each; } } }
if (OnSetFriendTagsRequestEvent != null) { foreach (var each in OnSetFriendTagsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnSetFriendTagsRequestEvent -= (PlayFabRequestEvent<ClientModels.SetFriendTagsRequest>)each; } } }
if (OnSetFriendTagsResultEvent != null) { foreach (var each in OnSetFriendTagsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnSetFriendTagsResultEvent -= (PlayFabResultEvent<ClientModels.SetFriendTagsResult>)each; } } }
if (OnRegisterForIOSPushNotificationRequestEvent != null) { foreach (var each in OnRegisterForIOSPushNotificationRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRegisterForIOSPushNotificationRequestEvent -= (PlayFabRequestEvent<ClientModels.RegisterForIOSPushNotificationRequest>)each; } } }
if (OnRegisterForIOSPushNotificationResultEvent != null) { foreach (var each in OnRegisterForIOSPushNotificationResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRegisterForIOSPushNotificationResultEvent -= (PlayFabResultEvent<ClientModels.RegisterForIOSPushNotificationResult>)each; } } }
if (OnRestoreIOSPurchasesRequestEvent != null) { foreach (var each in OnRestoreIOSPurchasesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRestoreIOSPurchasesRequestEvent -= (PlayFabRequestEvent<ClientModels.RestoreIOSPurchasesRequest>)each; } } }
if (OnRestoreIOSPurchasesResultEvent != null) { foreach (var each in OnRestoreIOSPurchasesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRestoreIOSPurchasesResultEvent -= (PlayFabResultEvent<ClientModels.RestoreIOSPurchasesResult>)each; } } }
if (OnValidateIOSReceiptRequestEvent != null) { foreach (var each in OnValidateIOSReceiptRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnValidateIOSReceiptRequestEvent -= (PlayFabRequestEvent<ClientModels.ValidateIOSReceiptRequest>)each; } } }
if (OnValidateIOSReceiptResultEvent != null) { foreach (var each in OnValidateIOSReceiptResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnValidateIOSReceiptResultEvent -= (PlayFabResultEvent<ClientModels.ValidateIOSReceiptResult>)each; } } }
if (OnGetCurrentGamesRequestEvent != null) { foreach (var each in OnGetCurrentGamesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCurrentGamesRequestEvent -= (PlayFabRequestEvent<ClientModels.CurrentGamesRequest>)each; } } }
if (OnGetCurrentGamesResultEvent != null) { foreach (var each in OnGetCurrentGamesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCurrentGamesResultEvent -= (PlayFabResultEvent<ClientModels.CurrentGamesResult>)each; } } }
if (OnGetGameServerRegionsRequestEvent != null) { foreach (var each in OnGetGameServerRegionsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetGameServerRegionsRequestEvent -= (PlayFabRequestEvent<ClientModels.GameServerRegionsRequest>)each; } } }
if (OnGetGameServerRegionsResultEvent != null) { foreach (var each in OnGetGameServerRegionsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetGameServerRegionsResultEvent -= (PlayFabResultEvent<ClientModels.GameServerRegionsResult>)each; } } }
if (OnMatchmakeRequestEvent != null) { foreach (var each in OnMatchmakeRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakeRequestEvent -= (PlayFabRequestEvent<ClientModels.MatchmakeRequest>)each; } } }
if (OnMatchmakeResultEvent != null) { foreach (var each in OnMatchmakeResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnMatchmakeResultEvent -= (PlayFabResultEvent<ClientModels.MatchmakeResult>)each; } } }
if (OnStartGameRequestEvent != null) { foreach (var each in OnStartGameRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnStartGameRequestEvent -= (PlayFabRequestEvent<ClientModels.StartGameRequest>)each; } } }
if (OnStartGameResultEvent != null) { foreach (var each in OnStartGameResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnStartGameResultEvent -= (PlayFabResultEvent<ClientModels.StartGameResult>)each; } } }
if (OnAndroidDevicePushNotificationRegistrationRequestEvent != null) { foreach (var each in OnAndroidDevicePushNotificationRegistrationRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAndroidDevicePushNotificationRegistrationRequestEvent -= (PlayFabRequestEvent<ClientModels.AndroidDevicePushNotificationRegistrationRequest>)each; } } }
if (OnAndroidDevicePushNotificationRegistrationResultEvent != null) { foreach (var each in OnAndroidDevicePushNotificationRegistrationResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAndroidDevicePushNotificationRegistrationResultEvent -= (PlayFabResultEvent<ClientModels.AndroidDevicePushNotificationRegistrationResult>)each; } } }
if (OnValidateGooglePlayPurchaseRequestEvent != null) { foreach (var each in OnValidateGooglePlayPurchaseRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnValidateGooglePlayPurchaseRequestEvent -= (PlayFabRequestEvent<ClientModels.ValidateGooglePlayPurchaseRequest>)each; } } }
if (OnValidateGooglePlayPurchaseResultEvent != null) { foreach (var each in OnValidateGooglePlayPurchaseResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnValidateGooglePlayPurchaseResultEvent -= (PlayFabResultEvent<ClientModels.ValidateGooglePlayPurchaseResult>)each; } } }
if (OnLogEventRequestEvent != null) { foreach (var each in OnLogEventRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLogEventRequestEvent -= (PlayFabRequestEvent<ClientModels.LogEventRequest>)each; } } }
if (OnLogEventResultEvent != null) { foreach (var each in OnLogEventResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnLogEventResultEvent -= (PlayFabResultEvent<ClientModels.LogEventResult>)each; } } }
if (OnWriteCharacterEventRequestEvent != null) { foreach (var each in OnWriteCharacterEventRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnWriteCharacterEventRequestEvent -= (PlayFabRequestEvent<ClientModels.WriteClientCharacterEventRequest>)each; } } }
if (OnWriteCharacterEventResultEvent != null) { foreach (var each in OnWriteCharacterEventResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnWriteCharacterEventResultEvent -= (PlayFabResultEvent<ClientModels.WriteEventResponse>)each; } } }
if (OnWritePlayerEventRequestEvent != null) { foreach (var each in OnWritePlayerEventRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnWritePlayerEventRequestEvent -= (PlayFabRequestEvent<ClientModels.WriteClientPlayerEventRequest>)each; } } }
if (OnWritePlayerEventResultEvent != null) { foreach (var each in OnWritePlayerEventResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnWritePlayerEventResultEvent -= (PlayFabResultEvent<ClientModels.WriteEventResponse>)each; } } }
if (OnWriteTitleEventRequestEvent != null) { foreach (var each in OnWriteTitleEventRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnWriteTitleEventRequestEvent -= (PlayFabRequestEvent<ClientModels.WriteTitleEventRequest>)each; } } }
if (OnWriteTitleEventResultEvent != null) { foreach (var each in OnWriteTitleEventResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnWriteTitleEventResultEvent -= (PlayFabResultEvent<ClientModels.WriteEventResponse>)each; } } }
if (OnAddSharedGroupMembersRequestEvent != null) { foreach (var each in OnAddSharedGroupMembersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddSharedGroupMembersRequestEvent -= (PlayFabRequestEvent<ClientModels.AddSharedGroupMembersRequest>)each; } } }
if (OnAddSharedGroupMembersResultEvent != null) { foreach (var each in OnAddSharedGroupMembersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAddSharedGroupMembersResultEvent -= (PlayFabResultEvent<ClientModels.AddSharedGroupMembersResult>)each; } } }
if (OnCreateSharedGroupRequestEvent != null) { foreach (var each in OnCreateSharedGroupRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnCreateSharedGroupRequestEvent -= (PlayFabRequestEvent<ClientModels.CreateSharedGroupRequest>)each; } } }
if (OnCreateSharedGroupResultEvent != null) { foreach (var each in OnCreateSharedGroupResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnCreateSharedGroupResultEvent -= (PlayFabResultEvent<ClientModels.CreateSharedGroupResult>)each; } } }
if (OnGetSharedGroupDataRequestEvent != null) { foreach (var each in OnGetSharedGroupDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetSharedGroupDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetSharedGroupDataRequest>)each; } } }
if (OnGetSharedGroupDataResultEvent != null) { foreach (var each in OnGetSharedGroupDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetSharedGroupDataResultEvent -= (PlayFabResultEvent<ClientModels.GetSharedGroupDataResult>)each; } } }
if (OnRemoveSharedGroupMembersRequestEvent != null) { foreach (var each in OnRemoveSharedGroupMembersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRemoveSharedGroupMembersRequestEvent -= (PlayFabRequestEvent<ClientModels.RemoveSharedGroupMembersRequest>)each; } } }
if (OnRemoveSharedGroupMembersResultEvent != null) { foreach (var each in OnRemoveSharedGroupMembersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRemoveSharedGroupMembersResultEvent -= (PlayFabResultEvent<ClientModels.RemoveSharedGroupMembersResult>)each; } } }
if (OnUpdateSharedGroupDataRequestEvent != null) { foreach (var each in OnUpdateSharedGroupDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateSharedGroupDataRequestEvent -= (PlayFabRequestEvent<ClientModels.UpdateSharedGroupDataRequest>)each; } } }
if (OnUpdateSharedGroupDataResultEvent != null) { foreach (var each in OnUpdateSharedGroupDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateSharedGroupDataResultEvent -= (PlayFabResultEvent<ClientModels.UpdateSharedGroupDataResult>)each; } } }
if (OnExecuteCloudScriptRequestEvent != null) { foreach (var each in OnExecuteCloudScriptRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnExecuteCloudScriptRequestEvent -= (PlayFabRequestEvent<ClientModels.ExecuteCloudScriptRequest>)each; } } }
if (OnExecuteCloudScriptResultEvent != null) { foreach (var each in OnExecuteCloudScriptResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnExecuteCloudScriptResultEvent -= (PlayFabResultEvent<ClientModels.ExecuteCloudScriptResult>)each; } } }
if (OnGetCloudScriptUrlRequestEvent != null) { foreach (var each in OnGetCloudScriptUrlRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCloudScriptUrlRequestEvent -= (PlayFabRequestEvent<ClientModels.GetCloudScriptUrlRequest>)each; } } }
if (OnGetCloudScriptUrlResultEvent != null) { foreach (var each in OnGetCloudScriptUrlResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCloudScriptUrlResultEvent -= (PlayFabResultEvent<ClientModels.GetCloudScriptUrlResult>)each; } } }
if (OnRunCloudScriptRequestEvent != null) { foreach (var each in OnRunCloudScriptRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRunCloudScriptRequestEvent -= (PlayFabRequestEvent<ClientModels.RunCloudScriptRequest>)each; } } }
if (OnRunCloudScriptResultEvent != null) { foreach (var each in OnRunCloudScriptResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnRunCloudScriptResultEvent -= (PlayFabResultEvent<ClientModels.RunCloudScriptResult>)each; } } }
if (OnGetContentDownloadUrlRequestEvent != null) { foreach (var each in OnGetContentDownloadUrlRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetContentDownloadUrlRequestEvent -= (PlayFabRequestEvent<ClientModels.GetContentDownloadUrlRequest>)each; } } }
if (OnGetContentDownloadUrlResultEvent != null) { foreach (var each in OnGetContentDownloadUrlResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetContentDownloadUrlResultEvent -= (PlayFabResultEvent<ClientModels.GetContentDownloadUrlResult>)each; } } }
if (OnGetAllUsersCharactersRequestEvent != null) { foreach (var each in OnGetAllUsersCharactersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetAllUsersCharactersRequestEvent -= (PlayFabRequestEvent<ClientModels.ListUsersCharactersRequest>)each; } } }
if (OnGetAllUsersCharactersResultEvent != null) { foreach (var each in OnGetAllUsersCharactersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetAllUsersCharactersResultEvent -= (PlayFabResultEvent<ClientModels.ListUsersCharactersResult>)each; } } }
if (OnGetCharacterLeaderboardRequestEvent != null) { foreach (var each in OnGetCharacterLeaderboardRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterLeaderboardRequestEvent -= (PlayFabRequestEvent<ClientModels.GetCharacterLeaderboardRequest>)each; } } }
if (OnGetCharacterLeaderboardResultEvent != null) { foreach (var each in OnGetCharacterLeaderboardResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterLeaderboardResultEvent -= (PlayFabResultEvent<ClientModels.GetCharacterLeaderboardResult>)each; } } }
if (OnGetCharacterStatisticsRequestEvent != null) { foreach (var each in OnGetCharacterStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterStatisticsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetCharacterStatisticsRequest>)each; } } }
if (OnGetCharacterStatisticsResultEvent != null) { foreach (var each in OnGetCharacterStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterStatisticsResultEvent -= (PlayFabResultEvent<ClientModels.GetCharacterStatisticsResult>)each; } } }
if (OnGetLeaderboardAroundCharacterRequestEvent != null) { foreach (var each in OnGetLeaderboardAroundCharacterRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardAroundCharacterRequestEvent -= (PlayFabRequestEvent<ClientModels.GetLeaderboardAroundCharacterRequest>)each; } } }
if (OnGetLeaderboardAroundCharacterResultEvent != null) { foreach (var each in OnGetLeaderboardAroundCharacterResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardAroundCharacterResultEvent -= (PlayFabResultEvent<ClientModels.GetLeaderboardAroundCharacterResult>)each; } } }
if (OnGetLeaderboardForUserCharactersRequestEvent != null) { foreach (var each in OnGetLeaderboardForUserCharactersRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardForUserCharactersRequestEvent -= (PlayFabRequestEvent<ClientModels.GetLeaderboardForUsersCharactersRequest>)each; } } }
if (OnGetLeaderboardForUserCharactersResultEvent != null) { foreach (var each in OnGetLeaderboardForUserCharactersResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetLeaderboardForUserCharactersResultEvent -= (PlayFabResultEvent<ClientModels.GetLeaderboardForUsersCharactersResult>)each; } } }
if (OnGrantCharacterToUserRequestEvent != null) { foreach (var each in OnGrantCharacterToUserRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGrantCharacterToUserRequestEvent -= (PlayFabRequestEvent<ClientModels.GrantCharacterToUserRequest>)each; } } }
if (OnGrantCharacterToUserResultEvent != null) { foreach (var each in OnGrantCharacterToUserResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGrantCharacterToUserResultEvent -= (PlayFabResultEvent<ClientModels.GrantCharacterToUserResult>)each; } } }
if (OnUpdateCharacterStatisticsRequestEvent != null) { foreach (var each in OnUpdateCharacterStatisticsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateCharacterStatisticsRequestEvent -= (PlayFabRequestEvent<ClientModels.UpdateCharacterStatisticsRequest>)each; } } }
if (OnUpdateCharacterStatisticsResultEvent != null) { foreach (var each in OnUpdateCharacterStatisticsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateCharacterStatisticsResultEvent -= (PlayFabResultEvent<ClientModels.UpdateCharacterStatisticsResult>)each; } } }
if (OnGetCharacterDataRequestEvent != null) { foreach (var each in OnGetCharacterDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetCharacterDataRequest>)each; } } }
if (OnGetCharacterDataResultEvent != null) { foreach (var each in OnGetCharacterDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterDataResultEvent -= (PlayFabResultEvent<ClientModels.GetCharacterDataResult>)each; } } }
if (OnGetCharacterReadOnlyDataRequestEvent != null) { foreach (var each in OnGetCharacterReadOnlyDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterReadOnlyDataRequestEvent -= (PlayFabRequestEvent<ClientModels.GetCharacterDataRequest>)each; } } }
if (OnGetCharacterReadOnlyDataResultEvent != null) { foreach (var each in OnGetCharacterReadOnlyDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetCharacterReadOnlyDataResultEvent -= (PlayFabResultEvent<ClientModels.GetCharacterDataResult>)each; } } }
if (OnUpdateCharacterDataRequestEvent != null) { foreach (var each in OnUpdateCharacterDataRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateCharacterDataRequestEvent -= (PlayFabRequestEvent<ClientModels.UpdateCharacterDataRequest>)each; } } }
if (OnUpdateCharacterDataResultEvent != null) { foreach (var each in OnUpdateCharacterDataResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnUpdateCharacterDataResultEvent -= (PlayFabResultEvent<ClientModels.UpdateCharacterDataResult>)each; } } }
if (OnValidateAmazonIAPReceiptRequestEvent != null) { foreach (var each in OnValidateAmazonIAPReceiptRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnValidateAmazonIAPReceiptRequestEvent -= (PlayFabRequestEvent<ClientModels.ValidateAmazonReceiptRequest>)each; } } }
if (OnValidateAmazonIAPReceiptResultEvent != null) { foreach (var each in OnValidateAmazonIAPReceiptResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnValidateAmazonIAPReceiptResultEvent -= (PlayFabResultEvent<ClientModels.ValidateAmazonReceiptResult>)each; } } }
if (OnAcceptTradeRequestEvent != null) { foreach (var each in OnAcceptTradeRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAcceptTradeRequestEvent -= (PlayFabRequestEvent<ClientModels.AcceptTradeRequest>)each; } } }
if (OnAcceptTradeResultEvent != null) { foreach (var each in OnAcceptTradeResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAcceptTradeResultEvent -= (PlayFabResultEvent<ClientModels.AcceptTradeResponse>)each; } } }
if (OnCancelTradeRequestEvent != null) { foreach (var each in OnCancelTradeRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnCancelTradeRequestEvent -= (PlayFabRequestEvent<ClientModels.CancelTradeRequest>)each; } } }
if (OnCancelTradeResultEvent != null) { foreach (var each in OnCancelTradeResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnCancelTradeResultEvent -= (PlayFabResultEvent<ClientModels.CancelTradeResponse>)each; } } }
if (OnGetPlayerTradesRequestEvent != null) { foreach (var each in OnGetPlayerTradesRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerTradesRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayerTradesRequest>)each; } } }
if (OnGetPlayerTradesResultEvent != null) { foreach (var each in OnGetPlayerTradesResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerTradesResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayerTradesResponse>)each; } } }
if (OnGetTradeStatusRequestEvent != null) { foreach (var each in OnGetTradeStatusRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetTradeStatusRequestEvent -= (PlayFabRequestEvent<ClientModels.GetTradeStatusRequest>)each; } } }
if (OnGetTradeStatusResultEvent != null) { foreach (var each in OnGetTradeStatusResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetTradeStatusResultEvent -= (PlayFabResultEvent<ClientModels.GetTradeStatusResponse>)each; } } }
if (OnOpenTradeRequestEvent != null) { foreach (var each in OnOpenTradeRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnOpenTradeRequestEvent -= (PlayFabRequestEvent<ClientModels.OpenTradeRequest>)each; } } }
if (OnOpenTradeResultEvent != null) { foreach (var each in OnOpenTradeResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnOpenTradeResultEvent -= (PlayFabResultEvent<ClientModels.OpenTradeResponse>)each; } } }
if (OnAttributeInstallRequestEvent != null) { foreach (var each in OnAttributeInstallRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAttributeInstallRequestEvent -= (PlayFabRequestEvent<ClientModels.AttributeInstallRequest>)each; } } }
if (OnAttributeInstallResultEvent != null) { foreach (var each in OnAttributeInstallResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnAttributeInstallResultEvent -= (PlayFabResultEvent<ClientModels.AttributeInstallResult>)each; } } }
if (OnGetPlayerSegmentsRequestEvent != null) { foreach (var each in OnGetPlayerSegmentsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerSegmentsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayerSegmentsRequest>)each; } } }
if (OnGetPlayerSegmentsResultEvent != null) { foreach (var each in OnGetPlayerSegmentsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerSegmentsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayerSegmentsResult>)each; } } }
if (OnGetPlayerTagsRequestEvent != null) { foreach (var each in OnGetPlayerTagsRequestEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerTagsRequestEvent -= (PlayFabRequestEvent<ClientModels.GetPlayerTagsRequest>)each; } } }
if (OnGetPlayerTagsResultEvent != null) { foreach (var each in OnGetPlayerTagsResultEvent.GetInvocationList()) { if (ReferenceEquals(each.Target, instance)) { OnGetPlayerTagsResultEvent -= (PlayFabResultEvent<ClientModels.GetPlayerTagsResult>)each; } } }
#endif
}
private void OnProcessingErrorEvent(PlayFabRequestCommon request, PlayFabError error)
{
//This just forwards the event.
if (_instance.OnGlobalErrorEvent != null)
{
_instance.OnGlobalErrorEvent(request, error);
}
}
private void OnProcessingEvent(ApiProcessingEventArgs e)
{
if (e.EventType == ApiProcessingEventType.Pre)
{
var type = e.Request.GetType();
#if ENABLE_PLAYFABADMIN_API
if (type == typeof(AdminModels.BanUsersRequest)) { if (_instance.OnAdminBanUsersRequestEvent != null) { _instance.OnAdminBanUsersRequestEvent((AdminModels.BanUsersRequest)e.Request); return; } }
if (type == typeof(AdminModels.LookupUserAccountInfoRequest)) { if (_instance.OnAdminGetUserAccountInfoRequestEvent != null) { _instance.OnAdminGetUserAccountInfoRequestEvent((AdminModels.LookupUserAccountInfoRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetUserBansRequest)) { if (_instance.OnAdminGetUserBansRequestEvent != null) { _instance.OnAdminGetUserBansRequestEvent((AdminModels.GetUserBansRequest)e.Request); return; } }
if (type == typeof(AdminModels.ResetUsersRequest)) { if (_instance.OnAdminResetUsersRequestEvent != null) { _instance.OnAdminResetUsersRequestEvent((AdminModels.ResetUsersRequest)e.Request); return; } }
if (type == typeof(AdminModels.RevokeAllBansForUserRequest)) { if (_instance.OnAdminRevokeAllBansForUserRequestEvent != null) { _instance.OnAdminRevokeAllBansForUserRequestEvent((AdminModels.RevokeAllBansForUserRequest)e.Request); return; } }
if (type == typeof(AdminModels.RevokeBansRequest)) { if (_instance.OnAdminRevokeBansRequestEvent != null) { _instance.OnAdminRevokeBansRequestEvent((AdminModels.RevokeBansRequest)e.Request); return; } }
if (type == typeof(AdminModels.SendAccountRecoveryEmailRequest)) { if (_instance.OnAdminSendAccountRecoveryEmailRequestEvent != null) { _instance.OnAdminSendAccountRecoveryEmailRequestEvent((AdminModels.SendAccountRecoveryEmailRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateBansRequest)) { if (_instance.OnAdminUpdateBansRequestEvent != null) { _instance.OnAdminUpdateBansRequestEvent((AdminModels.UpdateBansRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateUserTitleDisplayNameRequest)) { if (_instance.OnAdminUpdateUserTitleDisplayNameRequestEvent != null) { _instance.OnAdminUpdateUserTitleDisplayNameRequestEvent((AdminModels.UpdateUserTitleDisplayNameRequest)e.Request); return; } }
if (type == typeof(AdminModels.CreatePlayerStatisticDefinitionRequest)) { if (_instance.OnAdminCreatePlayerStatisticDefinitionRequestEvent != null) { _instance.OnAdminCreatePlayerStatisticDefinitionRequestEvent((AdminModels.CreatePlayerStatisticDefinitionRequest)e.Request); return; } }
if (type == typeof(AdminModels.DeleteUsersRequest)) { if (_instance.OnAdminDeleteUsersRequestEvent != null) { _instance.OnAdminDeleteUsersRequestEvent((AdminModels.DeleteUsersRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetDataReportRequest)) { if (_instance.OnAdminGetDataReportRequestEvent != null) { _instance.OnAdminGetDataReportRequestEvent((AdminModels.GetDataReportRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetPlayerStatisticDefinitionsRequest)) { if (_instance.OnAdminGetPlayerStatisticDefinitionsRequestEvent != null) { _instance.OnAdminGetPlayerStatisticDefinitionsRequestEvent((AdminModels.GetPlayerStatisticDefinitionsRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetPlayerStatisticVersionsRequest)) { if (_instance.OnAdminGetPlayerStatisticVersionsRequestEvent != null) { _instance.OnAdminGetPlayerStatisticVersionsRequestEvent((AdminModels.GetPlayerStatisticVersionsRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetUserDataRequest)) { if (_instance.OnAdminGetUserDataRequestEvent != null) { _instance.OnAdminGetUserDataRequestEvent((AdminModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetUserDataRequest)) { if (_instance.OnAdminGetUserInternalDataRequestEvent != null) { _instance.OnAdminGetUserInternalDataRequestEvent((AdminModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetUserDataRequest)) { if (_instance.OnAdminGetUserPublisherDataRequestEvent != null) { _instance.OnAdminGetUserPublisherDataRequestEvent((AdminModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetUserDataRequest)) { if (_instance.OnAdminGetUserPublisherInternalDataRequestEvent != null) { _instance.OnAdminGetUserPublisherInternalDataRequestEvent((AdminModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetUserDataRequest)) { if (_instance.OnAdminGetUserPublisherReadOnlyDataRequestEvent != null) { _instance.OnAdminGetUserPublisherReadOnlyDataRequestEvent((AdminModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetUserDataRequest)) { if (_instance.OnAdminGetUserReadOnlyDataRequestEvent != null) { _instance.OnAdminGetUserReadOnlyDataRequestEvent((AdminModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.IncrementPlayerStatisticVersionRequest)) { if (_instance.OnAdminIncrementPlayerStatisticVersionRequestEvent != null) { _instance.OnAdminIncrementPlayerStatisticVersionRequestEvent((AdminModels.IncrementPlayerStatisticVersionRequest)e.Request); return; } }
if (type == typeof(AdminModels.RefundPurchaseRequest)) { if (_instance.OnAdminRefundPurchaseRequestEvent != null) { _instance.OnAdminRefundPurchaseRequestEvent((AdminModels.RefundPurchaseRequest)e.Request); return; } }
if (type == typeof(AdminModels.ResetUserStatisticsRequest)) { if (_instance.OnAdminResetUserStatisticsRequestEvent != null) { _instance.OnAdminResetUserStatisticsRequestEvent((AdminModels.ResetUserStatisticsRequest)e.Request); return; } }
if (type == typeof(AdminModels.ResolvePurchaseDisputeRequest)) { if (_instance.OnAdminResolvePurchaseDisputeRequestEvent != null) { _instance.OnAdminResolvePurchaseDisputeRequestEvent((AdminModels.ResolvePurchaseDisputeRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdatePlayerStatisticDefinitionRequest)) { if (_instance.OnAdminUpdatePlayerStatisticDefinitionRequestEvent != null) { _instance.OnAdminUpdatePlayerStatisticDefinitionRequestEvent((AdminModels.UpdatePlayerStatisticDefinitionRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateUserDataRequest)) { if (_instance.OnAdminUpdateUserDataRequestEvent != null) { _instance.OnAdminUpdateUserDataRequestEvent((AdminModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateUserInternalDataRequest)) { if (_instance.OnAdminUpdateUserInternalDataRequestEvent != null) { _instance.OnAdminUpdateUserInternalDataRequestEvent((AdminModels.UpdateUserInternalDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateUserDataRequest)) { if (_instance.OnAdminUpdateUserPublisherDataRequestEvent != null) { _instance.OnAdminUpdateUserPublisherDataRequestEvent((AdminModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateUserInternalDataRequest)) { if (_instance.OnAdminUpdateUserPublisherInternalDataRequestEvent != null) { _instance.OnAdminUpdateUserPublisherInternalDataRequestEvent((AdminModels.UpdateUserInternalDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateUserDataRequest)) { if (_instance.OnAdminUpdateUserPublisherReadOnlyDataRequestEvent != null) { _instance.OnAdminUpdateUserPublisherReadOnlyDataRequestEvent((AdminModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateUserDataRequest)) { if (_instance.OnAdminUpdateUserReadOnlyDataRequestEvent != null) { _instance.OnAdminUpdateUserReadOnlyDataRequestEvent((AdminModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.AddNewsRequest)) { if (_instance.OnAdminAddNewsRequestEvent != null) { _instance.OnAdminAddNewsRequestEvent((AdminModels.AddNewsRequest)e.Request); return; } }
if (type == typeof(AdminModels.AddVirtualCurrencyTypesRequest)) { if (_instance.OnAdminAddVirtualCurrencyTypesRequestEvent != null) { _instance.OnAdminAddVirtualCurrencyTypesRequestEvent((AdminModels.AddVirtualCurrencyTypesRequest)e.Request); return; } }
if (type == typeof(AdminModels.DeleteStoreRequest)) { if (_instance.OnAdminDeleteStoreRequestEvent != null) { _instance.OnAdminDeleteStoreRequestEvent((AdminModels.DeleteStoreRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetCatalogItemsRequest)) { if (_instance.OnAdminGetCatalogItemsRequestEvent != null) { _instance.OnAdminGetCatalogItemsRequestEvent((AdminModels.GetCatalogItemsRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetPublisherDataRequest)) { if (_instance.OnAdminGetPublisherDataRequestEvent != null) { _instance.OnAdminGetPublisherDataRequestEvent((AdminModels.GetPublisherDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetRandomResultTablesRequest)) { if (_instance.OnAdminGetRandomResultTablesRequestEvent != null) { _instance.OnAdminGetRandomResultTablesRequestEvent((AdminModels.GetRandomResultTablesRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetStoreItemsRequest)) { if (_instance.OnAdminGetStoreItemsRequestEvent != null) { _instance.OnAdminGetStoreItemsRequestEvent((AdminModels.GetStoreItemsRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetTitleDataRequest)) { if (_instance.OnAdminGetTitleDataRequestEvent != null) { _instance.OnAdminGetTitleDataRequestEvent((AdminModels.GetTitleDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetTitleDataRequest)) { if (_instance.OnAdminGetTitleInternalDataRequestEvent != null) { _instance.OnAdminGetTitleInternalDataRequestEvent((AdminModels.GetTitleDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.ListVirtualCurrencyTypesRequest)) { if (_instance.OnAdminListVirtualCurrencyTypesRequestEvent != null) { _instance.OnAdminListVirtualCurrencyTypesRequestEvent((AdminModels.ListVirtualCurrencyTypesRequest)e.Request); return; } }
if (type == typeof(AdminModels.RemoveVirtualCurrencyTypesRequest)) { if (_instance.OnAdminRemoveVirtualCurrencyTypesRequestEvent != null) { _instance.OnAdminRemoveVirtualCurrencyTypesRequestEvent((AdminModels.RemoveVirtualCurrencyTypesRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateCatalogItemsRequest)) { if (_instance.OnAdminSetCatalogItemsRequestEvent != null) { _instance.OnAdminSetCatalogItemsRequestEvent((AdminModels.UpdateCatalogItemsRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateStoreItemsRequest)) { if (_instance.OnAdminSetStoreItemsRequestEvent != null) { _instance.OnAdminSetStoreItemsRequestEvent((AdminModels.UpdateStoreItemsRequest)e.Request); return; } }
if (type == typeof(AdminModels.SetTitleDataRequest)) { if (_instance.OnAdminSetTitleDataRequestEvent != null) { _instance.OnAdminSetTitleDataRequestEvent((AdminModels.SetTitleDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.SetTitleDataRequest)) { if (_instance.OnAdminSetTitleInternalDataRequestEvent != null) { _instance.OnAdminSetTitleInternalDataRequestEvent((AdminModels.SetTitleDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.SetupPushNotificationRequest)) { if (_instance.OnAdminSetupPushNotificationRequestEvent != null) { _instance.OnAdminSetupPushNotificationRequestEvent((AdminModels.SetupPushNotificationRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateCatalogItemsRequest)) { if (_instance.OnAdminUpdateCatalogItemsRequestEvent != null) { _instance.OnAdminUpdateCatalogItemsRequestEvent((AdminModels.UpdateCatalogItemsRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateRandomResultTablesRequest)) { if (_instance.OnAdminUpdateRandomResultTablesRequestEvent != null) { _instance.OnAdminUpdateRandomResultTablesRequestEvent((AdminModels.UpdateRandomResultTablesRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateStoreItemsRequest)) { if (_instance.OnAdminUpdateStoreItemsRequestEvent != null) { _instance.OnAdminUpdateStoreItemsRequestEvent((AdminModels.UpdateStoreItemsRequest)e.Request); return; } }
if (type == typeof(AdminModels.AddUserVirtualCurrencyRequest)) { if (_instance.OnAdminAddUserVirtualCurrencyRequestEvent != null) { _instance.OnAdminAddUserVirtualCurrencyRequestEvent((AdminModels.AddUserVirtualCurrencyRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetUserInventoryRequest)) { if (_instance.OnAdminGetUserInventoryRequestEvent != null) { _instance.OnAdminGetUserInventoryRequestEvent((AdminModels.GetUserInventoryRequest)e.Request); return; } }
if (type == typeof(AdminModels.GrantItemsToUsersRequest)) { if (_instance.OnAdminGrantItemsToUsersRequestEvent != null) { _instance.OnAdminGrantItemsToUsersRequestEvent((AdminModels.GrantItemsToUsersRequest)e.Request); return; } }
if (type == typeof(AdminModels.RevokeInventoryItemRequest)) { if (_instance.OnAdminRevokeInventoryItemRequestEvent != null) { _instance.OnAdminRevokeInventoryItemRequestEvent((AdminModels.RevokeInventoryItemRequest)e.Request); return; } }
if (type == typeof(AdminModels.SubtractUserVirtualCurrencyRequest)) { if (_instance.OnAdminSubtractUserVirtualCurrencyRequestEvent != null) { _instance.OnAdminSubtractUserVirtualCurrencyRequestEvent((AdminModels.SubtractUserVirtualCurrencyRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetMatchmakerGameInfoRequest)) { if (_instance.OnAdminGetMatchmakerGameInfoRequestEvent != null) { _instance.OnAdminGetMatchmakerGameInfoRequestEvent((AdminModels.GetMatchmakerGameInfoRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetMatchmakerGameModesRequest)) { if (_instance.OnAdminGetMatchmakerGameModesRequestEvent != null) { _instance.OnAdminGetMatchmakerGameModesRequestEvent((AdminModels.GetMatchmakerGameModesRequest)e.Request); return; } }
if (type == typeof(AdminModels.ModifyMatchmakerGameModesRequest)) { if (_instance.OnAdminModifyMatchmakerGameModesRequestEvent != null) { _instance.OnAdminModifyMatchmakerGameModesRequestEvent((AdminModels.ModifyMatchmakerGameModesRequest)e.Request); return; } }
if (type == typeof(AdminModels.AddServerBuildRequest)) { if (_instance.OnAdminAddServerBuildRequestEvent != null) { _instance.OnAdminAddServerBuildRequestEvent((AdminModels.AddServerBuildRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetServerBuildInfoRequest)) { if (_instance.OnAdminGetServerBuildInfoRequestEvent != null) { _instance.OnAdminGetServerBuildInfoRequestEvent((AdminModels.GetServerBuildInfoRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetServerBuildUploadURLRequest)) { if (_instance.OnAdminGetServerBuildUploadUrlRequestEvent != null) { _instance.OnAdminGetServerBuildUploadUrlRequestEvent((AdminModels.GetServerBuildUploadURLRequest)e.Request); return; } }
if (type == typeof(AdminModels.ListBuildsRequest)) { if (_instance.OnAdminListServerBuildsRequestEvent != null) { _instance.OnAdminListServerBuildsRequestEvent((AdminModels.ListBuildsRequest)e.Request); return; } }
if (type == typeof(AdminModels.ModifyServerBuildRequest)) { if (_instance.OnAdminModifyServerBuildRequestEvent != null) { _instance.OnAdminModifyServerBuildRequestEvent((AdminModels.ModifyServerBuildRequest)e.Request); return; } }
if (type == typeof(AdminModels.RemoveServerBuildRequest)) { if (_instance.OnAdminRemoveServerBuildRequestEvent != null) { _instance.OnAdminRemoveServerBuildRequestEvent((AdminModels.RemoveServerBuildRequest)e.Request); return; } }
if (type == typeof(AdminModels.SetPublisherDataRequest)) { if (_instance.OnAdminSetPublisherDataRequestEvent != null) { _instance.OnAdminSetPublisherDataRequestEvent((AdminModels.SetPublisherDataRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetCloudScriptRevisionRequest)) { if (_instance.OnAdminGetCloudScriptRevisionRequestEvent != null) { _instance.OnAdminGetCloudScriptRevisionRequestEvent((AdminModels.GetCloudScriptRevisionRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetCloudScriptVersionsRequest)) { if (_instance.OnAdminGetCloudScriptVersionsRequestEvent != null) { _instance.OnAdminGetCloudScriptVersionsRequestEvent((AdminModels.GetCloudScriptVersionsRequest)e.Request); return; } }
if (type == typeof(AdminModels.SetPublishedRevisionRequest)) { if (_instance.OnAdminSetPublishedRevisionRequestEvent != null) { _instance.OnAdminSetPublishedRevisionRequestEvent((AdminModels.SetPublishedRevisionRequest)e.Request); return; } }
if (type == typeof(AdminModels.UpdateCloudScriptRequest)) { if (_instance.OnAdminUpdateCloudScriptRequestEvent != null) { _instance.OnAdminUpdateCloudScriptRequestEvent((AdminModels.UpdateCloudScriptRequest)e.Request); return; } }
if (type == typeof(AdminModels.DeleteContentRequest)) { if (_instance.OnAdminDeleteContentRequestEvent != null) { _instance.OnAdminDeleteContentRequestEvent((AdminModels.DeleteContentRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetContentListRequest)) { if (_instance.OnAdminGetContentListRequestEvent != null) { _instance.OnAdminGetContentListRequestEvent((AdminModels.GetContentListRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetContentUploadUrlRequest)) { if (_instance.OnAdminGetContentUploadUrlRequestEvent != null) { _instance.OnAdminGetContentUploadUrlRequestEvent((AdminModels.GetContentUploadUrlRequest)e.Request); return; } }
if (type == typeof(AdminModels.ResetCharacterStatisticsRequest)) { if (_instance.OnAdminResetCharacterStatisticsRequestEvent != null) { _instance.OnAdminResetCharacterStatisticsRequestEvent((AdminModels.ResetCharacterStatisticsRequest)e.Request); return; } }
if (type == typeof(AdminModels.AddPlayerTagRequest)) { if (_instance.OnAdminAddPlayerTagRequestEvent != null) { _instance.OnAdminAddPlayerTagRequestEvent((AdminModels.AddPlayerTagRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetAllActionGroupsRequest)) { if (_instance.OnAdminGetAllActionGroupsRequestEvent != null) { _instance.OnAdminGetAllActionGroupsRequestEvent((AdminModels.GetAllActionGroupsRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetAllSegmentsRequest)) { if (_instance.OnAdminGetAllSegmentsRequestEvent != null) { _instance.OnAdminGetAllSegmentsRequestEvent((AdminModels.GetAllSegmentsRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetPlayersSegmentsRequest)) { if (_instance.OnAdminGetPlayerSegmentsRequestEvent != null) { _instance.OnAdminGetPlayerSegmentsRequestEvent((AdminModels.GetPlayersSegmentsRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetPlayersInSegmentRequest)) { if (_instance.OnAdminGetPlayersInSegmentRequestEvent != null) { _instance.OnAdminGetPlayersInSegmentRequestEvent((AdminModels.GetPlayersInSegmentRequest)e.Request); return; } }
if (type == typeof(AdminModels.GetPlayerTagsRequest)) { if (_instance.OnAdminGetPlayerTagsRequestEvent != null) { _instance.OnAdminGetPlayerTagsRequestEvent((AdminModels.GetPlayerTagsRequest)e.Request); return; } }
if (type == typeof(AdminModels.RemovePlayerTagRequest)) { if (_instance.OnAdminRemovePlayerTagRequestEvent != null) { _instance.OnAdminRemovePlayerTagRequestEvent((AdminModels.RemovePlayerTagRequest)e.Request); return; } }
#endif
#if ENABLE_PLAYFABSERVER_API
if (type == typeof(MatchmakerModels.AuthUserRequest)) { if (_instance.OnMatchmakerAuthUserRequestEvent != null) { _instance.OnMatchmakerAuthUserRequestEvent((MatchmakerModels.AuthUserRequest)e.Request); return; } }
if (type == typeof(MatchmakerModels.PlayerJoinedRequest)) { if (_instance.OnMatchmakerPlayerJoinedRequestEvent != null) { _instance.OnMatchmakerPlayerJoinedRequestEvent((MatchmakerModels.PlayerJoinedRequest)e.Request); return; } }
if (type == typeof(MatchmakerModels.PlayerLeftRequest)) { if (_instance.OnMatchmakerPlayerLeftRequestEvent != null) { _instance.OnMatchmakerPlayerLeftRequestEvent((MatchmakerModels.PlayerLeftRequest)e.Request); return; } }
if (type == typeof(MatchmakerModels.StartGameRequest)) { if (_instance.OnMatchmakerStartGameRequestEvent != null) { _instance.OnMatchmakerStartGameRequestEvent((MatchmakerModels.StartGameRequest)e.Request); return; } }
if (type == typeof(MatchmakerModels.UserInfoRequest)) { if (_instance.OnMatchmakerUserInfoRequestEvent != null) { _instance.OnMatchmakerUserInfoRequestEvent((MatchmakerModels.UserInfoRequest)e.Request); return; } }
#endif
#if ENABLE_PLAYFABSERVER_API
if (type == typeof(ServerModels.AuthenticateSessionTicketRequest)) { if (_instance.OnServerAuthenticateSessionTicketRequestEvent != null) { _instance.OnServerAuthenticateSessionTicketRequestEvent((ServerModels.AuthenticateSessionTicketRequest)e.Request); return; } }
if (type == typeof(ServerModels.BanUsersRequest)) { if (_instance.OnServerBanUsersRequestEvent != null) { _instance.OnServerBanUsersRequestEvent((ServerModels.BanUsersRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPlayFabIDsFromFacebookIDsRequest)) { if (_instance.OnServerGetPlayFabIDsFromFacebookIDsRequestEvent != null) { _instance.OnServerGetPlayFabIDsFromFacebookIDsRequestEvent((ServerModels.GetPlayFabIDsFromFacebookIDsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPlayFabIDsFromSteamIDsRequest)) { if (_instance.OnServerGetPlayFabIDsFromSteamIDsRequestEvent != null) { _instance.OnServerGetPlayFabIDsFromSteamIDsRequestEvent((ServerModels.GetPlayFabIDsFromSteamIDsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserAccountInfoRequest)) { if (_instance.OnServerGetUserAccountInfoRequestEvent != null) { _instance.OnServerGetUserAccountInfoRequestEvent((ServerModels.GetUserAccountInfoRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserBansRequest)) { if (_instance.OnServerGetUserBansRequestEvent != null) { _instance.OnServerGetUserBansRequestEvent((ServerModels.GetUserBansRequest)e.Request); return; } }
if (type == typeof(ServerModels.RevokeAllBansForUserRequest)) { if (_instance.OnServerRevokeAllBansForUserRequestEvent != null) { _instance.OnServerRevokeAllBansForUserRequestEvent((ServerModels.RevokeAllBansForUserRequest)e.Request); return; } }
if (type == typeof(ServerModels.RevokeBansRequest)) { if (_instance.OnServerRevokeBansRequestEvent != null) { _instance.OnServerRevokeBansRequestEvent((ServerModels.RevokeBansRequest)e.Request); return; } }
if (type == typeof(ServerModels.SendPushNotificationRequest)) { if (_instance.OnServerSendPushNotificationRequestEvent != null) { _instance.OnServerSendPushNotificationRequestEvent((ServerModels.SendPushNotificationRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateBansRequest)) { if (_instance.OnServerUpdateBansRequestEvent != null) { _instance.OnServerUpdateBansRequestEvent((ServerModels.UpdateBansRequest)e.Request); return; } }
if (type == typeof(ServerModels.DeleteUsersRequest)) { if (_instance.OnServerDeleteUsersRequestEvent != null) { _instance.OnServerDeleteUsersRequestEvent((ServerModels.DeleteUsersRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetFriendLeaderboardRequest)) { if (_instance.OnServerGetFriendLeaderboardRequestEvent != null) { _instance.OnServerGetFriendLeaderboardRequestEvent((ServerModels.GetFriendLeaderboardRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetLeaderboardRequest)) { if (_instance.OnServerGetLeaderboardRequestEvent != null) { _instance.OnServerGetLeaderboardRequestEvent((ServerModels.GetLeaderboardRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetLeaderboardAroundUserRequest)) { if (_instance.OnServerGetLeaderboardAroundUserRequestEvent != null) { _instance.OnServerGetLeaderboardAroundUserRequestEvent((ServerModels.GetLeaderboardAroundUserRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPlayerCombinedInfoRequest)) { if (_instance.OnServerGetPlayerCombinedInfoRequestEvent != null) { _instance.OnServerGetPlayerCombinedInfoRequestEvent((ServerModels.GetPlayerCombinedInfoRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPlayerStatisticsRequest)) { if (_instance.OnServerGetPlayerStatisticsRequestEvent != null) { _instance.OnServerGetPlayerStatisticsRequestEvent((ServerModels.GetPlayerStatisticsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPlayerStatisticVersionsRequest)) { if (_instance.OnServerGetPlayerStatisticVersionsRequestEvent != null) { _instance.OnServerGetPlayerStatisticVersionsRequestEvent((ServerModels.GetPlayerStatisticVersionsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserDataRequest)) { if (_instance.OnServerGetUserDataRequestEvent != null) { _instance.OnServerGetUserDataRequestEvent((ServerModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserDataRequest)) { if (_instance.OnServerGetUserInternalDataRequestEvent != null) { _instance.OnServerGetUserInternalDataRequestEvent((ServerModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserDataRequest)) { if (_instance.OnServerGetUserPublisherDataRequestEvent != null) { _instance.OnServerGetUserPublisherDataRequestEvent((ServerModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserDataRequest)) { if (_instance.OnServerGetUserPublisherInternalDataRequestEvent != null) { _instance.OnServerGetUserPublisherInternalDataRequestEvent((ServerModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserDataRequest)) { if (_instance.OnServerGetUserPublisherReadOnlyDataRequestEvent != null) { _instance.OnServerGetUserPublisherReadOnlyDataRequestEvent((ServerModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserDataRequest)) { if (_instance.OnServerGetUserReadOnlyDataRequestEvent != null) { _instance.OnServerGetUserReadOnlyDataRequestEvent((ServerModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserStatisticsRequest)) { if (_instance.OnServerGetUserStatisticsRequestEvent != null) { _instance.OnServerGetUserStatisticsRequestEvent((ServerModels.GetUserStatisticsRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdatePlayerStatisticsRequest)) { if (_instance.OnServerUpdatePlayerStatisticsRequestEvent != null) { _instance.OnServerUpdatePlayerStatisticsRequestEvent((ServerModels.UpdatePlayerStatisticsRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateUserDataRequest)) { if (_instance.OnServerUpdateUserDataRequestEvent != null) { _instance.OnServerUpdateUserDataRequestEvent((ServerModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateUserInternalDataRequest)) { if (_instance.OnServerUpdateUserInternalDataRequestEvent != null) { _instance.OnServerUpdateUserInternalDataRequestEvent((ServerModels.UpdateUserInternalDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateUserDataRequest)) { if (_instance.OnServerUpdateUserPublisherDataRequestEvent != null) { _instance.OnServerUpdateUserPublisherDataRequestEvent((ServerModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateUserInternalDataRequest)) { if (_instance.OnServerUpdateUserPublisherInternalDataRequestEvent != null) { _instance.OnServerUpdateUserPublisherInternalDataRequestEvent((ServerModels.UpdateUserInternalDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateUserDataRequest)) { if (_instance.OnServerUpdateUserPublisherReadOnlyDataRequestEvent != null) { _instance.OnServerUpdateUserPublisherReadOnlyDataRequestEvent((ServerModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateUserDataRequest)) { if (_instance.OnServerUpdateUserReadOnlyDataRequestEvent != null) { _instance.OnServerUpdateUserReadOnlyDataRequestEvent((ServerModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateUserStatisticsRequest)) { if (_instance.OnServerUpdateUserStatisticsRequestEvent != null) { _instance.OnServerUpdateUserStatisticsRequestEvent((ServerModels.UpdateUserStatisticsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetCatalogItemsRequest)) { if (_instance.OnServerGetCatalogItemsRequestEvent != null) { _instance.OnServerGetCatalogItemsRequestEvent((ServerModels.GetCatalogItemsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPublisherDataRequest)) { if (_instance.OnServerGetPublisherDataRequestEvent != null) { _instance.OnServerGetPublisherDataRequestEvent((ServerModels.GetPublisherDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetTimeRequest)) { if (_instance.OnServerGetTimeRequestEvent != null) { _instance.OnServerGetTimeRequestEvent((ServerModels.GetTimeRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetTitleDataRequest)) { if (_instance.OnServerGetTitleDataRequestEvent != null) { _instance.OnServerGetTitleDataRequestEvent((ServerModels.GetTitleDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetTitleDataRequest)) { if (_instance.OnServerGetTitleInternalDataRequestEvent != null) { _instance.OnServerGetTitleInternalDataRequestEvent((ServerModels.GetTitleDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetTitleNewsRequest)) { if (_instance.OnServerGetTitleNewsRequestEvent != null) { _instance.OnServerGetTitleNewsRequestEvent((ServerModels.GetTitleNewsRequest)e.Request); return; } }
if (type == typeof(ServerModels.SetPublisherDataRequest)) { if (_instance.OnServerSetPublisherDataRequestEvent != null) { _instance.OnServerSetPublisherDataRequestEvent((ServerModels.SetPublisherDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.SetTitleDataRequest)) { if (_instance.OnServerSetTitleDataRequestEvent != null) { _instance.OnServerSetTitleDataRequestEvent((ServerModels.SetTitleDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.SetTitleDataRequest)) { if (_instance.OnServerSetTitleInternalDataRequestEvent != null) { _instance.OnServerSetTitleInternalDataRequestEvent((ServerModels.SetTitleDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.AddCharacterVirtualCurrencyRequest)) { if (_instance.OnServerAddCharacterVirtualCurrencyRequestEvent != null) { _instance.OnServerAddCharacterVirtualCurrencyRequestEvent((ServerModels.AddCharacterVirtualCurrencyRequest)e.Request); return; } }
if (type == typeof(ServerModels.AddUserVirtualCurrencyRequest)) { if (_instance.OnServerAddUserVirtualCurrencyRequestEvent != null) { _instance.OnServerAddUserVirtualCurrencyRequestEvent((ServerModels.AddUserVirtualCurrencyRequest)e.Request); return; } }
if (type == typeof(ServerModels.ConsumeItemRequest)) { if (_instance.OnServerConsumeItemRequestEvent != null) { _instance.OnServerConsumeItemRequestEvent((ServerModels.ConsumeItemRequest)e.Request); return; } }
if (type == typeof(ServerModels.EvaluateRandomResultTableRequest)) { if (_instance.OnServerEvaluateRandomResultTableRequestEvent != null) { _instance.OnServerEvaluateRandomResultTableRequestEvent((ServerModels.EvaluateRandomResultTableRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetCharacterInventoryRequest)) { if (_instance.OnServerGetCharacterInventoryRequestEvent != null) { _instance.OnServerGetCharacterInventoryRequestEvent((ServerModels.GetCharacterInventoryRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetRandomResultTablesRequest)) { if (_instance.OnServerGetRandomResultTablesRequestEvent != null) { _instance.OnServerGetRandomResultTablesRequestEvent((ServerModels.GetRandomResultTablesRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetUserInventoryRequest)) { if (_instance.OnServerGetUserInventoryRequestEvent != null) { _instance.OnServerGetUserInventoryRequestEvent((ServerModels.GetUserInventoryRequest)e.Request); return; } }
if (type == typeof(ServerModels.GrantItemsToCharacterRequest)) { if (_instance.OnServerGrantItemsToCharacterRequestEvent != null) { _instance.OnServerGrantItemsToCharacterRequestEvent((ServerModels.GrantItemsToCharacterRequest)e.Request); return; } }
if (type == typeof(ServerModels.GrantItemsToUserRequest)) { if (_instance.OnServerGrantItemsToUserRequestEvent != null) { _instance.OnServerGrantItemsToUserRequestEvent((ServerModels.GrantItemsToUserRequest)e.Request); return; } }
if (type == typeof(ServerModels.GrantItemsToUsersRequest)) { if (_instance.OnServerGrantItemsToUsersRequestEvent != null) { _instance.OnServerGrantItemsToUsersRequestEvent((ServerModels.GrantItemsToUsersRequest)e.Request); return; } }
if (type == typeof(ServerModels.ModifyItemUsesRequest)) { if (_instance.OnServerModifyItemUsesRequestEvent != null) { _instance.OnServerModifyItemUsesRequestEvent((ServerModels.ModifyItemUsesRequest)e.Request); return; } }
if (type == typeof(ServerModels.MoveItemToCharacterFromCharacterRequest)) { if (_instance.OnServerMoveItemToCharacterFromCharacterRequestEvent != null) { _instance.OnServerMoveItemToCharacterFromCharacterRequestEvent((ServerModels.MoveItemToCharacterFromCharacterRequest)e.Request); return; } }
if (type == typeof(ServerModels.MoveItemToCharacterFromUserRequest)) { if (_instance.OnServerMoveItemToCharacterFromUserRequestEvent != null) { _instance.OnServerMoveItemToCharacterFromUserRequestEvent((ServerModels.MoveItemToCharacterFromUserRequest)e.Request); return; } }
if (type == typeof(ServerModels.MoveItemToUserFromCharacterRequest)) { if (_instance.OnServerMoveItemToUserFromCharacterRequestEvent != null) { _instance.OnServerMoveItemToUserFromCharacterRequestEvent((ServerModels.MoveItemToUserFromCharacterRequest)e.Request); return; } }
if (type == typeof(ServerModels.RedeemCouponRequest)) { if (_instance.OnServerRedeemCouponRequestEvent != null) { _instance.OnServerRedeemCouponRequestEvent((ServerModels.RedeemCouponRequest)e.Request); return; } }
if (type == typeof(ServerModels.ReportPlayerServerRequest)) { if (_instance.OnServerReportPlayerRequestEvent != null) { _instance.OnServerReportPlayerRequestEvent((ServerModels.ReportPlayerServerRequest)e.Request); return; } }
if (type == typeof(ServerModels.RevokeInventoryItemRequest)) { if (_instance.OnServerRevokeInventoryItemRequestEvent != null) { _instance.OnServerRevokeInventoryItemRequestEvent((ServerModels.RevokeInventoryItemRequest)e.Request); return; } }
if (type == typeof(ServerModels.SubtractCharacterVirtualCurrencyRequest)) { if (_instance.OnServerSubtractCharacterVirtualCurrencyRequestEvent != null) { _instance.OnServerSubtractCharacterVirtualCurrencyRequestEvent((ServerModels.SubtractCharacterVirtualCurrencyRequest)e.Request); return; } }
if (type == typeof(ServerModels.SubtractUserVirtualCurrencyRequest)) { if (_instance.OnServerSubtractUserVirtualCurrencyRequestEvent != null) { _instance.OnServerSubtractUserVirtualCurrencyRequestEvent((ServerModels.SubtractUserVirtualCurrencyRequest)e.Request); return; } }
if (type == typeof(ServerModels.UnlockContainerInstanceRequest)) { if (_instance.OnServerUnlockContainerInstanceRequestEvent != null) { _instance.OnServerUnlockContainerInstanceRequestEvent((ServerModels.UnlockContainerInstanceRequest)e.Request); return; } }
if (type == typeof(ServerModels.UnlockContainerItemRequest)) { if (_instance.OnServerUnlockContainerItemRequestEvent != null) { _instance.OnServerUnlockContainerItemRequestEvent((ServerModels.UnlockContainerItemRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateUserInventoryItemDataRequest)) { if (_instance.OnServerUpdateUserInventoryItemCustomDataRequestEvent != null) { _instance.OnServerUpdateUserInventoryItemCustomDataRequestEvent((ServerModels.UpdateUserInventoryItemDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.AddFriendRequest)) { if (_instance.OnServerAddFriendRequestEvent != null) { _instance.OnServerAddFriendRequestEvent((ServerModels.AddFriendRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetFriendsListRequest)) { if (_instance.OnServerGetFriendsListRequestEvent != null) { _instance.OnServerGetFriendsListRequestEvent((ServerModels.GetFriendsListRequest)e.Request); return; } }
if (type == typeof(ServerModels.RemoveFriendRequest)) { if (_instance.OnServerRemoveFriendRequestEvent != null) { _instance.OnServerRemoveFriendRequestEvent((ServerModels.RemoveFriendRequest)e.Request); return; } }
if (type == typeof(ServerModels.DeregisterGameRequest)) { if (_instance.OnServerDeregisterGameRequestEvent != null) { _instance.OnServerDeregisterGameRequestEvent((ServerModels.DeregisterGameRequest)e.Request); return; } }
if (type == typeof(ServerModels.NotifyMatchmakerPlayerLeftRequest)) { if (_instance.OnServerNotifyMatchmakerPlayerLeftRequestEvent != null) { _instance.OnServerNotifyMatchmakerPlayerLeftRequestEvent((ServerModels.NotifyMatchmakerPlayerLeftRequest)e.Request); return; } }
if (type == typeof(ServerModels.RedeemMatchmakerTicketRequest)) { if (_instance.OnServerRedeemMatchmakerTicketRequestEvent != null) { _instance.OnServerRedeemMatchmakerTicketRequestEvent((ServerModels.RedeemMatchmakerTicketRequest)e.Request); return; } }
if (type == typeof(ServerModels.RefreshGameServerInstanceHeartbeatRequest)) { if (_instance.OnServerRefreshGameServerInstanceHeartbeatRequestEvent != null) { _instance.OnServerRefreshGameServerInstanceHeartbeatRequestEvent((ServerModels.RefreshGameServerInstanceHeartbeatRequest)e.Request); return; } }
if (type == typeof(ServerModels.RegisterGameRequest)) { if (_instance.OnServerRegisterGameRequestEvent != null) { _instance.OnServerRegisterGameRequestEvent((ServerModels.RegisterGameRequest)e.Request); return; } }
if (type == typeof(ServerModels.SetGameServerInstanceDataRequest)) { if (_instance.OnServerSetGameServerInstanceDataRequestEvent != null) { _instance.OnServerSetGameServerInstanceDataRequestEvent((ServerModels.SetGameServerInstanceDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.SetGameServerInstanceStateRequest)) { if (_instance.OnServerSetGameServerInstanceStateRequestEvent != null) { _instance.OnServerSetGameServerInstanceStateRequestEvent((ServerModels.SetGameServerInstanceStateRequest)e.Request); return; } }
if (type == typeof(ServerModels.SetGameServerInstanceTagsRequest)) { if (_instance.OnServerSetGameServerInstanceTagsRequestEvent != null) { _instance.OnServerSetGameServerInstanceTagsRequestEvent((ServerModels.SetGameServerInstanceTagsRequest)e.Request); return; } }
if (type == typeof(ServerModels.AwardSteamAchievementRequest)) { if (_instance.OnServerAwardSteamAchievementRequestEvent != null) { _instance.OnServerAwardSteamAchievementRequestEvent((ServerModels.AwardSteamAchievementRequest)e.Request); return; } }
if (type == typeof(ServerModels.LogEventRequest)) { if (_instance.OnServerLogEventRequestEvent != null) { _instance.OnServerLogEventRequestEvent((ServerModels.LogEventRequest)e.Request); return; } }
if (type == typeof(ServerModels.WriteServerCharacterEventRequest)) { if (_instance.OnServerWriteCharacterEventRequestEvent != null) { _instance.OnServerWriteCharacterEventRequestEvent((ServerModels.WriteServerCharacterEventRequest)e.Request); return; } }
if (type == typeof(ServerModels.WriteServerPlayerEventRequest)) { if (_instance.OnServerWritePlayerEventRequestEvent != null) { _instance.OnServerWritePlayerEventRequestEvent((ServerModels.WriteServerPlayerEventRequest)e.Request); return; } }
if (type == typeof(ServerModels.WriteTitleEventRequest)) { if (_instance.OnServerWriteTitleEventRequestEvent != null) { _instance.OnServerWriteTitleEventRequestEvent((ServerModels.WriteTitleEventRequest)e.Request); return; } }
if (type == typeof(ServerModels.AddSharedGroupMembersRequest)) { if (_instance.OnServerAddSharedGroupMembersRequestEvent != null) { _instance.OnServerAddSharedGroupMembersRequestEvent((ServerModels.AddSharedGroupMembersRequest)e.Request); return; } }
if (type == typeof(ServerModels.CreateSharedGroupRequest)) { if (_instance.OnServerCreateSharedGroupRequestEvent != null) { _instance.OnServerCreateSharedGroupRequestEvent((ServerModels.CreateSharedGroupRequest)e.Request); return; } }
if (type == typeof(ServerModels.DeleteSharedGroupRequest)) { if (_instance.OnServerDeleteSharedGroupRequestEvent != null) { _instance.OnServerDeleteSharedGroupRequestEvent((ServerModels.DeleteSharedGroupRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetSharedGroupDataRequest)) { if (_instance.OnServerGetSharedGroupDataRequestEvent != null) { _instance.OnServerGetSharedGroupDataRequestEvent((ServerModels.GetSharedGroupDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.RemoveSharedGroupMembersRequest)) { if (_instance.OnServerRemoveSharedGroupMembersRequestEvent != null) { _instance.OnServerRemoveSharedGroupMembersRequestEvent((ServerModels.RemoveSharedGroupMembersRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateSharedGroupDataRequest)) { if (_instance.OnServerUpdateSharedGroupDataRequestEvent != null) { _instance.OnServerUpdateSharedGroupDataRequestEvent((ServerModels.UpdateSharedGroupDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.ExecuteCloudScriptServerRequest)) { if (_instance.OnServerExecuteCloudScriptRequestEvent != null) { _instance.OnServerExecuteCloudScriptRequestEvent((ServerModels.ExecuteCloudScriptServerRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetContentDownloadUrlRequest)) { if (_instance.OnServerGetContentDownloadUrlRequestEvent != null) { _instance.OnServerGetContentDownloadUrlRequestEvent((ServerModels.GetContentDownloadUrlRequest)e.Request); return; } }
if (type == typeof(ServerModels.DeleteCharacterFromUserRequest)) { if (_instance.OnServerDeleteCharacterFromUserRequestEvent != null) { _instance.OnServerDeleteCharacterFromUserRequestEvent((ServerModels.DeleteCharacterFromUserRequest)e.Request); return; } }
if (type == typeof(ServerModels.ListUsersCharactersRequest)) { if (_instance.OnServerGetAllUsersCharactersRequestEvent != null) { _instance.OnServerGetAllUsersCharactersRequestEvent((ServerModels.ListUsersCharactersRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetCharacterLeaderboardRequest)) { if (_instance.OnServerGetCharacterLeaderboardRequestEvent != null) { _instance.OnServerGetCharacterLeaderboardRequestEvent((ServerModels.GetCharacterLeaderboardRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetCharacterStatisticsRequest)) { if (_instance.OnServerGetCharacterStatisticsRequestEvent != null) { _instance.OnServerGetCharacterStatisticsRequestEvent((ServerModels.GetCharacterStatisticsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetLeaderboardAroundCharacterRequest)) { if (_instance.OnServerGetLeaderboardAroundCharacterRequestEvent != null) { _instance.OnServerGetLeaderboardAroundCharacterRequestEvent((ServerModels.GetLeaderboardAroundCharacterRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetLeaderboardForUsersCharactersRequest)) { if (_instance.OnServerGetLeaderboardForUserCharactersRequestEvent != null) { _instance.OnServerGetLeaderboardForUserCharactersRequestEvent((ServerModels.GetLeaderboardForUsersCharactersRequest)e.Request); return; } }
if (type == typeof(ServerModels.GrantCharacterToUserRequest)) { if (_instance.OnServerGrantCharacterToUserRequestEvent != null) { _instance.OnServerGrantCharacterToUserRequestEvent((ServerModels.GrantCharacterToUserRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateCharacterStatisticsRequest)) { if (_instance.OnServerUpdateCharacterStatisticsRequestEvent != null) { _instance.OnServerUpdateCharacterStatisticsRequestEvent((ServerModels.UpdateCharacterStatisticsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetCharacterDataRequest)) { if (_instance.OnServerGetCharacterDataRequestEvent != null) { _instance.OnServerGetCharacterDataRequestEvent((ServerModels.GetCharacterDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetCharacterDataRequest)) { if (_instance.OnServerGetCharacterInternalDataRequestEvent != null) { _instance.OnServerGetCharacterInternalDataRequestEvent((ServerModels.GetCharacterDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetCharacterDataRequest)) { if (_instance.OnServerGetCharacterReadOnlyDataRequestEvent != null) { _instance.OnServerGetCharacterReadOnlyDataRequestEvent((ServerModels.GetCharacterDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateCharacterDataRequest)) { if (_instance.OnServerUpdateCharacterDataRequestEvent != null) { _instance.OnServerUpdateCharacterDataRequestEvent((ServerModels.UpdateCharacterDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateCharacterDataRequest)) { if (_instance.OnServerUpdateCharacterInternalDataRequestEvent != null) { _instance.OnServerUpdateCharacterInternalDataRequestEvent((ServerModels.UpdateCharacterDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.UpdateCharacterDataRequest)) { if (_instance.OnServerUpdateCharacterReadOnlyDataRequestEvent != null) { _instance.OnServerUpdateCharacterReadOnlyDataRequestEvent((ServerModels.UpdateCharacterDataRequest)e.Request); return; } }
if (type == typeof(ServerModels.AddPlayerTagRequest)) { if (_instance.OnServerAddPlayerTagRequestEvent != null) { _instance.OnServerAddPlayerTagRequestEvent((ServerModels.AddPlayerTagRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetAllActionGroupsRequest)) { if (_instance.OnServerGetAllActionGroupsRequestEvent != null) { _instance.OnServerGetAllActionGroupsRequestEvent((ServerModels.GetAllActionGroupsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetAllSegmentsRequest)) { if (_instance.OnServerGetAllSegmentsRequestEvent != null) { _instance.OnServerGetAllSegmentsRequestEvent((ServerModels.GetAllSegmentsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPlayersSegmentsRequest)) { if (_instance.OnServerGetPlayerSegmentsRequestEvent != null) { _instance.OnServerGetPlayerSegmentsRequestEvent((ServerModels.GetPlayersSegmentsRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPlayersInSegmentRequest)) { if (_instance.OnServerGetPlayersInSegmentRequestEvent != null) { _instance.OnServerGetPlayersInSegmentRequestEvent((ServerModels.GetPlayersInSegmentRequest)e.Request); return; } }
if (type == typeof(ServerModels.GetPlayerTagsRequest)) { if (_instance.OnServerGetPlayerTagsRequestEvent != null) { _instance.OnServerGetPlayerTagsRequestEvent((ServerModels.GetPlayerTagsRequest)e.Request); return; } }
if (type == typeof(ServerModels.RemovePlayerTagRequest)) { if (_instance.OnServerRemovePlayerTagRequestEvent != null) { _instance.OnServerRemovePlayerTagRequestEvent((ServerModels.RemovePlayerTagRequest)e.Request); return; } }
#endif
#if !DISABLE_PLAYFABCLIENT_API
if (type == typeof(ClientModels.GetPhotonAuthenticationTokenRequest)) { if (_instance.OnGetPhotonAuthenticationTokenRequestEvent != null) { _instance.OnGetPhotonAuthenticationTokenRequestEvent((ClientModels.GetPhotonAuthenticationTokenRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithAndroidDeviceIDRequest)) { if (_instance.OnLoginWithAndroidDeviceIDRequestEvent != null) { _instance.OnLoginWithAndroidDeviceIDRequestEvent((ClientModels.LoginWithAndroidDeviceIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithCustomIDRequest)) { if (_instance.OnLoginWithCustomIDRequestEvent != null) { _instance.OnLoginWithCustomIDRequestEvent((ClientModels.LoginWithCustomIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithEmailAddressRequest)) { if (_instance.OnLoginWithEmailAddressRequestEvent != null) { _instance.OnLoginWithEmailAddressRequestEvent((ClientModels.LoginWithEmailAddressRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithFacebookRequest)) { if (_instance.OnLoginWithFacebookRequestEvent != null) { _instance.OnLoginWithFacebookRequestEvent((ClientModels.LoginWithFacebookRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithGameCenterRequest)) { if (_instance.OnLoginWithGameCenterRequestEvent != null) { _instance.OnLoginWithGameCenterRequestEvent((ClientModels.LoginWithGameCenterRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithGoogleAccountRequest)) { if (_instance.OnLoginWithGoogleAccountRequestEvent != null) { _instance.OnLoginWithGoogleAccountRequestEvent((ClientModels.LoginWithGoogleAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithIOSDeviceIDRequest)) { if (_instance.OnLoginWithIOSDeviceIDRequestEvent != null) { _instance.OnLoginWithIOSDeviceIDRequestEvent((ClientModels.LoginWithIOSDeviceIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithKongregateRequest)) { if (_instance.OnLoginWithKongregateRequestEvent != null) { _instance.OnLoginWithKongregateRequestEvent((ClientModels.LoginWithKongregateRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithPlayFabRequest)) { if (_instance.OnLoginWithPlayFabRequestEvent != null) { _instance.OnLoginWithPlayFabRequestEvent((ClientModels.LoginWithPlayFabRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithSteamRequest)) { if (_instance.OnLoginWithSteamRequestEvent != null) { _instance.OnLoginWithSteamRequestEvent((ClientModels.LoginWithSteamRequest)e.Request); return; } }
if (type == typeof(ClientModels.LoginWithTwitchRequest)) { if (_instance.OnLoginWithTwitchRequestEvent != null) { _instance.OnLoginWithTwitchRequestEvent((ClientModels.LoginWithTwitchRequest)e.Request); return; } }
if (type == typeof(ClientModels.RegisterPlayFabUserRequest)) { if (_instance.OnRegisterPlayFabUserRequestEvent != null) { _instance.OnRegisterPlayFabUserRequestEvent((ClientModels.RegisterPlayFabUserRequest)e.Request); return; } }
if (type == typeof(ClientModels.AddGenericIDRequest)) { if (_instance.OnAddGenericIDRequestEvent != null) { _instance.OnAddGenericIDRequestEvent((ClientModels.AddGenericIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.AddUsernamePasswordRequest)) { if (_instance.OnAddUsernamePasswordRequestEvent != null) { _instance.OnAddUsernamePasswordRequestEvent((ClientModels.AddUsernamePasswordRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetAccountInfoRequest)) { if (_instance.OnGetAccountInfoRequestEvent != null) { _instance.OnGetAccountInfoRequestEvent((ClientModels.GetAccountInfoRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayerCombinedInfoRequest)) { if (_instance.OnGetPlayerCombinedInfoRequestEvent != null) { _instance.OnGetPlayerCombinedInfoRequestEvent((ClientModels.GetPlayerCombinedInfoRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromFacebookIDsRequest)) { if (_instance.OnGetPlayFabIDsFromFacebookIDsRequestEvent != null) { _instance.OnGetPlayFabIDsFromFacebookIDsRequestEvent((ClientModels.GetPlayFabIDsFromFacebookIDsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromGameCenterIDsRequest)) { if (_instance.OnGetPlayFabIDsFromGameCenterIDsRequestEvent != null) { _instance.OnGetPlayFabIDsFromGameCenterIDsRequestEvent((ClientModels.GetPlayFabIDsFromGameCenterIDsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromGenericIDsRequest)) { if (_instance.OnGetPlayFabIDsFromGenericIDsRequestEvent != null) { _instance.OnGetPlayFabIDsFromGenericIDsRequestEvent((ClientModels.GetPlayFabIDsFromGenericIDsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromGoogleIDsRequest)) { if (_instance.OnGetPlayFabIDsFromGoogleIDsRequestEvent != null) { _instance.OnGetPlayFabIDsFromGoogleIDsRequestEvent((ClientModels.GetPlayFabIDsFromGoogleIDsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromKongregateIDsRequest)) { if (_instance.OnGetPlayFabIDsFromKongregateIDsRequestEvent != null) { _instance.OnGetPlayFabIDsFromKongregateIDsRequestEvent((ClientModels.GetPlayFabIDsFromKongregateIDsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromSteamIDsRequest)) { if (_instance.OnGetPlayFabIDsFromSteamIDsRequestEvent != null) { _instance.OnGetPlayFabIDsFromSteamIDsRequestEvent((ClientModels.GetPlayFabIDsFromSteamIDsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromTwitchIDsRequest)) { if (_instance.OnGetPlayFabIDsFromTwitchIDsRequestEvent != null) { _instance.OnGetPlayFabIDsFromTwitchIDsRequestEvent((ClientModels.GetPlayFabIDsFromTwitchIDsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetUserCombinedInfoRequest)) { if (_instance.OnGetUserCombinedInfoRequestEvent != null) { _instance.OnGetUserCombinedInfoRequestEvent((ClientModels.GetUserCombinedInfoRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkAndroidDeviceIDRequest)) { if (_instance.OnLinkAndroidDeviceIDRequestEvent != null) { _instance.OnLinkAndroidDeviceIDRequestEvent((ClientModels.LinkAndroidDeviceIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkCustomIDRequest)) { if (_instance.OnLinkCustomIDRequestEvent != null) { _instance.OnLinkCustomIDRequestEvent((ClientModels.LinkCustomIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkFacebookAccountRequest)) { if (_instance.OnLinkFacebookAccountRequestEvent != null) { _instance.OnLinkFacebookAccountRequestEvent((ClientModels.LinkFacebookAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkGameCenterAccountRequest)) { if (_instance.OnLinkGameCenterAccountRequestEvent != null) { _instance.OnLinkGameCenterAccountRequestEvent((ClientModels.LinkGameCenterAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkGoogleAccountRequest)) { if (_instance.OnLinkGoogleAccountRequestEvent != null) { _instance.OnLinkGoogleAccountRequestEvent((ClientModels.LinkGoogleAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkIOSDeviceIDRequest)) { if (_instance.OnLinkIOSDeviceIDRequestEvent != null) { _instance.OnLinkIOSDeviceIDRequestEvent((ClientModels.LinkIOSDeviceIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkKongregateAccountRequest)) { if (_instance.OnLinkKongregateRequestEvent != null) { _instance.OnLinkKongregateRequestEvent((ClientModels.LinkKongregateAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkSteamAccountRequest)) { if (_instance.OnLinkSteamAccountRequestEvent != null) { _instance.OnLinkSteamAccountRequestEvent((ClientModels.LinkSteamAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.LinkTwitchAccountRequest)) { if (_instance.OnLinkTwitchRequestEvent != null) { _instance.OnLinkTwitchRequestEvent((ClientModels.LinkTwitchAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.RemoveGenericIDRequest)) { if (_instance.OnRemoveGenericIDRequestEvent != null) { _instance.OnRemoveGenericIDRequestEvent((ClientModels.RemoveGenericIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.ReportPlayerClientRequest)) { if (_instance.OnReportPlayerRequestEvent != null) { _instance.OnReportPlayerRequestEvent((ClientModels.ReportPlayerClientRequest)e.Request); return; } }
if (type == typeof(ClientModels.SendAccountRecoveryEmailRequest)) { if (_instance.OnSendAccountRecoveryEmailRequestEvent != null) { _instance.OnSendAccountRecoveryEmailRequestEvent((ClientModels.SendAccountRecoveryEmailRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkAndroidDeviceIDRequest)) { if (_instance.OnUnlinkAndroidDeviceIDRequestEvent != null) { _instance.OnUnlinkAndroidDeviceIDRequestEvent((ClientModels.UnlinkAndroidDeviceIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkCustomIDRequest)) { if (_instance.OnUnlinkCustomIDRequestEvent != null) { _instance.OnUnlinkCustomIDRequestEvent((ClientModels.UnlinkCustomIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkFacebookAccountRequest)) { if (_instance.OnUnlinkFacebookAccountRequestEvent != null) { _instance.OnUnlinkFacebookAccountRequestEvent((ClientModels.UnlinkFacebookAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkGameCenterAccountRequest)) { if (_instance.OnUnlinkGameCenterAccountRequestEvent != null) { _instance.OnUnlinkGameCenterAccountRequestEvent((ClientModels.UnlinkGameCenterAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkGoogleAccountRequest)) { if (_instance.OnUnlinkGoogleAccountRequestEvent != null) { _instance.OnUnlinkGoogleAccountRequestEvent((ClientModels.UnlinkGoogleAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkIOSDeviceIDRequest)) { if (_instance.OnUnlinkIOSDeviceIDRequestEvent != null) { _instance.OnUnlinkIOSDeviceIDRequestEvent((ClientModels.UnlinkIOSDeviceIDRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkKongregateAccountRequest)) { if (_instance.OnUnlinkKongregateRequestEvent != null) { _instance.OnUnlinkKongregateRequestEvent((ClientModels.UnlinkKongregateAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkSteamAccountRequest)) { if (_instance.OnUnlinkSteamAccountRequestEvent != null) { _instance.OnUnlinkSteamAccountRequestEvent((ClientModels.UnlinkSteamAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlinkTwitchAccountRequest)) { if (_instance.OnUnlinkTwitchRequestEvent != null) { _instance.OnUnlinkTwitchRequestEvent((ClientModels.UnlinkTwitchAccountRequest)e.Request); return; } }
if (type == typeof(ClientModels.UpdateUserTitleDisplayNameRequest)) { if (_instance.OnUpdateUserTitleDisplayNameRequestEvent != null) { _instance.OnUpdateUserTitleDisplayNameRequestEvent((ClientModels.UpdateUserTitleDisplayNameRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetFriendLeaderboardRequest)) { if (_instance.OnGetFriendLeaderboardRequestEvent != null) { _instance.OnGetFriendLeaderboardRequestEvent((ClientModels.GetFriendLeaderboardRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetFriendLeaderboardAroundCurrentUserRequest)) { if (_instance.OnGetFriendLeaderboardAroundCurrentUserRequestEvent != null) { _instance.OnGetFriendLeaderboardAroundCurrentUserRequestEvent((ClientModels.GetFriendLeaderboardAroundCurrentUserRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetFriendLeaderboardAroundPlayerRequest)) { if (_instance.OnGetFriendLeaderboardAroundPlayerRequestEvent != null) { _instance.OnGetFriendLeaderboardAroundPlayerRequestEvent((ClientModels.GetFriendLeaderboardAroundPlayerRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetLeaderboardRequest)) { if (_instance.OnGetLeaderboardRequestEvent != null) { _instance.OnGetLeaderboardRequestEvent((ClientModels.GetLeaderboardRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetLeaderboardAroundCurrentUserRequest)) { if (_instance.OnGetLeaderboardAroundCurrentUserRequestEvent != null) { _instance.OnGetLeaderboardAroundCurrentUserRequestEvent((ClientModels.GetLeaderboardAroundCurrentUserRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetLeaderboardAroundPlayerRequest)) { if (_instance.OnGetLeaderboardAroundPlayerRequestEvent != null) { _instance.OnGetLeaderboardAroundPlayerRequestEvent((ClientModels.GetLeaderboardAroundPlayerRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayerStatisticsRequest)) { if (_instance.OnGetPlayerStatisticsRequestEvent != null) { _instance.OnGetPlayerStatisticsRequestEvent((ClientModels.GetPlayerStatisticsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayerStatisticVersionsRequest)) { if (_instance.OnGetPlayerStatisticVersionsRequestEvent != null) { _instance.OnGetPlayerStatisticVersionsRequestEvent((ClientModels.GetPlayerStatisticVersionsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetUserDataRequest)) { if (_instance.OnGetUserDataRequestEvent != null) { _instance.OnGetUserDataRequestEvent((ClientModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetUserDataRequest)) { if (_instance.OnGetUserPublisherDataRequestEvent != null) { _instance.OnGetUserPublisherDataRequestEvent((ClientModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetUserDataRequest)) { if (_instance.OnGetUserPublisherReadOnlyDataRequestEvent != null) { _instance.OnGetUserPublisherReadOnlyDataRequestEvent((ClientModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetUserDataRequest)) { if (_instance.OnGetUserReadOnlyDataRequestEvent != null) { _instance.OnGetUserReadOnlyDataRequestEvent((ClientModels.GetUserDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetUserStatisticsRequest)) { if (_instance.OnGetUserStatisticsRequestEvent != null) { _instance.OnGetUserStatisticsRequestEvent((ClientModels.GetUserStatisticsRequest)e.Request); return; } }
if (type == typeof(ClientModels.UpdatePlayerStatisticsRequest)) { if (_instance.OnUpdatePlayerStatisticsRequestEvent != null) { _instance.OnUpdatePlayerStatisticsRequestEvent((ClientModels.UpdatePlayerStatisticsRequest)e.Request); return; } }
if (type == typeof(ClientModels.UpdateUserDataRequest)) { if (_instance.OnUpdateUserDataRequestEvent != null) { _instance.OnUpdateUserDataRequestEvent((ClientModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.UpdateUserDataRequest)) { if (_instance.OnUpdateUserPublisherDataRequestEvent != null) { _instance.OnUpdateUserPublisherDataRequestEvent((ClientModels.UpdateUserDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.UpdateUserStatisticsRequest)) { if (_instance.OnUpdateUserStatisticsRequestEvent != null) { _instance.OnUpdateUserStatisticsRequestEvent((ClientModels.UpdateUserStatisticsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetCatalogItemsRequest)) { if (_instance.OnGetCatalogItemsRequestEvent != null) { _instance.OnGetCatalogItemsRequestEvent((ClientModels.GetCatalogItemsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPublisherDataRequest)) { if (_instance.OnGetPublisherDataRequestEvent != null) { _instance.OnGetPublisherDataRequestEvent((ClientModels.GetPublisherDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetStoreItemsRequest)) { if (_instance.OnGetStoreItemsRequestEvent != null) { _instance.OnGetStoreItemsRequestEvent((ClientModels.GetStoreItemsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetTimeRequest)) { if (_instance.OnGetTimeRequestEvent != null) { _instance.OnGetTimeRequestEvent((ClientModels.GetTimeRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetTitleDataRequest)) { if (_instance.OnGetTitleDataRequestEvent != null) { _instance.OnGetTitleDataRequestEvent((ClientModels.GetTitleDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetTitleNewsRequest)) { if (_instance.OnGetTitleNewsRequestEvent != null) { _instance.OnGetTitleNewsRequestEvent((ClientModels.GetTitleNewsRequest)e.Request); return; } }
if (type == typeof(ClientModels.AddUserVirtualCurrencyRequest)) { if (_instance.OnAddUserVirtualCurrencyRequestEvent != null) { _instance.OnAddUserVirtualCurrencyRequestEvent((ClientModels.AddUserVirtualCurrencyRequest)e.Request); return; } }
if (type == typeof(ClientModels.ConfirmPurchaseRequest)) { if (_instance.OnConfirmPurchaseRequestEvent != null) { _instance.OnConfirmPurchaseRequestEvent((ClientModels.ConfirmPurchaseRequest)e.Request); return; } }
if (type == typeof(ClientModels.ConsumeItemRequest)) { if (_instance.OnConsumeItemRequestEvent != null) { _instance.OnConsumeItemRequestEvent((ClientModels.ConsumeItemRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetCharacterInventoryRequest)) { if (_instance.OnGetCharacterInventoryRequestEvent != null) { _instance.OnGetCharacterInventoryRequestEvent((ClientModels.GetCharacterInventoryRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPurchaseRequest)) { if (_instance.OnGetPurchaseRequestEvent != null) { _instance.OnGetPurchaseRequestEvent((ClientModels.GetPurchaseRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetUserInventoryRequest)) { if (_instance.OnGetUserInventoryRequestEvent != null) { _instance.OnGetUserInventoryRequestEvent((ClientModels.GetUserInventoryRequest)e.Request); return; } }
if (type == typeof(ClientModels.PayForPurchaseRequest)) { if (_instance.OnPayForPurchaseRequestEvent != null) { _instance.OnPayForPurchaseRequestEvent((ClientModels.PayForPurchaseRequest)e.Request); return; } }
if (type == typeof(ClientModels.PurchaseItemRequest)) { if (_instance.OnPurchaseItemRequestEvent != null) { _instance.OnPurchaseItemRequestEvent((ClientModels.PurchaseItemRequest)e.Request); return; } }
if (type == typeof(ClientModels.RedeemCouponRequest)) { if (_instance.OnRedeemCouponRequestEvent != null) { _instance.OnRedeemCouponRequestEvent((ClientModels.RedeemCouponRequest)e.Request); return; } }
if (type == typeof(ClientModels.StartPurchaseRequest)) { if (_instance.OnStartPurchaseRequestEvent != null) { _instance.OnStartPurchaseRequestEvent((ClientModels.StartPurchaseRequest)e.Request); return; } }
if (type == typeof(ClientModels.SubtractUserVirtualCurrencyRequest)) { if (_instance.OnSubtractUserVirtualCurrencyRequestEvent != null) { _instance.OnSubtractUserVirtualCurrencyRequestEvent((ClientModels.SubtractUserVirtualCurrencyRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlockContainerInstanceRequest)) { if (_instance.OnUnlockContainerInstanceRequestEvent != null) { _instance.OnUnlockContainerInstanceRequestEvent((ClientModels.UnlockContainerInstanceRequest)e.Request); return; } }
if (type == typeof(ClientModels.UnlockContainerItemRequest)) { if (_instance.OnUnlockContainerItemRequestEvent != null) { _instance.OnUnlockContainerItemRequestEvent((ClientModels.UnlockContainerItemRequest)e.Request); return; } }
if (type == typeof(ClientModels.AddFriendRequest)) { if (_instance.OnAddFriendRequestEvent != null) { _instance.OnAddFriendRequestEvent((ClientModels.AddFriendRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetFriendsListRequest)) { if (_instance.OnGetFriendsListRequestEvent != null) { _instance.OnGetFriendsListRequestEvent((ClientModels.GetFriendsListRequest)e.Request); return; } }
if (type == typeof(ClientModels.RemoveFriendRequest)) { if (_instance.OnRemoveFriendRequestEvent != null) { _instance.OnRemoveFriendRequestEvent((ClientModels.RemoveFriendRequest)e.Request); return; } }
if (type == typeof(ClientModels.SetFriendTagsRequest)) { if (_instance.OnSetFriendTagsRequestEvent != null) { _instance.OnSetFriendTagsRequestEvent((ClientModels.SetFriendTagsRequest)e.Request); return; } }
if (type == typeof(ClientModels.RegisterForIOSPushNotificationRequest)) { if (_instance.OnRegisterForIOSPushNotificationRequestEvent != null) { _instance.OnRegisterForIOSPushNotificationRequestEvent((ClientModels.RegisterForIOSPushNotificationRequest)e.Request); return; } }
if (type == typeof(ClientModels.RestoreIOSPurchasesRequest)) { if (_instance.OnRestoreIOSPurchasesRequestEvent != null) { _instance.OnRestoreIOSPurchasesRequestEvent((ClientModels.RestoreIOSPurchasesRequest)e.Request); return; } }
if (type == typeof(ClientModels.ValidateIOSReceiptRequest)) { if (_instance.OnValidateIOSReceiptRequestEvent != null) { _instance.OnValidateIOSReceiptRequestEvent((ClientModels.ValidateIOSReceiptRequest)e.Request); return; } }
if (type == typeof(ClientModels.CurrentGamesRequest)) { if (_instance.OnGetCurrentGamesRequestEvent != null) { _instance.OnGetCurrentGamesRequestEvent((ClientModels.CurrentGamesRequest)e.Request); return; } }
if (type == typeof(ClientModels.GameServerRegionsRequest)) { if (_instance.OnGetGameServerRegionsRequestEvent != null) { _instance.OnGetGameServerRegionsRequestEvent((ClientModels.GameServerRegionsRequest)e.Request); return; } }
if (type == typeof(ClientModels.MatchmakeRequest)) { if (_instance.OnMatchmakeRequestEvent != null) { _instance.OnMatchmakeRequestEvent((ClientModels.MatchmakeRequest)e.Request); return; } }
if (type == typeof(ClientModels.StartGameRequest)) { if (_instance.OnStartGameRequestEvent != null) { _instance.OnStartGameRequestEvent((ClientModels.StartGameRequest)e.Request); return; } }
if (type == typeof(ClientModels.AndroidDevicePushNotificationRegistrationRequest)) { if (_instance.OnAndroidDevicePushNotificationRegistrationRequestEvent != null) { _instance.OnAndroidDevicePushNotificationRegistrationRequestEvent((ClientModels.AndroidDevicePushNotificationRegistrationRequest)e.Request); return; } }
if (type == typeof(ClientModels.ValidateGooglePlayPurchaseRequest)) { if (_instance.OnValidateGooglePlayPurchaseRequestEvent != null) { _instance.OnValidateGooglePlayPurchaseRequestEvent((ClientModels.ValidateGooglePlayPurchaseRequest)e.Request); return; } }
if (type == typeof(ClientModels.LogEventRequest)) { if (_instance.OnLogEventRequestEvent != null) { _instance.OnLogEventRequestEvent((ClientModels.LogEventRequest)e.Request); return; } }
if (type == typeof(ClientModels.WriteClientCharacterEventRequest)) { if (_instance.OnWriteCharacterEventRequestEvent != null) { _instance.OnWriteCharacterEventRequestEvent((ClientModels.WriteClientCharacterEventRequest)e.Request); return; } }
if (type == typeof(ClientModels.WriteClientPlayerEventRequest)) { if (_instance.OnWritePlayerEventRequestEvent != null) { _instance.OnWritePlayerEventRequestEvent((ClientModels.WriteClientPlayerEventRequest)e.Request); return; } }
if (type == typeof(ClientModels.WriteTitleEventRequest)) { if (_instance.OnWriteTitleEventRequestEvent != null) { _instance.OnWriteTitleEventRequestEvent((ClientModels.WriteTitleEventRequest)e.Request); return; } }
if (type == typeof(ClientModels.AddSharedGroupMembersRequest)) { if (_instance.OnAddSharedGroupMembersRequestEvent != null) { _instance.OnAddSharedGroupMembersRequestEvent((ClientModels.AddSharedGroupMembersRequest)e.Request); return; } }
if (type == typeof(ClientModels.CreateSharedGroupRequest)) { if (_instance.OnCreateSharedGroupRequestEvent != null) { _instance.OnCreateSharedGroupRequestEvent((ClientModels.CreateSharedGroupRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetSharedGroupDataRequest)) { if (_instance.OnGetSharedGroupDataRequestEvent != null) { _instance.OnGetSharedGroupDataRequestEvent((ClientModels.GetSharedGroupDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.RemoveSharedGroupMembersRequest)) { if (_instance.OnRemoveSharedGroupMembersRequestEvent != null) { _instance.OnRemoveSharedGroupMembersRequestEvent((ClientModels.RemoveSharedGroupMembersRequest)e.Request); return; } }
if (type == typeof(ClientModels.UpdateSharedGroupDataRequest)) { if (_instance.OnUpdateSharedGroupDataRequestEvent != null) { _instance.OnUpdateSharedGroupDataRequestEvent((ClientModels.UpdateSharedGroupDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.ExecuteCloudScriptRequest)) { if (_instance.OnExecuteCloudScriptRequestEvent != null) { _instance.OnExecuteCloudScriptRequestEvent((ClientModels.ExecuteCloudScriptRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetCloudScriptUrlRequest)) { if (_instance.OnGetCloudScriptUrlRequestEvent != null) { _instance.OnGetCloudScriptUrlRequestEvent((ClientModels.GetCloudScriptUrlRequest)e.Request); return; } }
if (type == typeof(ClientModels.RunCloudScriptRequest)) { if (_instance.OnRunCloudScriptRequestEvent != null) { _instance.OnRunCloudScriptRequestEvent((ClientModels.RunCloudScriptRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetContentDownloadUrlRequest)) { if (_instance.OnGetContentDownloadUrlRequestEvent != null) { _instance.OnGetContentDownloadUrlRequestEvent((ClientModels.GetContentDownloadUrlRequest)e.Request); return; } }
if (type == typeof(ClientModels.ListUsersCharactersRequest)) { if (_instance.OnGetAllUsersCharactersRequestEvent != null) { _instance.OnGetAllUsersCharactersRequestEvent((ClientModels.ListUsersCharactersRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetCharacterLeaderboardRequest)) { if (_instance.OnGetCharacterLeaderboardRequestEvent != null) { _instance.OnGetCharacterLeaderboardRequestEvent((ClientModels.GetCharacterLeaderboardRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetCharacterStatisticsRequest)) { if (_instance.OnGetCharacterStatisticsRequestEvent != null) { _instance.OnGetCharacterStatisticsRequestEvent((ClientModels.GetCharacterStatisticsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetLeaderboardAroundCharacterRequest)) { if (_instance.OnGetLeaderboardAroundCharacterRequestEvent != null) { _instance.OnGetLeaderboardAroundCharacterRequestEvent((ClientModels.GetLeaderboardAroundCharacterRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetLeaderboardForUsersCharactersRequest)) { if (_instance.OnGetLeaderboardForUserCharactersRequestEvent != null) { _instance.OnGetLeaderboardForUserCharactersRequestEvent((ClientModels.GetLeaderboardForUsersCharactersRequest)e.Request); return; } }
if (type == typeof(ClientModels.GrantCharacterToUserRequest)) { if (_instance.OnGrantCharacterToUserRequestEvent != null) { _instance.OnGrantCharacterToUserRequestEvent((ClientModels.GrantCharacterToUserRequest)e.Request); return; } }
if (type == typeof(ClientModels.UpdateCharacterStatisticsRequest)) { if (_instance.OnUpdateCharacterStatisticsRequestEvent != null) { _instance.OnUpdateCharacterStatisticsRequestEvent((ClientModels.UpdateCharacterStatisticsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetCharacterDataRequest)) { if (_instance.OnGetCharacterDataRequestEvent != null) { _instance.OnGetCharacterDataRequestEvent((ClientModels.GetCharacterDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetCharacterDataRequest)) { if (_instance.OnGetCharacterReadOnlyDataRequestEvent != null) { _instance.OnGetCharacterReadOnlyDataRequestEvent((ClientModels.GetCharacterDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.UpdateCharacterDataRequest)) { if (_instance.OnUpdateCharacterDataRequestEvent != null) { _instance.OnUpdateCharacterDataRequestEvent((ClientModels.UpdateCharacterDataRequest)e.Request); return; } }
if (type == typeof(ClientModels.ValidateAmazonReceiptRequest)) { if (_instance.OnValidateAmazonIAPReceiptRequestEvent != null) { _instance.OnValidateAmazonIAPReceiptRequestEvent((ClientModels.ValidateAmazonReceiptRequest)e.Request); return; } }
if (type == typeof(ClientModels.AcceptTradeRequest)) { if (_instance.OnAcceptTradeRequestEvent != null) { _instance.OnAcceptTradeRequestEvent((ClientModels.AcceptTradeRequest)e.Request); return; } }
if (type == typeof(ClientModels.CancelTradeRequest)) { if (_instance.OnCancelTradeRequestEvent != null) { _instance.OnCancelTradeRequestEvent((ClientModels.CancelTradeRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayerTradesRequest)) { if (_instance.OnGetPlayerTradesRequestEvent != null) { _instance.OnGetPlayerTradesRequestEvent((ClientModels.GetPlayerTradesRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetTradeStatusRequest)) { if (_instance.OnGetTradeStatusRequestEvent != null) { _instance.OnGetTradeStatusRequestEvent((ClientModels.GetTradeStatusRequest)e.Request); return; } }
if (type == typeof(ClientModels.OpenTradeRequest)) { if (_instance.OnOpenTradeRequestEvent != null) { _instance.OnOpenTradeRequestEvent((ClientModels.OpenTradeRequest)e.Request); return; } }
if (type == typeof(ClientModels.AttributeInstallRequest)) { if (_instance.OnAttributeInstallRequestEvent != null) { _instance.OnAttributeInstallRequestEvent((ClientModels.AttributeInstallRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayerSegmentsRequest)) { if (_instance.OnGetPlayerSegmentsRequestEvent != null) { _instance.OnGetPlayerSegmentsRequestEvent((ClientModels.GetPlayerSegmentsRequest)e.Request); return; } }
if (type == typeof(ClientModels.GetPlayerTagsRequest)) { if (_instance.OnGetPlayerTagsRequestEvent != null) { _instance.OnGetPlayerTagsRequestEvent((ClientModels.GetPlayerTagsRequest)e.Request); return; } }
#endif
}
else
{
var type = e.Result.GetType();
#if ENABLE_PLAYFABADMIN_API
if (type == typeof(AdminModels.BanUsersResult)) { if (_instance.OnAdminBanUsersResultEvent != null) { _instance.OnAdminBanUsersResultEvent((AdminModels.BanUsersResult)e.Result); return; } }
if (type == typeof(AdminModels.LookupUserAccountInfoResult)) { if (_instance.OnAdminGetUserAccountInfoResultEvent != null) { _instance.OnAdminGetUserAccountInfoResultEvent((AdminModels.LookupUserAccountInfoResult)e.Result); return; } }
if (type == typeof(AdminModels.GetUserBansResult)) { if (_instance.OnAdminGetUserBansResultEvent != null) { _instance.OnAdminGetUserBansResultEvent((AdminModels.GetUserBansResult)e.Result); return; } }
if (type == typeof(AdminModels.BlankResult)) { if (_instance.OnAdminResetUsersResultEvent != null) { _instance.OnAdminResetUsersResultEvent((AdminModels.BlankResult)e.Result); return; } }
if (type == typeof(AdminModels.RevokeAllBansForUserResult)) { if (_instance.OnAdminRevokeAllBansForUserResultEvent != null) { _instance.OnAdminRevokeAllBansForUserResultEvent((AdminModels.RevokeAllBansForUserResult)e.Result); return; } }
if (type == typeof(AdminModels.RevokeBansResult)) { if (_instance.OnAdminRevokeBansResultEvent != null) { _instance.OnAdminRevokeBansResultEvent((AdminModels.RevokeBansResult)e.Result); return; } }
if (type == typeof(AdminModels.SendAccountRecoveryEmailResult)) { if (_instance.OnAdminSendAccountRecoveryEmailResultEvent != null) { _instance.OnAdminSendAccountRecoveryEmailResultEvent((AdminModels.SendAccountRecoveryEmailResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateBansResult)) { if (_instance.OnAdminUpdateBansResultEvent != null) { _instance.OnAdminUpdateBansResultEvent((AdminModels.UpdateBansResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateUserTitleDisplayNameResult)) { if (_instance.OnAdminUpdateUserTitleDisplayNameResultEvent != null) { _instance.OnAdminUpdateUserTitleDisplayNameResultEvent((AdminModels.UpdateUserTitleDisplayNameResult)e.Result); return; } }
if (type == typeof(AdminModels.CreatePlayerStatisticDefinitionResult)) { if (_instance.OnAdminCreatePlayerStatisticDefinitionResultEvent != null) { _instance.OnAdminCreatePlayerStatisticDefinitionResultEvent((AdminModels.CreatePlayerStatisticDefinitionResult)e.Result); return; } }
if (type == typeof(AdminModels.DeleteUsersResult)) { if (_instance.OnAdminDeleteUsersResultEvent != null) { _instance.OnAdminDeleteUsersResultEvent((AdminModels.DeleteUsersResult)e.Result); return; } }
if (type == typeof(AdminModels.GetDataReportResult)) { if (_instance.OnAdminGetDataReportResultEvent != null) { _instance.OnAdminGetDataReportResultEvent((AdminModels.GetDataReportResult)e.Result); return; } }
if (type == typeof(AdminModels.GetPlayerStatisticDefinitionsResult)) { if (_instance.OnAdminGetPlayerStatisticDefinitionsResultEvent != null) { _instance.OnAdminGetPlayerStatisticDefinitionsResultEvent((AdminModels.GetPlayerStatisticDefinitionsResult)e.Result); return; } }
if (type == typeof(AdminModels.GetPlayerStatisticVersionsResult)) { if (_instance.OnAdminGetPlayerStatisticVersionsResultEvent != null) { _instance.OnAdminGetPlayerStatisticVersionsResultEvent((AdminModels.GetPlayerStatisticVersionsResult)e.Result); return; } }
if (type == typeof(AdminModels.GetUserDataResult)) { if (_instance.OnAdminGetUserDataResultEvent != null) { _instance.OnAdminGetUserDataResultEvent((AdminModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.GetUserDataResult)) { if (_instance.OnAdminGetUserInternalDataResultEvent != null) { _instance.OnAdminGetUserInternalDataResultEvent((AdminModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.GetUserDataResult)) { if (_instance.OnAdminGetUserPublisherDataResultEvent != null) { _instance.OnAdminGetUserPublisherDataResultEvent((AdminModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.GetUserDataResult)) { if (_instance.OnAdminGetUserPublisherInternalDataResultEvent != null) { _instance.OnAdminGetUserPublisherInternalDataResultEvent((AdminModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.GetUserDataResult)) { if (_instance.OnAdminGetUserPublisherReadOnlyDataResultEvent != null) { _instance.OnAdminGetUserPublisherReadOnlyDataResultEvent((AdminModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.GetUserDataResult)) { if (_instance.OnAdminGetUserReadOnlyDataResultEvent != null) { _instance.OnAdminGetUserReadOnlyDataResultEvent((AdminModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.IncrementPlayerStatisticVersionResult)) { if (_instance.OnAdminIncrementPlayerStatisticVersionResultEvent != null) { _instance.OnAdminIncrementPlayerStatisticVersionResultEvent((AdminModels.IncrementPlayerStatisticVersionResult)e.Result); return; } }
if (type == typeof(AdminModels.RefundPurchaseResponse)) { if (_instance.OnAdminRefundPurchaseResultEvent != null) { _instance.OnAdminRefundPurchaseResultEvent((AdminModels.RefundPurchaseResponse)e.Result); return; } }
if (type == typeof(AdminModels.ResetUserStatisticsResult)) { if (_instance.OnAdminResetUserStatisticsResultEvent != null) { _instance.OnAdminResetUserStatisticsResultEvent((AdminModels.ResetUserStatisticsResult)e.Result); return; } }
if (type == typeof(AdminModels.ResolvePurchaseDisputeResponse)) { if (_instance.OnAdminResolvePurchaseDisputeResultEvent != null) { _instance.OnAdminResolvePurchaseDisputeResultEvent((AdminModels.ResolvePurchaseDisputeResponse)e.Result); return; } }
if (type == typeof(AdminModels.UpdatePlayerStatisticDefinitionResult)) { if (_instance.OnAdminUpdatePlayerStatisticDefinitionResultEvent != null) { _instance.OnAdminUpdatePlayerStatisticDefinitionResultEvent((AdminModels.UpdatePlayerStatisticDefinitionResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateUserDataResult)) { if (_instance.OnAdminUpdateUserDataResultEvent != null) { _instance.OnAdminUpdateUserDataResultEvent((AdminModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateUserDataResult)) { if (_instance.OnAdminUpdateUserInternalDataResultEvent != null) { _instance.OnAdminUpdateUserInternalDataResultEvent((AdminModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateUserDataResult)) { if (_instance.OnAdminUpdateUserPublisherDataResultEvent != null) { _instance.OnAdminUpdateUserPublisherDataResultEvent((AdminModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateUserDataResult)) { if (_instance.OnAdminUpdateUserPublisherInternalDataResultEvent != null) { _instance.OnAdminUpdateUserPublisherInternalDataResultEvent((AdminModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateUserDataResult)) { if (_instance.OnAdminUpdateUserPublisherReadOnlyDataResultEvent != null) { _instance.OnAdminUpdateUserPublisherReadOnlyDataResultEvent((AdminModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateUserDataResult)) { if (_instance.OnAdminUpdateUserReadOnlyDataResultEvent != null) { _instance.OnAdminUpdateUserReadOnlyDataResultEvent((AdminModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(AdminModels.AddNewsResult)) { if (_instance.OnAdminAddNewsResultEvent != null) { _instance.OnAdminAddNewsResultEvent((AdminModels.AddNewsResult)e.Result); return; } }
if (type == typeof(AdminModels.BlankResult)) { if (_instance.OnAdminAddVirtualCurrencyTypesResultEvent != null) { _instance.OnAdminAddVirtualCurrencyTypesResultEvent((AdminModels.BlankResult)e.Result); return; } }
if (type == typeof(AdminModels.DeleteStoreResult)) { if (_instance.OnAdminDeleteStoreResultEvent != null) { _instance.OnAdminDeleteStoreResultEvent((AdminModels.DeleteStoreResult)e.Result); return; } }
if (type == typeof(AdminModels.GetCatalogItemsResult)) { if (_instance.OnAdminGetCatalogItemsResultEvent != null) { _instance.OnAdminGetCatalogItemsResultEvent((AdminModels.GetCatalogItemsResult)e.Result); return; } }
if (type == typeof(AdminModels.GetPublisherDataResult)) { if (_instance.OnAdminGetPublisherDataResultEvent != null) { _instance.OnAdminGetPublisherDataResultEvent((AdminModels.GetPublisherDataResult)e.Result); return; } }
if (type == typeof(AdminModels.GetRandomResultTablesResult)) { if (_instance.OnAdminGetRandomResultTablesResultEvent != null) { _instance.OnAdminGetRandomResultTablesResultEvent((AdminModels.GetRandomResultTablesResult)e.Result); return; } }
if (type == typeof(AdminModels.GetStoreItemsResult)) { if (_instance.OnAdminGetStoreItemsResultEvent != null) { _instance.OnAdminGetStoreItemsResultEvent((AdminModels.GetStoreItemsResult)e.Result); return; } }
if (type == typeof(AdminModels.GetTitleDataResult)) { if (_instance.OnAdminGetTitleDataResultEvent != null) { _instance.OnAdminGetTitleDataResultEvent((AdminModels.GetTitleDataResult)e.Result); return; } }
if (type == typeof(AdminModels.GetTitleDataResult)) { if (_instance.OnAdminGetTitleInternalDataResultEvent != null) { _instance.OnAdminGetTitleInternalDataResultEvent((AdminModels.GetTitleDataResult)e.Result); return; } }
if (type == typeof(AdminModels.ListVirtualCurrencyTypesResult)) { if (_instance.OnAdminListVirtualCurrencyTypesResultEvent != null) { _instance.OnAdminListVirtualCurrencyTypesResultEvent((AdminModels.ListVirtualCurrencyTypesResult)e.Result); return; } }
if (type == typeof(AdminModels.BlankResult)) { if (_instance.OnAdminRemoveVirtualCurrencyTypesResultEvent != null) { _instance.OnAdminRemoveVirtualCurrencyTypesResultEvent((AdminModels.BlankResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateCatalogItemsResult)) { if (_instance.OnAdminSetCatalogItemsResultEvent != null) { _instance.OnAdminSetCatalogItemsResultEvent((AdminModels.UpdateCatalogItemsResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateStoreItemsResult)) { if (_instance.OnAdminSetStoreItemsResultEvent != null) { _instance.OnAdminSetStoreItemsResultEvent((AdminModels.UpdateStoreItemsResult)e.Result); return; } }
if (type == typeof(AdminModels.SetTitleDataResult)) { if (_instance.OnAdminSetTitleDataResultEvent != null) { _instance.OnAdminSetTitleDataResultEvent((AdminModels.SetTitleDataResult)e.Result); return; } }
if (type == typeof(AdminModels.SetTitleDataResult)) { if (_instance.OnAdminSetTitleInternalDataResultEvent != null) { _instance.OnAdminSetTitleInternalDataResultEvent((AdminModels.SetTitleDataResult)e.Result); return; } }
if (type == typeof(AdminModels.SetupPushNotificationResult)) { if (_instance.OnAdminSetupPushNotificationResultEvent != null) { _instance.OnAdminSetupPushNotificationResultEvent((AdminModels.SetupPushNotificationResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateCatalogItemsResult)) { if (_instance.OnAdminUpdateCatalogItemsResultEvent != null) { _instance.OnAdminUpdateCatalogItemsResultEvent((AdminModels.UpdateCatalogItemsResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateRandomResultTablesResult)) { if (_instance.OnAdminUpdateRandomResultTablesResultEvent != null) { _instance.OnAdminUpdateRandomResultTablesResultEvent((AdminModels.UpdateRandomResultTablesResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateStoreItemsResult)) { if (_instance.OnAdminUpdateStoreItemsResultEvent != null) { _instance.OnAdminUpdateStoreItemsResultEvent((AdminModels.UpdateStoreItemsResult)e.Result); return; } }
if (type == typeof(AdminModels.ModifyUserVirtualCurrencyResult)) { if (_instance.OnAdminAddUserVirtualCurrencyResultEvent != null) { _instance.OnAdminAddUserVirtualCurrencyResultEvent((AdminModels.ModifyUserVirtualCurrencyResult)e.Result); return; } }
if (type == typeof(AdminModels.GetUserInventoryResult)) { if (_instance.OnAdminGetUserInventoryResultEvent != null) { _instance.OnAdminGetUserInventoryResultEvent((AdminModels.GetUserInventoryResult)e.Result); return; } }
if (type == typeof(AdminModels.GrantItemsToUsersResult)) { if (_instance.OnAdminGrantItemsToUsersResultEvent != null) { _instance.OnAdminGrantItemsToUsersResultEvent((AdminModels.GrantItemsToUsersResult)e.Result); return; } }
if (type == typeof(AdminModels.RevokeInventoryResult)) { if (_instance.OnAdminRevokeInventoryItemResultEvent != null) { _instance.OnAdminRevokeInventoryItemResultEvent((AdminModels.RevokeInventoryResult)e.Result); return; } }
if (type == typeof(AdminModels.ModifyUserVirtualCurrencyResult)) { if (_instance.OnAdminSubtractUserVirtualCurrencyResultEvent != null) { _instance.OnAdminSubtractUserVirtualCurrencyResultEvent((AdminModels.ModifyUserVirtualCurrencyResult)e.Result); return; } }
if (type == typeof(AdminModels.GetMatchmakerGameInfoResult)) { if (_instance.OnAdminGetMatchmakerGameInfoResultEvent != null) { _instance.OnAdminGetMatchmakerGameInfoResultEvent((AdminModels.GetMatchmakerGameInfoResult)e.Result); return; } }
if (type == typeof(AdminModels.GetMatchmakerGameModesResult)) { if (_instance.OnAdminGetMatchmakerGameModesResultEvent != null) { _instance.OnAdminGetMatchmakerGameModesResultEvent((AdminModels.GetMatchmakerGameModesResult)e.Result); return; } }
if (type == typeof(AdminModels.ModifyMatchmakerGameModesResult)) { if (_instance.OnAdminModifyMatchmakerGameModesResultEvent != null) { _instance.OnAdminModifyMatchmakerGameModesResultEvent((AdminModels.ModifyMatchmakerGameModesResult)e.Result); return; } }
if (type == typeof(AdminModels.AddServerBuildResult)) { if (_instance.OnAdminAddServerBuildResultEvent != null) { _instance.OnAdminAddServerBuildResultEvent((AdminModels.AddServerBuildResult)e.Result); return; } }
if (type == typeof(AdminModels.GetServerBuildInfoResult)) { if (_instance.OnAdminGetServerBuildInfoResultEvent != null) { _instance.OnAdminGetServerBuildInfoResultEvent((AdminModels.GetServerBuildInfoResult)e.Result); return; } }
if (type == typeof(AdminModels.GetServerBuildUploadURLResult)) { if (_instance.OnAdminGetServerBuildUploadUrlResultEvent != null) { _instance.OnAdminGetServerBuildUploadUrlResultEvent((AdminModels.GetServerBuildUploadURLResult)e.Result); return; } }
if (type == typeof(AdminModels.ListBuildsResult)) { if (_instance.OnAdminListServerBuildsResultEvent != null) { _instance.OnAdminListServerBuildsResultEvent((AdminModels.ListBuildsResult)e.Result); return; } }
if (type == typeof(AdminModels.ModifyServerBuildResult)) { if (_instance.OnAdminModifyServerBuildResultEvent != null) { _instance.OnAdminModifyServerBuildResultEvent((AdminModels.ModifyServerBuildResult)e.Result); return; } }
if (type == typeof(AdminModels.RemoveServerBuildResult)) { if (_instance.OnAdminRemoveServerBuildResultEvent != null) { _instance.OnAdminRemoveServerBuildResultEvent((AdminModels.RemoveServerBuildResult)e.Result); return; } }
if (type == typeof(AdminModels.SetPublisherDataResult)) { if (_instance.OnAdminSetPublisherDataResultEvent != null) { _instance.OnAdminSetPublisherDataResultEvent((AdminModels.SetPublisherDataResult)e.Result); return; } }
if (type == typeof(AdminModels.GetCloudScriptRevisionResult)) { if (_instance.OnAdminGetCloudScriptRevisionResultEvent != null) { _instance.OnAdminGetCloudScriptRevisionResultEvent((AdminModels.GetCloudScriptRevisionResult)e.Result); return; } }
if (type == typeof(AdminModels.GetCloudScriptVersionsResult)) { if (_instance.OnAdminGetCloudScriptVersionsResultEvent != null) { _instance.OnAdminGetCloudScriptVersionsResultEvent((AdminModels.GetCloudScriptVersionsResult)e.Result); return; } }
if (type == typeof(AdminModels.SetPublishedRevisionResult)) { if (_instance.OnAdminSetPublishedRevisionResultEvent != null) { _instance.OnAdminSetPublishedRevisionResultEvent((AdminModels.SetPublishedRevisionResult)e.Result); return; } }
if (type == typeof(AdminModels.UpdateCloudScriptResult)) { if (_instance.OnAdminUpdateCloudScriptResultEvent != null) { _instance.OnAdminUpdateCloudScriptResultEvent((AdminModels.UpdateCloudScriptResult)e.Result); return; } }
if (type == typeof(AdminModels.BlankResult)) { if (_instance.OnAdminDeleteContentResultEvent != null) { _instance.OnAdminDeleteContentResultEvent((AdminModels.BlankResult)e.Result); return; } }
if (type == typeof(AdminModels.GetContentListResult)) { if (_instance.OnAdminGetContentListResultEvent != null) { _instance.OnAdminGetContentListResultEvent((AdminModels.GetContentListResult)e.Result); return; } }
if (type == typeof(AdminModels.GetContentUploadUrlResult)) { if (_instance.OnAdminGetContentUploadUrlResultEvent != null) { _instance.OnAdminGetContentUploadUrlResultEvent((AdminModels.GetContentUploadUrlResult)e.Result); return; } }
if (type == typeof(AdminModels.ResetCharacterStatisticsResult)) { if (_instance.OnAdminResetCharacterStatisticsResultEvent != null) { _instance.OnAdminResetCharacterStatisticsResultEvent((AdminModels.ResetCharacterStatisticsResult)e.Result); return; } }
if (type == typeof(AdminModels.AddPlayerTagResult)) { if (_instance.OnAdminAddPlayerTagResultEvent != null) { _instance.OnAdminAddPlayerTagResultEvent((AdminModels.AddPlayerTagResult)e.Result); return; } }
if (type == typeof(AdminModels.GetAllActionGroupsResult)) { if (_instance.OnAdminGetAllActionGroupsResultEvent != null) { _instance.OnAdminGetAllActionGroupsResultEvent((AdminModels.GetAllActionGroupsResult)e.Result); return; } }
if (type == typeof(AdminModels.GetAllSegmentsResult)) { if (_instance.OnAdminGetAllSegmentsResultEvent != null) { _instance.OnAdminGetAllSegmentsResultEvent((AdminModels.GetAllSegmentsResult)e.Result); return; } }
if (type == typeof(AdminModels.GetPlayerSegmentsResult)) { if (_instance.OnAdminGetPlayerSegmentsResultEvent != null) { _instance.OnAdminGetPlayerSegmentsResultEvent((AdminModels.GetPlayerSegmentsResult)e.Result); return; } }
if (type == typeof(AdminModels.GetPlayersInSegmentResult)) { if (_instance.OnAdminGetPlayersInSegmentResultEvent != null) { _instance.OnAdminGetPlayersInSegmentResultEvent((AdminModels.GetPlayersInSegmentResult)e.Result); return; } }
if (type == typeof(AdminModels.GetPlayerTagsResult)) { if (_instance.OnAdminGetPlayerTagsResultEvent != null) { _instance.OnAdminGetPlayerTagsResultEvent((AdminModels.GetPlayerTagsResult)e.Result); return; } }
if (type == typeof(AdminModels.RemovePlayerTagResult)) { if (_instance.OnAdminRemovePlayerTagResultEvent != null) { _instance.OnAdminRemovePlayerTagResultEvent((AdminModels.RemovePlayerTagResult)e.Result); return; } }
#endif
#if ENABLE_PLAYFABSERVER_API
if (type == typeof(MatchmakerModels.AuthUserResponse)) { if (_instance.OnMatchmakerAuthUserResultEvent != null) { _instance.OnMatchmakerAuthUserResultEvent((MatchmakerModels.AuthUserResponse)e.Result); return; } }
if (type == typeof(MatchmakerModels.PlayerJoinedResponse)) { if (_instance.OnMatchmakerPlayerJoinedResultEvent != null) { _instance.OnMatchmakerPlayerJoinedResultEvent((MatchmakerModels.PlayerJoinedResponse)e.Result); return; } }
if (type == typeof(MatchmakerModels.PlayerLeftResponse)) { if (_instance.OnMatchmakerPlayerLeftResultEvent != null) { _instance.OnMatchmakerPlayerLeftResultEvent((MatchmakerModels.PlayerLeftResponse)e.Result); return; } }
if (type == typeof(MatchmakerModels.StartGameResponse)) { if (_instance.OnMatchmakerStartGameResultEvent != null) { _instance.OnMatchmakerStartGameResultEvent((MatchmakerModels.StartGameResponse)e.Result); return; } }
if (type == typeof(MatchmakerModels.UserInfoResponse)) { if (_instance.OnMatchmakerUserInfoResultEvent != null) { _instance.OnMatchmakerUserInfoResultEvent((MatchmakerModels.UserInfoResponse)e.Result); return; } }
#endif
#if ENABLE_PLAYFABSERVER_API
if (type == typeof(ServerModels.AuthenticateSessionTicketResult)) { if (_instance.OnServerAuthenticateSessionTicketResultEvent != null) { _instance.OnServerAuthenticateSessionTicketResultEvent((ServerModels.AuthenticateSessionTicketResult)e.Result); return; } }
if (type == typeof(ServerModels.BanUsersResult)) { if (_instance.OnServerBanUsersResultEvent != null) { _instance.OnServerBanUsersResultEvent((ServerModels.BanUsersResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPlayFabIDsFromFacebookIDsResult)) { if (_instance.OnServerGetPlayFabIDsFromFacebookIDsResultEvent != null) { _instance.OnServerGetPlayFabIDsFromFacebookIDsResultEvent((ServerModels.GetPlayFabIDsFromFacebookIDsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPlayFabIDsFromSteamIDsResult)) { if (_instance.OnServerGetPlayFabIDsFromSteamIDsResultEvent != null) { _instance.OnServerGetPlayFabIDsFromSteamIDsResultEvent((ServerModels.GetPlayFabIDsFromSteamIDsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserAccountInfoResult)) { if (_instance.OnServerGetUserAccountInfoResultEvent != null) { _instance.OnServerGetUserAccountInfoResultEvent((ServerModels.GetUserAccountInfoResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserBansResult)) { if (_instance.OnServerGetUserBansResultEvent != null) { _instance.OnServerGetUserBansResultEvent((ServerModels.GetUserBansResult)e.Result); return; } }
if (type == typeof(ServerModels.RevokeAllBansForUserResult)) { if (_instance.OnServerRevokeAllBansForUserResultEvent != null) { _instance.OnServerRevokeAllBansForUserResultEvent((ServerModels.RevokeAllBansForUserResult)e.Result); return; } }
if (type == typeof(ServerModels.RevokeBansResult)) { if (_instance.OnServerRevokeBansResultEvent != null) { _instance.OnServerRevokeBansResultEvent((ServerModels.RevokeBansResult)e.Result); return; } }
if (type == typeof(ServerModels.SendPushNotificationResult)) { if (_instance.OnServerSendPushNotificationResultEvent != null) { _instance.OnServerSendPushNotificationResultEvent((ServerModels.SendPushNotificationResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateBansResult)) { if (_instance.OnServerUpdateBansResultEvent != null) { _instance.OnServerUpdateBansResultEvent((ServerModels.UpdateBansResult)e.Result); return; } }
if (type == typeof(ServerModels.DeleteUsersResult)) { if (_instance.OnServerDeleteUsersResultEvent != null) { _instance.OnServerDeleteUsersResultEvent((ServerModels.DeleteUsersResult)e.Result); return; } }
if (type == typeof(ServerModels.GetLeaderboardResult)) { if (_instance.OnServerGetFriendLeaderboardResultEvent != null) { _instance.OnServerGetFriendLeaderboardResultEvent((ServerModels.GetLeaderboardResult)e.Result); return; } }
if (type == typeof(ServerModels.GetLeaderboardResult)) { if (_instance.OnServerGetLeaderboardResultEvent != null) { _instance.OnServerGetLeaderboardResultEvent((ServerModels.GetLeaderboardResult)e.Result); return; } }
if (type == typeof(ServerModels.GetLeaderboardAroundUserResult)) { if (_instance.OnServerGetLeaderboardAroundUserResultEvent != null) { _instance.OnServerGetLeaderboardAroundUserResultEvent((ServerModels.GetLeaderboardAroundUserResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPlayerCombinedInfoResult)) { if (_instance.OnServerGetPlayerCombinedInfoResultEvent != null) { _instance.OnServerGetPlayerCombinedInfoResultEvent((ServerModels.GetPlayerCombinedInfoResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPlayerStatisticsResult)) { if (_instance.OnServerGetPlayerStatisticsResultEvent != null) { _instance.OnServerGetPlayerStatisticsResultEvent((ServerModels.GetPlayerStatisticsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPlayerStatisticVersionsResult)) { if (_instance.OnServerGetPlayerStatisticVersionsResultEvent != null) { _instance.OnServerGetPlayerStatisticVersionsResultEvent((ServerModels.GetPlayerStatisticVersionsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserDataResult)) { if (_instance.OnServerGetUserDataResultEvent != null) { _instance.OnServerGetUserDataResultEvent((ServerModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserDataResult)) { if (_instance.OnServerGetUserInternalDataResultEvent != null) { _instance.OnServerGetUserInternalDataResultEvent((ServerModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserDataResult)) { if (_instance.OnServerGetUserPublisherDataResultEvent != null) { _instance.OnServerGetUserPublisherDataResultEvent((ServerModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserDataResult)) { if (_instance.OnServerGetUserPublisherInternalDataResultEvent != null) { _instance.OnServerGetUserPublisherInternalDataResultEvent((ServerModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserDataResult)) { if (_instance.OnServerGetUserPublisherReadOnlyDataResultEvent != null) { _instance.OnServerGetUserPublisherReadOnlyDataResultEvent((ServerModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserDataResult)) { if (_instance.OnServerGetUserReadOnlyDataResultEvent != null) { _instance.OnServerGetUserReadOnlyDataResultEvent((ServerModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserStatisticsResult)) { if (_instance.OnServerGetUserStatisticsResultEvent != null) { _instance.OnServerGetUserStatisticsResultEvent((ServerModels.GetUserStatisticsResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdatePlayerStatisticsResult)) { if (_instance.OnServerUpdatePlayerStatisticsResultEvent != null) { _instance.OnServerUpdatePlayerStatisticsResultEvent((ServerModels.UpdatePlayerStatisticsResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateUserDataResult)) { if (_instance.OnServerUpdateUserDataResultEvent != null) { _instance.OnServerUpdateUserDataResultEvent((ServerModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateUserDataResult)) { if (_instance.OnServerUpdateUserInternalDataResultEvent != null) { _instance.OnServerUpdateUserInternalDataResultEvent((ServerModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateUserDataResult)) { if (_instance.OnServerUpdateUserPublisherDataResultEvent != null) { _instance.OnServerUpdateUserPublisherDataResultEvent((ServerModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateUserDataResult)) { if (_instance.OnServerUpdateUserPublisherInternalDataResultEvent != null) { _instance.OnServerUpdateUserPublisherInternalDataResultEvent((ServerModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateUserDataResult)) { if (_instance.OnServerUpdateUserPublisherReadOnlyDataResultEvent != null) { _instance.OnServerUpdateUserPublisherReadOnlyDataResultEvent((ServerModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateUserDataResult)) { if (_instance.OnServerUpdateUserReadOnlyDataResultEvent != null) { _instance.OnServerUpdateUserReadOnlyDataResultEvent((ServerModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateUserStatisticsResult)) { if (_instance.OnServerUpdateUserStatisticsResultEvent != null) { _instance.OnServerUpdateUserStatisticsResultEvent((ServerModels.UpdateUserStatisticsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetCatalogItemsResult)) { if (_instance.OnServerGetCatalogItemsResultEvent != null) { _instance.OnServerGetCatalogItemsResultEvent((ServerModels.GetCatalogItemsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPublisherDataResult)) { if (_instance.OnServerGetPublisherDataResultEvent != null) { _instance.OnServerGetPublisherDataResultEvent((ServerModels.GetPublisherDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetTimeResult)) { if (_instance.OnServerGetTimeResultEvent != null) { _instance.OnServerGetTimeResultEvent((ServerModels.GetTimeResult)e.Result); return; } }
if (type == typeof(ServerModels.GetTitleDataResult)) { if (_instance.OnServerGetTitleDataResultEvent != null) { _instance.OnServerGetTitleDataResultEvent((ServerModels.GetTitleDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetTitleDataResult)) { if (_instance.OnServerGetTitleInternalDataResultEvent != null) { _instance.OnServerGetTitleInternalDataResultEvent((ServerModels.GetTitleDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetTitleNewsResult)) { if (_instance.OnServerGetTitleNewsResultEvent != null) { _instance.OnServerGetTitleNewsResultEvent((ServerModels.GetTitleNewsResult)e.Result); return; } }
if (type == typeof(ServerModels.SetPublisherDataResult)) { if (_instance.OnServerSetPublisherDataResultEvent != null) { _instance.OnServerSetPublisherDataResultEvent((ServerModels.SetPublisherDataResult)e.Result); return; } }
if (type == typeof(ServerModels.SetTitleDataResult)) { if (_instance.OnServerSetTitleDataResultEvent != null) { _instance.OnServerSetTitleDataResultEvent((ServerModels.SetTitleDataResult)e.Result); return; } }
if (type == typeof(ServerModels.SetTitleDataResult)) { if (_instance.OnServerSetTitleInternalDataResultEvent != null) { _instance.OnServerSetTitleInternalDataResultEvent((ServerModels.SetTitleDataResult)e.Result); return; } }
if (type == typeof(ServerModels.ModifyCharacterVirtualCurrencyResult)) { if (_instance.OnServerAddCharacterVirtualCurrencyResultEvent != null) { _instance.OnServerAddCharacterVirtualCurrencyResultEvent((ServerModels.ModifyCharacterVirtualCurrencyResult)e.Result); return; } }
if (type == typeof(ServerModels.ModifyUserVirtualCurrencyResult)) { if (_instance.OnServerAddUserVirtualCurrencyResultEvent != null) { _instance.OnServerAddUserVirtualCurrencyResultEvent((ServerModels.ModifyUserVirtualCurrencyResult)e.Result); return; } }
if (type == typeof(ServerModels.ConsumeItemResult)) { if (_instance.OnServerConsumeItemResultEvent != null) { _instance.OnServerConsumeItemResultEvent((ServerModels.ConsumeItemResult)e.Result); return; } }
if (type == typeof(ServerModels.EvaluateRandomResultTableResult)) { if (_instance.OnServerEvaluateRandomResultTableResultEvent != null) { _instance.OnServerEvaluateRandomResultTableResultEvent((ServerModels.EvaluateRandomResultTableResult)e.Result); return; } }
if (type == typeof(ServerModels.GetCharacterInventoryResult)) { if (_instance.OnServerGetCharacterInventoryResultEvent != null) { _instance.OnServerGetCharacterInventoryResultEvent((ServerModels.GetCharacterInventoryResult)e.Result); return; } }
if (type == typeof(ServerModels.GetRandomResultTablesResult)) { if (_instance.OnServerGetRandomResultTablesResultEvent != null) { _instance.OnServerGetRandomResultTablesResultEvent((ServerModels.GetRandomResultTablesResult)e.Result); return; } }
if (type == typeof(ServerModels.GetUserInventoryResult)) { if (_instance.OnServerGetUserInventoryResultEvent != null) { _instance.OnServerGetUserInventoryResultEvent((ServerModels.GetUserInventoryResult)e.Result); return; } }
if (type == typeof(ServerModels.GrantItemsToCharacterResult)) { if (_instance.OnServerGrantItemsToCharacterResultEvent != null) { _instance.OnServerGrantItemsToCharacterResultEvent((ServerModels.GrantItemsToCharacterResult)e.Result); return; } }
if (type == typeof(ServerModels.GrantItemsToUserResult)) { if (_instance.OnServerGrantItemsToUserResultEvent != null) { _instance.OnServerGrantItemsToUserResultEvent((ServerModels.GrantItemsToUserResult)e.Result); return; } }
if (type == typeof(ServerModels.GrantItemsToUsersResult)) { if (_instance.OnServerGrantItemsToUsersResultEvent != null) { _instance.OnServerGrantItemsToUsersResultEvent((ServerModels.GrantItemsToUsersResult)e.Result); return; } }
if (type == typeof(ServerModels.ModifyItemUsesResult)) { if (_instance.OnServerModifyItemUsesResultEvent != null) { _instance.OnServerModifyItemUsesResultEvent((ServerModels.ModifyItemUsesResult)e.Result); return; } }
if (type == typeof(ServerModels.MoveItemToCharacterFromCharacterResult)) { if (_instance.OnServerMoveItemToCharacterFromCharacterResultEvent != null) { _instance.OnServerMoveItemToCharacterFromCharacterResultEvent((ServerModels.MoveItemToCharacterFromCharacterResult)e.Result); return; } }
if (type == typeof(ServerModels.MoveItemToCharacterFromUserResult)) { if (_instance.OnServerMoveItemToCharacterFromUserResultEvent != null) { _instance.OnServerMoveItemToCharacterFromUserResultEvent((ServerModels.MoveItemToCharacterFromUserResult)e.Result); return; } }
if (type == typeof(ServerModels.MoveItemToUserFromCharacterResult)) { if (_instance.OnServerMoveItemToUserFromCharacterResultEvent != null) { _instance.OnServerMoveItemToUserFromCharacterResultEvent((ServerModels.MoveItemToUserFromCharacterResult)e.Result); return; } }
if (type == typeof(ServerModels.RedeemCouponResult)) { if (_instance.OnServerRedeemCouponResultEvent != null) { _instance.OnServerRedeemCouponResultEvent((ServerModels.RedeemCouponResult)e.Result); return; } }
if (type == typeof(ServerModels.ReportPlayerServerResult)) { if (_instance.OnServerReportPlayerResultEvent != null) { _instance.OnServerReportPlayerResultEvent((ServerModels.ReportPlayerServerResult)e.Result); return; } }
if (type == typeof(ServerModels.RevokeInventoryResult)) { if (_instance.OnServerRevokeInventoryItemResultEvent != null) { _instance.OnServerRevokeInventoryItemResultEvent((ServerModels.RevokeInventoryResult)e.Result); return; } }
if (type == typeof(ServerModels.ModifyCharacterVirtualCurrencyResult)) { if (_instance.OnServerSubtractCharacterVirtualCurrencyResultEvent != null) { _instance.OnServerSubtractCharacterVirtualCurrencyResultEvent((ServerModels.ModifyCharacterVirtualCurrencyResult)e.Result); return; } }
if (type == typeof(ServerModels.ModifyUserVirtualCurrencyResult)) { if (_instance.OnServerSubtractUserVirtualCurrencyResultEvent != null) { _instance.OnServerSubtractUserVirtualCurrencyResultEvent((ServerModels.ModifyUserVirtualCurrencyResult)e.Result); return; } }
if (type == typeof(ServerModels.UnlockContainerItemResult)) { if (_instance.OnServerUnlockContainerInstanceResultEvent != null) { _instance.OnServerUnlockContainerInstanceResultEvent((ServerModels.UnlockContainerItemResult)e.Result); return; } }
if (type == typeof(ServerModels.UnlockContainerItemResult)) { if (_instance.OnServerUnlockContainerItemResultEvent != null) { _instance.OnServerUnlockContainerItemResultEvent((ServerModels.UnlockContainerItemResult)e.Result); return; } }
if (type == typeof(ServerModels.EmptyResult)) { if (_instance.OnServerUpdateUserInventoryItemCustomDataResultEvent != null) { _instance.OnServerUpdateUserInventoryItemCustomDataResultEvent((ServerModels.EmptyResult)e.Result); return; } }
if (type == typeof(ServerModels.EmptyResult)) { if (_instance.OnServerAddFriendResultEvent != null) { _instance.OnServerAddFriendResultEvent((ServerModels.EmptyResult)e.Result); return; } }
if (type == typeof(ServerModels.GetFriendsListResult)) { if (_instance.OnServerGetFriendsListResultEvent != null) { _instance.OnServerGetFriendsListResultEvent((ServerModels.GetFriendsListResult)e.Result); return; } }
if (type == typeof(ServerModels.EmptyResult)) { if (_instance.OnServerRemoveFriendResultEvent != null) { _instance.OnServerRemoveFriendResultEvent((ServerModels.EmptyResult)e.Result); return; } }
if (type == typeof(ServerModels.DeregisterGameResponse)) { if (_instance.OnServerDeregisterGameResultEvent != null) { _instance.OnServerDeregisterGameResultEvent((ServerModels.DeregisterGameResponse)e.Result); return; } }
if (type == typeof(ServerModels.NotifyMatchmakerPlayerLeftResult)) { if (_instance.OnServerNotifyMatchmakerPlayerLeftResultEvent != null) { _instance.OnServerNotifyMatchmakerPlayerLeftResultEvent((ServerModels.NotifyMatchmakerPlayerLeftResult)e.Result); return; } }
if (type == typeof(ServerModels.RedeemMatchmakerTicketResult)) { if (_instance.OnServerRedeemMatchmakerTicketResultEvent != null) { _instance.OnServerRedeemMatchmakerTicketResultEvent((ServerModels.RedeemMatchmakerTicketResult)e.Result); return; } }
if (type == typeof(ServerModels.RefreshGameServerInstanceHeartbeatResult)) { if (_instance.OnServerRefreshGameServerInstanceHeartbeatResultEvent != null) { _instance.OnServerRefreshGameServerInstanceHeartbeatResultEvent((ServerModels.RefreshGameServerInstanceHeartbeatResult)e.Result); return; } }
if (type == typeof(ServerModels.RegisterGameResponse)) { if (_instance.OnServerRegisterGameResultEvent != null) { _instance.OnServerRegisterGameResultEvent((ServerModels.RegisterGameResponse)e.Result); return; } }
if (type == typeof(ServerModels.SetGameServerInstanceDataResult)) { if (_instance.OnServerSetGameServerInstanceDataResultEvent != null) { _instance.OnServerSetGameServerInstanceDataResultEvent((ServerModels.SetGameServerInstanceDataResult)e.Result); return; } }
if (type == typeof(ServerModels.SetGameServerInstanceStateResult)) { if (_instance.OnServerSetGameServerInstanceStateResultEvent != null) { _instance.OnServerSetGameServerInstanceStateResultEvent((ServerModels.SetGameServerInstanceStateResult)e.Result); return; } }
if (type == typeof(ServerModels.SetGameServerInstanceTagsResult)) { if (_instance.OnServerSetGameServerInstanceTagsResultEvent != null) { _instance.OnServerSetGameServerInstanceTagsResultEvent((ServerModels.SetGameServerInstanceTagsResult)e.Result); return; } }
if (type == typeof(ServerModels.AwardSteamAchievementResult)) { if (_instance.OnServerAwardSteamAchievementResultEvent != null) { _instance.OnServerAwardSteamAchievementResultEvent((ServerModels.AwardSteamAchievementResult)e.Result); return; } }
if (type == typeof(ServerModels.LogEventResult)) { if (_instance.OnServerLogEventResultEvent != null) { _instance.OnServerLogEventResultEvent((ServerModels.LogEventResult)e.Result); return; } }
if (type == typeof(ServerModels.WriteEventResponse)) { if (_instance.OnServerWriteCharacterEventResultEvent != null) { _instance.OnServerWriteCharacterEventResultEvent((ServerModels.WriteEventResponse)e.Result); return; } }
if (type == typeof(ServerModels.WriteEventResponse)) { if (_instance.OnServerWritePlayerEventResultEvent != null) { _instance.OnServerWritePlayerEventResultEvent((ServerModels.WriteEventResponse)e.Result); return; } }
if (type == typeof(ServerModels.WriteEventResponse)) { if (_instance.OnServerWriteTitleEventResultEvent != null) { _instance.OnServerWriteTitleEventResultEvent((ServerModels.WriteEventResponse)e.Result); return; } }
if (type == typeof(ServerModels.AddSharedGroupMembersResult)) { if (_instance.OnServerAddSharedGroupMembersResultEvent != null) { _instance.OnServerAddSharedGroupMembersResultEvent((ServerModels.AddSharedGroupMembersResult)e.Result); return; } }
if (type == typeof(ServerModels.CreateSharedGroupResult)) { if (_instance.OnServerCreateSharedGroupResultEvent != null) { _instance.OnServerCreateSharedGroupResultEvent((ServerModels.CreateSharedGroupResult)e.Result); return; } }
if (type == typeof(ServerModels.EmptyResult)) { if (_instance.OnServerDeleteSharedGroupResultEvent != null) { _instance.OnServerDeleteSharedGroupResultEvent((ServerModels.EmptyResult)e.Result); return; } }
if (type == typeof(ServerModels.GetSharedGroupDataResult)) { if (_instance.OnServerGetSharedGroupDataResultEvent != null) { _instance.OnServerGetSharedGroupDataResultEvent((ServerModels.GetSharedGroupDataResult)e.Result); return; } }
if (type == typeof(ServerModels.RemoveSharedGroupMembersResult)) { if (_instance.OnServerRemoveSharedGroupMembersResultEvent != null) { _instance.OnServerRemoveSharedGroupMembersResultEvent((ServerModels.RemoveSharedGroupMembersResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateSharedGroupDataResult)) { if (_instance.OnServerUpdateSharedGroupDataResultEvent != null) { _instance.OnServerUpdateSharedGroupDataResultEvent((ServerModels.UpdateSharedGroupDataResult)e.Result); return; } }
if (type == typeof(ServerModels.ExecuteCloudScriptResult)) { if (_instance.OnServerExecuteCloudScriptResultEvent != null) { _instance.OnServerExecuteCloudScriptResultEvent((ServerModels.ExecuteCloudScriptResult)e.Result); return; } }
if (type == typeof(ServerModels.GetContentDownloadUrlResult)) { if (_instance.OnServerGetContentDownloadUrlResultEvent != null) { _instance.OnServerGetContentDownloadUrlResultEvent((ServerModels.GetContentDownloadUrlResult)e.Result); return; } }
if (type == typeof(ServerModels.DeleteCharacterFromUserResult)) { if (_instance.OnServerDeleteCharacterFromUserResultEvent != null) { _instance.OnServerDeleteCharacterFromUserResultEvent((ServerModels.DeleteCharacterFromUserResult)e.Result); return; } }
if (type == typeof(ServerModels.ListUsersCharactersResult)) { if (_instance.OnServerGetAllUsersCharactersResultEvent != null) { _instance.OnServerGetAllUsersCharactersResultEvent((ServerModels.ListUsersCharactersResult)e.Result); return; } }
if (type == typeof(ServerModels.GetCharacterLeaderboardResult)) { if (_instance.OnServerGetCharacterLeaderboardResultEvent != null) { _instance.OnServerGetCharacterLeaderboardResultEvent((ServerModels.GetCharacterLeaderboardResult)e.Result); return; } }
if (type == typeof(ServerModels.GetCharacterStatisticsResult)) { if (_instance.OnServerGetCharacterStatisticsResultEvent != null) { _instance.OnServerGetCharacterStatisticsResultEvent((ServerModels.GetCharacterStatisticsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetLeaderboardAroundCharacterResult)) { if (_instance.OnServerGetLeaderboardAroundCharacterResultEvent != null) { _instance.OnServerGetLeaderboardAroundCharacterResultEvent((ServerModels.GetLeaderboardAroundCharacterResult)e.Result); return; } }
if (type == typeof(ServerModels.GetLeaderboardForUsersCharactersResult)) { if (_instance.OnServerGetLeaderboardForUserCharactersResultEvent != null) { _instance.OnServerGetLeaderboardForUserCharactersResultEvent((ServerModels.GetLeaderboardForUsersCharactersResult)e.Result); return; } }
if (type == typeof(ServerModels.GrantCharacterToUserResult)) { if (_instance.OnServerGrantCharacterToUserResultEvent != null) { _instance.OnServerGrantCharacterToUserResultEvent((ServerModels.GrantCharacterToUserResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateCharacterStatisticsResult)) { if (_instance.OnServerUpdateCharacterStatisticsResultEvent != null) { _instance.OnServerUpdateCharacterStatisticsResultEvent((ServerModels.UpdateCharacterStatisticsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetCharacterDataResult)) { if (_instance.OnServerGetCharacterDataResultEvent != null) { _instance.OnServerGetCharacterDataResultEvent((ServerModels.GetCharacterDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetCharacterDataResult)) { if (_instance.OnServerGetCharacterInternalDataResultEvent != null) { _instance.OnServerGetCharacterInternalDataResultEvent((ServerModels.GetCharacterDataResult)e.Result); return; } }
if (type == typeof(ServerModels.GetCharacterDataResult)) { if (_instance.OnServerGetCharacterReadOnlyDataResultEvent != null) { _instance.OnServerGetCharacterReadOnlyDataResultEvent((ServerModels.GetCharacterDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateCharacterDataResult)) { if (_instance.OnServerUpdateCharacterDataResultEvent != null) { _instance.OnServerUpdateCharacterDataResultEvent((ServerModels.UpdateCharacterDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateCharacterDataResult)) { if (_instance.OnServerUpdateCharacterInternalDataResultEvent != null) { _instance.OnServerUpdateCharacterInternalDataResultEvent((ServerModels.UpdateCharacterDataResult)e.Result); return; } }
if (type == typeof(ServerModels.UpdateCharacterDataResult)) { if (_instance.OnServerUpdateCharacterReadOnlyDataResultEvent != null) { _instance.OnServerUpdateCharacterReadOnlyDataResultEvent((ServerModels.UpdateCharacterDataResult)e.Result); return; } }
if (type == typeof(ServerModels.AddPlayerTagResult)) { if (_instance.OnServerAddPlayerTagResultEvent != null) { _instance.OnServerAddPlayerTagResultEvent((ServerModels.AddPlayerTagResult)e.Result); return; } }
if (type == typeof(ServerModels.GetAllActionGroupsResult)) { if (_instance.OnServerGetAllActionGroupsResultEvent != null) { _instance.OnServerGetAllActionGroupsResultEvent((ServerModels.GetAllActionGroupsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetAllSegmentsResult)) { if (_instance.OnServerGetAllSegmentsResultEvent != null) { _instance.OnServerGetAllSegmentsResultEvent((ServerModels.GetAllSegmentsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPlayerSegmentsResult)) { if (_instance.OnServerGetPlayerSegmentsResultEvent != null) { _instance.OnServerGetPlayerSegmentsResultEvent((ServerModels.GetPlayerSegmentsResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPlayersInSegmentResult)) { if (_instance.OnServerGetPlayersInSegmentResultEvent != null) { _instance.OnServerGetPlayersInSegmentResultEvent((ServerModels.GetPlayersInSegmentResult)e.Result); return; } }
if (type == typeof(ServerModels.GetPlayerTagsResult)) { if (_instance.OnServerGetPlayerTagsResultEvent != null) { _instance.OnServerGetPlayerTagsResultEvent((ServerModels.GetPlayerTagsResult)e.Result); return; } }
if (type == typeof(ServerModels.RemovePlayerTagResult)) { if (_instance.OnServerRemovePlayerTagResultEvent != null) { _instance.OnServerRemovePlayerTagResultEvent((ServerModels.RemovePlayerTagResult)e.Result); return; } }
#endif
#if !DISABLE_PLAYFABCLIENT_API
if (type == typeof(ClientModels.LoginResult)) { if (_instance.OnLoginResultEvent != null) { _instance.OnLoginResultEvent((ClientModels.LoginResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPhotonAuthenticationTokenResult)) { if (_instance.OnGetPhotonAuthenticationTokenResultEvent != null) { _instance.OnGetPhotonAuthenticationTokenResultEvent((ClientModels.GetPhotonAuthenticationTokenResult)e.Result); return; } }
if (type == typeof(ClientModels.RegisterPlayFabUserResult)) { if (_instance.OnRegisterPlayFabUserResultEvent != null) { _instance.OnRegisterPlayFabUserResultEvent((ClientModels.RegisterPlayFabUserResult)e.Result); return; } }
if (type == typeof(ClientModels.AddGenericIDResult)) { if (_instance.OnAddGenericIDResultEvent != null) { _instance.OnAddGenericIDResultEvent((ClientModels.AddGenericIDResult)e.Result); return; } }
if (type == typeof(ClientModels.AddUsernamePasswordResult)) { if (_instance.OnAddUsernamePasswordResultEvent != null) { _instance.OnAddUsernamePasswordResultEvent((ClientModels.AddUsernamePasswordResult)e.Result); return; } }
if (type == typeof(ClientModels.GetAccountInfoResult)) { if (_instance.OnGetAccountInfoResultEvent != null) { _instance.OnGetAccountInfoResultEvent((ClientModels.GetAccountInfoResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayerCombinedInfoResult)) { if (_instance.OnGetPlayerCombinedInfoResultEvent != null) { _instance.OnGetPlayerCombinedInfoResultEvent((ClientModels.GetPlayerCombinedInfoResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromFacebookIDsResult)) { if (_instance.OnGetPlayFabIDsFromFacebookIDsResultEvent != null) { _instance.OnGetPlayFabIDsFromFacebookIDsResultEvent((ClientModels.GetPlayFabIDsFromFacebookIDsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromGameCenterIDsResult)) { if (_instance.OnGetPlayFabIDsFromGameCenterIDsResultEvent != null) { _instance.OnGetPlayFabIDsFromGameCenterIDsResultEvent((ClientModels.GetPlayFabIDsFromGameCenterIDsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromGenericIDsResult)) { if (_instance.OnGetPlayFabIDsFromGenericIDsResultEvent != null) { _instance.OnGetPlayFabIDsFromGenericIDsResultEvent((ClientModels.GetPlayFabIDsFromGenericIDsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromGoogleIDsResult)) { if (_instance.OnGetPlayFabIDsFromGoogleIDsResultEvent != null) { _instance.OnGetPlayFabIDsFromGoogleIDsResultEvent((ClientModels.GetPlayFabIDsFromGoogleIDsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromKongregateIDsResult)) { if (_instance.OnGetPlayFabIDsFromKongregateIDsResultEvent != null) { _instance.OnGetPlayFabIDsFromKongregateIDsResultEvent((ClientModels.GetPlayFabIDsFromKongregateIDsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromSteamIDsResult)) { if (_instance.OnGetPlayFabIDsFromSteamIDsResultEvent != null) { _instance.OnGetPlayFabIDsFromSteamIDsResultEvent((ClientModels.GetPlayFabIDsFromSteamIDsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayFabIDsFromTwitchIDsResult)) { if (_instance.OnGetPlayFabIDsFromTwitchIDsResultEvent != null) { _instance.OnGetPlayFabIDsFromTwitchIDsResultEvent((ClientModels.GetPlayFabIDsFromTwitchIDsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetUserCombinedInfoResult)) { if (_instance.OnGetUserCombinedInfoResultEvent != null) { _instance.OnGetUserCombinedInfoResultEvent((ClientModels.GetUserCombinedInfoResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkAndroidDeviceIDResult)) { if (_instance.OnLinkAndroidDeviceIDResultEvent != null) { _instance.OnLinkAndroidDeviceIDResultEvent((ClientModels.LinkAndroidDeviceIDResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkCustomIDResult)) { if (_instance.OnLinkCustomIDResultEvent != null) { _instance.OnLinkCustomIDResultEvent((ClientModels.LinkCustomIDResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkFacebookAccountResult)) { if (_instance.OnLinkFacebookAccountResultEvent != null) { _instance.OnLinkFacebookAccountResultEvent((ClientModels.LinkFacebookAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkGameCenterAccountResult)) { if (_instance.OnLinkGameCenterAccountResultEvent != null) { _instance.OnLinkGameCenterAccountResultEvent((ClientModels.LinkGameCenterAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkGoogleAccountResult)) { if (_instance.OnLinkGoogleAccountResultEvent != null) { _instance.OnLinkGoogleAccountResultEvent((ClientModels.LinkGoogleAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkIOSDeviceIDResult)) { if (_instance.OnLinkIOSDeviceIDResultEvent != null) { _instance.OnLinkIOSDeviceIDResultEvent((ClientModels.LinkIOSDeviceIDResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkKongregateAccountResult)) { if (_instance.OnLinkKongregateResultEvent != null) { _instance.OnLinkKongregateResultEvent((ClientModels.LinkKongregateAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkSteamAccountResult)) { if (_instance.OnLinkSteamAccountResultEvent != null) { _instance.OnLinkSteamAccountResultEvent((ClientModels.LinkSteamAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.LinkTwitchAccountResult)) { if (_instance.OnLinkTwitchResultEvent != null) { _instance.OnLinkTwitchResultEvent((ClientModels.LinkTwitchAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.RemoveGenericIDResult)) { if (_instance.OnRemoveGenericIDResultEvent != null) { _instance.OnRemoveGenericIDResultEvent((ClientModels.RemoveGenericIDResult)e.Result); return; } }
if (type == typeof(ClientModels.ReportPlayerClientResult)) { if (_instance.OnReportPlayerResultEvent != null) { _instance.OnReportPlayerResultEvent((ClientModels.ReportPlayerClientResult)e.Result); return; } }
if (type == typeof(ClientModels.SendAccountRecoveryEmailResult)) { if (_instance.OnSendAccountRecoveryEmailResultEvent != null) { _instance.OnSendAccountRecoveryEmailResultEvent((ClientModels.SendAccountRecoveryEmailResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkAndroidDeviceIDResult)) { if (_instance.OnUnlinkAndroidDeviceIDResultEvent != null) { _instance.OnUnlinkAndroidDeviceIDResultEvent((ClientModels.UnlinkAndroidDeviceIDResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkCustomIDResult)) { if (_instance.OnUnlinkCustomIDResultEvent != null) { _instance.OnUnlinkCustomIDResultEvent((ClientModels.UnlinkCustomIDResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkFacebookAccountResult)) { if (_instance.OnUnlinkFacebookAccountResultEvent != null) { _instance.OnUnlinkFacebookAccountResultEvent((ClientModels.UnlinkFacebookAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkGameCenterAccountResult)) { if (_instance.OnUnlinkGameCenterAccountResultEvent != null) { _instance.OnUnlinkGameCenterAccountResultEvent((ClientModels.UnlinkGameCenterAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkGoogleAccountResult)) { if (_instance.OnUnlinkGoogleAccountResultEvent != null) { _instance.OnUnlinkGoogleAccountResultEvent((ClientModels.UnlinkGoogleAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkIOSDeviceIDResult)) { if (_instance.OnUnlinkIOSDeviceIDResultEvent != null) { _instance.OnUnlinkIOSDeviceIDResultEvent((ClientModels.UnlinkIOSDeviceIDResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkKongregateAccountResult)) { if (_instance.OnUnlinkKongregateResultEvent != null) { _instance.OnUnlinkKongregateResultEvent((ClientModels.UnlinkKongregateAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkSteamAccountResult)) { if (_instance.OnUnlinkSteamAccountResultEvent != null) { _instance.OnUnlinkSteamAccountResultEvent((ClientModels.UnlinkSteamAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlinkTwitchAccountResult)) { if (_instance.OnUnlinkTwitchResultEvent != null) { _instance.OnUnlinkTwitchResultEvent((ClientModels.UnlinkTwitchAccountResult)e.Result); return; } }
if (type == typeof(ClientModels.UpdateUserTitleDisplayNameResult)) { if (_instance.OnUpdateUserTitleDisplayNameResultEvent != null) { _instance.OnUpdateUserTitleDisplayNameResultEvent((ClientModels.UpdateUserTitleDisplayNameResult)e.Result); return; } }
if (type == typeof(ClientModels.GetLeaderboardResult)) { if (_instance.OnGetFriendLeaderboardResultEvent != null) { _instance.OnGetFriendLeaderboardResultEvent((ClientModels.GetLeaderboardResult)e.Result); return; } }
if (type == typeof(ClientModels.GetFriendLeaderboardAroundCurrentUserResult)) { if (_instance.OnGetFriendLeaderboardAroundCurrentUserResultEvent != null) { _instance.OnGetFriendLeaderboardAroundCurrentUserResultEvent((ClientModels.GetFriendLeaderboardAroundCurrentUserResult)e.Result); return; } }
if (type == typeof(ClientModels.GetFriendLeaderboardAroundPlayerResult)) { if (_instance.OnGetFriendLeaderboardAroundPlayerResultEvent != null) { _instance.OnGetFriendLeaderboardAroundPlayerResultEvent((ClientModels.GetFriendLeaderboardAroundPlayerResult)e.Result); return; } }
if (type == typeof(ClientModels.GetLeaderboardResult)) { if (_instance.OnGetLeaderboardResultEvent != null) { _instance.OnGetLeaderboardResultEvent((ClientModels.GetLeaderboardResult)e.Result); return; } }
if (type == typeof(ClientModels.GetLeaderboardAroundCurrentUserResult)) { if (_instance.OnGetLeaderboardAroundCurrentUserResultEvent != null) { _instance.OnGetLeaderboardAroundCurrentUserResultEvent((ClientModels.GetLeaderboardAroundCurrentUserResult)e.Result); return; } }
if (type == typeof(ClientModels.GetLeaderboardAroundPlayerResult)) { if (_instance.OnGetLeaderboardAroundPlayerResultEvent != null) { _instance.OnGetLeaderboardAroundPlayerResultEvent((ClientModels.GetLeaderboardAroundPlayerResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayerStatisticsResult)) { if (_instance.OnGetPlayerStatisticsResultEvent != null) { _instance.OnGetPlayerStatisticsResultEvent((ClientModels.GetPlayerStatisticsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayerStatisticVersionsResult)) { if (_instance.OnGetPlayerStatisticVersionsResultEvent != null) { _instance.OnGetPlayerStatisticVersionsResultEvent((ClientModels.GetPlayerStatisticVersionsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetUserDataResult)) { if (_instance.OnGetUserDataResultEvent != null) { _instance.OnGetUserDataResultEvent((ClientModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ClientModels.GetUserDataResult)) { if (_instance.OnGetUserPublisherDataResultEvent != null) { _instance.OnGetUserPublisherDataResultEvent((ClientModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ClientModels.GetUserDataResult)) { if (_instance.OnGetUserPublisherReadOnlyDataResultEvent != null) { _instance.OnGetUserPublisherReadOnlyDataResultEvent((ClientModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ClientModels.GetUserDataResult)) { if (_instance.OnGetUserReadOnlyDataResultEvent != null) { _instance.OnGetUserReadOnlyDataResultEvent((ClientModels.GetUserDataResult)e.Result); return; } }
if (type == typeof(ClientModels.GetUserStatisticsResult)) { if (_instance.OnGetUserStatisticsResultEvent != null) { _instance.OnGetUserStatisticsResultEvent((ClientModels.GetUserStatisticsResult)e.Result); return; } }
if (type == typeof(ClientModels.UpdatePlayerStatisticsResult)) { if (_instance.OnUpdatePlayerStatisticsResultEvent != null) { _instance.OnUpdatePlayerStatisticsResultEvent((ClientModels.UpdatePlayerStatisticsResult)e.Result); return; } }
if (type == typeof(ClientModels.UpdateUserDataResult)) { if (_instance.OnUpdateUserDataResultEvent != null) { _instance.OnUpdateUserDataResultEvent((ClientModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(ClientModels.UpdateUserDataResult)) { if (_instance.OnUpdateUserPublisherDataResultEvent != null) { _instance.OnUpdateUserPublisherDataResultEvent((ClientModels.UpdateUserDataResult)e.Result); return; } }
if (type == typeof(ClientModels.UpdateUserStatisticsResult)) { if (_instance.OnUpdateUserStatisticsResultEvent != null) { _instance.OnUpdateUserStatisticsResultEvent((ClientModels.UpdateUserStatisticsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetCatalogItemsResult)) { if (_instance.OnGetCatalogItemsResultEvent != null) { _instance.OnGetCatalogItemsResultEvent((ClientModels.GetCatalogItemsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPublisherDataResult)) { if (_instance.OnGetPublisherDataResultEvent != null) { _instance.OnGetPublisherDataResultEvent((ClientModels.GetPublisherDataResult)e.Result); return; } }
if (type == typeof(ClientModels.GetStoreItemsResult)) { if (_instance.OnGetStoreItemsResultEvent != null) { _instance.OnGetStoreItemsResultEvent((ClientModels.GetStoreItemsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetTimeResult)) { if (_instance.OnGetTimeResultEvent != null) { _instance.OnGetTimeResultEvent((ClientModels.GetTimeResult)e.Result); return; } }
if (type == typeof(ClientModels.GetTitleDataResult)) { if (_instance.OnGetTitleDataResultEvent != null) { _instance.OnGetTitleDataResultEvent((ClientModels.GetTitleDataResult)e.Result); return; } }
if (type == typeof(ClientModels.GetTitleNewsResult)) { if (_instance.OnGetTitleNewsResultEvent != null) { _instance.OnGetTitleNewsResultEvent((ClientModels.GetTitleNewsResult)e.Result); return; } }
if (type == typeof(ClientModels.ModifyUserVirtualCurrencyResult)) { if (_instance.OnAddUserVirtualCurrencyResultEvent != null) { _instance.OnAddUserVirtualCurrencyResultEvent((ClientModels.ModifyUserVirtualCurrencyResult)e.Result); return; } }
if (type == typeof(ClientModels.ConfirmPurchaseResult)) { if (_instance.OnConfirmPurchaseResultEvent != null) { _instance.OnConfirmPurchaseResultEvent((ClientModels.ConfirmPurchaseResult)e.Result); return; } }
if (type == typeof(ClientModels.ConsumeItemResult)) { if (_instance.OnConsumeItemResultEvent != null) { _instance.OnConsumeItemResultEvent((ClientModels.ConsumeItemResult)e.Result); return; } }
if (type == typeof(ClientModels.GetCharacterInventoryResult)) { if (_instance.OnGetCharacterInventoryResultEvent != null) { _instance.OnGetCharacterInventoryResultEvent((ClientModels.GetCharacterInventoryResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPurchaseResult)) { if (_instance.OnGetPurchaseResultEvent != null) { _instance.OnGetPurchaseResultEvent((ClientModels.GetPurchaseResult)e.Result); return; } }
if (type == typeof(ClientModels.GetUserInventoryResult)) { if (_instance.OnGetUserInventoryResultEvent != null) { _instance.OnGetUserInventoryResultEvent((ClientModels.GetUserInventoryResult)e.Result); return; } }
if (type == typeof(ClientModels.PayForPurchaseResult)) { if (_instance.OnPayForPurchaseResultEvent != null) { _instance.OnPayForPurchaseResultEvent((ClientModels.PayForPurchaseResult)e.Result); return; } }
if (type == typeof(ClientModels.PurchaseItemResult)) { if (_instance.OnPurchaseItemResultEvent != null) { _instance.OnPurchaseItemResultEvent((ClientModels.PurchaseItemResult)e.Result); return; } }
if (type == typeof(ClientModels.RedeemCouponResult)) { if (_instance.OnRedeemCouponResultEvent != null) { _instance.OnRedeemCouponResultEvent((ClientModels.RedeemCouponResult)e.Result); return; } }
if (type == typeof(ClientModels.StartPurchaseResult)) { if (_instance.OnStartPurchaseResultEvent != null) { _instance.OnStartPurchaseResultEvent((ClientModels.StartPurchaseResult)e.Result); return; } }
if (type == typeof(ClientModels.ModifyUserVirtualCurrencyResult)) { if (_instance.OnSubtractUserVirtualCurrencyResultEvent != null) { _instance.OnSubtractUserVirtualCurrencyResultEvent((ClientModels.ModifyUserVirtualCurrencyResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlockContainerItemResult)) { if (_instance.OnUnlockContainerInstanceResultEvent != null) { _instance.OnUnlockContainerInstanceResultEvent((ClientModels.UnlockContainerItemResult)e.Result); return; } }
if (type == typeof(ClientModels.UnlockContainerItemResult)) { if (_instance.OnUnlockContainerItemResultEvent != null) { _instance.OnUnlockContainerItemResultEvent((ClientModels.UnlockContainerItemResult)e.Result); return; } }
if (type == typeof(ClientModels.AddFriendResult)) { if (_instance.OnAddFriendResultEvent != null) { _instance.OnAddFriendResultEvent((ClientModels.AddFriendResult)e.Result); return; } }
if (type == typeof(ClientModels.GetFriendsListResult)) { if (_instance.OnGetFriendsListResultEvent != null) { _instance.OnGetFriendsListResultEvent((ClientModels.GetFriendsListResult)e.Result); return; } }
if (type == typeof(ClientModels.RemoveFriendResult)) { if (_instance.OnRemoveFriendResultEvent != null) { _instance.OnRemoveFriendResultEvent((ClientModels.RemoveFriendResult)e.Result); return; } }
if (type == typeof(ClientModels.SetFriendTagsResult)) { if (_instance.OnSetFriendTagsResultEvent != null) { _instance.OnSetFriendTagsResultEvent((ClientModels.SetFriendTagsResult)e.Result); return; } }
if (type == typeof(ClientModels.RegisterForIOSPushNotificationResult)) { if (_instance.OnRegisterForIOSPushNotificationResultEvent != null) { _instance.OnRegisterForIOSPushNotificationResultEvent((ClientModels.RegisterForIOSPushNotificationResult)e.Result); return; } }
if (type == typeof(ClientModels.RestoreIOSPurchasesResult)) { if (_instance.OnRestoreIOSPurchasesResultEvent != null) { _instance.OnRestoreIOSPurchasesResultEvent((ClientModels.RestoreIOSPurchasesResult)e.Result); return; } }
if (type == typeof(ClientModels.ValidateIOSReceiptResult)) { if (_instance.OnValidateIOSReceiptResultEvent != null) { _instance.OnValidateIOSReceiptResultEvent((ClientModels.ValidateIOSReceiptResult)e.Result); return; } }
if (type == typeof(ClientModels.CurrentGamesResult)) { if (_instance.OnGetCurrentGamesResultEvent != null) { _instance.OnGetCurrentGamesResultEvent((ClientModels.CurrentGamesResult)e.Result); return; } }
if (type == typeof(ClientModels.GameServerRegionsResult)) { if (_instance.OnGetGameServerRegionsResultEvent != null) { _instance.OnGetGameServerRegionsResultEvent((ClientModels.GameServerRegionsResult)e.Result); return; } }
if (type == typeof(ClientModels.MatchmakeResult)) { if (_instance.OnMatchmakeResultEvent != null) { _instance.OnMatchmakeResultEvent((ClientModels.MatchmakeResult)e.Result); return; } }
if (type == typeof(ClientModels.StartGameResult)) { if (_instance.OnStartGameResultEvent != null) { _instance.OnStartGameResultEvent((ClientModels.StartGameResult)e.Result); return; } }
if (type == typeof(ClientModels.AndroidDevicePushNotificationRegistrationResult)) { if (_instance.OnAndroidDevicePushNotificationRegistrationResultEvent != null) { _instance.OnAndroidDevicePushNotificationRegistrationResultEvent((ClientModels.AndroidDevicePushNotificationRegistrationResult)e.Result); return; } }
if (type == typeof(ClientModels.ValidateGooglePlayPurchaseResult)) { if (_instance.OnValidateGooglePlayPurchaseResultEvent != null) { _instance.OnValidateGooglePlayPurchaseResultEvent((ClientModels.ValidateGooglePlayPurchaseResult)e.Result); return; } }
if (type == typeof(ClientModels.LogEventResult)) { if (_instance.OnLogEventResultEvent != null) { _instance.OnLogEventResultEvent((ClientModels.LogEventResult)e.Result); return; } }
if (type == typeof(ClientModels.WriteEventResponse)) { if (_instance.OnWriteCharacterEventResultEvent != null) { _instance.OnWriteCharacterEventResultEvent((ClientModels.WriteEventResponse)e.Result); return; } }
if (type == typeof(ClientModels.WriteEventResponse)) { if (_instance.OnWritePlayerEventResultEvent != null) { _instance.OnWritePlayerEventResultEvent((ClientModels.WriteEventResponse)e.Result); return; } }
if (type == typeof(ClientModels.WriteEventResponse)) { if (_instance.OnWriteTitleEventResultEvent != null) { _instance.OnWriteTitleEventResultEvent((ClientModels.WriteEventResponse)e.Result); return; } }
if (type == typeof(ClientModels.AddSharedGroupMembersResult)) { if (_instance.OnAddSharedGroupMembersResultEvent != null) { _instance.OnAddSharedGroupMembersResultEvent((ClientModels.AddSharedGroupMembersResult)e.Result); return; } }
if (type == typeof(ClientModels.CreateSharedGroupResult)) { if (_instance.OnCreateSharedGroupResultEvent != null) { _instance.OnCreateSharedGroupResultEvent((ClientModels.CreateSharedGroupResult)e.Result); return; } }
if (type == typeof(ClientModels.GetSharedGroupDataResult)) { if (_instance.OnGetSharedGroupDataResultEvent != null) { _instance.OnGetSharedGroupDataResultEvent((ClientModels.GetSharedGroupDataResult)e.Result); return; } }
if (type == typeof(ClientModels.RemoveSharedGroupMembersResult)) { if (_instance.OnRemoveSharedGroupMembersResultEvent != null) { _instance.OnRemoveSharedGroupMembersResultEvent((ClientModels.RemoveSharedGroupMembersResult)e.Result); return; } }
if (type == typeof(ClientModels.UpdateSharedGroupDataResult)) { if (_instance.OnUpdateSharedGroupDataResultEvent != null) { _instance.OnUpdateSharedGroupDataResultEvent((ClientModels.UpdateSharedGroupDataResult)e.Result); return; } }
if (type == typeof(ClientModels.ExecuteCloudScriptResult)) { if (_instance.OnExecuteCloudScriptResultEvent != null) { _instance.OnExecuteCloudScriptResultEvent((ClientModels.ExecuteCloudScriptResult)e.Result); return; } }
if (type == typeof(ClientModels.GetCloudScriptUrlResult)) { if (_instance.OnGetCloudScriptUrlResultEvent != null) { _instance.OnGetCloudScriptUrlResultEvent((ClientModels.GetCloudScriptUrlResult)e.Result); return; } }
if (type == typeof(ClientModels.RunCloudScriptResult)) { if (_instance.OnRunCloudScriptResultEvent != null) { _instance.OnRunCloudScriptResultEvent((ClientModels.RunCloudScriptResult)e.Result); return; } }
if (type == typeof(ClientModels.GetContentDownloadUrlResult)) { if (_instance.OnGetContentDownloadUrlResultEvent != null) { _instance.OnGetContentDownloadUrlResultEvent((ClientModels.GetContentDownloadUrlResult)e.Result); return; } }
if (type == typeof(ClientModels.ListUsersCharactersResult)) { if (_instance.OnGetAllUsersCharactersResultEvent != null) { _instance.OnGetAllUsersCharactersResultEvent((ClientModels.ListUsersCharactersResult)e.Result); return; } }
if (type == typeof(ClientModels.GetCharacterLeaderboardResult)) { if (_instance.OnGetCharacterLeaderboardResultEvent != null) { _instance.OnGetCharacterLeaderboardResultEvent((ClientModels.GetCharacterLeaderboardResult)e.Result); return; } }
if (type == typeof(ClientModels.GetCharacterStatisticsResult)) { if (_instance.OnGetCharacterStatisticsResultEvent != null) { _instance.OnGetCharacterStatisticsResultEvent((ClientModels.GetCharacterStatisticsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetLeaderboardAroundCharacterResult)) { if (_instance.OnGetLeaderboardAroundCharacterResultEvent != null) { _instance.OnGetLeaderboardAroundCharacterResultEvent((ClientModels.GetLeaderboardAroundCharacterResult)e.Result); return; } }
if (type == typeof(ClientModels.GetLeaderboardForUsersCharactersResult)) { if (_instance.OnGetLeaderboardForUserCharactersResultEvent != null) { _instance.OnGetLeaderboardForUserCharactersResultEvent((ClientModels.GetLeaderboardForUsersCharactersResult)e.Result); return; } }
if (type == typeof(ClientModels.GrantCharacterToUserResult)) { if (_instance.OnGrantCharacterToUserResultEvent != null) { _instance.OnGrantCharacterToUserResultEvent((ClientModels.GrantCharacterToUserResult)e.Result); return; } }
if (type == typeof(ClientModels.UpdateCharacterStatisticsResult)) { if (_instance.OnUpdateCharacterStatisticsResultEvent != null) { _instance.OnUpdateCharacterStatisticsResultEvent((ClientModels.UpdateCharacterStatisticsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetCharacterDataResult)) { if (_instance.OnGetCharacterDataResultEvent != null) { _instance.OnGetCharacterDataResultEvent((ClientModels.GetCharacterDataResult)e.Result); return; } }
if (type == typeof(ClientModels.GetCharacterDataResult)) { if (_instance.OnGetCharacterReadOnlyDataResultEvent != null) { _instance.OnGetCharacterReadOnlyDataResultEvent((ClientModels.GetCharacterDataResult)e.Result); return; } }
if (type == typeof(ClientModels.UpdateCharacterDataResult)) { if (_instance.OnUpdateCharacterDataResultEvent != null) { _instance.OnUpdateCharacterDataResultEvent((ClientModels.UpdateCharacterDataResult)e.Result); return; } }
if (type == typeof(ClientModels.ValidateAmazonReceiptResult)) { if (_instance.OnValidateAmazonIAPReceiptResultEvent != null) { _instance.OnValidateAmazonIAPReceiptResultEvent((ClientModels.ValidateAmazonReceiptResult)e.Result); return; } }
if (type == typeof(ClientModels.AcceptTradeResponse)) { if (_instance.OnAcceptTradeResultEvent != null) { _instance.OnAcceptTradeResultEvent((ClientModels.AcceptTradeResponse)e.Result); return; } }
if (type == typeof(ClientModels.CancelTradeResponse)) { if (_instance.OnCancelTradeResultEvent != null) { _instance.OnCancelTradeResultEvent((ClientModels.CancelTradeResponse)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayerTradesResponse)) { if (_instance.OnGetPlayerTradesResultEvent != null) { _instance.OnGetPlayerTradesResultEvent((ClientModels.GetPlayerTradesResponse)e.Result); return; } }
if (type == typeof(ClientModels.GetTradeStatusResponse)) { if (_instance.OnGetTradeStatusResultEvent != null) { _instance.OnGetTradeStatusResultEvent((ClientModels.GetTradeStatusResponse)e.Result); return; } }
if (type == typeof(ClientModels.OpenTradeResponse)) { if (_instance.OnOpenTradeResultEvent != null) { _instance.OnOpenTradeResultEvent((ClientModels.OpenTradeResponse)e.Result); return; } }
if (type == typeof(ClientModels.AttributeInstallResult)) { if (_instance.OnAttributeInstallResultEvent != null) { _instance.OnAttributeInstallResultEvent((ClientModels.AttributeInstallResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayerSegmentsResult)) { if (_instance.OnGetPlayerSegmentsResultEvent != null) { _instance.OnGetPlayerSegmentsResultEvent((ClientModels.GetPlayerSegmentsResult)e.Result); return; } }
if (type == typeof(ClientModels.GetPlayerTagsResult)) { if (_instance.OnGetPlayerTagsResultEvent != null) { _instance.OnGetPlayerTagsResultEvent((ClientModels.GetPlayerTagsResult)e.Result); return; } }
#endif
}
}
}
}
| 411 | 0.815145 | 1 | 0.815145 | game-dev | MEDIA | 0.516439 | game-dev,web-backend | 0.827232 | 1 | 0.827232 |
gridhead/gi-loadouts | 124,334 | gi_loadouts/face/otpt/otpt.py |
################################################################################
## Form generated from reading UI file 'otpt.ui'
##
## Created by: Qt User Interface Compiler version 6.8.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import QCoreApplication, QMetaObject, QRect, QSize, Qt
from PySide6.QtGui import QFont
from PySide6.QtWidgets import QFrame, QLabel, QSizePolicy, QWidget
class Ui_otptwind:
def setupUi(self, otptwind):
if not otptwind.objectName():
otptwind.setObjectName("otptwind")
otptwind.resize(1260, 600)
sizePolicy = QSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(otptwind.sizePolicy().hasHeightForWidth())
otptwind.setSizePolicy(sizePolicy)
otptwind.setMinimumSize(QSize(1260, 600))
otptwind.setMaximumSize(QSize(1260, 600))
otptwind.setStyleSheet("font: 10pt \"IBM Plex Sans\";")
self.centwdgt = QWidget(otptwind)
self.centwdgt.setObjectName("centwdgt")
self.head_area = QFrame(self.centwdgt)
self.head_area.setObjectName("head_area")
self.head_area.setGeometry(QRect(200, 5, 1055, 75))
sizePolicy.setHeightForWidth(self.head_area.sizePolicy().hasHeightForWidth())
self.head_area.setSizePolicy(sizePolicy)
self.head_area.setMinimumSize(QSize(1055, 75))
self.head_area.setMaximumSize(QSize(1055, 75))
self.head_area.setStyleSheet("#head_area {border: 1px solid rgba(128, 128, 128, 160); border-radius: 5px; background-color: rgba(128, 128, 128, 160);}")
self.head_area.setFrameShape(QFrame.Shape.StyledPanel)
self.head_area.setFrameShadow(QFrame.Shadow.Raised)
self.head_area_line_prim = QLabel(self.head_area)
self.head_area_line_prim.setObjectName("head_area_line_prim")
self.head_area_line_prim.setGeometry(QRect(5, 5, 975, 25))
sizePolicy.setHeightForWidth(self.head_area_line_prim.sizePolicy().hasHeightForWidth())
self.head_area_line_prim.setSizePolicy(sizePolicy)
self.head_area_line_prim.setMinimumSize(QSize(975, 25))
self.head_area_line_prim.setMaximumSize(QSize(975, 25))
self.head_area_line_prim.setStyleSheet("font: 75 15pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.head_area_line_seco = QLabel(self.head_area)
self.head_area_line_seco.setObjectName("head_area_line_seco")
self.head_area_line_seco.setGeometry(QRect(5, 35, 975, 35))
sizePolicy.setHeightForWidth(self.head_area_line_seco.sizePolicy().hasHeightForWidth())
self.head_area_line_seco.setSizePolicy(sizePolicy)
self.head_area_line_seco.setMinimumSize(QSize(975, 35))
self.head_area_line_seco.setMaximumSize(QSize(975, 35))
self.head_area_line_seco.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.head_vson = QLabel(self.head_area)
self.head_vson.setObjectName("head_vson")
self.head_vson.setGeometry(QRect(985, 5, 65, 65))
sizePolicy.setHeightForWidth(self.head_vson.sizePolicy().hasHeightForWidth())
self.head_vson.setSizePolicy(sizePolicy)
self.head_vson.setMinimumSize(QSize(65, 65))
self.head_vson.setMaximumSize(QSize(65, 65))
self.head_vson.setScaledContents(True)
self.head_vson.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.char_area = QFrame(self.centwdgt)
self.char_area.setObjectName("char_area")
self.char_area.setGeometry(QRect(5, 5, 190, 590))
sizePolicy.setHeightForWidth(self.char_area.sizePolicy().hasHeightForWidth())
self.char_area.setSizePolicy(sizePolicy)
self.char_area.setMinimumSize(QSize(190, 590))
self.char_area.setMaximumSize(QSize(190, 590))
self.char_area.setStyleSheet("#char_area {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160); border-radius: 5px;}")
self.char_area.setFrameShape(QFrame.Shape.StyledPanel)
self.char_area.setFrameShadow(QFrame.Shadow.Raised)
self.char_wish = QLabel(self.char_area)
self.char_wish.setObjectName("char_wish")
self.char_wish.setGeometry(QRect(5, 5, 180, 580))
sizePolicy.setHeightForWidth(self.char_wish.sizePolicy().hasHeightForWidth())
self.char_wish.setSizePolicy(sizePolicy)
self.char_wish.setMinimumSize(QSize(180, 580))
self.char_wish.setMaximumSize(QSize(180, 580))
self.char_wish.setStyleSheet("#char_port_area {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.char_wish.setScaledContents(True)
self.char_back = QLabel(self.centwdgt)
self.char_back.setObjectName("char_back")
self.char_back.setGeometry(QRect(0, 0, 1260, 600))
sizePolicy.setHeightForWidth(self.char_back.sizePolicy().hasHeightForWidth())
self.char_back.setSizePolicy(sizePolicy)
self.char_back.setMinimumSize(QSize(1260, 600))
self.char_back.setMaximumSize(QSize(1260, 600))
self.char_back.setScaledContents(True)
self.advc_area = QFrame(self.centwdgt)
self.advc_area.setObjectName("advc_area")
self.advc_area.setGeometry(QRect(490, 85, 380, 270))
sizePolicy.setHeightForWidth(self.advc_area.sizePolicy().hasHeightForWidth())
self.advc_area.setSizePolicy(sizePolicy)
self.advc_area.setMinimumSize(QSize(380, 270))
self.advc_area.setMaximumSize(QSize(380, 270))
self.advc_area.setStyleSheet("#advc_area {border: 1px solid rgba(128, 128, 128, 160); border-radius: 5px;}")
self.advc_area.setFrameShape(QFrame.Shape.StyledPanel)
self.advc_area.setFrameShadow(QFrame.Shadow.Raised)
self.advc_desc_area = QFrame(self.advc_area)
self.advc_desc_area.setObjectName("advc_desc_area")
self.advc_desc_area.setGeometry(QRect(0, 0, 380, 25))
sizePolicy.setHeightForWidth(self.advc_desc_area.sizePolicy().hasHeightForWidth())
self.advc_desc_area.setSizePolicy(sizePolicy)
self.advc_desc_area.setMinimumSize(QSize(380, 25))
self.advc_desc_area.setMaximumSize(QSize(380, 25))
self.advc_desc_area.setStyleSheet("#advc_desc_area {border: 1px solid rgba(128, 128, 128, 160); border-top-left-radius: 5px; border-top-right-radius: 5px; background-color: rgba(128, 128, 128, 160);}")
self.advc_desc_area.setFrameShape(QFrame.Shape.StyledPanel)
self.advc_desc_area.setFrameShadow(QFrame.Shadow.Raised)
self.advc_desc_text = QLabel(self.advc_desc_area)
self.advc_desc_text.setObjectName("advc_desc_text")
self.advc_desc_text.setGeometry(QRect(5, 5, 370, 15))
sizePolicy.setHeightForWidth(self.advc_desc_text.sizePolicy().hasHeightForWidth())
self.advc_desc_text.setSizePolicy(sizePolicy)
self.advc_desc_text.setMinimumSize(QSize(370, 15))
self.advc_desc_text.setMaximumSize(QSize(370, 15))
self.advc_desc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crit_base = QFrame(self.advc_area)
self.area_crit_base.setObjectName("area_crit_base")
self.area_crit_base.setGeometry(QRect(5, 30, 120, 25))
sizePolicy.setHeightForWidth(self.area_crit_base.sizePolicy().hasHeightForWidth())
self.area_crit_base.setSizePolicy(sizePolicy)
self.area_crit_base.setMinimumSize(QSize(120, 25))
self.area_crit_base.setMaximumSize(QSize(120, 25))
self.area_crit_base.setStyleSheet("#area_crit_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_crit_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_crit_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_crit_base_text = QLabel(self.area_crit_base)
self.area_crit_base_text.setObjectName("area_crit_base_text")
self.area_crit_base_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_crit_base_text.sizePolicy().hasHeightForWidth())
self.area_crit_base_text.setSizePolicy(sizePolicy)
self.area_crit_base_text.setMinimumSize(QSize(90, 15))
self.area_crit_base_text.setMaximumSize(QSize(90, 15))
self.area_crit_base_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crit_base_icon = QLabel(self.area_crit_base)
self.area_crit_base_icon.setObjectName("area_crit_base_icon")
self.area_crit_base_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_crit_base_icon.sizePolicy().hasHeightForWidth())
self.area_crit_base_icon.setSizePolicy(sizePolicy)
self.area_crit_base_icon.setMinimumSize(QSize(15, 15))
self.area_crit_base_icon.setMaximumSize(QSize(15, 15))
self.area_crit_base_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_crit_base_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_crit_dmge_head = QFrame(self.advc_area)
self.area_crit_dmge_head.setObjectName("area_crit_dmge_head")
self.area_crit_dmge_head.setGeometry(QRect(255, 30, 120, 25))
sizePolicy.setHeightForWidth(self.area_crit_dmge_head.sizePolicy().hasHeightForWidth())
self.area_crit_dmge_head.setSizePolicy(sizePolicy)
self.area_crit_dmge_head.setMinimumSize(QSize(120, 25))
self.area_crit_dmge_head.setMaximumSize(QSize(120, 25))
self.area_crit_dmge_head.setStyleSheet("#area_crit_dmge_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_crit_dmge_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_crit_dmge_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_crit_dmge_text = QLabel(self.area_crit_dmge_head)
self.area_crit_dmge_text.setObjectName("area_crit_dmge_text")
self.area_crit_dmge_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_crit_dmge_text.sizePolicy().hasHeightForWidth())
self.area_crit_dmge_text.setSizePolicy(sizePolicy)
self.area_crit_dmge_text.setMinimumSize(QSize(90, 15))
self.area_crit_dmge_text.setMaximumSize(QSize(90, 15))
self.area_crit_dmge_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crit_dmge_icon = QLabel(self.area_crit_dmge_head)
self.area_crit_dmge_icon.setObjectName("area_crit_dmge_icon")
self.area_crit_dmge_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_crit_dmge_icon.sizePolicy().hasHeightForWidth())
self.area_crit_dmge_icon.setSizePolicy(sizePolicy)
self.area_crit_dmge_icon.setMinimumSize(QSize(15, 15))
self.area_crit_dmge_icon.setMaximumSize(QSize(15, 15))
self.area_crit_dmge_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_crit_dmge_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_crit_rate_head = QFrame(self.advc_area)
self.area_crit_rate_head.setObjectName("area_crit_rate_head")
self.area_crit_rate_head.setGeometry(QRect(130, 30, 120, 25))
sizePolicy.setHeightForWidth(self.area_crit_rate_head.sizePolicy().hasHeightForWidth())
self.area_crit_rate_head.setSizePolicy(sizePolicy)
self.area_crit_rate_head.setMinimumSize(QSize(120, 25))
self.area_crit_rate_head.setMaximumSize(QSize(120, 25))
self.area_crit_rate_head.setStyleSheet("#area_crit_rate_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_crit_rate_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_crit_rate_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_crit_rate_text = QLabel(self.area_crit_rate_head)
self.area_crit_rate_text.setObjectName("area_crit_rate_text")
self.area_crit_rate_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_crit_rate_text.sizePolicy().hasHeightForWidth())
self.area_crit_rate_text.setSizePolicy(sizePolicy)
self.area_crit_rate_text.setMinimumSize(QSize(90, 15))
self.area_crit_rate_text.setMaximumSize(QSize(90, 15))
self.area_crit_rate_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crit_rate_icon = QLabel(self.area_crit_rate_head)
self.area_crit_rate_icon.setObjectName("area_crit_rate_icon")
self.area_crit_rate_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_crit_rate_icon.sizePolicy().hasHeightForWidth())
self.area_crit_rate_icon.setSizePolicy(sizePolicy)
self.area_crit_rate_icon.setMinimumSize(QSize(15, 15))
self.area_crit_rate_icon.setMaximumSize(QSize(15, 15))
self.area_crit_rate_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_crit_rate_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_heal_incm_head = QFrame(self.advc_area)
self.area_heal_incm_head.setObjectName("area_heal_incm_head")
self.area_heal_incm_head.setGeometry(QRect(255, 90, 120, 25))
sizePolicy.setHeightForWidth(self.area_heal_incm_head.sizePolicy().hasHeightForWidth())
self.area_heal_incm_head.setSizePolicy(sizePolicy)
self.area_heal_incm_head.setMinimumSize(QSize(120, 25))
self.area_heal_incm_head.setMaximumSize(QSize(120, 25))
self.area_heal_incm_head.setStyleSheet("#area_heal_incm_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_heal_incm_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_heal_incm_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_heal_incm_text = QLabel(self.area_heal_incm_head)
self.area_heal_incm_text.setObjectName("area_heal_incm_text")
self.area_heal_incm_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_heal_incm_text.sizePolicy().hasHeightForWidth())
self.area_heal_incm_text.setSizePolicy(sizePolicy)
self.area_heal_incm_text.setMinimumSize(QSize(90, 15))
self.area_heal_incm_text.setMaximumSize(QSize(90, 15))
self.area_heal_incm_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_heal_incm_icon = QLabel(self.area_heal_incm_head)
self.area_heal_incm_icon.setObjectName("area_heal_incm_icon")
self.area_heal_incm_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_heal_incm_icon.sizePolicy().hasHeightForWidth())
self.area_heal_incm_icon.setSizePolicy(sizePolicy)
self.area_heal_incm_icon.setMinimumSize(QSize(15, 15))
self.area_heal_incm_icon.setMaximumSize(QSize(15, 15))
self.area_heal_incm_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_heal_incm_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_heal_perc_head = QFrame(self.advc_area)
self.area_heal_perc_head.setObjectName("area_heal_perc_head")
self.area_heal_perc_head.setGeometry(QRect(130, 90, 120, 25))
sizePolicy.setHeightForWidth(self.area_heal_perc_head.sizePolicy().hasHeightForWidth())
self.area_heal_perc_head.setSizePolicy(sizePolicy)
self.area_heal_perc_head.setMinimumSize(QSize(120, 25))
self.area_heal_perc_head.setMaximumSize(QSize(120, 25))
self.area_heal_perc_head.setStyleSheet("#area_heal_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_heal_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_heal_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_heal_perc_text = QLabel(self.area_heal_perc_head)
self.area_heal_perc_text.setObjectName("area_heal_perc_text")
self.area_heal_perc_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_heal_perc_text.sizePolicy().hasHeightForWidth())
self.area_heal_perc_text.setSizePolicy(sizePolicy)
self.area_heal_perc_text.setMinimumSize(QSize(90, 15))
self.area_heal_perc_text.setMaximumSize(QSize(90, 15))
self.area_heal_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_heal_perc_icon = QLabel(self.area_heal_perc_head)
self.area_heal_perc_icon.setObjectName("area_heal_perc_icon")
self.area_heal_perc_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_heal_perc_icon.sizePolicy().hasHeightForWidth())
self.area_heal_perc_icon.setSizePolicy(sizePolicy)
self.area_heal_perc_icon.setMinimumSize(QSize(15, 15))
self.area_heal_perc_icon.setMaximumSize(QSize(15, 15))
self.area_heal_perc_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_heal_perc_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_heal_base = QFrame(self.advc_area)
self.area_heal_base.setObjectName("area_heal_base")
self.area_heal_base.setGeometry(QRect(5, 90, 120, 25))
sizePolicy.setHeightForWidth(self.area_heal_base.sizePolicy().hasHeightForWidth())
self.area_heal_base.setSizePolicy(sizePolicy)
self.area_heal_base.setMinimumSize(QSize(120, 25))
self.area_heal_base.setMaximumSize(QSize(120, 25))
self.area_heal_base.setStyleSheet("#area_heal_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_heal_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_heal_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_heal_base_text = QLabel(self.area_heal_base)
self.area_heal_base_text.setObjectName("area_heal_base_text")
self.area_heal_base_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_heal_base_text.sizePolicy().hasHeightForWidth())
self.area_heal_base_text.setSizePolicy(sizePolicy)
self.area_heal_base_text.setMinimumSize(QSize(90, 15))
self.area_heal_base_text.setMaximumSize(QSize(90, 15))
self.area_heal_base_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_heal_base_icon = QLabel(self.area_heal_base)
self.area_heal_base_icon.setObjectName("area_heal_base_icon")
self.area_heal_base_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_heal_base_icon.sizePolicy().hasHeightForWidth())
self.area_heal_base_icon.setSizePolicy(sizePolicy)
self.area_heal_base_icon.setMinimumSize(QSize(15, 15))
self.area_heal_base_icon.setMaximumSize(QSize(15, 15))
self.area_heal_base_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_heal_base_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_enrc = QFrame(self.advc_area)
self.area_enrc.setObjectName("area_enrc")
self.area_enrc.setGeometry(QRect(255, 150, 120, 25))
sizePolicy.setHeightForWidth(self.area_enrc.sizePolicy().hasHeightForWidth())
self.area_enrc.setSizePolicy(sizePolicy)
self.area_enrc.setMinimumSize(QSize(120, 25))
self.area_enrc.setMaximumSize(QSize(120, 25))
self.area_enrc.setStyleSheet("#area_enrc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_enrc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_enrc.setFrameShadow(QFrame.Shadow.Raised)
self.area_enrc_data = QLabel(self.area_enrc)
self.area_enrc_data.setObjectName("area_enrc_data")
self.area_enrc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_enrc_data.sizePolicy().hasHeightForWidth())
self.area_enrc_data.setSizePolicy(sizePolicy)
self.area_enrc_data.setMinimumSize(QSize(110, 15))
self.area_enrc_data.setMaximumSize(QSize(110, 15))
self.area_enrc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_cldn = QFrame(self.advc_area)
self.area_cldn.setObjectName("area_cldn")
self.area_cldn.setGeometry(QRect(255, 180, 120, 25))
sizePolicy.setHeightForWidth(self.area_cldn.sizePolicy().hasHeightForWidth())
self.area_cldn.setSizePolicy(sizePolicy)
self.area_cldn.setMinimumSize(QSize(120, 25))
self.area_cldn.setMaximumSize(QSize(120, 25))
self.area_cldn.setStyleSheet("#area_cldn {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_cldn.setFrameShape(QFrame.Shape.StyledPanel)
self.area_cldn.setFrameShadow(QFrame.Shadow.Raised)
self.area_cldn_data = QLabel(self.area_cldn)
self.area_cldn_data.setObjectName("area_cldn_data")
self.area_cldn_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_cldn_data.sizePolicy().hasHeightForWidth())
self.area_cldn_data.setSizePolicy(sizePolicy)
self.area_cldn_data.setMinimumSize(QSize(110, 15))
self.area_cldn_data.setMaximumSize(QSize(110, 15))
self.area_cldn_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_sdsh = QFrame(self.advc_area)
self.area_sdsh.setObjectName("area_sdsh")
self.area_sdsh.setGeometry(QRect(255, 210, 120, 25))
sizePolicy.setHeightForWidth(self.area_sdsh.sizePolicy().hasHeightForWidth())
self.area_sdsh.setSizePolicy(sizePolicy)
self.area_sdsh.setMinimumSize(QSize(120, 25))
self.area_sdsh.setMaximumSize(QSize(120, 25))
self.area_sdsh.setStyleSheet("#area_sdsh {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_sdsh.setFrameShape(QFrame.Shape.StyledPanel)
self.area_sdsh.setFrameShadow(QFrame.Shadow.Raised)
self.area_sdsh_data = QLabel(self.area_sdsh)
self.area_sdsh_data.setObjectName("area_sdsh_data")
self.area_sdsh_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_sdsh_data.sizePolicy().hasHeightForWidth())
self.area_sdsh_data.setSizePolicy(sizePolicy)
self.area_sdsh_data.setMinimumSize(QSize(110, 15))
self.area_sdsh_data.setMaximumSize(QSize(110, 15))
self.area_sdsh_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crit_rate = QFrame(self.advc_area)
self.area_crit_rate.setObjectName("area_crit_rate")
self.area_crit_rate.setGeometry(QRect(130, 60, 120, 25))
sizePolicy.setHeightForWidth(self.area_crit_rate.sizePolicy().hasHeightForWidth())
self.area_crit_rate.setSizePolicy(sizePolicy)
self.area_crit_rate.setMinimumSize(QSize(120, 25))
self.area_crit_rate.setMaximumSize(QSize(120, 25))
self.area_crit_rate.setStyleSheet("#area_crit_rate {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_crit_rate.setFrameShape(QFrame.Shape.StyledPanel)
self.area_crit_rate.setFrameShadow(QFrame.Shadow.Raised)
self.area_crit_rate_data = QLabel(self.area_crit_rate)
self.area_crit_rate_data.setObjectName("area_crit_rate_data")
self.area_crit_rate_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_crit_rate_data.sizePolicy().hasHeightForWidth())
self.area_crit_rate_data.setSizePolicy(sizePolicy)
self.area_crit_rate_data.setMinimumSize(QSize(110, 15))
self.area_crit_rate_data.setMaximumSize(QSize(110, 15))
self.area_crit_rate_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crit_dmge = QFrame(self.advc_area)
self.area_crit_dmge.setObjectName("area_crit_dmge")
self.area_crit_dmge.setGeometry(QRect(255, 60, 120, 25))
sizePolicy.setHeightForWidth(self.area_crit_dmge.sizePolicy().hasHeightForWidth())
self.area_crit_dmge.setSizePolicy(sizePolicy)
self.area_crit_dmge.setMinimumSize(QSize(120, 25))
self.area_crit_dmge.setMaximumSize(QSize(120, 25))
self.area_crit_dmge.setStyleSheet("#area_crit_dmge {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_crit_dmge.setFrameShape(QFrame.Shape.StyledPanel)
self.area_crit_dmge.setFrameShadow(QFrame.Shadow.Raised)
self.area_crit_dmge_data = QLabel(self.area_crit_dmge)
self.area_crit_dmge_data.setObjectName("area_crit_dmge_data")
self.area_crit_dmge_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_crit_dmge_data.sizePolicy().hasHeightForWidth())
self.area_crit_dmge_data.setSizePolicy(sizePolicy)
self.area_crit_dmge_data.setMinimumSize(QSize(110, 15))
self.area_crit_dmge_data.setMaximumSize(QSize(110, 15))
self.area_crit_dmge_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_heal_perc = QFrame(self.advc_area)
self.area_heal_perc.setObjectName("area_heal_perc")
self.area_heal_perc.setGeometry(QRect(130, 120, 120, 25))
sizePolicy.setHeightForWidth(self.area_heal_perc.sizePolicy().hasHeightForWidth())
self.area_heal_perc.setSizePolicy(sizePolicy)
self.area_heal_perc.setMinimumSize(QSize(120, 25))
self.area_heal_perc.setMaximumSize(QSize(120, 25))
self.area_heal_perc.setStyleSheet("#area_heal_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_heal_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_heal_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_heal_perc_data = QLabel(self.area_heal_perc)
self.area_heal_perc_data.setObjectName("area_heal_perc_data")
self.area_heal_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_heal_perc_data.sizePolicy().hasHeightForWidth())
self.area_heal_perc_data.setSizePolicy(sizePolicy)
self.area_heal_perc_data.setMinimumSize(QSize(110, 15))
self.area_heal_perc_data.setMaximumSize(QSize(110, 15))
self.area_heal_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_heal_incm = QFrame(self.advc_area)
self.area_heal_incm.setObjectName("area_heal_incm")
self.area_heal_incm.setGeometry(QRect(255, 120, 120, 25))
sizePolicy.setHeightForWidth(self.area_heal_incm.sizePolicy().hasHeightForWidth())
self.area_heal_incm.setSizePolicy(sizePolicy)
self.area_heal_incm.setMinimumSize(QSize(120, 25))
self.area_heal_incm.setMaximumSize(QSize(120, 25))
self.area_heal_incm.setStyleSheet("#area_heal_incm {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_heal_incm.setFrameShape(QFrame.Shape.StyledPanel)
self.area_heal_incm.setFrameShadow(QFrame.Shadow.Raised)
self.area_heal_incm_data = QLabel(self.area_heal_incm)
self.area_heal_incm_data.setObjectName("area_heal_incm_data")
self.area_heal_incm_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_heal_incm_data.sizePolicy().hasHeightForWidth())
self.area_heal_incm_data.setSizePolicy(sizePolicy)
self.area_heal_incm_data.setMinimumSize(QSize(110, 15))
self.area_heal_incm_data.setMaximumSize(QSize(110, 15))
self.area_heal_incm_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_enrc_head = QFrame(self.advc_area)
self.area_enrc_head.setObjectName("area_enrc_head")
self.area_enrc_head.setGeometry(QRect(5, 150, 245, 25))
sizePolicy.setHeightForWidth(self.area_enrc_head.sizePolicy().hasHeightForWidth())
self.area_enrc_head.setSizePolicy(sizePolicy)
self.area_enrc_head.setMinimumSize(QSize(245, 25))
self.area_enrc_head.setMaximumSize(QSize(245, 25))
self.area_enrc_head.setStyleSheet("#area_enrc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_enrc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_enrc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_enrc_text = QLabel(self.area_enrc_head)
self.area_enrc_text.setObjectName("area_enrc_text")
self.area_enrc_text.setGeometry(QRect(5, 5, 215, 15))
sizePolicy.setHeightForWidth(self.area_enrc_text.sizePolicy().hasHeightForWidth())
self.area_enrc_text.setSizePolicy(sizePolicy)
self.area_enrc_text.setMinimumSize(QSize(215, 15))
self.area_enrc_text.setMaximumSize(QSize(215, 15))
self.area_enrc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_enrc_icon = QLabel(self.area_enrc_head)
self.area_enrc_icon.setObjectName("area_enrc_icon")
self.area_enrc_icon.setGeometry(QRect(225, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_enrc_icon.sizePolicy().hasHeightForWidth())
self.area_enrc_icon.setSizePolicy(sizePolicy)
self.area_enrc_icon.setMinimumSize(QSize(15, 15))
self.area_enrc_icon.setMaximumSize(QSize(15, 15))
self.area_enrc_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_enrc_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_cldn_head = QFrame(self.advc_area)
self.area_cldn_head.setObjectName("area_cldn_head")
self.area_cldn_head.setGeometry(QRect(5, 180, 245, 25))
sizePolicy.setHeightForWidth(self.area_cldn_head.sizePolicy().hasHeightForWidth())
self.area_cldn_head.setSizePolicy(sizePolicy)
self.area_cldn_head.setMinimumSize(QSize(245, 25))
self.area_cldn_head.setMaximumSize(QSize(245, 25))
self.area_cldn_head.setStyleSheet("#area_cldn_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_cldn_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_cldn_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_cldn_text = QLabel(self.area_cldn_head)
self.area_cldn_text.setObjectName("area_cldn_text")
self.area_cldn_text.setGeometry(QRect(5, 5, 215, 15))
sizePolicy.setHeightForWidth(self.area_cldn_text.sizePolicy().hasHeightForWidth())
self.area_cldn_text.setSizePolicy(sizePolicy)
self.area_cldn_text.setMinimumSize(QSize(215, 15))
self.area_cldn_text.setMaximumSize(QSize(215, 15))
self.area_cldn_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_cldn_icon = QLabel(self.area_cldn_head)
self.area_cldn_icon.setObjectName("area_cldn_icon")
self.area_cldn_icon.setGeometry(QRect(225, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_cldn_icon.sizePolicy().hasHeightForWidth())
self.area_cldn_icon.setSizePolicy(sizePolicy)
self.area_cldn_icon.setMinimumSize(QSize(15, 15))
self.area_cldn_icon.setMaximumSize(QSize(15, 15))
self.area_cldn_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_cldn_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_sdsh_head = QFrame(self.advc_area)
self.area_sdsh_head.setObjectName("area_sdsh_head")
self.area_sdsh_head.setGeometry(QRect(5, 210, 245, 25))
sizePolicy.setHeightForWidth(self.area_sdsh_head.sizePolicy().hasHeightForWidth())
self.area_sdsh_head.setSizePolicy(sizePolicy)
self.area_sdsh_head.setMinimumSize(QSize(245, 25))
self.area_sdsh_head.setMaximumSize(QSize(245, 25))
self.area_sdsh_head.setStyleSheet("#area_sdsh_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_sdsh_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_sdsh_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_sdsh_text = QLabel(self.area_sdsh_head)
self.area_sdsh_text.setObjectName("area_sdsh_text")
self.area_sdsh_text.setGeometry(QRect(5, 5, 215, 15))
sizePolicy.setHeightForWidth(self.area_sdsh_text.sizePolicy().hasHeightForWidth())
self.area_sdsh_text.setSizePolicy(sizePolicy)
self.area_sdsh_text.setMinimumSize(QSize(215, 15))
self.area_sdsh_text.setMaximumSize(QSize(215, 15))
self.area_sdsh_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_sdsh_icon = QLabel(self.area_sdsh_head)
self.area_sdsh_icon.setObjectName("area_sdsh_icon")
self.area_sdsh_icon.setGeometry(QRect(225, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_sdsh_icon.sizePolicy().hasHeightForWidth())
self.area_sdsh_icon.setSizePolicy(sizePolicy)
self.area_sdsh_icon.setMinimumSize(QSize(15, 15))
self.area_sdsh_icon.setMaximumSize(QSize(15, 15))
self.area_sdsh_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_sdsh_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.elem_area = QFrame(self.centwdgt)
self.elem_area.setObjectName("elem_area")
self.elem_area.setGeometry(QRect(875, 85, 380, 510))
sizePolicy.setHeightForWidth(self.elem_area.sizePolicy().hasHeightForWidth())
self.elem_area.setSizePolicy(sizePolicy)
self.elem_area.setMinimumSize(QSize(380, 510))
self.elem_area.setMaximumSize(QSize(380, 510))
self.elem_area.setStyleSheet("#elem_area {border: 1px solid rgba(128, 128, 128, 160); border-radius: 5px;}")
self.elem_area.setFrameShape(QFrame.Shape.StyledPanel)
self.elem_area.setFrameShadow(QFrame.Shadow.Raised)
self.elem_desc_area = QFrame(self.elem_area)
self.elem_desc_area.setObjectName("elem_desc_area")
self.elem_desc_area.setGeometry(QRect(0, 0, 380, 25))
sizePolicy.setHeightForWidth(self.elem_desc_area.sizePolicy().hasHeightForWidth())
self.elem_desc_area.setSizePolicy(sizePolicy)
self.elem_desc_area.setMinimumSize(QSize(380, 25))
self.elem_desc_area.setMaximumSize(QSize(380, 25))
self.elem_desc_area.setStyleSheet("#elem_desc_area {border: 1px solid rgba(128, 128, 128, 160); border-top-left-radius: 5px; border-top-right-radius: 5px; background-color: rgba(128, 128, 128, 160);}")
self.elem_desc_area.setFrameShape(QFrame.Shape.StyledPanel)
self.elem_desc_area.setFrameShadow(QFrame.Shadow.Raised)
self.elem_desc_text = QLabel(self.elem_desc_area)
self.elem_desc_text.setObjectName("elem_desc_text")
self.elem_desc_text.setGeometry(QRect(5, 5, 370, 15))
sizePolicy.setHeightForWidth(self.elem_desc_text.sizePolicy().hasHeightForWidth())
self.elem_desc_text.setSizePolicy(sizePolicy)
self.elem_desc_text.setMinimumSize(QSize(370, 15))
self.elem_desc_text.setMaximumSize(QSize(370, 15))
self.elem_desc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_pyro_base = QFrame(self.elem_area)
self.area_pyro_base.setObjectName("area_pyro_base")
self.area_pyro_base.setGeometry(QRect(5, 30, 120, 25))
sizePolicy.setHeightForWidth(self.area_pyro_base.sizePolicy().hasHeightForWidth())
self.area_pyro_base.setSizePolicy(sizePolicy)
self.area_pyro_base.setMinimumSize(QSize(120, 25))
self.area_pyro_base.setMaximumSize(QSize(120, 25))
self.area_pyro_base.setStyleSheet("#area_pyro_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_pyro_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_pyro_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_pyro_text = QLabel(self.area_pyro_base)
self.area_pyro_text.setObjectName("area_pyro_text")
self.area_pyro_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_pyro_text.sizePolicy().hasHeightForWidth())
self.area_pyro_text.setSizePolicy(sizePolicy)
self.area_pyro_text.setMinimumSize(QSize(90, 15))
self.area_pyro_text.setMaximumSize(QSize(90, 15))
self.area_pyro_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_pyro_icon = QLabel(self.area_pyro_base)
self.area_pyro_icon.setObjectName("area_pyro_icon")
self.area_pyro_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_pyro_icon.sizePolicy().hasHeightForWidth())
self.area_pyro_icon.setSizePolicy(sizePolicy)
self.area_pyro_icon.setMinimumSize(QSize(15, 15))
self.area_pyro_icon.setMaximumSize(QSize(15, 15))
self.area_pyro_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_pyro_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_pyro_resi = QFrame(self.elem_area)
self.area_pyro_resi.setObjectName("area_pyro_resi")
self.area_pyro_resi.setGeometry(QRect(255, 60, 120, 25))
sizePolicy.setHeightForWidth(self.area_pyro_resi.sizePolicy().hasHeightForWidth())
self.area_pyro_resi.setSizePolicy(sizePolicy)
self.area_pyro_resi.setMinimumSize(QSize(120, 25))
self.area_pyro_resi.setMaximumSize(QSize(120, 25))
self.area_pyro_resi.setStyleSheet("#area_pyro_resi {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_pyro_resi.setFrameShape(QFrame.Shape.StyledPanel)
self.area_pyro_resi.setFrameShadow(QFrame.Shadow.Raised)
self.area_pyro_resi_data = QLabel(self.area_pyro_resi)
self.area_pyro_resi_data.setObjectName("area_pyro_resi_data")
self.area_pyro_resi_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_pyro_resi_data.sizePolicy().hasHeightForWidth())
self.area_pyro_resi_data.setSizePolicy(sizePolicy)
self.area_pyro_resi_data.setMinimumSize(QSize(110, 15))
self.area_pyro_resi_data.setMaximumSize(QSize(110, 15))
self.area_pyro_resi_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_pyro_perc = QFrame(self.elem_area)
self.area_pyro_perc.setObjectName("area_pyro_perc")
self.area_pyro_perc.setGeometry(QRect(130, 60, 120, 25))
sizePolicy.setHeightForWidth(self.area_pyro_perc.sizePolicy().hasHeightForWidth())
self.area_pyro_perc.setSizePolicy(sizePolicy)
self.area_pyro_perc.setMinimumSize(QSize(120, 25))
self.area_pyro_perc.setMaximumSize(QSize(120, 25))
self.area_pyro_perc.setStyleSheet("#area_pyro_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_pyro_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_pyro_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_pyro_perc_data = QLabel(self.area_pyro_perc)
self.area_pyro_perc_data.setObjectName("area_pyro_perc_data")
self.area_pyro_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_pyro_perc_data.sizePolicy().hasHeightForWidth())
self.area_pyro_perc_data.setSizePolicy(sizePolicy)
self.area_pyro_perc_data.setMinimumSize(QSize(110, 15))
self.area_pyro_perc_data.setMaximumSize(QSize(110, 15))
self.area_pyro_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_pyro_perc_head = QFrame(self.elem_area)
self.area_pyro_perc_head.setObjectName("area_pyro_perc_head")
self.area_pyro_perc_head.setGeometry(QRect(130, 30, 120, 25))
sizePolicy.setHeightForWidth(self.area_pyro_perc_head.sizePolicy().hasHeightForWidth())
self.area_pyro_perc_head.setSizePolicy(sizePolicy)
self.area_pyro_perc_head.setMinimumSize(QSize(120, 25))
self.area_pyro_perc_head.setMaximumSize(QSize(120, 25))
self.area_pyro_perc_head.setStyleSheet("#area_pyro_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_pyro_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_pyro_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_pyro_perc_text = QLabel(self.area_pyro_perc_head)
self.area_pyro_perc_text.setObjectName("area_pyro_perc_text")
self.area_pyro_perc_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_pyro_perc_text.sizePolicy().hasHeightForWidth())
self.area_pyro_perc_text.setSizePolicy(sizePolicy)
self.area_pyro_perc_text.setMinimumSize(QSize(110, 15))
self.area_pyro_perc_text.setMaximumSize(QSize(110, 15))
self.area_pyro_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_pyro_resi_head = QFrame(self.elem_area)
self.area_pyro_resi_head.setObjectName("area_pyro_resi_head")
self.area_pyro_resi_head.setGeometry(QRect(255, 30, 120, 25))
sizePolicy.setHeightForWidth(self.area_pyro_resi_head.sizePolicy().hasHeightForWidth())
self.area_pyro_resi_head.setSizePolicy(sizePolicy)
self.area_pyro_resi_head.setMinimumSize(QSize(120, 25))
self.area_pyro_resi_head.setMaximumSize(QSize(120, 25))
self.area_pyro_resi_head.setStyleSheet("#area_pyro_resi_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_pyro_resi_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_pyro_resi_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_pyro_resi_text = QLabel(self.area_pyro_resi_head)
self.area_pyro_resi_text.setObjectName("area_pyro_resi_text")
self.area_pyro_resi_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_pyro_resi_text.sizePolicy().hasHeightForWidth())
self.area_pyro_resi_text.setSizePolicy(sizePolicy)
self.area_pyro_resi_text.setMinimumSize(QSize(110, 15))
self.area_pyro_resi_text.setMaximumSize(QSize(110, 15))
self.area_pyro_resi_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_hydo_perc = QFrame(self.elem_area)
self.area_hydo_perc.setObjectName("area_hydo_perc")
self.area_hydo_perc.setGeometry(QRect(130, 120, 120, 25))
sizePolicy.setHeightForWidth(self.area_hydo_perc.sizePolicy().hasHeightForWidth())
self.area_hydo_perc.setSizePolicy(sizePolicy)
self.area_hydo_perc.setMinimumSize(QSize(120, 25))
self.area_hydo_perc.setMaximumSize(QSize(120, 25))
self.area_hydo_perc.setStyleSheet("#area_hydo_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_hydo_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_hydo_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_hydo_perc_data = QLabel(self.area_hydo_perc)
self.area_hydo_perc_data.setObjectName("area_hydo_perc_data")
self.area_hydo_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_hydo_perc_data.sizePolicy().hasHeightForWidth())
self.area_hydo_perc_data.setSizePolicy(sizePolicy)
self.area_hydo_perc_data.setMinimumSize(QSize(110, 15))
self.area_hydo_perc_data.setMaximumSize(QSize(110, 15))
self.area_hydo_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_hydo_perc_head = QFrame(self.elem_area)
self.area_hydo_perc_head.setObjectName("area_hydo_perc_head")
self.area_hydo_perc_head.setGeometry(QRect(130, 90, 120, 25))
sizePolicy.setHeightForWidth(self.area_hydo_perc_head.sizePolicy().hasHeightForWidth())
self.area_hydo_perc_head.setSizePolicy(sizePolicy)
self.area_hydo_perc_head.setMinimumSize(QSize(120, 25))
self.area_hydo_perc_head.setMaximumSize(QSize(120, 25))
self.area_hydo_perc_head.setStyleSheet("#area_hydo_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_hydo_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_hydo_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_hydo_perc_text = QLabel(self.area_hydo_perc_head)
self.area_hydo_perc_text.setObjectName("area_hydo_perc_text")
self.area_hydo_perc_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_hydo_perc_text.sizePolicy().hasHeightForWidth())
self.area_hydo_perc_text.setSizePolicy(sizePolicy)
self.area_hydo_perc_text.setMinimumSize(QSize(110, 15))
self.area_hydo_perc_text.setMaximumSize(QSize(110, 15))
self.area_hydo_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_hydo_resi_head = QFrame(self.elem_area)
self.area_hydo_resi_head.setObjectName("area_hydo_resi_head")
self.area_hydo_resi_head.setGeometry(QRect(255, 90, 120, 25))
sizePolicy.setHeightForWidth(self.area_hydo_resi_head.sizePolicy().hasHeightForWidth())
self.area_hydo_resi_head.setSizePolicy(sizePolicy)
self.area_hydo_resi_head.setMinimumSize(QSize(120, 25))
self.area_hydo_resi_head.setMaximumSize(QSize(120, 25))
self.area_hydo_resi_head.setStyleSheet("#area_hydo_resi_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_hydo_resi_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_hydo_resi_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_hydo_resi_text = QLabel(self.area_hydo_resi_head)
self.area_hydo_resi_text.setObjectName("area_hydo_resi_text")
self.area_hydo_resi_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_hydo_resi_text.sizePolicy().hasHeightForWidth())
self.area_hydo_resi_text.setSizePolicy(sizePolicy)
self.area_hydo_resi_text.setMinimumSize(QSize(110, 15))
self.area_hydo_resi_text.setMaximumSize(QSize(110, 15))
self.area_hydo_resi_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_hydo_base = QFrame(self.elem_area)
self.area_hydo_base.setObjectName("area_hydo_base")
self.area_hydo_base.setGeometry(QRect(5, 90, 120, 25))
sizePolicy.setHeightForWidth(self.area_hydo_base.sizePolicy().hasHeightForWidth())
self.area_hydo_base.setSizePolicy(sizePolicy)
self.area_hydo_base.setMinimumSize(QSize(120, 25))
self.area_hydo_base.setMaximumSize(QSize(120, 25))
self.area_hydo_base.setStyleSheet("#area_hydo_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_hydo_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_hydo_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_hydo_text = QLabel(self.area_hydo_base)
self.area_hydo_text.setObjectName("area_hydo_text")
self.area_hydo_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_hydo_text.sizePolicy().hasHeightForWidth())
self.area_hydo_text.setSizePolicy(sizePolicy)
self.area_hydo_text.setMinimumSize(QSize(90, 15))
self.area_hydo_text.setMaximumSize(QSize(90, 15))
self.area_hydo_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_hydo_icon = QLabel(self.area_hydo_base)
self.area_hydo_icon.setObjectName("area_hydo_icon")
self.area_hydo_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_hydo_icon.sizePolicy().hasHeightForWidth())
self.area_hydo_icon.setSizePolicy(sizePolicy)
self.area_hydo_icon.setMinimumSize(QSize(15, 15))
self.area_hydo_icon.setMaximumSize(QSize(15, 15))
self.area_hydo_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_hydo_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_hydo_resi = QFrame(self.elem_area)
self.area_hydo_resi.setObjectName("area_hydo_resi")
self.area_hydo_resi.setGeometry(QRect(255, 120, 120, 25))
sizePolicy.setHeightForWidth(self.area_hydo_resi.sizePolicy().hasHeightForWidth())
self.area_hydo_resi.setSizePolicy(sizePolicy)
self.area_hydo_resi.setMinimumSize(QSize(120, 25))
self.area_hydo_resi.setMaximumSize(QSize(120, 25))
self.area_hydo_resi.setStyleSheet("#area_hydo_resi {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_hydo_resi.setFrameShape(QFrame.Shape.StyledPanel)
self.area_hydo_resi.setFrameShadow(QFrame.Shadow.Raised)
self.area_hydo_resi_data = QLabel(self.area_hydo_resi)
self.area_hydo_resi_data.setObjectName("area_hydo_resi_data")
self.area_hydo_resi_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_hydo_resi_data.sizePolicy().hasHeightForWidth())
self.area_hydo_resi_data.setSizePolicy(sizePolicy)
self.area_hydo_resi_data.setMinimumSize(QSize(110, 15))
self.area_hydo_resi_data.setMaximumSize(QSize(110, 15))
self.area_hydo_resi_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_dend_resi_head = QFrame(self.elem_area)
self.area_dend_resi_head.setObjectName("area_dend_resi_head")
self.area_dend_resi_head.setGeometry(QRect(255, 150, 120, 25))
sizePolicy.setHeightForWidth(self.area_dend_resi_head.sizePolicy().hasHeightForWidth())
self.area_dend_resi_head.setSizePolicy(sizePolicy)
self.area_dend_resi_head.setMinimumSize(QSize(120, 25))
self.area_dend_resi_head.setMaximumSize(QSize(120, 25))
self.area_dend_resi_head.setStyleSheet("#area_dend_resi_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_dend_resi_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_dend_resi_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_dend_resi_text = QLabel(self.area_dend_resi_head)
self.area_dend_resi_text.setObjectName("area_dend_resi_text")
self.area_dend_resi_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_dend_resi_text.sizePolicy().hasHeightForWidth())
self.area_dend_resi_text.setSizePolicy(sizePolicy)
self.area_dend_resi_text.setMinimumSize(QSize(110, 15))
self.area_dend_resi_text.setMaximumSize(QSize(110, 15))
self.area_dend_resi_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_dend_resi = QFrame(self.elem_area)
self.area_dend_resi.setObjectName("area_dend_resi")
self.area_dend_resi.setGeometry(QRect(255, 180, 120, 25))
sizePolicy.setHeightForWidth(self.area_dend_resi.sizePolicy().hasHeightForWidth())
self.area_dend_resi.setSizePolicy(sizePolicy)
self.area_dend_resi.setMinimumSize(QSize(120, 25))
self.area_dend_resi.setMaximumSize(QSize(120, 25))
self.area_dend_resi.setStyleSheet("#area_dend_resi {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_dend_resi.setFrameShape(QFrame.Shape.StyledPanel)
self.area_dend_resi.setFrameShadow(QFrame.Shadow.Raised)
self.area_dend_resi_data = QLabel(self.area_dend_resi)
self.area_dend_resi_data.setObjectName("area_dend_resi_data")
self.area_dend_resi_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_dend_resi_data.sizePolicy().hasHeightForWidth())
self.area_dend_resi_data.setSizePolicy(sizePolicy)
self.area_dend_resi_data.setMinimumSize(QSize(110, 15))
self.area_dend_resi_data.setMaximumSize(QSize(110, 15))
self.area_dend_resi_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_dend_base = QFrame(self.elem_area)
self.area_dend_base.setObjectName("area_dend_base")
self.area_dend_base.setGeometry(QRect(5, 150, 120, 25))
sizePolicy.setHeightForWidth(self.area_dend_base.sizePolicy().hasHeightForWidth())
self.area_dend_base.setSizePolicy(sizePolicy)
self.area_dend_base.setMinimumSize(QSize(120, 25))
self.area_dend_base.setMaximumSize(QSize(120, 25))
self.area_dend_base.setStyleSheet("#area_dend_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_dend_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_dend_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_dend_text = QLabel(self.area_dend_base)
self.area_dend_text.setObjectName("area_dend_text")
self.area_dend_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_dend_text.sizePolicy().hasHeightForWidth())
self.area_dend_text.setSizePolicy(sizePolicy)
self.area_dend_text.setMinimumSize(QSize(90, 15))
self.area_dend_text.setMaximumSize(QSize(90, 15))
self.area_dend_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_dend_icon = QLabel(self.area_dend_base)
self.area_dend_icon.setObjectName("area_dend_icon")
self.area_dend_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_dend_icon.sizePolicy().hasHeightForWidth())
self.area_dend_icon.setSizePolicy(sizePolicy)
self.area_dend_icon.setMinimumSize(QSize(15, 15))
self.area_dend_icon.setMaximumSize(QSize(15, 15))
self.area_dend_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_dend_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_dend_perc = QFrame(self.elem_area)
self.area_dend_perc.setObjectName("area_dend_perc")
self.area_dend_perc.setGeometry(QRect(130, 180, 120, 25))
sizePolicy.setHeightForWidth(self.area_dend_perc.sizePolicy().hasHeightForWidth())
self.area_dend_perc.setSizePolicy(sizePolicy)
self.area_dend_perc.setMinimumSize(QSize(120, 25))
self.area_dend_perc.setMaximumSize(QSize(120, 25))
self.area_dend_perc.setStyleSheet("#area_dend_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_dend_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_dend_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_dend_perc_data = QLabel(self.area_dend_perc)
self.area_dend_perc_data.setObjectName("area_dend_perc_data")
self.area_dend_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_dend_perc_data.sizePolicy().hasHeightForWidth())
self.area_dend_perc_data.setSizePolicy(sizePolicy)
self.area_dend_perc_data.setMinimumSize(QSize(110, 15))
self.area_dend_perc_data.setMaximumSize(QSize(110, 15))
self.area_dend_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_dend_perc_head = QFrame(self.elem_area)
self.area_dend_perc_head.setObjectName("area_dend_perc_head")
self.area_dend_perc_head.setGeometry(QRect(130, 150, 120, 25))
sizePolicy.setHeightForWidth(self.area_dend_perc_head.sizePolicy().hasHeightForWidth())
self.area_dend_perc_head.setSizePolicy(sizePolicy)
self.area_dend_perc_head.setMinimumSize(QSize(120, 25))
self.area_dend_perc_head.setMaximumSize(QSize(120, 25))
self.area_dend_perc_head.setStyleSheet("#area_dend_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_dend_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_dend_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_dend_perc_text = QLabel(self.area_dend_perc_head)
self.area_dend_perc_text.setObjectName("area_dend_perc_text")
self.area_dend_perc_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_dend_perc_text.sizePolicy().hasHeightForWidth())
self.area_dend_perc_text.setSizePolicy(sizePolicy)
self.area_dend_perc_text.setMinimumSize(QSize(110, 15))
self.area_dend_perc_text.setMaximumSize(QSize(110, 15))
self.area_dend_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_elec_resi_head = QFrame(self.elem_area)
self.area_elec_resi_head.setObjectName("area_elec_resi_head")
self.area_elec_resi_head.setGeometry(QRect(255, 210, 120, 25))
sizePolicy.setHeightForWidth(self.area_elec_resi_head.sizePolicy().hasHeightForWidth())
self.area_elec_resi_head.setSizePolicy(sizePolicy)
self.area_elec_resi_head.setMinimumSize(QSize(120, 25))
self.area_elec_resi_head.setMaximumSize(QSize(120, 25))
self.area_elec_resi_head.setStyleSheet("#area_elec_resi_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_elec_resi_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_elec_resi_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_elec_resi_text = QLabel(self.area_elec_resi_head)
self.area_elec_resi_text.setObjectName("area_elec_resi_text")
self.area_elec_resi_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_elec_resi_text.sizePolicy().hasHeightForWidth())
self.area_elec_resi_text.setSizePolicy(sizePolicy)
self.area_elec_resi_text.setMinimumSize(QSize(110, 15))
self.area_elec_resi_text.setMaximumSize(QSize(110, 15))
self.area_elec_resi_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_elec_base = QFrame(self.elem_area)
self.area_elec_base.setObjectName("area_elec_base")
self.area_elec_base.setGeometry(QRect(5, 210, 120, 25))
sizePolicy.setHeightForWidth(self.area_elec_base.sizePolicy().hasHeightForWidth())
self.area_elec_base.setSizePolicy(sizePolicy)
self.area_elec_base.setMinimumSize(QSize(120, 25))
self.area_elec_base.setMaximumSize(QSize(120, 25))
self.area_elec_base.setStyleSheet("#area_elec_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_elec_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_elec_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_elec_text = QLabel(self.area_elec_base)
self.area_elec_text.setObjectName("area_elec_text")
self.area_elec_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_elec_text.sizePolicy().hasHeightForWidth())
self.area_elec_text.setSizePolicy(sizePolicy)
self.area_elec_text.setMinimumSize(QSize(90, 15))
self.area_elec_text.setMaximumSize(QSize(90, 15))
self.area_elec_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_elec_icon = QLabel(self.area_elec_base)
self.area_elec_icon.setObjectName("area_elec_icon")
self.area_elec_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_elec_icon.sizePolicy().hasHeightForWidth())
self.area_elec_icon.setSizePolicy(sizePolicy)
self.area_elec_icon.setMinimumSize(QSize(15, 15))
self.area_elec_icon.setMaximumSize(QSize(15, 15))
self.area_elec_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_elec_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_elec_perc = QFrame(self.elem_area)
self.area_elec_perc.setObjectName("area_elec_perc")
self.area_elec_perc.setGeometry(QRect(130, 240, 120, 25))
sizePolicy.setHeightForWidth(self.area_elec_perc.sizePolicy().hasHeightForWidth())
self.area_elec_perc.setSizePolicy(sizePolicy)
self.area_elec_perc.setMinimumSize(QSize(120, 25))
self.area_elec_perc.setMaximumSize(QSize(120, 25))
self.area_elec_perc.setStyleSheet("#area_elec_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_elec_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_elec_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_elec_perc_data = QLabel(self.area_elec_perc)
self.area_elec_perc_data.setObjectName("area_elec_perc_data")
self.area_elec_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_elec_perc_data.sizePolicy().hasHeightForWidth())
self.area_elec_perc_data.setSizePolicy(sizePolicy)
self.area_elec_perc_data.setMinimumSize(QSize(110, 15))
self.area_elec_perc_data.setMaximumSize(QSize(110, 15))
self.area_elec_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_elec_resi = QFrame(self.elem_area)
self.area_elec_resi.setObjectName("area_elec_resi")
self.area_elec_resi.setGeometry(QRect(255, 240, 120, 25))
sizePolicy.setHeightForWidth(self.area_elec_resi.sizePolicy().hasHeightForWidth())
self.area_elec_resi.setSizePolicy(sizePolicy)
self.area_elec_resi.setMinimumSize(QSize(120, 25))
self.area_elec_resi.setMaximumSize(QSize(120, 25))
self.area_elec_resi.setStyleSheet("#area_elec_resi {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_elec_resi.setFrameShape(QFrame.Shape.StyledPanel)
self.area_elec_resi.setFrameShadow(QFrame.Shadow.Raised)
self.area_elec_resi_data = QLabel(self.area_elec_resi)
self.area_elec_resi_data.setObjectName("area_elec_resi_data")
self.area_elec_resi_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_elec_resi_data.sizePolicy().hasHeightForWidth())
self.area_elec_resi_data.setSizePolicy(sizePolicy)
self.area_elec_resi_data.setMinimumSize(QSize(110, 15))
self.area_elec_resi_data.setMaximumSize(QSize(110, 15))
self.area_elec_resi_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_elec_perc_head = QFrame(self.elem_area)
self.area_elec_perc_head.setObjectName("area_elec_perc_head")
self.area_elec_perc_head.setGeometry(QRect(130, 210, 120, 25))
sizePolicy.setHeightForWidth(self.area_elec_perc_head.sizePolicy().hasHeightForWidth())
self.area_elec_perc_head.setSizePolicy(sizePolicy)
self.area_elec_perc_head.setMinimumSize(QSize(120, 25))
self.area_elec_perc_head.setMaximumSize(QSize(120, 25))
self.area_elec_perc_head.setStyleSheet("#area_elec_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_elec_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_elec_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_elec_perc_text = QLabel(self.area_elec_perc_head)
self.area_elec_perc_text.setObjectName("area_elec_perc_text")
self.area_elec_perc_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_elec_perc_text.sizePolicy().hasHeightForWidth())
self.area_elec_perc_text.setSizePolicy(sizePolicy)
self.area_elec_perc_text.setMinimumSize(QSize(110, 15))
self.area_elec_perc_text.setMaximumSize(QSize(110, 15))
self.area_elec_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_anem_resi = QFrame(self.elem_area)
self.area_anem_resi.setObjectName("area_anem_resi")
self.area_anem_resi.setGeometry(QRect(255, 300, 120, 25))
sizePolicy.setHeightForWidth(self.area_anem_resi.sizePolicy().hasHeightForWidth())
self.area_anem_resi.setSizePolicy(sizePolicy)
self.area_anem_resi.setMinimumSize(QSize(120, 25))
self.area_anem_resi.setMaximumSize(QSize(120, 25))
self.area_anem_resi.setStyleSheet("#area_anem_resi {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_anem_resi.setFrameShape(QFrame.Shape.StyledPanel)
self.area_anem_resi.setFrameShadow(QFrame.Shadow.Raised)
self.area_anem_resi_data = QLabel(self.area_anem_resi)
self.area_anem_resi_data.setObjectName("area_anem_resi_data")
self.area_anem_resi_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_anem_resi_data.sizePolicy().hasHeightForWidth())
self.area_anem_resi_data.setSizePolicy(sizePolicy)
self.area_anem_resi_data.setMinimumSize(QSize(110, 15))
self.area_anem_resi_data.setMaximumSize(QSize(110, 15))
self.area_anem_resi_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_anem_base = QFrame(self.elem_area)
self.area_anem_base.setObjectName("area_anem_base")
self.area_anem_base.setGeometry(QRect(5, 270, 120, 25))
sizePolicy.setHeightForWidth(self.area_anem_base.sizePolicy().hasHeightForWidth())
self.area_anem_base.setSizePolicy(sizePolicy)
self.area_anem_base.setMinimumSize(QSize(120, 25))
self.area_anem_base.setMaximumSize(QSize(120, 25))
self.area_anem_base.setStyleSheet("#area_anem_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_anem_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_anem_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_anem_text = QLabel(self.area_anem_base)
self.area_anem_text.setObjectName("area_anem_text")
self.area_anem_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_anem_text.sizePolicy().hasHeightForWidth())
self.area_anem_text.setSizePolicy(sizePolicy)
self.area_anem_text.setMinimumSize(QSize(90, 15))
self.area_anem_text.setMaximumSize(QSize(90, 15))
self.area_anem_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_anem_icon = QLabel(self.area_anem_base)
self.area_anem_icon.setObjectName("area_anem_icon")
self.area_anem_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_anem_icon.sizePolicy().hasHeightForWidth())
self.area_anem_icon.setSizePolicy(sizePolicy)
self.area_anem_icon.setMinimumSize(QSize(15, 15))
self.area_anem_icon.setMaximumSize(QSize(15, 15))
self.area_anem_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_anem_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_anem_resi_head = QFrame(self.elem_area)
self.area_anem_resi_head.setObjectName("area_anem_resi_head")
self.area_anem_resi_head.setGeometry(QRect(255, 270, 120, 25))
sizePolicy.setHeightForWidth(self.area_anem_resi_head.sizePolicy().hasHeightForWidth())
self.area_anem_resi_head.setSizePolicy(sizePolicy)
self.area_anem_resi_head.setMinimumSize(QSize(120, 25))
self.area_anem_resi_head.setMaximumSize(QSize(120, 25))
self.area_anem_resi_head.setStyleSheet("#area_anem_resi_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_anem_resi_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_anem_resi_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_anem_resi_text = QLabel(self.area_anem_resi_head)
self.area_anem_resi_text.setObjectName("area_anem_resi_text")
self.area_anem_resi_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_anem_resi_text.sizePolicy().hasHeightForWidth())
self.area_anem_resi_text.setSizePolicy(sizePolicy)
self.area_anem_resi_text.setMinimumSize(QSize(110, 15))
self.area_anem_resi_text.setMaximumSize(QSize(110, 15))
self.area_anem_resi_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_anem_perc_head = QFrame(self.elem_area)
self.area_anem_perc_head.setObjectName("area_anem_perc_head")
self.area_anem_perc_head.setGeometry(QRect(130, 270, 120, 25))
sizePolicy.setHeightForWidth(self.area_anem_perc_head.sizePolicy().hasHeightForWidth())
self.area_anem_perc_head.setSizePolicy(sizePolicy)
self.area_anem_perc_head.setMinimumSize(QSize(120, 25))
self.area_anem_perc_head.setMaximumSize(QSize(120, 25))
self.area_anem_perc_head.setStyleSheet("#area_anem_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_anem_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_anem_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_anem_perc_text = QLabel(self.area_anem_perc_head)
self.area_anem_perc_text.setObjectName("area_anem_perc_text")
self.area_anem_perc_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_anem_perc_text.sizePolicy().hasHeightForWidth())
self.area_anem_perc_text.setSizePolicy(sizePolicy)
self.area_anem_perc_text.setMinimumSize(QSize(110, 15))
self.area_anem_perc_text.setMaximumSize(QSize(110, 15))
self.area_anem_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_anem_perc = QFrame(self.elem_area)
self.area_anem_perc.setObjectName("area_anem_perc")
self.area_anem_perc.setGeometry(QRect(130, 300, 120, 25))
sizePolicy.setHeightForWidth(self.area_anem_perc.sizePolicy().hasHeightForWidth())
self.area_anem_perc.setSizePolicy(sizePolicy)
self.area_anem_perc.setMinimumSize(QSize(120, 25))
self.area_anem_perc.setMaximumSize(QSize(120, 25))
self.area_anem_perc.setStyleSheet("#area_anem_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_anem_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_anem_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_anem_perc_data = QLabel(self.area_anem_perc)
self.area_anem_perc_data.setObjectName("area_anem_perc_data")
self.area_anem_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_anem_perc_data.sizePolicy().hasHeightForWidth())
self.area_anem_perc_data.setSizePolicy(sizePolicy)
self.area_anem_perc_data.setMinimumSize(QSize(110, 15))
self.area_anem_perc_data.setMaximumSize(QSize(110, 15))
self.area_anem_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_cryo_perc_head = QFrame(self.elem_area)
self.area_cryo_perc_head.setObjectName("area_cryo_perc_head")
self.area_cryo_perc_head.setGeometry(QRect(130, 330, 120, 25))
sizePolicy.setHeightForWidth(self.area_cryo_perc_head.sizePolicy().hasHeightForWidth())
self.area_cryo_perc_head.setSizePolicy(sizePolicy)
self.area_cryo_perc_head.setMinimumSize(QSize(120, 25))
self.area_cryo_perc_head.setMaximumSize(QSize(120, 25))
self.area_cryo_perc_head.setStyleSheet("#area_cryo_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_cryo_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_cryo_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_cryo_perc_text = QLabel(self.area_cryo_perc_head)
self.area_cryo_perc_text.setObjectName("area_cryo_perc_text")
self.area_cryo_perc_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_cryo_perc_text.sizePolicy().hasHeightForWidth())
self.area_cryo_perc_text.setSizePolicy(sizePolicy)
self.area_cryo_perc_text.setMinimumSize(QSize(110, 15))
self.area_cryo_perc_text.setMaximumSize(QSize(110, 15))
self.area_cryo_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_cryo_resi_head = QFrame(self.elem_area)
self.area_cryo_resi_head.setObjectName("area_cryo_resi_head")
self.area_cryo_resi_head.setGeometry(QRect(255, 330, 120, 25))
sizePolicy.setHeightForWidth(self.area_cryo_resi_head.sizePolicy().hasHeightForWidth())
self.area_cryo_resi_head.setSizePolicy(sizePolicy)
self.area_cryo_resi_head.setMinimumSize(QSize(120, 25))
self.area_cryo_resi_head.setMaximumSize(QSize(120, 25))
self.area_cryo_resi_head.setStyleSheet("#area_cryo_resi_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_cryo_resi_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_cryo_resi_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_cryo_resi_text = QLabel(self.area_cryo_resi_head)
self.area_cryo_resi_text.setObjectName("area_cryo_resi_text")
self.area_cryo_resi_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_cryo_resi_text.sizePolicy().hasHeightForWidth())
self.area_cryo_resi_text.setSizePolicy(sizePolicy)
self.area_cryo_resi_text.setMinimumSize(QSize(110, 15))
self.area_cryo_resi_text.setMaximumSize(QSize(110, 15))
self.area_cryo_resi_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_cryo_perc = QFrame(self.elem_area)
self.area_cryo_perc.setObjectName("area_cryo_perc")
self.area_cryo_perc.setGeometry(QRect(130, 360, 120, 25))
sizePolicy.setHeightForWidth(self.area_cryo_perc.sizePolicy().hasHeightForWidth())
self.area_cryo_perc.setSizePolicy(sizePolicy)
self.area_cryo_perc.setMinimumSize(QSize(120, 25))
self.area_cryo_perc.setMaximumSize(QSize(120, 25))
self.area_cryo_perc.setStyleSheet("#area_cryo_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_cryo_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_cryo_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_cryo_perc_data = QLabel(self.area_cryo_perc)
self.area_cryo_perc_data.setObjectName("area_cryo_perc_data")
self.area_cryo_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_cryo_perc_data.sizePolicy().hasHeightForWidth())
self.area_cryo_perc_data.setSizePolicy(sizePolicy)
self.area_cryo_perc_data.setMinimumSize(QSize(110, 15))
self.area_cryo_perc_data.setMaximumSize(QSize(110, 15))
self.area_cryo_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_cryo_base = QFrame(self.elem_area)
self.area_cryo_base.setObjectName("area_cryo_base")
self.area_cryo_base.setGeometry(QRect(5, 330, 120, 25))
sizePolicy.setHeightForWidth(self.area_cryo_base.sizePolicy().hasHeightForWidth())
self.area_cryo_base.setSizePolicy(sizePolicy)
self.area_cryo_base.setMinimumSize(QSize(120, 25))
self.area_cryo_base.setMaximumSize(QSize(120, 25))
self.area_cryo_base.setStyleSheet("#area_cryo_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_cryo_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_cryo_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_cryo_text = QLabel(self.area_cryo_base)
self.area_cryo_text.setObjectName("area_cryo_text")
self.area_cryo_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_cryo_text.sizePolicy().hasHeightForWidth())
self.area_cryo_text.setSizePolicy(sizePolicy)
self.area_cryo_text.setMinimumSize(QSize(90, 15))
self.area_cryo_text.setMaximumSize(QSize(90, 15))
self.area_cryo_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_cryo_icon = QLabel(self.area_cryo_base)
self.area_cryo_icon.setObjectName("area_cryo_icon")
self.area_cryo_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_cryo_icon.sizePolicy().hasHeightForWidth())
self.area_cryo_icon.setSizePolicy(sizePolicy)
self.area_cryo_icon.setMinimumSize(QSize(15, 15))
self.area_cryo_icon.setMaximumSize(QSize(15, 15))
self.area_cryo_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_cryo_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_cryo_resi = QFrame(self.elem_area)
self.area_cryo_resi.setObjectName("area_cryo_resi")
self.area_cryo_resi.setGeometry(QRect(255, 360, 120, 25))
sizePolicy.setHeightForWidth(self.area_cryo_resi.sizePolicy().hasHeightForWidth())
self.area_cryo_resi.setSizePolicy(sizePolicy)
self.area_cryo_resi.setMinimumSize(QSize(120, 25))
self.area_cryo_resi.setMaximumSize(QSize(120, 25))
self.area_cryo_resi.setStyleSheet("#area_cryo_resi {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_cryo_resi.setFrameShape(QFrame.Shape.StyledPanel)
self.area_cryo_resi.setFrameShadow(QFrame.Shadow.Raised)
self.area_cryo_resi_data = QLabel(self.area_cryo_resi)
self.area_cryo_resi_data.setObjectName("area_cryo_resi_data")
self.area_cryo_resi_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_cryo_resi_data.sizePolicy().hasHeightForWidth())
self.area_cryo_resi_data.setSizePolicy(sizePolicy)
self.area_cryo_resi_data.setMinimumSize(QSize(110, 15))
self.area_cryo_resi_data.setMaximumSize(QSize(110, 15))
self.area_cryo_resi_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_geox_perc = QFrame(self.elem_area)
self.area_geox_perc.setObjectName("area_geox_perc")
self.area_geox_perc.setGeometry(QRect(130, 420, 120, 25))
sizePolicy.setHeightForWidth(self.area_geox_perc.sizePolicy().hasHeightForWidth())
self.area_geox_perc.setSizePolicy(sizePolicy)
self.area_geox_perc.setMinimumSize(QSize(120, 25))
self.area_geox_perc.setMaximumSize(QSize(120, 25))
self.area_geox_perc.setStyleSheet("#area_geox_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_geox_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_geox_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_geox_perc_data = QLabel(self.area_geox_perc)
self.area_geox_perc_data.setObjectName("area_geox_perc_data")
self.area_geox_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_geox_perc_data.sizePolicy().hasHeightForWidth())
self.area_geox_perc_data.setSizePolicy(sizePolicy)
self.area_geox_perc_data.setMinimumSize(QSize(110, 15))
self.area_geox_perc_data.setMaximumSize(QSize(110, 15))
self.area_geox_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_geox_resi_head = QFrame(self.elem_area)
self.area_geox_resi_head.setObjectName("area_geox_resi_head")
self.area_geox_resi_head.setGeometry(QRect(255, 390, 120, 25))
sizePolicy.setHeightForWidth(self.area_geox_resi_head.sizePolicy().hasHeightForWidth())
self.area_geox_resi_head.setSizePolicy(sizePolicy)
self.area_geox_resi_head.setMinimumSize(QSize(120, 25))
self.area_geox_resi_head.setMaximumSize(QSize(120, 25))
self.area_geox_resi_head.setStyleSheet("#area_geox_resi_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_geox_resi_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_geox_resi_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_geox_resi_text = QLabel(self.area_geox_resi_head)
self.area_geox_resi_text.setObjectName("area_geox_resi_text")
self.area_geox_resi_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_geox_resi_text.sizePolicy().hasHeightForWidth())
self.area_geox_resi_text.setSizePolicy(sizePolicy)
self.area_geox_resi_text.setMinimumSize(QSize(110, 15))
self.area_geox_resi_text.setMaximumSize(QSize(110, 15))
self.area_geox_resi_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_geox_base = QFrame(self.elem_area)
self.area_geox_base.setObjectName("area_geox_base")
self.area_geox_base.setGeometry(QRect(5, 390, 120, 25))
sizePolicy.setHeightForWidth(self.area_geox_base.sizePolicy().hasHeightForWidth())
self.area_geox_base.setSizePolicy(sizePolicy)
self.area_geox_base.setMinimumSize(QSize(120, 25))
self.area_geox_base.setMaximumSize(QSize(120, 25))
self.area_geox_base.setStyleSheet("#area_geox_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_geox_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_geox_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_geox_text = QLabel(self.area_geox_base)
self.area_geox_text.setObjectName("area_geox_text")
self.area_geox_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_geox_text.sizePolicy().hasHeightForWidth())
self.area_geox_text.setSizePolicy(sizePolicy)
self.area_geox_text.setMinimumSize(QSize(90, 15))
self.area_geox_text.setMaximumSize(QSize(90, 15))
self.area_geox_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_geox_icon = QLabel(self.area_geox_base)
self.area_geox_icon.setObjectName("area_geox_icon")
self.area_geox_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_geox_icon.sizePolicy().hasHeightForWidth())
self.area_geox_icon.setSizePolicy(sizePolicy)
self.area_geox_icon.setMinimumSize(QSize(15, 15))
self.area_geox_icon.setMaximumSize(QSize(15, 15))
self.area_geox_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_geox_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_geox_perc_head = QFrame(self.elem_area)
self.area_geox_perc_head.setObjectName("area_geox_perc_head")
self.area_geox_perc_head.setGeometry(QRect(130, 390, 120, 25))
sizePolicy.setHeightForWidth(self.area_geox_perc_head.sizePolicy().hasHeightForWidth())
self.area_geox_perc_head.setSizePolicy(sizePolicy)
self.area_geox_perc_head.setMinimumSize(QSize(120, 25))
self.area_geox_perc_head.setMaximumSize(QSize(120, 25))
self.area_geox_perc_head.setStyleSheet("#area_geox_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_geox_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_geox_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_geox_perc_text = QLabel(self.area_geox_perc_head)
self.area_geox_perc_text.setObjectName("area_geox_perc_text")
self.area_geox_perc_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_geox_perc_text.sizePolicy().hasHeightForWidth())
self.area_geox_perc_text.setSizePolicy(sizePolicy)
self.area_geox_perc_text.setMinimumSize(QSize(110, 15))
self.area_geox_perc_text.setMaximumSize(QSize(110, 15))
self.area_geox_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_geox_resi = QFrame(self.elem_area)
self.area_geox_resi.setObjectName("area_geox_resi")
self.area_geox_resi.setGeometry(QRect(255, 420, 120, 25))
sizePolicy.setHeightForWidth(self.area_geox_resi.sizePolicy().hasHeightForWidth())
self.area_geox_resi.setSizePolicy(sizePolicy)
self.area_geox_resi.setMinimumSize(QSize(120, 25))
self.area_geox_resi.setMaximumSize(QSize(120, 25))
self.area_geox_resi.setStyleSheet("#area_geox_resi {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_geox_resi.setFrameShape(QFrame.Shape.StyledPanel)
self.area_geox_resi.setFrameShadow(QFrame.Shadow.Raised)
self.area_geox_resi_data = QLabel(self.area_geox_resi)
self.area_geox_resi_data.setObjectName("area_geox_resi_data")
self.area_geox_resi_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_geox_resi_data.sizePolicy().hasHeightForWidth())
self.area_geox_resi_data.setSizePolicy(sizePolicy)
self.area_geox_resi_data.setMinimumSize(QSize(110, 15))
self.area_geox_resi_data.setMaximumSize(QSize(110, 15))
self.area_geox_resi_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_phys_perc_head = QFrame(self.elem_area)
self.area_phys_perc_head.setObjectName("area_phys_perc_head")
self.area_phys_perc_head.setGeometry(QRect(130, 450, 120, 25))
sizePolicy.setHeightForWidth(self.area_phys_perc_head.sizePolicy().hasHeightForWidth())
self.area_phys_perc_head.setSizePolicy(sizePolicy)
self.area_phys_perc_head.setMinimumSize(QSize(120, 25))
self.area_phys_perc_head.setMaximumSize(QSize(120, 25))
self.area_phys_perc_head.setStyleSheet("#area_phys_perc_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_phys_perc_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_phys_perc_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_phys_perc_text = QLabel(self.area_phys_perc_head)
self.area_phys_perc_text.setObjectName("area_phys_perc_text")
self.area_phys_perc_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_phys_perc_text.sizePolicy().hasHeightForWidth())
self.area_phys_perc_text.setSizePolicy(sizePolicy)
self.area_phys_perc_text.setMinimumSize(QSize(110, 15))
self.area_phys_perc_text.setMaximumSize(QSize(110, 15))
self.area_phys_perc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_phys_resi = QFrame(self.elem_area)
self.area_phys_resi.setObjectName("area_phys_resi")
self.area_phys_resi.setGeometry(QRect(255, 480, 120, 25))
sizePolicy.setHeightForWidth(self.area_phys_resi.sizePolicy().hasHeightForWidth())
self.area_phys_resi.setSizePolicy(sizePolicy)
self.area_phys_resi.setMinimumSize(QSize(120, 25))
self.area_phys_resi.setMaximumSize(QSize(120, 25))
self.area_phys_resi.setStyleSheet("#area_phys_resi {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_phys_resi.setFrameShape(QFrame.Shape.StyledPanel)
self.area_phys_resi.setFrameShadow(QFrame.Shadow.Raised)
self.area_phys_resi_data = QLabel(self.area_phys_resi)
self.area_phys_resi_data.setObjectName("area_phys_resi_data")
self.area_phys_resi_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_phys_resi_data.sizePolicy().hasHeightForWidth())
self.area_phys_resi_data.setSizePolicy(sizePolicy)
self.area_phys_resi_data.setMinimumSize(QSize(110, 15))
self.area_phys_resi_data.setMaximumSize(QSize(110, 15))
self.area_phys_resi_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_phys_perc = QFrame(self.elem_area)
self.area_phys_perc.setObjectName("area_phys_perc")
self.area_phys_perc.setGeometry(QRect(130, 480, 120, 25))
sizePolicy.setHeightForWidth(self.area_phys_perc.sizePolicy().hasHeightForWidth())
self.area_phys_perc.setSizePolicy(sizePolicy)
self.area_phys_perc.setMinimumSize(QSize(120, 25))
self.area_phys_perc.setMaximumSize(QSize(120, 25))
self.area_phys_perc.setStyleSheet("#area_phys_perc {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_phys_perc.setFrameShape(QFrame.Shape.StyledPanel)
self.area_phys_perc.setFrameShadow(QFrame.Shadow.Raised)
self.area_phys_perc_data = QLabel(self.area_phys_perc)
self.area_phys_perc_data.setObjectName("area_phys_perc_data")
self.area_phys_perc_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_phys_perc_data.sizePolicy().hasHeightForWidth())
self.area_phys_perc_data.setSizePolicy(sizePolicy)
self.area_phys_perc_data.setMinimumSize(QSize(110, 15))
self.area_phys_perc_data.setMaximumSize(QSize(110, 15))
self.area_phys_perc_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_phys_resi_head = QFrame(self.elem_area)
self.area_phys_resi_head.setObjectName("area_phys_resi_head")
self.area_phys_resi_head.setGeometry(QRect(255, 450, 120, 25))
sizePolicy.setHeightForWidth(self.area_phys_resi_head.sizePolicy().hasHeightForWidth())
self.area_phys_resi_head.setSizePolicy(sizePolicy)
self.area_phys_resi_head.setMinimumSize(QSize(120, 25))
self.area_phys_resi_head.setMaximumSize(QSize(120, 25))
self.area_phys_resi_head.setStyleSheet("#area_phys_resi_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_phys_resi_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_phys_resi_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_phys_resi_text = QLabel(self.area_phys_resi_head)
self.area_phys_resi_text.setObjectName("area_phys_resi_text")
self.area_phys_resi_text.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_phys_resi_text.sizePolicy().hasHeightForWidth())
self.area_phys_resi_text.setSizePolicy(sizePolicy)
self.area_phys_resi_text.setMinimumSize(QSize(110, 15))
self.area_phys_resi_text.setMaximumSize(QSize(110, 15))
self.area_phys_resi_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_phys_base = QFrame(self.elem_area)
self.area_phys_base.setObjectName("area_phys_base")
self.area_phys_base.setGeometry(QRect(5, 450, 120, 25))
sizePolicy.setHeightForWidth(self.area_phys_base.sizePolicy().hasHeightForWidth())
self.area_phys_base.setSizePolicy(sizePolicy)
self.area_phys_base.setMinimumSize(QSize(120, 25))
self.area_phys_base.setMaximumSize(QSize(120, 25))
self.area_phys_base.setStyleSheet("#area_phys_base {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_phys_base.setFrameShape(QFrame.Shape.StyledPanel)
self.area_phys_base.setFrameShadow(QFrame.Shadow.Raised)
self.area_phys_text = QLabel(self.area_phys_base)
self.area_phys_text.setObjectName("area_phys_text")
self.area_phys_text.setGeometry(QRect(5, 5, 90, 15))
sizePolicy.setHeightForWidth(self.area_phys_text.sizePolicy().hasHeightForWidth())
self.area_phys_text.setSizePolicy(sizePolicy)
self.area_phys_text.setMinimumSize(QSize(90, 15))
self.area_phys_text.setMaximumSize(QSize(90, 15))
self.area_phys_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_phys_icon = QLabel(self.area_phys_base)
self.area_phys_icon.setObjectName("area_phys_icon")
self.area_phys_icon.setGeometry(QRect(100, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_phys_icon.sizePolicy().hasHeightForWidth())
self.area_phys_icon.setSizePolicy(sizePolicy)
self.area_phys_icon.setMinimumSize(QSize(15, 15))
self.area_phys_icon.setMaximumSize(QSize(15, 15))
self.area_phys_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_phys_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.base_area = QFrame(self.centwdgt)
self.base_area.setObjectName("base_area")
self.base_area.setGeometry(QRect(200, 85, 285, 240))
sizePolicy.setHeightForWidth(self.base_area.sizePolicy().hasHeightForWidth())
self.base_area.setSizePolicy(sizePolicy)
self.base_area.setMinimumSize(QSize(285, 240))
self.base_area.setMaximumSize(QSize(285, 240))
self.base_area.setStyleSheet("#base_area {border: 1px solid rgba(128, 128, 128, 160); border-radius: 5px;}")
self.base_area.setFrameShape(QFrame.Shape.StyledPanel)
self.base_area.setFrameShadow(QFrame.Shadow.Raised)
self.base_desc_area = QFrame(self.base_area)
self.base_desc_area.setObjectName("base_desc_area")
self.base_desc_area.setGeometry(QRect(0, 0, 285, 25))
sizePolicy.setHeightForWidth(self.base_desc_area.sizePolicy().hasHeightForWidth())
self.base_desc_area.setSizePolicy(sizePolicy)
self.base_desc_area.setMinimumSize(QSize(285, 25))
self.base_desc_area.setMaximumSize(QSize(285, 25))
self.base_desc_area.setStyleSheet("#base_desc_area {border: 1px solid rgba(128, 128, 128, 160); border-top-left-radius: 5px; border-top-right-radius: 5px; background-color: rgba(128, 128, 128, 160);}")
self.base_desc_area.setFrameShape(QFrame.Shape.StyledPanel)
self.base_desc_area.setFrameShadow(QFrame.Shadow.Raised)
self.base_desc_text = QLabel(self.base_desc_area)
self.base_desc_text.setObjectName("base_desc_text")
self.base_desc_text.setGeometry(QRect(5, 5, 275, 15))
sizePolicy.setHeightForWidth(self.base_desc_text.sizePolicy().hasHeightForWidth())
self.base_desc_text.setSizePolicy(sizePolicy)
self.base_desc_text.setMinimumSize(QSize(275, 15))
self.base_desc_text.setMaximumSize(QSize(275, 15))
self.base_desc_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_hlpt_head = QFrame(self.base_area)
self.area_hlpt_head.setObjectName("area_hlpt_head")
self.area_hlpt_head.setGeometry(QRect(5, 30, 135, 25))
sizePolicy.setHeightForWidth(self.area_hlpt_head.sizePolicy().hasHeightForWidth())
self.area_hlpt_head.setSizePolicy(sizePolicy)
self.area_hlpt_head.setMinimumSize(QSize(135, 25))
self.area_hlpt_head.setMaximumSize(QSize(135, 25))
self.area_hlpt_head.setStyleSheet("#area_hlpt_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_hlpt_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_hlpt_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_hlpt_text = QLabel(self.area_hlpt_head)
self.area_hlpt_text.setObjectName("area_hlpt_text")
self.area_hlpt_text.setGeometry(QRect(5, 5, 105, 15))
sizePolicy.setHeightForWidth(self.area_hlpt_text.sizePolicy().hasHeightForWidth())
self.area_hlpt_text.setSizePolicy(sizePolicy)
self.area_hlpt_text.setMinimumSize(QSize(105, 15))
self.area_hlpt_text.setMaximumSize(QSize(105, 15))
self.area_hlpt_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_hlpt_icon = QLabel(self.area_hlpt_head)
self.area_hlpt_icon.setObjectName("area_hlpt_icon")
self.area_hlpt_icon.setGeometry(QRect(115, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_hlpt_icon.sizePolicy().hasHeightForWidth())
self.area_hlpt_icon.setSizePolicy(sizePolicy)
self.area_hlpt_icon.setMinimumSize(QSize(15, 15))
self.area_hlpt_icon.setMaximumSize(QSize(15, 15))
self.area_hlpt_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_hlpt_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_attk_head = QFrame(self.base_area)
self.area_attk_head.setObjectName("area_attk_head")
self.area_attk_head.setGeometry(QRect(5, 90, 135, 25))
sizePolicy.setHeightForWidth(self.area_attk_head.sizePolicy().hasHeightForWidth())
self.area_attk_head.setSizePolicy(sizePolicy)
self.area_attk_head.setMinimumSize(QSize(135, 25))
self.area_attk_head.setMaximumSize(QSize(135, 25))
self.area_attk_head.setStyleSheet("#area_attk_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_attk_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_attk_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_attk_text = QLabel(self.area_attk_head)
self.area_attk_text.setObjectName("area_attk_text")
self.area_attk_text.setGeometry(QRect(5, 5, 105, 15))
sizePolicy.setHeightForWidth(self.area_attk_text.sizePolicy().hasHeightForWidth())
self.area_attk_text.setSizePolicy(sizePolicy)
self.area_attk_text.setMinimumSize(QSize(105, 15))
self.area_attk_text.setMaximumSize(QSize(105, 15))
self.area_attk_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_attk_icon = QLabel(self.area_attk_head)
self.area_attk_icon.setObjectName("area_attk_icon")
self.area_attk_icon.setGeometry(QRect(115, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_attk_icon.sizePolicy().hasHeightForWidth())
self.area_attk_icon.setSizePolicy(sizePolicy)
self.area_attk_icon.setMinimumSize(QSize(15, 15))
self.area_attk_icon.setMaximumSize(QSize(15, 15))
self.area_attk_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_attk_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_dfns_head = QFrame(self.base_area)
self.area_dfns_head.setObjectName("area_dfns_head")
self.area_dfns_head.setGeometry(QRect(5, 150, 135, 25))
sizePolicy.setHeightForWidth(self.area_dfns_head.sizePolicy().hasHeightForWidth())
self.area_dfns_head.setSizePolicy(sizePolicy)
self.area_dfns_head.setMinimumSize(QSize(135, 25))
self.area_dfns_head.setMaximumSize(QSize(135, 25))
self.area_dfns_head.setStyleSheet("#area_dfns_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_dfns_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_dfns_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_dfns_text = QLabel(self.area_dfns_head)
self.area_dfns_text.setObjectName("area_dfns_text")
self.area_dfns_text.setGeometry(QRect(5, 5, 105, 15))
sizePolicy.setHeightForWidth(self.area_dfns_text.sizePolicy().hasHeightForWidth())
self.area_dfns_text.setSizePolicy(sizePolicy)
self.area_dfns_text.setMinimumSize(QSize(105, 15))
self.area_dfns_text.setMaximumSize(QSize(105, 15))
self.area_dfns_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_dfns_icon = QLabel(self.area_dfns_head)
self.area_dfns_icon.setObjectName("area_dfns_icon")
self.area_dfns_icon.setGeometry(QRect(115, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_dfns_icon.sizePolicy().hasHeightForWidth())
self.area_dfns_icon.setSizePolicy(sizePolicy)
self.area_dfns_icon.setMinimumSize(QSize(15, 15))
self.area_dfns_icon.setMaximumSize(QSize(15, 15))
self.area_dfns_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_dfns_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_elma_head = QFrame(self.base_area)
self.area_elma_head.setObjectName("area_elma_head")
self.area_elma_head.setGeometry(QRect(5, 210, 135, 25))
sizePolicy.setHeightForWidth(self.area_elma_head.sizePolicy().hasHeightForWidth())
self.area_elma_head.setSizePolicy(sizePolicy)
self.area_elma_head.setMinimumSize(QSize(135, 25))
self.area_elma_head.setMaximumSize(QSize(135, 25))
self.area_elma_head.setStyleSheet("#area_elma_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_elma_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_elma_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_elma_text = QLabel(self.area_elma_head)
self.area_elma_text.setObjectName("area_elma_text")
self.area_elma_text.setGeometry(QRect(5, 5, 105, 15))
sizePolicy.setHeightForWidth(self.area_elma_text.sizePolicy().hasHeightForWidth())
self.area_elma_text.setSizePolicy(sizePolicy)
self.area_elma_text.setMinimumSize(QSize(105, 15))
self.area_elma_text.setMaximumSize(QSize(105, 15))
self.area_elma_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_elma_icon = QLabel(self.area_elma_head)
self.area_elma_icon.setObjectName("area_elma_icon")
self.area_elma_icon.setGeometry(QRect(115, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_elma_icon.sizePolicy().hasHeightForWidth())
self.area_elma_icon.setSizePolicy(sizePolicy)
self.area_elma_icon.setMinimumSize(QSize(15, 15))
self.area_elma_icon.setMaximumSize(QSize(15, 15))
self.area_elma_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_elma_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
self.area_hlpt = QFrame(self.base_area)
self.area_hlpt.setObjectName("area_hlpt")
self.area_hlpt.setGeometry(QRect(145, 30, 135, 55))
sizePolicy.setHeightForWidth(self.area_hlpt.sizePolicy().hasHeightForWidth())
self.area_hlpt.setSizePolicy(sizePolicy)
self.area_hlpt.setMinimumSize(QSize(135, 55))
self.area_hlpt.setMaximumSize(QSize(135, 55))
self.area_hlpt.setStyleSheet("#area_hlpt {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_hlpt.setFrameShape(QFrame.Shape.StyledPanel)
self.area_hlpt.setFrameShadow(QFrame.Shadow.Raised)
self.area_hlpt_calc = QLabel(self.area_hlpt)
self.area_hlpt_calc.setObjectName("area_hlpt_calc")
self.area_hlpt_calc.setGeometry(QRect(5, 35, 125, 15))
sizePolicy.setHeightForWidth(self.area_hlpt_calc.sizePolicy().hasHeightForWidth())
self.area_hlpt_calc.setSizePolicy(sizePolicy)
self.area_hlpt_calc.setMinimumSize(QSize(125, 15))
self.area_hlpt_calc.setMaximumSize(QSize(125, 15))
self.area_hlpt_calc.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(32, 255, 32, 255);")
self.area_hlpt_data = QLabel(self.area_hlpt)
self.area_hlpt_data.setObjectName("area_hlpt_data")
self.area_hlpt_data.setGeometry(QRect(5, 5, 125, 25))
sizePolicy.setHeightForWidth(self.area_hlpt_data.sizePolicy().hasHeightForWidth())
self.area_hlpt_data.setSizePolicy(sizePolicy)
self.area_hlpt_data.setMinimumSize(QSize(125, 25))
self.area_hlpt_data.setMaximumSize(QSize(125, 25))
font = QFont()
font.setFamilies(["IBM Plex Sans"])
font.setPointSize(15)
font.setBold(False)
font.setItalic(False)
self.area_hlpt_data.setFont(font)
self.area_hlpt_data.setStyleSheet("font: 15pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_attk = QFrame(self.base_area)
self.area_attk.setObjectName("area_attk")
self.area_attk.setGeometry(QRect(145, 90, 135, 55))
sizePolicy.setHeightForWidth(self.area_attk.sizePolicy().hasHeightForWidth())
self.area_attk.setSizePolicy(sizePolicy)
self.area_attk.setMinimumSize(QSize(135, 55))
self.area_attk.setMaximumSize(QSize(135, 55))
self.area_attk.setStyleSheet("#area_attk {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_attk.setFrameShape(QFrame.Shape.StyledPanel)
self.area_attk.setFrameShadow(QFrame.Shadow.Raised)
self.area_attk_calc = QLabel(self.area_attk)
self.area_attk_calc.setObjectName("area_attk_calc")
self.area_attk_calc.setGeometry(QRect(5, 35, 125, 15))
sizePolicy.setHeightForWidth(self.area_attk_calc.sizePolicy().hasHeightForWidth())
self.area_attk_calc.setSizePolicy(sizePolicy)
self.area_attk_calc.setMinimumSize(QSize(125, 15))
self.area_attk_calc.setMaximumSize(QSize(125, 15))
self.area_attk_calc.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(32, 255, 32, 255);")
self.area_attk_data = QLabel(self.area_attk)
self.area_attk_data.setObjectName("area_attk_data")
self.area_attk_data.setGeometry(QRect(5, 5, 125, 25))
sizePolicy.setHeightForWidth(self.area_attk_data.sizePolicy().hasHeightForWidth())
self.area_attk_data.setSizePolicy(sizePolicy)
self.area_attk_data.setMinimumSize(QSize(125, 25))
self.area_attk_data.setMaximumSize(QSize(125, 25))
self.area_attk_data.setFont(font)
self.area_attk_data.setStyleSheet("font: 15pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_dfns = QFrame(self.base_area)
self.area_dfns.setObjectName("area_dfns")
self.area_dfns.setGeometry(QRect(145, 150, 135, 55))
sizePolicy.setHeightForWidth(self.area_dfns.sizePolicy().hasHeightForWidth())
self.area_dfns.setSizePolicy(sizePolicy)
self.area_dfns.setMinimumSize(QSize(135, 55))
self.area_dfns.setMaximumSize(QSize(135, 55))
self.area_dfns.setStyleSheet("#area_dfns {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_dfns.setFrameShape(QFrame.Shape.StyledPanel)
self.area_dfns.setFrameShadow(QFrame.Shadow.Raised)
self.area_dfns_calc = QLabel(self.area_dfns)
self.area_dfns_calc.setObjectName("area_dfns_calc")
self.area_dfns_calc.setGeometry(QRect(5, 35, 125, 15))
sizePolicy.setHeightForWidth(self.area_dfns_calc.sizePolicy().hasHeightForWidth())
self.area_dfns_calc.setSizePolicy(sizePolicy)
self.area_dfns_calc.setMinimumSize(QSize(125, 15))
self.area_dfns_calc.setMaximumSize(QSize(125, 15))
self.area_dfns_calc.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(32, 255, 32, 255);")
self.area_dfns_data = QLabel(self.area_dfns)
self.area_dfns_data.setObjectName("area_dfns_data")
self.area_dfns_data.setGeometry(QRect(5, 5, 125, 25))
sizePolicy.setHeightForWidth(self.area_dfns_data.sizePolicy().hasHeightForWidth())
self.area_dfns_data.setSizePolicy(sizePolicy)
self.area_dfns_data.setMinimumSize(QSize(125, 25))
self.area_dfns_data.setMaximumSize(QSize(125, 25))
self.area_dfns_data.setFont(font)
self.area_dfns_data.setStyleSheet("font: 15pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_elma = QFrame(self.base_area)
self.area_elma.setObjectName("area_elma")
self.area_elma.setGeometry(QRect(145, 210, 135, 25))
sizePolicy.setHeightForWidth(self.area_elma.sizePolicy().hasHeightForWidth())
self.area_elma.setSizePolicy(sizePolicy)
self.area_elma.setMinimumSize(QSize(135, 25))
self.area_elma.setMaximumSize(QSize(135, 25))
self.area_elma.setStyleSheet("#area_elma {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_elma.setFrameShape(QFrame.Shape.StyledPanel)
self.area_elma.setFrameShadow(QFrame.Shadow.Raised)
self.area_elma_data = QLabel(self.area_elma)
self.area_elma_data.setObjectName("area_elma_data")
self.area_elma_data.setGeometry(QRect(5, 5, 125, 15))
sizePolicy.setHeightForWidth(self.area_elma_data.sizePolicy().hasHeightForWidth())
self.area_elma_data.setSizePolicy(sizePolicy)
self.area_elma_data.setMinimumSize(QSize(125, 15))
self.area_elma_data.setMaximumSize(QSize(125, 15))
self.area_elma_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crvl = QFrame(self.centwdgt)
self.area_crvl.setObjectName("area_crvl")
self.area_crvl.setGeometry(QRect(745, 325, 120, 25))
sizePolicy.setHeightForWidth(self.area_crvl.sizePolicy().hasHeightForWidth())
self.area_crvl.setSizePolicy(sizePolicy)
self.area_crvl.setMinimumSize(QSize(120, 25))
self.area_crvl.setMaximumSize(QSize(120, 25))
self.area_crvl.setStyleSheet("#area_crvl {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_crvl.setFrameShape(QFrame.Shape.StyledPanel)
self.area_crvl.setFrameShadow(QFrame.Shadow.Raised)
self.area_crvl_data = QLabel(self.area_crvl)
self.area_crvl_data.setObjectName("area_crvl_data")
self.area_crvl_data.setGeometry(QRect(5, 5, 110, 15))
sizePolicy.setHeightForWidth(self.area_crvl_data.sizePolicy().hasHeightForWidth())
self.area_crvl_data.setSizePolicy(sizePolicy)
self.area_crvl_data.setMinimumSize(QSize(110, 15))
self.area_crvl_data.setMaximumSize(QSize(110, 15))
self.area_crvl_data.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crvl_head = QFrame(self.centwdgt)
self.area_crvl_head.setObjectName("area_crvl_head")
self.area_crvl_head.setGeometry(QRect(495, 325, 245, 25))
sizePolicy.setHeightForWidth(self.area_crvl_head.sizePolicy().hasHeightForWidth())
self.area_crvl_head.setSizePolicy(sizePolicy)
self.area_crvl_head.setMinimumSize(QSize(245, 25))
self.area_crvl_head.setMaximumSize(QSize(245, 25))
self.area_crvl_head.setStyleSheet("#area_crvl_head {border: 1px solid rgba(128, 128, 128, 160); background-color: rgba(128, 128, 128, 160);}")
self.area_crvl_head.setFrameShape(QFrame.Shape.StyledPanel)
self.area_crvl_head.setFrameShadow(QFrame.Shadow.Raised)
self.area_crvl_text = QLabel(self.area_crvl_head)
self.area_crvl_text.setObjectName("area_crvl_text")
self.area_crvl_text.setGeometry(QRect(5, 5, 215, 15))
sizePolicy.setHeightForWidth(self.area_crvl_text.sizePolicy().hasHeightForWidth())
self.area_crvl_text.setSizePolicy(sizePolicy)
self.area_crvl_text.setMinimumSize(QSize(215, 15))
self.area_crvl_text.setMaximumSize(QSize(215, 15))
self.area_crvl_text.setStyleSheet("font: 10pt \"IBM Plex Sans\"; color: rgba(255, 255, 255, 255);")
self.area_crvl_icon = QLabel(self.area_crvl_head)
self.area_crvl_icon.setObjectName("area_crvl_icon")
self.area_crvl_icon.setGeometry(QRect(225, 5, 15, 15))
sizePolicy.setHeightForWidth(self.area_crvl_icon.sizePolicy().hasHeightForWidth())
self.area_crvl_icon.setSizePolicy(sizePolicy)
self.area_crvl_icon.setMinimumSize(QSize(15, 15))
self.area_crvl_icon.setMaximumSize(QSize(15, 15))
self.area_crvl_icon.setStyleSheet("font: 87 10pt \"Font Awesome 6 Free Solid\"; color: rgba(255, 255, 255, 255);")
self.area_crvl_icon.setAlignment(Qt.AlignmentFlag.AlignCenter)
otptwind.setCentralWidget(self.centwdgt)
self.char_back.raise_()
self.head_area.raise_()
self.char_area.raise_()
self.advc_area.raise_()
self.elem_area.raise_()
self.base_area.raise_()
self.area_crvl.raise_()
self.area_crvl_head.raise_()
self.retranslateUi(otptwind)
QMetaObject.connectSlotsByName(otptwind)
# setupUi
def retranslateUi(self, otptwind):
otptwind.setWindowTitle(QCoreApplication.translate("otptwind", "MainWindow", None))
self.head_area_line_prim.setText(QCoreApplication.translate("otptwind", "Head area line PRIM", None))
self.head_area_line_seco.setText(QCoreApplication.translate("otptwind", "Head area line SECO\n"
"Head area line SECO", None))
self.head_vson.setText("")
self.char_wish.setText("")
self.char_back.setText("")
self.advc_desc_text.setText(QCoreApplication.translate("otptwind", "<html><head/><body><p>ADVANCED STATS</p></body></html>", None))
self.area_crit_base_text.setText(QCoreApplication.translate("otptwind", "Critical", None))
self.area_crit_base_icon.setText(QCoreApplication.translate("otptwind", "star", None))
self.area_crit_dmge_text.setText(QCoreApplication.translate("otptwind", "Damage", None))
self.area_crit_dmge_icon.setText(QCoreApplication.translate("otptwind", "location-crosshairs", None))
self.area_crit_rate_text.setText(QCoreApplication.translate("otptwind", "Rate", None))
self.area_crit_rate_icon.setText(QCoreApplication.translate("otptwind", "dice-d6", None))
self.area_heal_incm_text.setText(QCoreApplication.translate("otptwind", "Incoming", None))
self.area_heal_incm_icon.setText(QCoreApplication.translate("otptwind", "plus-circle", None))
self.area_heal_perc_text.setText(QCoreApplication.translate("otptwind", "Current", None))
self.area_heal_perc_icon.setText(QCoreApplication.translate("otptwind", "circle-check", None))
self.area_heal_base_text.setText(QCoreApplication.translate("otptwind", "Healing", None))
self.area_heal_base_icon.setText(QCoreApplication.translate("otptwind", "heart-pulse", None))
self.area_enrc_data.setText(QCoreApplication.translate("otptwind", "100.0%", None))
self.area_cldn_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_sdsh_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_crit_rate_data.setText(QCoreApplication.translate("otptwind", "5.0%", None))
self.area_crit_dmge_data.setText(QCoreApplication.translate("otptwind", "50.0%", None))
self.area_heal_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_heal_incm_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_enrc_text.setText(QCoreApplication.translate("otptwind", "Energy recharge", None))
self.area_enrc_icon.setText(QCoreApplication.translate("otptwind", "atom", None))
self.area_cldn_text.setText(QCoreApplication.translate("otptwind", "Cooldown reduction", None))
self.area_cldn_icon.setText(QCoreApplication.translate("otptwind", "hourglass-half", None))
self.area_sdsh_text.setText(QCoreApplication.translate("otptwind", "Shield strength", None))
self.area_sdsh_icon.setText(QCoreApplication.translate("otptwind", "shield-heart", None))
self.elem_desc_text.setText(QCoreApplication.translate("otptwind", "ELEMENTAL STATS", None))
self.area_pyro_text.setText(QCoreApplication.translate("otptwind", "Pyro", None))
self.area_pyro_icon.setText(QCoreApplication.translate("otptwind", "fire", None))
self.area_pyro_resi_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_pyro_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_pyro_perc_text.setText(QCoreApplication.translate("otptwind", "DMG Bonus", None))
self.area_pyro_resi_text.setText(QCoreApplication.translate("otptwind", "Resistance", None))
self.area_hydo_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_hydo_perc_text.setText(QCoreApplication.translate("otptwind", "DMG Bonus", None))
self.area_hydo_resi_text.setText(QCoreApplication.translate("otptwind", "Resistance", None))
self.area_hydo_text.setText(QCoreApplication.translate("otptwind", "Hydro", None))
self.area_hydo_icon.setText(QCoreApplication.translate("otptwind", "droplet", None))
self.area_hydo_resi_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_dend_resi_text.setText(QCoreApplication.translate("otptwind", "Resistance", None))
self.area_dend_resi_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_dend_text.setText(QCoreApplication.translate("otptwind", "Dendro", None))
self.area_dend_icon.setText(QCoreApplication.translate("otptwind", "leaf", None))
self.area_dend_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_dend_perc_text.setText(QCoreApplication.translate("otptwind", "DMG Bonus", None))
self.area_elec_resi_text.setText(QCoreApplication.translate("otptwind", "Resistance", None))
self.area_elec_text.setText(QCoreApplication.translate("otptwind", "Electro", None))
self.area_elec_icon.setText(QCoreApplication.translate("otptwind", "bolt", None))
self.area_elec_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_elec_resi_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_elec_perc_text.setText(QCoreApplication.translate("otptwind", "DMG Bonus", None))
self.area_anem_resi_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_anem_text.setText(QCoreApplication.translate("otptwind", "Anemo", None))
self.area_anem_icon.setText(QCoreApplication.translate("otptwind", "wind", None))
self.area_anem_resi_text.setText(QCoreApplication.translate("otptwind", "Resistance", None))
self.area_anem_perc_text.setText(QCoreApplication.translate("otptwind", "DMG Bonus", None))
self.area_anem_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_cryo_perc_text.setText(QCoreApplication.translate("otptwind", "DMG Bonus", None))
self.area_cryo_resi_text.setText(QCoreApplication.translate("otptwind", "Resistance", None))
self.area_cryo_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_cryo_text.setText(QCoreApplication.translate("otptwind", "Cryo", None))
self.area_cryo_icon.setText(QCoreApplication.translate("otptwind", "snowflake", None))
self.area_cryo_resi_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_geox_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_geox_resi_text.setText(QCoreApplication.translate("otptwind", "Resistance", None))
self.area_geox_text.setText(QCoreApplication.translate("otptwind", "Geo", None))
self.area_geox_icon.setText(QCoreApplication.translate("otptwind", "gem", None))
self.area_geox_perc_text.setText(QCoreApplication.translate("otptwind", "DMG Bonus", None))
self.area_geox_resi_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_phys_perc_text.setText(QCoreApplication.translate("otptwind", "DMG Bonus", None))
self.area_phys_resi_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_phys_perc_data.setText(QCoreApplication.translate("otptwind", "0.0%", None))
self.area_phys_resi_text.setText(QCoreApplication.translate("otptwind", "Resistance", None))
self.area_phys_text.setText(QCoreApplication.translate("otptwind", "Physical", None))
self.area_phys_icon.setText(QCoreApplication.translate("otptwind", "hand-back-fist", None))
self.base_desc_text.setText(QCoreApplication.translate("otptwind", "<html><head/><body><p>BASE STATS</p></body></html>", None))
self.area_hlpt_text.setText(QCoreApplication.translate("otptwind", "HP", None))
self.area_hlpt_icon.setText(QCoreApplication.translate("otptwind", "heart", None))
self.area_attk_text.setText(QCoreApplication.translate("otptwind", "ATK", None))
self.area_attk_icon.setText(QCoreApplication.translate("otptwind", "skull", None))
self.area_dfns_text.setText(QCoreApplication.translate("otptwind", "DEF", None))
self.area_dfns_icon.setText(QCoreApplication.translate("otptwind", "shield", None))
self.area_elma_text.setText(QCoreApplication.translate("otptwind", "EM", None))
self.area_elma_icon.setText(QCoreApplication.translate("otptwind", "flask", None))
self.area_hlpt_calc.setText(QCoreApplication.translate("otptwind", "+ 0.0", None))
self.area_hlpt_data.setText(QCoreApplication.translate("otptwind", "0.0", None))
self.area_attk_calc.setText(QCoreApplication.translate("otptwind", "+ 0.0", None))
self.area_attk_data.setText(QCoreApplication.translate("otptwind", "0.0", None))
self.area_dfns_calc.setText(QCoreApplication.translate("otptwind", "+ 0.0", None))
self.area_dfns_data.setText(QCoreApplication.translate("otptwind", "0.0", None))
self.area_elma_data.setText(QCoreApplication.translate("otptwind", "0", None))
self.area_crvl_data.setText(QCoreApplication.translate("otptwind", "60.0", None))
self.area_crvl_text.setText(QCoreApplication.translate("otptwind", "Critical value", None))
self.area_crvl_icon.setText(QCoreApplication.translate("otptwind", "circle-radiation", None))
# retranslateUi
| 411 | 0.821021 | 1 | 0.821021 | game-dev | MEDIA | 0.65424 | game-dev | 0.873226 | 1 | 0.873226 |
PacktPublishing/Unity-Artificial-Intelligence-Programming-Fifth-Edition | 1,966 | Chapter07/Assets/Scripts/TestCode/TestCode.cs | using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TestCode : MonoBehaviour {
private Transform startPos, endPos;
public Node startNode { get; set; }
public Node goalNode { get; set; }
public List<Node> pathArray;
GameObject objStartCube, objEndCube;
private float elapsedTime = 0.0f;
public float intervalTime = 1.0f; //Interval time between path finding
// Use this for initialization
void Start() {
objStartCube = GameObject.FindGameObjectWithTag("Start");
objEndCube = GameObject.FindGameObjectWithTag("End");
//AStar Calculated Path
pathArray = new List<Node>();
FindPath();
}
// Update is called once per frame
void Update() {
elapsedTime += Time.deltaTime;
if (elapsedTime >= intervalTime) {
elapsedTime = 0.0f;
FindPath();
}
}
void FindPath() {
startPos = objStartCube.transform;
endPos = objEndCube.transform;
//Assign StartNode and Goal Node
var (startColumn,startRow) = GridManager.instance.GetGridCoordinates(startPos.position);
var (goalColumn, goalRow) = GridManager.instance.GetGridCoordinates(endPos.position);
startNode = new Node(GridManager.instance.GetGridCellCenter(startColumn, startRow));
goalNode = new Node(GridManager.instance.GetGridCellCenter(goalColumn, goalRow));
pathArray = new AStar().FindPath(startNode, goalNode);
}
void OnDrawGizmos() {
if (pathArray == null)
return;
if (pathArray.Count > 0) {
int index = 1;
foreach (Node node in pathArray) {
if (index < pathArray.Count) {
Node nextNode = pathArray[index];
Debug.DrawLine(node.position, nextNode.position, Color.green);
index++;
}
};
}
}
} | 411 | 0.831643 | 1 | 0.831643 | game-dev | MEDIA | 0.71674 | game-dev | 0.972192 | 1 | 0.972192 |
quiverteam/Engine | 17,343 | src/game/server/TemplateEntities.cpp | //========= Copyright 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Template entities are used by spawners to create copies of entities
// that were configured by the level designer. This allows us to spawn
// entities with arbitrary sets of key/value data and entity I/O
// connections.
//
// Template entities are marked with a special spawnflag which causes
// them not to spawn, but to be saved as a string containing all the
// map data (keyvalues and I/O connections) from the BSP. Template
// entities are looked up by name by the spawner, which copies the
// map data into a local string (that's how the template data is saved
// and restored). Once all the entities in the map have been activated,
// the template database is freed.
//
//=============================================================================//
#include "cbase.h"
#include "igamesystem.h"
#include "mapentities_shared.h"
#include "point_template.h"
#include "eventqueue.h"
#include "TemplateEntities.h"
#include "utldict.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
ConVar template_debug( "template_debug", "0" );
// This is appended to key's values that will need to be unique in template instances
const char *ENTITYIO_FIXUP_STRING = "&0000";
int MapEntity_GetNumKeysInEntity( const char *pEntData );
struct TemplateEntityData_t
{
const char *pszName;
char *pszMapData;
string_t iszMapData;
int iMapDataLength;
bool bNeedsEntityIOFixup; // If true, this template has entity I/O in its mapdata that needs fixup before spawning.
char *pszFixedMapData; // A single copy of this template that we used to fix up the Entity I/O whenever someone wants a fixed version of this template
DECLARE_SIMPLE_DATADESC();
};
BEGIN_SIMPLE_DATADESC( TemplateEntityData_t )
//DEFINE_FIELD( pszName, FIELD_STRING ), // Saved custom, see below
//DEFINE_FIELD( pszMapData, FIELD_STRING ), // Saved custom, see below
DEFINE_FIELD( iszMapData, FIELD_STRING ),
DEFINE_FIELD( iMapDataLength, FIELD_INTEGER ),
DEFINE_FIELD( bNeedsEntityIOFixup, FIELD_BOOLEAN ),
//DEFINE_FIELD( pszFixedMapData, FIELD_STRING ), // Not saved at all
END_DATADESC()
struct grouptemplate_t
{
CEntityMapData *pMapDataParser;
char pszName[MAPKEY_MAXLENGTH];
int iIndex;
bool bChangeTargetname;
};
static CUtlVector<TemplateEntityData_t *> g_Templates;
int g_iCurrentTemplateInstance;
//-----------------------------------------------------------------------------
// Purpose: Saves the given entity's keyvalue data for later use by a spawner.
// Returns the index into the templates.
//-----------------------------------------------------------------------------
int Templates_Add(CBaseEntity *pEntity, const char *pszMapData, int nLen)
{
const char *pszName = STRING(pEntity->GetEntityName());
if ((!pszName) || (!strlen(pszName)))
{
DevWarning(1, "RegisterTemplateEntity: template entity with no name, class %s\n", pEntity->GetClassname());
return -1;
}
TemplateEntityData_t *pEntData = (TemplateEntityData_t *)malloc(sizeof(TemplateEntityData_t));
pEntData->pszName = strdup( pszName );
// We may modify the values of the keys in this mapdata chunk later on to fix Entity I/O
// connections. For this reason, we need to ensure we have enough memory to do that.
int iKeys = MapEntity_GetNumKeysInEntity( pszMapData );
int iExtraSpace = (strlen(ENTITYIO_FIXUP_STRING)+1) * iKeys;
// Extra 1 because the mapdata passed in isn't null terminated
pEntData->iMapDataLength = nLen + iExtraSpace + 1;
pEntData->pszMapData = (char *)malloc( pEntData->iMapDataLength );
memcpy(pEntData->pszMapData, pszMapData, nLen + 1);
pEntData->pszMapData[nLen] = '\0';
// We don't alloc these suckers right now because that gives us no time to
// tweak them for Entity I/O purposes.
pEntData->iszMapData = NULL_STRING;
pEntData->bNeedsEntityIOFixup = false;
pEntData->pszFixedMapData = NULL;
return g_Templates.AddToTail(pEntData);
}
//-----------------------------------------------------------------------------
// Purpose: Returns true if the specified index needs to be fixed up to be unique
// when the template is spawned.
//-----------------------------------------------------------------------------
bool Templates_IndexRequiresEntityIOFixup( int iIndex )
{
Assert( iIndex < g_Templates.Count() );
return g_Templates[iIndex]->bNeedsEntityIOFixup;
}
//-----------------------------------------------------------------------------
// Purpose: Looks up a template entity by its index in the templates
// Used by point_templates because they often have multiple templates with the same name
//-----------------------------------------------------------------------------
string_t Templates_FindByIndex( int iIndex )
{
Assert( iIndex < g_Templates.Count() );
// First time through we alloc the mapdata onto the pool.
// It's safe to do it now because this isn't called until post Entity I/O cleanup.
if ( g_Templates[iIndex]->iszMapData == NULL_STRING )
{
g_Templates[iIndex]->iszMapData = AllocPooledString( g_Templates[iIndex]->pszMapData );
}
return g_Templates[iIndex]->iszMapData;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int Templates_GetStringSize( int iIndex )
{
Assert( iIndex < g_Templates.Count() );
return g_Templates[iIndex]->iMapDataLength;
}
//-----------------------------------------------------------------------------
// Purpose: Looks up a template entity by name, returning the map data blob as
// a null-terminated string containing key/value pairs.
// NOTE: This can't handle multiple templates with the same targetname.
//-----------------------------------------------------------------------------
string_t Templates_FindByTargetName(const char *pszName)
{
int nCount = g_Templates.Count();
for (int i = 0; i < nCount; i++)
{
TemplateEntityData_t *pTemplate = g_Templates.Element(i);
if ( !stricmp(pTemplate->pszName, pszName) )
return Templates_FindByIndex( i );
}
return NULL_STRING;
}
//-----------------------------------------------------------------------------
// Purpose: A CPointTemplate has asked us to reconnect all the entity I/O links
// inside it's templates. Go through the keys and add look for values
// that match a name within the group's entity names. Append %d to any
// found values, which will later be filled out by a unique identifier
// whenever the template is instanced.
//-----------------------------------------------------------------------------
void Templates_ReconnectIOForGroup( CPointTemplate *pGroup )
{
int iCount = pGroup->GetNumTemplates();
if ( !iCount )
return;
// First assemble a list of the targetnames of all the templates in the group.
// We need to store off the original names here, because we're going to change
// them as we go along.
CUtlVector< grouptemplate_t > GroupTemplates;
int i;
for ( i = 0; i < iCount; i++ )
{
grouptemplate_t newGroupTemplate;
newGroupTemplate.iIndex = pGroup->GetTemplateIndexForTemplate(i);
newGroupTemplate.pMapDataParser = new CEntityMapData( g_Templates[ newGroupTemplate.iIndex ]->pszMapData, g_Templates[ newGroupTemplate.iIndex ]->iMapDataLength );
Assert( newGroupTemplate.pMapDataParser );
newGroupTemplate.pMapDataParser->ExtractValue( "targetname", newGroupTemplate.pszName );
newGroupTemplate.bChangeTargetname = false;
GroupTemplates.AddToTail( newGroupTemplate );
}
if (pGroup->AllowNameFixup())
{
char keyName[MAPKEY_MAXLENGTH];
char value[MAPKEY_MAXLENGTH];
char valueclipped[MAPKEY_MAXLENGTH];
// Now go through all the entities in the group and parse their mapdata keyvalues.
// We're looking for any values that match targetnames of any of the group entities.
for ( i = 0; i < iCount; i++ )
{
// We need to know what instance of each key we're changing.
// Store a table of the count of the keys we've run into.
CUtlDict< int, int > KeyInstanceCount;
CEntityMapData *mapData = GroupTemplates[i].pMapDataParser;
// Loop through our keys
if ( !mapData->GetFirstKey(keyName, value) )
continue;
do
{
// Ignore targetnames
if ( !stricmp( keyName, "targetname" ) )
continue;
// Add to the count for this
int idx = KeyInstanceCount.Find( keyName );
if ( idx == KeyInstanceCount.InvalidIndex() )
{
idx = KeyInstanceCount.Insert( keyName, 0 );
}
KeyInstanceCount[idx]++;
// Entity I/O values are stored as "Targetname,<data>", so we need to see if there's a ',' in the string
char *sValue = value;
// FIXME: This is very brittle. Any key with a , will not be found.
char *s = strchr( value, ',' );
if ( s )
{
// Grab just the targetname of the receiver
Q_strncpy( valueclipped, value, (s - value+1) );
sValue = valueclipped;
}
// Loop through our group templates
for ( int iTName = 0; iTName < iCount; iTName++ )
{
char *pName = GroupTemplates[iTName].pszName;
if ( stricmp( pName, sValue ) )
continue;
if ( template_debug.GetInt() )
{
Msg("Template Connection Found: Key %s (\"%s\") in entity named \"%s\"(%d) matches entity %d's targetname\n", keyName, sValue, GroupTemplates[i].pszName, i, iTName );
}
char newvalue[MAPKEY_MAXLENGTH];
// Get the current key instance. (-1 because it's this one we're changing)
int nKeyInstance = KeyInstanceCount[idx] - 1;
// Add our IO value to the targetname
// We need to append it if this isn't an Entity I/O value, or prepend it to the ',' if it is
if ( s )
{
Q_strncpy( newvalue, valueclipped, MAPKEY_MAXLENGTH );
Q_strncat( newvalue, ENTITYIO_FIXUP_STRING, sizeof(newvalue), COPY_ALL_CHARACTERS );
Q_strncat( newvalue, s, sizeof(newvalue), COPY_ALL_CHARACTERS );
mapData->SetValue( keyName, newvalue, nKeyInstance );
}
else
{
Q_strncpy( newvalue, sValue, MAPKEY_MAXLENGTH );
Q_strncat( newvalue, ENTITYIO_FIXUP_STRING, sizeof(newvalue), COPY_ALL_CHARACTERS );
mapData->SetValue( keyName, newvalue, nKeyInstance );
}
// Remember we changed this targetname
GroupTemplates[iTName].bChangeTargetname = true;
// Set both entity's flags telling them their template needs fixup when it's spawned
g_Templates[ GroupTemplates[i].iIndex ]->bNeedsEntityIOFixup = true;
g_Templates[ GroupTemplates[iTName].iIndex ]->bNeedsEntityIOFixup = true;
}
}
while ( mapData->GetNextKey(keyName, value) );
}
// Now change targetnames for all entities that need them changed
for ( i = 0; i < iCount; i++ )
{
char value[MAPKEY_MAXLENGTH];
if ( GroupTemplates[i].bChangeTargetname )
{
CEntityMapData *mapData = GroupTemplates[i].pMapDataParser;
mapData->ExtractValue( "targetname", value );
Q_strncat( value, ENTITYIO_FIXUP_STRING, sizeof(value), COPY_ALL_CHARACTERS );
mapData->SetValue( "targetname", value );
}
}
}
// Delete our group parsers
for ( i = 0; i < iCount; i++ )
{
delete GroupTemplates[i].pMapDataParser;
}
GroupTemplates.Purge();
}
//-----------------------------------------------------------------------------
// Purpose: Someone's about to start instancing a new group of entities.
// Generate a unique identifier for this group.
//-----------------------------------------------------------------------------
void Templates_StartUniqueInstance( void )
{
g_iCurrentTemplateInstance++;
// Make sure there's enough room to fit it into the string
int iMax = pow(10.0f, (int)((strlen(ENTITYIO_FIXUP_STRING) - 1))); // -1 for the &
if ( g_iCurrentTemplateInstance >= iMax )
{
// We won't hit this.
Assert(0);
// Hopefully there were still be instance number 0 around.
g_iCurrentTemplateInstance = 0;
}
}
//-----------------------------------------------------------------------------
// Purpose: Someone wants to spawn an instance of a template that requires
// entity IO fixup. Fill out the pMapData with a copy of the template
// with unique key/values where the template requires them.
//-----------------------------------------------------------------------------
char *Templates_GetEntityIOFixedMapData( int iIndex )
{
Assert( Templates_IndexRequiresEntityIOFixup( iIndex ) );
// First time through?
if ( !g_Templates[iIndex]->pszFixedMapData )
{
g_Templates[iIndex]->pszFixedMapData = new char[g_Templates[iIndex]->iMapDataLength];
Q_strncpy( g_Templates[iIndex]->pszFixedMapData, g_Templates[iIndex]->pszMapData, g_Templates[iIndex]->iMapDataLength );
}
int iFixupSize = strlen(ENTITYIO_FIXUP_STRING);
char *sOurFixup = new char[iFixupSize];
Q_snprintf( sOurFixup, iFixupSize, "%c%.4d", ENTITYIO_FIXUP_STRING[0], g_iCurrentTemplateInstance );
// Now rip through the map data string and replace any instances of the fixup string with our unique identifier
char *c = g_Templates[iIndex]->pszFixedMapData;
do
{
if ( *c == ENTITYIO_FIXUP_STRING[0] )
{
// Make sure it's our fixup string
bool bValid = true;
for ( int i = 1; i < iFixupSize; i++ )
{
// Look for any number, because we've already used this string
if ( !(*(c+i) >= '0' && *(c+i) <= '9') )
{
// Some other string
bValid = false;
break;
}
}
// Stomp it with our unique string
if ( bValid )
{
memcpy( c, sOurFixup, iFixupSize );
c += iFixupSize;
}
}
c++;
} while (*c);
return g_Templates[iIndex]->pszFixedMapData;
}
//-----------------------------------------------------------------------------
// Purpose: Frees all the template data. Called on level shutdown.
//-----------------------------------------------------------------------------
void Templates_RemoveAll(void)
{
int nCount = g_Templates.Count();
for (int i = 0; i < nCount; i++)
{
TemplateEntityData_t *pTemplate = g_Templates.Element(i);
free((void *)pTemplate->pszName);
free(pTemplate->pszMapData);
if ( pTemplate->pszFixedMapData )
{
free(pTemplate->pszFixedMapData);
}
free(pTemplate);
}
g_Templates.RemoveAll();
}
//-----------------------------------------------------------------------------
// Purpose: Hooks in the template manager's callbacks.
//-----------------------------------------------------------------------------
class CTemplatesHook : public CAutoGameSystem
{
public:
CTemplatesHook( char const *name ) : CAutoGameSystem( name )
{
}
virtual void LevelShutdownPostEntity( void )
{
Templates_RemoveAll();
}
};
CTemplatesHook g_TemplateEntityHook( "CTemplatesHook" );
//-----------------------------------------------------------------------------
// TEMPLATE SAVE / RESTORE
//-----------------------------------------------------------------------------
static short TEMPLATE_SAVE_RESTORE_VERSION = 1;
class CTemplate_SaveRestoreBlockHandler : public CDefSaveRestoreBlockHandler
{
public:
const char *GetBlockName()
{
return "Templates";
}
//---------------------------------
void Save( ISave *pSave )
{
pSave->WriteInt( &g_iCurrentTemplateInstance );
short nCount = g_Templates.Count();
pSave->WriteShort( &nCount );
for ( int i = 0; i < nCount; i++ )
{
TemplateEntityData_t *pTemplate = g_Templates[i];
pSave->WriteAll( pTemplate );
pSave->WriteString( pTemplate->pszName );
pSave->WriteString( pTemplate->pszMapData );
}
}
//---------------------------------
void WriteSaveHeaders( ISave *pSave )
{
pSave->WriteShort( &TEMPLATE_SAVE_RESTORE_VERSION );
}
//---------------------------------
void ReadRestoreHeaders( IRestore *pRestore )
{
// No reason why any future version shouldn't try to retain backward compatability. The default here is to not do so.
short version;
pRestore->ReadShort( &version );
m_fDoLoad = ( version == TEMPLATE_SAVE_RESTORE_VERSION );
}
//---------------------------------
void Restore( IRestore *pRestore, bool createPlayers )
{
if ( m_fDoLoad )
{
Templates_RemoveAll();
g_Templates.Purge();
g_iCurrentTemplateInstance = pRestore->ReadInt();
int iTemplates = pRestore->ReadShort();
while ( iTemplates-- )
{
TemplateEntityData_t *pNewTemplate = (TemplateEntityData_t *)malloc(sizeof(TemplateEntityData_t));
pRestore->ReadAll( pNewTemplate );
int sizeData = 0;//pRestore->SkipHeader();
char szName[MAPKEY_MAXLENGTH];
pRestore->ReadString( szName, MAPKEY_MAXLENGTH, sizeData );
pNewTemplate->pszName = strdup( szName );
//sizeData = pRestore->SkipHeader();
pNewTemplate->pszMapData = (char *)malloc( pNewTemplate->iMapDataLength );
pRestore->ReadString( pNewTemplate->pszMapData, pNewTemplate->iMapDataLength, sizeData );
// Set this to NULL so it'll be created the first time it gets used
pNewTemplate->pszFixedMapData = NULL;
g_Templates.AddToTail( pNewTemplate );
}
}
}
private:
bool m_fDoLoad;
};
//-----------------------------------------------------------------------------
CTemplate_SaveRestoreBlockHandler g_Template_SaveRestoreBlockHandler;
//-------------------------------------
ISaveRestoreBlockHandler *GetTemplateSaveRestoreBlockHandler()
{
return &g_Template_SaveRestoreBlockHandler;
}
| 411 | 0.91277 | 1 | 0.91277 | game-dev | MEDIA | 0.740907 | game-dev | 0.959789 | 1 | 0.959789 |
Dark-Basic-Software-Limited/Dark-Basic-Pro | 18,359 | SDK/BULLET/bullet-2.81-rev2613/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef BT_QUANTIZED_BVH_H
#define BT_QUANTIZED_BVH_H
class btSerializer;
//#define DEBUG_CHECK_DEQUANTIZATION 1
#ifdef DEBUG_CHECK_DEQUANTIZATION
#ifdef __SPU__
#define printf spu_printf
#endif //__SPU__
#include <stdio.h>
#include <stdlib.h>
#endif //DEBUG_CHECK_DEQUANTIZATION
#include "LinearMath/btVector3.h"
#include "LinearMath/btAlignedAllocator.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define btQuantizedBvhData btQuantizedBvhDoubleData
#define btOptimizedBvhNodeData btOptimizedBvhNodeDoubleData
#define btQuantizedBvhDataName "btQuantizedBvhDoubleData"
#else
#define btQuantizedBvhData btQuantizedBvhFloatData
#define btOptimizedBvhNodeData btOptimizedBvhNodeFloatData
#define btQuantizedBvhDataName "btQuantizedBvhFloatData"
#endif
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vclrf__m128.asp
//Note: currently we have 16 bytes per quantized node
#define MAX_SUBTREE_SIZE_IN_BYTES 2048
// 10 gives the potential for 1024 parts, with at most 2^21 (2097152) (minus one
// actually) triangles each (since the sign bit is reserved
#define MAX_NUM_PARTS_IN_BITS 10
///btQuantizedBvhNode is a compressed aabb node, 16 bytes.
///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range).
ATTRIBUTE_ALIGNED16 (struct) btQuantizedBvhNode
{
BT_DECLARE_ALIGNED_ALLOCATOR();
//12 bytes
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
//4 bytes
int m_escapeIndexOrTriangleIndex;
bool isLeafNode() const
{
//skipindex is negative (internal node), triangleindex >=0 (leafnode)
return (m_escapeIndexOrTriangleIndex >= 0);
}
int getEscapeIndex() const
{
btAssert(!isLeafNode());
return -m_escapeIndexOrTriangleIndex;
}
int getTriangleIndex() const
{
btAssert(isLeafNode());
unsigned int x=0;
unsigned int y = (~(x&0))<<(31-MAX_NUM_PARTS_IN_BITS);
// Get only the lower bits where the triangle index is stored
return (m_escapeIndexOrTriangleIndex&~(y));
}
int getPartId() const
{
btAssert(isLeafNode());
// Get only the highest bits where the part index is stored
return (m_escapeIndexOrTriangleIndex>>(31-MAX_NUM_PARTS_IN_BITS));
}
}
;
/// btOptimizedBvhNode contains both internal and leaf node information.
/// Total node size is 44 bytes / node. You can use the compressed version of 16 bytes.
ATTRIBUTE_ALIGNED16 (struct) btOptimizedBvhNode
{
BT_DECLARE_ALIGNED_ALLOCATOR();
//32 bytes
btVector3 m_aabbMinOrg;
btVector3 m_aabbMaxOrg;
//4
int m_escapeIndex;
//8
//for child nodes
int m_subPart;
int m_triangleIndex;
//pad the size to 64 bytes
char m_padding[20];
};
///btBvhSubtreeInfo provides info to gather a subtree of limited size
ATTRIBUTE_ALIGNED16(class) btBvhSubtreeInfo
{
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
//12 bytes
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
//4 bytes, points to the root of the subtree
int m_rootNodeIndex;
//4 bytes
int m_subtreeSize;
int m_padding[3];
btBvhSubtreeInfo()
{
//memset(&m_padding[0], 0, sizeof(m_padding));
}
void setAabbFromQuantizeNode(const btQuantizedBvhNode& quantizedNode)
{
m_quantizedAabbMin[0] = quantizedNode.m_quantizedAabbMin[0];
m_quantizedAabbMin[1] = quantizedNode.m_quantizedAabbMin[1];
m_quantizedAabbMin[2] = quantizedNode.m_quantizedAabbMin[2];
m_quantizedAabbMax[0] = quantizedNode.m_quantizedAabbMax[0];
m_quantizedAabbMax[1] = quantizedNode.m_quantizedAabbMax[1];
m_quantizedAabbMax[2] = quantizedNode.m_quantizedAabbMax[2];
}
}
;
class btNodeOverlapCallback
{
public:
virtual ~btNodeOverlapCallback() {};
virtual void processNode(int subPart, int triangleIndex) = 0;
};
#include "LinearMath/btAlignedAllocator.h"
#include "LinearMath/btAlignedObjectArray.h"
///for code readability:
typedef btAlignedObjectArray<btOptimizedBvhNode> NodeArray;
typedef btAlignedObjectArray<btQuantizedBvhNode> QuantizedNodeArray;
typedef btAlignedObjectArray<btBvhSubtreeInfo> BvhSubtreeInfoArray;
///The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU.
///It is used by the btBvhTriangleMeshShape as midphase, and by the btMultiSapBroadphase.
///It is recommended to use quantization for better performance and lower memory requirements.
ATTRIBUTE_ALIGNED16(class) btQuantizedBvh
{
public:
enum btTraversalMode
{
TRAVERSAL_STACKLESS = 0,
TRAVERSAL_STACKLESS_CACHE_FRIENDLY,
TRAVERSAL_RECURSIVE
};
protected:
btVector3 m_bvhAabbMin;
btVector3 m_bvhAabbMax;
btVector3 m_bvhQuantization;
int m_bulletVersion; //for serialization versioning. It could also be used to detect endianess.
int m_curNodeIndex;
//quantization data
bool m_useQuantization;
NodeArray m_leafNodes;
NodeArray m_contiguousNodes;
QuantizedNodeArray m_quantizedLeafNodes;
QuantizedNodeArray m_quantizedContiguousNodes;
btTraversalMode m_traversalMode;
BvhSubtreeInfoArray m_SubtreeHeaders;
//This is only used for serialization so we don't have to add serialization directly to btAlignedObjectArray
mutable int m_subtreeHeaderCount;
///two versions, one for quantized and normal nodes. This allows code-reuse while maintaining readability (no template/macro!)
///this might be refactored into a virtual, it is usually not calculated at run-time
void setInternalNodeAabbMin(int nodeIndex, const btVector3& aabbMin)
{
if (m_useQuantization)
{
quantize(&m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[0] ,aabbMin,0);
} else
{
m_contiguousNodes[nodeIndex].m_aabbMinOrg = aabbMin;
}
}
void setInternalNodeAabbMax(int nodeIndex,const btVector3& aabbMax)
{
if (m_useQuantization)
{
quantize(&m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[0],aabbMax,1);
} else
{
m_contiguousNodes[nodeIndex].m_aabbMaxOrg = aabbMax;
}
}
btVector3 getAabbMin(int nodeIndex) const
{
if (m_useQuantization)
{
return unQuantize(&m_quantizedLeafNodes[nodeIndex].m_quantizedAabbMin[0]);
}
//non-quantized
return m_leafNodes[nodeIndex].m_aabbMinOrg;
}
btVector3 getAabbMax(int nodeIndex) const
{
if (m_useQuantization)
{
return unQuantize(&m_quantizedLeafNodes[nodeIndex].m_quantizedAabbMax[0]);
}
//non-quantized
return m_leafNodes[nodeIndex].m_aabbMaxOrg;
}
void setInternalNodeEscapeIndex(int nodeIndex, int escapeIndex)
{
if (m_useQuantization)
{
m_quantizedContiguousNodes[nodeIndex].m_escapeIndexOrTriangleIndex = -escapeIndex;
}
else
{
m_contiguousNodes[nodeIndex].m_escapeIndex = escapeIndex;
}
}
void mergeInternalNodeAabb(int nodeIndex,const btVector3& newAabbMin,const btVector3& newAabbMax)
{
if (m_useQuantization)
{
unsigned short int quantizedAabbMin[3];
unsigned short int quantizedAabbMax[3];
quantize(quantizedAabbMin,newAabbMin,0);
quantize(quantizedAabbMax,newAabbMax,1);
for (int i=0;i<3;i++)
{
if (m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[i] > quantizedAabbMin[i])
m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[i] = quantizedAabbMin[i];
if (m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[i] < quantizedAabbMax[i])
m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[i] = quantizedAabbMax[i];
}
} else
{
//non-quantized
m_contiguousNodes[nodeIndex].m_aabbMinOrg.setMin(newAabbMin);
m_contiguousNodes[nodeIndex].m_aabbMaxOrg.setMax(newAabbMax);
}
}
void swapLeafNodes(int firstIndex,int secondIndex);
void assignInternalNodeFromLeafNode(int internalNode,int leafNodeIndex);
protected:
void buildTree (int startIndex,int endIndex);
int calcSplittingAxis(int startIndex,int endIndex);
int sortAndCalcSplittingIndex(int startIndex,int endIndex,int splitAxis);
void walkStacklessTree(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
void walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const;
void walkStacklessQuantizedTree(btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax,int startNodeIndex,int endNodeIndex) const;
void walkStacklessTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const;
///tree traversal designed for small-memory processors like PS3 SPU
void walkStacklessQuantizedTreeCacheFriendly(btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax) const;
///use the 16-byte stackless 'skipindex' node tree to do a recursive traversal
void walkRecursiveQuantizedTreeAgainstQueryAabb(const btQuantizedBvhNode* currentNode,btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax) const;
///use the 16-byte stackless 'skipindex' node tree to do a recursive traversal
void walkRecursiveQuantizedTreeAgainstQuantizedTree(const btQuantizedBvhNode* treeNodeA,const btQuantizedBvhNode* treeNodeB,btNodeOverlapCallback* nodeCallback) const;
void updateSubtreeHeaders(int leftChildNodexIndex,int rightChildNodexIndex);
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btQuantizedBvh();
virtual ~btQuantizedBvh();
///***************************************** expert/internal use only *************************
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.0));
QuantizedNodeArray& getLeafNodeArray() { return m_quantizedLeafNodes; }
///buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialized
void buildInternal();
///***************************************** expert/internal use only *************************
void reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
void reportRayOverlappingNodex (btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget) const;
void reportBoxCastOverlappingNodex(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin,const btVector3& aabbMax) const;
SIMD_FORCE_INLINE void quantize(unsigned short* out, const btVector3& point,int isMax) const
{
btAssert(m_useQuantization);
btAssert(point.getX() <= m_bvhAabbMax.getX());
btAssert(point.getY() <= m_bvhAabbMax.getY());
btAssert(point.getZ() <= m_bvhAabbMax.getZ());
btAssert(point.getX() >= m_bvhAabbMin.getX());
btAssert(point.getY() >= m_bvhAabbMin.getY());
btAssert(point.getZ() >= m_bvhAabbMin.getZ());
btVector3 v = (point - m_bvhAabbMin) * m_bvhQuantization;
///Make sure rounding is done in a way that unQuantize(quantizeWithClamp(...)) is conservative
///end-points always set the first bit, so that they are sorted properly (so that neighbouring AABBs overlap properly)
///@todo: double-check this
if (isMax)
{
out[0] = (unsigned short) (((unsigned short)(v.getX()+btScalar(1.)) | 1));
out[1] = (unsigned short) (((unsigned short)(v.getY()+btScalar(1.)) | 1));
out[2] = (unsigned short) (((unsigned short)(v.getZ()+btScalar(1.)) | 1));
} else
{
out[0] = (unsigned short) (((unsigned short)(v.getX()) & 0xfffe));
out[1] = (unsigned short) (((unsigned short)(v.getY()) & 0xfffe));
out[2] = (unsigned short) (((unsigned short)(v.getZ()) & 0xfffe));
}
#ifdef DEBUG_CHECK_DEQUANTIZATION
btVector3 newPoint = unQuantize(out);
if (isMax)
{
if (newPoint.getX() < point.getX())
{
printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n",newPoint.getX()-point.getX(), newPoint.getX(),point.getX());
}
if (newPoint.getY() < point.getY())
{
printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n",newPoint.getY()-point.getY(), newPoint.getY(),point.getY());
}
if (newPoint.getZ() < point.getZ())
{
printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n",newPoint.getZ()-point.getZ(), newPoint.getZ(),point.getZ());
}
} else
{
if (newPoint.getX() > point.getX())
{
printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n",newPoint.getX()-point.getX(), newPoint.getX(),point.getX());
}
if (newPoint.getY() > point.getY())
{
printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n",newPoint.getY()-point.getY(), newPoint.getY(),point.getY());
}
if (newPoint.getZ() > point.getZ())
{
printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n",newPoint.getZ()-point.getZ(), newPoint.getZ(),point.getZ());
}
}
#endif //DEBUG_CHECK_DEQUANTIZATION
}
SIMD_FORCE_INLINE void quantizeWithClamp(unsigned short* out, const btVector3& point2,int isMax) const
{
btAssert(m_useQuantization);
btVector3 clampedPoint(point2);
clampedPoint.setMax(m_bvhAabbMin);
clampedPoint.setMin(m_bvhAabbMax);
quantize(out,clampedPoint,isMax);
}
SIMD_FORCE_INLINE btVector3 unQuantize(const unsigned short* vecIn) const
{
btVector3 vecOut;
vecOut.setValue(
(btScalar)(vecIn[0]) / (m_bvhQuantization.getX()),
(btScalar)(vecIn[1]) / (m_bvhQuantization.getY()),
(btScalar)(vecIn[2]) / (m_bvhQuantization.getZ()));
vecOut += m_bvhAabbMin;
return vecOut;
}
///setTraversalMode let's you choose between stackless, recursive or stackless cache friendly tree traversal. Note this is only implemented for quantized trees.
void setTraversalMode(btTraversalMode traversalMode)
{
m_traversalMode = traversalMode;
}
SIMD_FORCE_INLINE QuantizedNodeArray& getQuantizedNodeArray()
{
return m_quantizedContiguousNodes;
}
SIMD_FORCE_INLINE BvhSubtreeInfoArray& getSubtreeInfoArray()
{
return m_SubtreeHeaders;
}
////////////////////////////////////////////////////////////////////
/////Calculate space needed to store BVH for serialization
unsigned calculateSerializeBufferSize() const;
/// Data buffer MUST be 16 byte aligned
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const;
///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
static btQuantizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian);
static unsigned int getAlignmentSerializationPadding();
//////////////////////////////////////////////////////////////////////
virtual int calculateSerializeBufferSizeNew() const;
///fills the dataBuffer and returns the struct name (and 0 on failure)
virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
virtual void deSerializeFloat(struct btQuantizedBvhFloatData& quantizedBvhFloatData);
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData& quantizedBvhDoubleData);
////////////////////////////////////////////////////////////////////
SIMD_FORCE_INLINE bool isQuantized()
{
return m_useQuantization;
}
private:
// Special "copy" constructor that allows for in-place deserialization
// Prevents btVector3's default constructor from being called, but doesn't inialize much else
// ownsMemory should most likely be false if deserializing, and if you are not, don't call this (it also changes the function signature, which we need)
btQuantizedBvh(btQuantizedBvh &other, bool ownsMemory);
}
;
struct btBvhSubtreeInfoData
{
int m_rootNodeIndex;
int m_subtreeSize;
unsigned short m_quantizedAabbMin[3];
unsigned short m_quantizedAabbMax[3];
};
struct btOptimizedBvhNodeFloatData
{
btVector3FloatData m_aabbMinOrg;
btVector3FloatData m_aabbMaxOrg;
int m_escapeIndex;
int m_subPart;
int m_triangleIndex;
char m_pad[4];
};
struct btOptimizedBvhNodeDoubleData
{
btVector3DoubleData m_aabbMinOrg;
btVector3DoubleData m_aabbMaxOrg;
int m_escapeIndex;
int m_subPart;
int m_triangleIndex;
char m_pad[4];
};
struct btQuantizedBvhNodeData
{
unsigned short m_quantizedAabbMin[3];
unsigned short m_quantizedAabbMax[3];
int m_escapeIndexOrTriangleIndex;
};
struct btQuantizedBvhFloatData
{
btVector3FloatData m_bvhAabbMin;
btVector3FloatData m_bvhAabbMax;
btVector3FloatData m_bvhQuantization;
int m_curNodeIndex;
int m_useQuantization;
int m_numContiguousLeafNodes;
int m_numQuantizedContiguousNodes;
btOptimizedBvhNodeFloatData *m_contiguousNodesPtr;
btQuantizedBvhNodeData *m_quantizedContiguousNodesPtr;
btBvhSubtreeInfoData *m_subTreeInfoPtr;
int m_traversalMode;
int m_numSubtreeHeaders;
};
struct btQuantizedBvhDoubleData
{
btVector3DoubleData m_bvhAabbMin;
btVector3DoubleData m_bvhAabbMax;
btVector3DoubleData m_bvhQuantization;
int m_curNodeIndex;
int m_useQuantization;
int m_numContiguousLeafNodes;
int m_numQuantizedContiguousNodes;
btOptimizedBvhNodeDoubleData *m_contiguousNodesPtr;
btQuantizedBvhNodeData *m_quantizedContiguousNodesPtr;
int m_traversalMode;
int m_numSubtreeHeaders;
btBvhSubtreeInfoData *m_subTreeInfoPtr;
};
SIMD_FORCE_INLINE int btQuantizedBvh::calculateSerializeBufferSizeNew() const
{
return sizeof(btQuantizedBvhData);
}
#endif //BT_QUANTIZED_BVH_H
| 411 | 0.974151 | 1 | 0.974151 | game-dev | MEDIA | 0.82759 | game-dev | 0.961085 | 1 | 0.961085 |
SonicEraZoR/Portal-Base | 13,796 | sp/src/game/server/portal/portal_radio.cpp | //========= Copyright Valve Corporation, All rights reserved. ============//
//
//
//=====================================================================================//
#include "cbase.h" // for pch
#include "props.h"
#include "filters.h"
#include "achievementmgr.h"
extern CAchievementMgr g_AchievementMgrPortal;
#define RADIO_MODEL_NAME "models/props/radio_reference.mdl"
//#define RADIO_DEBUG_SERVER
class CDinosaurSignal : public CBaseEntity
{
public:
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
DECLARE_CLASS( CDinosaurSignal, CBaseEntity );
void Spawn();
int UpdateTransmitState();
#if RADIO_DEBUG_SERVER
int DrawDebugTextOverlays( void );
#endif
CNetworkString( m_szSoundName, 128 );
CNetworkVar( float, m_flInnerRadius );
CNetworkVar( float, m_flOuterRadius );
CNetworkVar( int, m_nSignalID );
};
LINK_ENTITY_TO_CLASS( updateitem1, CDinosaurSignal );
BEGIN_DATADESC( CDinosaurSignal )
DEFINE_AUTO_ARRAY( m_szSoundName, FIELD_CHARACTER ),
DEFINE_FIELD( m_flOuterRadius, FIELD_FLOAT ),
DEFINE_FIELD( m_flInnerRadius, FIELD_FLOAT ),
DEFINE_FIELD( m_nSignalID, FIELD_INTEGER ),
END_DATADESC()
IMPLEMENT_SERVERCLASS_ST( CDinosaurSignal, DT_DinosaurSignal )
SendPropString( SENDINFO(m_szSoundName) ),
SendPropFloat( SENDINFO(m_flOuterRadius) ),
SendPropFloat( SENDINFO(m_flInnerRadius) ),
SendPropInt( SENDINFO(m_nSignalID) ),
END_SEND_TABLE()
void CDinosaurSignal::Spawn()
{
PrecacheScriptSound( m_szSoundName.Get() );
BaseClass::Spawn();
SetTransmitState( FL_EDICT_ALWAYS );
}
int CDinosaurSignal::UpdateTransmitState()
{
// ALWAYS transmit to all clients.
return SetTransmitState( FL_EDICT_ALWAYS );
}
#if RADIO_DEBUG_SERVER
int CDinosaurSignal::DrawDebugTextOverlays( void )
{
int text_offset = BaseClass::DrawDebugTextOverlays();
if (m_debugOverlays & OVERLAY_TEXT_BIT)
{
NDebugOverlay::Sphere( GetAbsOrigin(), GetAbsAngles(), m_flInnerRadius, 255, 0, 0, 64, false, 0.1f );
NDebugOverlay::Sphere( GetAbsOrigin(), GetAbsAngles(), m_flOuterRadius, 0, 255, 0, 64, false, 0.1f );
}
return text_offset;
}
#endif
class CPortal_Dinosaur : public CPhysicsProp
{
public:
DECLARE_CLASS( CPortal_Dinosaur, CPhysicsProp );
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
virtual void Spawn();
virtual void Precache();
virtual QAngle PreferredCarryAngles( void ) { return QAngle( 0, 180, 0 ); }
virtual bool HasPreferredCarryAnglesForPlayer( CBasePlayer *pPlayer ) { return true; }
virtual void Activate();
CNetworkHandle( CDinosaurSignal, m_hDinosaur_Signal );
CNetworkVar( bool, m_bAlreadyDiscovered );
};
LINK_ENTITY_TO_CLASS( updateitem2, CPortal_Dinosaur );
BEGIN_DATADESC( CPortal_Dinosaur )
DEFINE_FIELD( m_hDinosaur_Signal, FIELD_EHANDLE ),
DEFINE_FIELD( m_bAlreadyDiscovered, FIELD_BOOLEAN ),
END_DATADESC()
IMPLEMENT_SERVERCLASS_ST( CPortal_Dinosaur, DT_PropDinosaur )
SendPropEHandle( SENDINFO( m_hDinosaur_Signal ) ),
SendPropBool( SENDINFO( m_bAlreadyDiscovered ) ),
END_SEND_TABLE()
void CPortal_Dinosaur::Precache()
{
PrecacheModel( RADIO_MODEL_NAME );
PrecacheScriptSound( "Portal.room1_radio" );
PrecacheScriptSound( "UpdateItem.Static" );
PrecacheScriptSound( "UpdateItem.Dinosaur01" );
PrecacheScriptSound( "UpdateItem.Dinosaur02" );
PrecacheScriptSound( "UpdateItem.Dinosaur03" );
PrecacheScriptSound( "UpdateItem.Dinosaur04" );
PrecacheScriptSound( "UpdateItem.Dinosaur05" );
PrecacheScriptSound( "UpdateItem.Dinosaur06" );
PrecacheScriptSound( "UpdateItem.Dinosaur07" );
PrecacheScriptSound( "UpdateItem.Dinosaur08" );
PrecacheScriptSound( "UpdateItem.Dinosaur09" );
PrecacheScriptSound( "UpdateItem.Dinosaur10" );
PrecacheScriptSound( "UpdateItem.Dinosaur11" );
PrecacheScriptSound( "UpdateItem.Dinosaur12" );
PrecacheScriptSound( "UpdateItem.Dinosaur13" );
PrecacheScriptSound( "UpdateItem.Dinosaur14" );
PrecacheScriptSound( "UpdateItem.Dinosaur15" );
PrecacheScriptSound( "UpdateItem.Dinosaur16" );
PrecacheScriptSound( "UpdateItem.Dinosaur17" );
PrecacheScriptSound( "UpdateItem.Dinosaur18" );
PrecacheScriptSound( "UpdateItem.Dinosaur19" );
PrecacheScriptSound( "UpdateItem.Dinosaur20" );
PrecacheScriptSound( "UpdateItem.Dinosaur21" );
PrecacheScriptSound( "UpdateItem.Dinosaur22" );
PrecacheScriptSound( "UpdateItem.Dinosaur23" );
PrecacheScriptSound( "UpdateItem.Dinosaur24" );
PrecacheScriptSound( "UpdateItem.Dinosaur25" );
PrecacheScriptSound( "UpdateItem.Dinosaur26" );
PrecacheScriptSound( "UpdateItem.Fizzle" );
}
void CPortal_Dinosaur::Spawn()
{
Precache();
KeyValue( "model", RADIO_MODEL_NAME );
m_spawnflags |= SF_PHYSPROP_START_ASLEEP;
BaseClass::Spawn();
}
void CPortal_Dinosaur::Activate( void )
{
// Find the current completion status of the dinosaurs
uint64 fStateFlags = 0;
CBaseAchievement *pTransmissionRecvd = dynamic_cast<CBaseAchievement *>(g_AchievementMgrPortal.GetAchievementByName("PORTAL_TRANSMISSION_RECEIVED"));
if ( pTransmissionRecvd )
{
fStateFlags = pTransmissionRecvd->GetComponentBits();
}
if ( m_hDinosaur_Signal != NULL )
{
uint64 nId = m_hDinosaur_Signal.Get()->m_nSignalID;
// See if we're already tripped
if ( fStateFlags & ((uint64)1<<nId) )
{
m_bAlreadyDiscovered = true;
}
}
BaseClass::Activate();
}
struct radiolocs
{
const char *mapname;
const char *soundname;
int id;
float radiopos[3];
float radioang[3];
float soundpos[3];
float soundouterrad;
float soundinnerrad;
};
static const radiolocs s_radiolocs[] =
{
{
"testchmb_a_00",
"UpdateItem.Dinosaur01",
0,
{ 0, 0, 0 },
{ 0, 0, 0 },
{ -506, -924, 161 },
200,
64
},
{
"testchmb_a_00",
"UpdateItem.Dinosaur02",
1,
{ -960, -634, 783 },
{ 0, 90, 0 },
{ -926.435, -256.323, 583 },
200,
64,
},
{
"testchmb_a_01",
"UpdateItem.Dinosaur03",
2,
{ 233, 393, 130 },
{ 0, 225, 0 },
{ 96, 160, -108 },
224,
128,
},
{
"testchmb_a_01",
"UpdateItem.Dinosaur04",
3,
{ -1439.89, 1076.04, 779.102 },
{ 0, 270, 0 },
{ -731, 735, 888 },
400,
64,
},
{
// new entry
"testchmb_a_02",
"UpdateItem.Dinosaur05",
4,
{ 2, 65, 390 },
{ 0, 270, 0 },
{ -864, 192, 64},
192,
96,
},
{
"testchmb_a_02",
"UpdateItem.Dinosaur06",
21,
{ 111, 832, 577 },
{ 0, 0, 0 },
{ 918, 831, 512},
192,
96,
},
{
"testchmb_a_03",
"UpdateItem.Dinosaur07",
5,
{ -53.2337, 78.181, 236 },
{ 0, 225, 0 },
{ 304, 0, -96 },
256,
128
},
// new entry
{
"testchmb_a_03",
"UpdateItem.Dinosaur08",
6,
{ 428.112, 0.22326, 1201 },
{ 0, 180, 0 },
{ -581.096, 193.694, 1351 },
165,
128
},
{
"testchmb_a_04",
"UpdateItem.Dinosaur09",
7,
{ 118, -56.6, -38.8 },
{ 0, 180, 0 },
{ -640, 256, 8 },
512,
128
},
// new entry
{
"testchmb_a_05",
"UpdateItem.Dinosaur10",
8,
{ 64, 144, 160 },
{ 0, 270, 0 },
{ 64, 740, 7 },
350,
128
},
{
"testchmb_a_06",
"UpdateItem.Dinosaur11",
9,
{ 529, 315, 320 },
{ 0, 270, 0 },
{ 608, 128, -184 },
384,
160
},
{
"testchmb_a_07",
"UpdateItem.Dinosaur12",
10,
{ 192, -1546, 1425 },
{ 0, 113, 0 },
{ 272, -496, 1328 },
432,
88
},
// new entry
{
"testchmb_a_07",
"UpdateItem.Dinosaur13",
11,
{ -144, -768, 256 },
{ 0, 90, 0 },
{ -192, -384, 176 },
256,
128
},
{
"testchmb_a_08",
"UpdateItem.Dinosaur14",
12,
{ 267, -378, 256 },
{ 0, 90, 0 },
{ -560, 96, 320 },
288,
128,
},
{
"testchmb_a_09",
"UpdateItem.Dinosaur15",
13,
{ 634, 1308, 256 },
{ 0, 180, 0 },
{ 386.699, 1792.43, 7},
548,
64
},
{
"testchmb_a_10",
"UpdateItem.Dinosaur16",
14,
{ -1420, -2752, 76 },
{ 0, 0, 0 },
{ -1968, -2880, -334 },
448,
196,
},
// new entry
{
"testchmb_a_10",
"UpdateItem.Dinosaur17",
15,
{ 112, 1392, -63 },
{ 0, 260, 0 },
{ -189, 1220, 65 },
192,
128,
},
{
"testchmb_a_11",
"UpdateItem.Dinosaur18",
16,
{0,0,0},
{0,0,0},
{-512,644,64},
192,
96,
},
{
"testchmb_a_13",
"UpdateItem.Dinosaur19",
17,
{955,931,-267},
{-90,0,0},
{1472,-191,-12},
256,
128,
},
{
"testchmb_a_14",
"UpdateItem.Dinosaur20",
18,
{0,0,0},
{0,0,0},
{144,192,1288},
807,
128,
},
{
"testchmb_a_14",
"UpdateItem.Dinosaur21",
22,
{1285, 1344, 1412},
{0,0,0},
{2712, 894, 1011},
200,
120,
},
{
"testchmb_a_14",
"UpdateItem.Dinosaur22",
23,
{-952, 336, -256},
{0,0,0},
{-1144, -249, 3336},
400,
128,
},
{
"testchmb_a_15",
"UpdateItem.Dinosaur23",
19,
{-1529,293,-283},
{0,90,0},
{761,443,810},
256,
128,
},
{
"escape_00",
"UpdateItem.Dinosaur24",
24,
{192, -1344, -832},
{0, 135, 0},
{891, 322, -184},
285,
150,
},
{
"escape_01",
"UpdateItem.Dinosaur25",
20,
{0,0,0},
{0,0,0},
{-624, 1440, -464},
512,
128,
},
{
"escape_02",
"UpdateItem.Dinosaur26",
25,
{5504, 131, -1422},
{0, 90, 0},
{4218, 674, 8},
300,
100,
},
};
class CSpawnDinosaurHack : CAutoGameSystem
{
public:
virtual void LevelInitPreEntity();
virtual void LevelInitPostEntity();
CPortal_Dinosaur *SpawnDinosaur( radiolocs& loc );
CDinosaurSignal *SpawnSignal( radiolocs& loc );
void ApplyMapSpecificHacks();
};
static CSpawnDinosaurHack g_SpawnRadioHack;
void CSpawnDinosaurHack::LevelInitPreEntity()
{
UTIL_PrecacheOther( "updateitem2", RADIO_MODEL_NAME );
ApplyMapSpecificHacks();
}
// Spawn all the Dinosaurs and sstv images
void CSpawnDinosaurHack::LevelInitPostEntity()
{
if ( gpGlobals->eLoadType == MapLoad_LoadGame )
{
#if defined ( RADIO_DEBUG_SERVER )
Msg( "Not spawning any Dinosaurs: Detected a map load\n" );
#endif
return;
}
IAchievement *pHeartbreaker = g_AchievementMgrPortal.GetAchievementByName("PORTAL_BEAT_GAME");
if ( pHeartbreaker == NULL || pHeartbreaker->IsAchieved() == false )
{
#if defined ( RADIO_DEBUG_SERVER )
Msg( "Not spawning any Dinosaurs: Player has not beat the game, or failed to get heartbreaker achievement from mgr\n" );
#endif
return;
}
for ( int i = 0; i < ARRAYSIZE( s_radiolocs ); ++i )
{
radiolocs loc = s_radiolocs[i];
if ( V_strcmp( STRING(gpGlobals->mapname), loc.mapname ) == 0 )
{
#if defined ( RADIO_DEBUG_SERVER )
Msg( "Found Dinosaur and signal info for %s, spawning.\n", loc.mapname );
Msg( "Dinosaur pos: %f %f %f, ang: %f %f %f\n", loc.radiopos[0], loc.radiopos[1], loc.radiopos[2], loc.radioang[0], loc.radioang[1], loc.radioang[2] );
Msg( "Signal pos: %f %f %f, inner rad: %f, outter rad: %f\n", loc.soundpos[0], loc.soundpos[1], loc.soundpos[2], loc.soundinnerrad, loc.soundouterrad );
#endif
CPortal_Dinosaur *pDinosaur = SpawnDinosaur( loc );
CDinosaurSignal *pSignal = SpawnSignal( loc );
Assert ( pDinosaur && pSignal );
if ( pDinosaur && pSignal )
{
#if defined ( RADIO_DEBUG_SERVER )
Msg( "SUCCESS: Spawned Dinosaur and signal and linked them.\n" );
#endif
// OK, so these really could have been the same class... not worth changing it now though.
pDinosaur->m_hDinosaur_Signal.Set( pSignal );
pDinosaur->Activate();
}
}
}
}
CPortal_Dinosaur *CSpawnDinosaurHack::SpawnDinosaur( radiolocs& loc )
{
Vector vSpawnPos ( loc.radiopos[0], loc.radiopos[1], loc.radiopos[2] );
QAngle vSpawnAng ( loc.radioang[0], loc.radioang[1], loc.radioang[2] );
// origin and angles of zero means skip this Dinosaur creation and look for an existing radio
if ( loc.radiopos[0] == 0 &&
loc.radiopos[1] == 0 &&
loc.radiopos[2] == 0 &&
loc.radioang[0] == 0 &&
loc.radioang[1] == 0 &&
loc.radioang[2] == 0 )
{
#if defined ( RADIO_DEBUG_SERVER )
Msg( "Dinosaur found with zero angles and origin. Replacing existing radio.\n" );
#endif
// Find existing Dinosaur, kill it and spawn at its position
CPhysicsProp *pOldDinosaur = (CPhysicsProp*)gEntList.FindEntityByClassname( NULL, "prop_physics" );
while ( pOldDinosaur )
{
if ( V_strcmp( STRING( pOldDinosaur->GetModelName() ), RADIO_MODEL_NAME ) == 0 )
{
vSpawnPos = pOldDinosaur->GetAbsOrigin();
vSpawnAng = pOldDinosaur->GetAbsAngles();
UTIL_Remove( pOldDinosaur );
#if defined ( RADIO_DEBUG_SERVER )
Msg( "Found Dinosaur exiting in level, replacing with %f, %f %f and %f %f %f.\n", XYZ(vSpawnPos), XYZ(vSpawnAng) );
#endif
break;
}
pOldDinosaur = (CPhysicsProp*)gEntList.FindEntityByClassname( pOldDinosaur, "prop_physics" );
}
}
Assert( vSpawnPos != vec3_origin );
CPortal_Dinosaur *pDinosaur = (CPortal_Dinosaur*)CreateEntityByName( "updateitem2" );
Assert ( pDinosaur );
if ( pDinosaur )
{
pDinosaur->SetAbsOrigin( vSpawnPos );
pDinosaur->SetAbsAngles( vSpawnAng );
DispatchSpawn( pDinosaur );
}
return pDinosaur;
}
CDinosaurSignal *CSpawnDinosaurHack::SpawnSignal( radiolocs& loc )
{
CDinosaurSignal *pSignal = (CDinosaurSignal*)CreateEntityByName( "updateitem1" );
Assert ( pSignal );
if ( pSignal )
{
#if defined ( RADIO_DEBUG_SERVER )
if ( loc.soundinnerrad > loc.soundouterrad )
{
Assert( 0 );
Warning( "Dinosaur BUG: Inner radius is greater than outer radius. Will swap them.\n" );
swap( loc.soundinnerrad, loc.soundouterrad );
}
#endif
pSignal->SetAbsOrigin( Vector( loc.soundpos[0], loc.soundpos[1], loc.soundpos[2] ) );
pSignal->m_flInnerRadius = loc.soundinnerrad;
pSignal->m_flOuterRadius = loc.soundouterrad;
V_strncpy( pSignal->m_szSoundName.GetForModify(), loc.soundname, 128 );
pSignal->m_nSignalID = loc.id;
DispatchSpawn( pSignal );
}
return pSignal;
}
void CSpawnDinosaurHack::ApplyMapSpecificHacks()
{
if ( V_strcmp( STRING(gpGlobals->mapname), "testchmb_a_02" ) == 0 )
{
CBaseEntity *pFilter = CreateEntityByName( "filter_activator_name" );
Assert( pFilter );
if ( pFilter )
{
pFilter->KeyValue( "filtername", "box_2" );
pFilter->KeyValue( "targetname", "filter_weight_box" );
DispatchSpawn( pFilter );
}
}
}
| 411 | 0.845736 | 1 | 0.845736 | game-dev | MEDIA | 0.96159 | game-dev | 0.907872 | 1 | 0.907872 |
mono/roslyn | 13,387 | src/Workspaces/Core/Portable/Utilities/SerializableBytes.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Roslyn.Utilities
{
/// <summary>
/// Helpers to create temporary streams backed by pooled memory
/// </summary>
internal static class SerializableBytes
{
private const int ChunkSize = SharedPools.ByteBufferSize;
internal static PooledStream CreateReadableStream(byte[] bytes, CancellationToken cancellationToken)
{
var stream = CreateWritableStream();
stream.Write(bytes, 0, bytes.Length);
stream.Position = 0;
return stream;
}
internal static PooledStream CreateReadableStream(Stream stream, CancellationToken cancellationToken)
{
return CreateReadableStream(stream, /*length*/ -1, cancellationToken);
}
internal static PooledStream CreateReadableStream(Stream stream, long length, CancellationToken cancellationToken)
{
if (length == -1)
{
length = stream.Length;
}
long chunkCount = (length + ChunkSize - 1) / ChunkSize;
byte[][] chunks = new byte[chunkCount][];
try
{
for (long i = 0, c = 0; i < length; i += ChunkSize, c++)
{
int count = (int)Math.Min(ChunkSize, length - i);
var chunk = SharedPools.ByteArray.Allocate();
int chunkOffset = 0;
while (count > 0)
{
cancellationToken.ThrowIfCancellationRequested();
int bytesRead = stream.Read(chunk, chunkOffset, count);
if (bytesRead > 0)
{
count = count - bytesRead;
chunkOffset += bytesRead;
}
else
{
break;
}
}
chunks[c] = chunk;
}
var result = new PooledStream(length, chunks);
chunks = null;
return result;
}
finally
{
BlowChunks(chunks);
}
}
internal static Task<PooledStream> CreateReadableStreamAsync(Stream stream, CancellationToken cancellationToken)
{
return CreateReadableStreamAsync(stream, /*length*/ -1, cancellationToken);
}
internal static async Task<PooledStream> CreateReadableStreamAsync(Stream stream, long length, CancellationToken cancellationToken)
{
if (length == -1)
{
length = stream.Length;
}
long chunkCount = (length + ChunkSize - 1) / ChunkSize;
byte[][] chunks = new byte[chunkCount][];
try
{
for (long i = 0, c = 0; i < length; i += ChunkSize, c++)
{
int count = (int)Math.Min(ChunkSize, length - i);
var chunk = SharedPools.ByteArray.Allocate();
int chunkOffset = 0;
while (count > 0)
{
int bytesRead = await stream.ReadAsync(chunk, chunkOffset, count, cancellationToken).ConfigureAwait(false);
if (bytesRead > 0)
{
count = count - bytesRead;
chunkOffset += bytesRead;
}
else
{
break;
}
}
chunks[c] = chunk;
}
var result = new PooledStream(length, chunks);
chunks = null;
return result;
}
finally
{
BlowChunks(chunks);
}
}
// free any chunks remaining
private static void BlowChunks(byte[][] chunks)
{
if (chunks != null)
{
for (long c = 0; c < chunks.Length; c++)
{
if (chunks[c] != null)
{
SharedPools.ByteArray.Free(chunks[c]);
chunks[c] = null;
}
}
}
}
internal static PooledStream CreateWritableStream()
{
return new ReadWriteStream();
}
public class PooledStream : Stream
{
protected List<byte[]> chunks;
protected long position;
protected long length;
public PooledStream(long length, byte[][] chunks)
{
this.position = 0;
this.length = length;
this.chunks = new List<byte[]>(chunks);
}
protected PooledStream()
{
this.position = 0;
this.length = 0;
this.chunks = new List<byte[]>();
}
public override long Length
{
get
{
return this.length;
}
}
public override bool CanRead
{
get { return true; }
}
public override bool CanSeek
{
get { return true; }
}
public override bool CanWrite
{
get { return false; }
}
public override void Flush()
{
// nothing to do, this is a read-only stream
}
public override long Position
{
get
{
return this.position;
}
set
{
if (value < 0 || value >= length)
{
throw new ArgumentOutOfRangeException("value");
}
this.position = value;
}
}
public override long Seek(long offset, SeekOrigin origin)
{
long target;
try
{
switch (origin)
{
case SeekOrigin.Begin:
target = offset;
break;
case SeekOrigin.Current:
target = checked(offset + position);
break;
case SeekOrigin.End:
target = checked(offset + length);
break;
default:
throw new ArgumentOutOfRangeException("origin");
}
}
catch (OverflowException)
{
throw new ArgumentOutOfRangeException("offset");
}
if (target < 0)
{
throw new ArgumentOutOfRangeException("offset");
}
position = target;
return target;
}
public override int ReadByte()
{
if (position >= length)
{
return -1;
}
var currentIndex = CurrentChunkIndex;
var chunk = chunks[currentIndex];
var currentOffset = CurrentChunkOffset;
var result = chunk[currentOffset];
this.position++;
return result;
}
public override int Read(byte[] buffer, int index, int count)
{
if (count <= 0 || position >= length)
{
return 0;
}
var totalCopyCount = Read(this.chunks, this.position, this.length, buffer, index, count);
this.position += totalCopyCount;
return (int)totalCopyCount;
}
private static int Read(List<byte[]> chunks, long position, long length, byte[] buffer, int index, int count)
{
var oldPosition = position;
while (count > 0 && position < length)
{
var chunk = chunks[GetChunkIndex(position)];
var currentOffset = GetChunkOffset(position);
int copyCount = Math.Min(Math.Min(ChunkSize - currentOffset, count), (int)(length - position));
Array.Copy(chunk, currentOffset, buffer, index, copyCount);
position += copyCount;
index += copyCount;
count -= copyCount;
}
return (int)(position - oldPosition);
}
public byte[] ToArray()
{
if (this.Length == 0)
{
return SpecializedCollections.EmptyBytes;
}
var array = new byte[this.Length];
// read entire array
Read(this.chunks, 0, this.length, array, 0, array.Length);
return array;
}
protected int CurrentChunkIndex { get { return GetChunkIndex(this.position); } }
protected int CurrentChunkOffset { get { return GetChunkOffset(this.position); } }
protected static int GetChunkIndex(long value)
{
return (int)(value / ChunkSize);
}
protected static int GetChunkOffset(long value)
{
return (int)(value % ChunkSize);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (chunks != null)
{
foreach (var chunk in chunks)
{
SharedPools.ByteArray.Free(chunk);
}
chunks = null;
}
}
public override void SetLength(long value)
{
throw new NotSupportedException();
}
public override void Write(byte[] buffer, int offset, int count)
{
throw new NotSupportedException();
}
}
private class ReadWriteStream : PooledStream
{
public ReadWriteStream()
: base()
{
}
public override bool CanWrite
{
get { return true; }
}
public override long Position
{
get
{
return base.Position;
}
set
{
if (value < 0)
{
throw new ArgumentOutOfRangeException("value");
}
this.position = value;
}
}
private void EnsureCapacity(long value)
{
var nextIndex = GetChunkIndex(value);
for (var i = this.chunks.Count; i <= nextIndex; i++)
{
// allocate memory and initialize it to zero
var chunk = SharedPools.ByteArray.Allocate();
Array.Clear(chunk, 0, chunk.Length);
chunks.Add(chunk);
}
}
public override void WriteByte(byte value)
{
EnsureCapacity(this.position + 1);
var currentIndex = CurrentChunkIndex;
var currentOffset = CurrentChunkOffset;
chunks[currentIndex][currentOffset] = value;
this.position++;
if (this.position >= length)
{
this.length = this.position;
}
}
public override void Write(byte[] buffer, int index, int count)
{
EnsureCapacity(this.position + count);
var currentIndex = index;
var countLeft = count;
while (countLeft > 0)
{
var chunk = chunks[CurrentChunkIndex];
var currentOffset = CurrentChunkOffset;
int writeCount = Math.Min(ChunkSize - currentOffset, countLeft);
Array.Copy(buffer, currentIndex, chunk, currentOffset, writeCount);
this.position += writeCount;
currentIndex += writeCount;
countLeft -= writeCount;
}
if (this.position >= length)
{
this.length = this.position;
}
}
}
}
}
| 411 | 0.908761 | 1 | 0.908761 | game-dev | MEDIA | 0.289023 | game-dev | 0.990556 | 1 | 0.990556 |
letsgamedev/Suffragium | 1,674 | game/games/sortit/viewports.gd | extends GridContainer
const STATUS_DISPLAY_SCENE = preload("res://games/sortit/ui/status_display.tscn")
onready var _players: Node = $"../Players"
onready var _minimap = $MiniMap
func _add_viewport_container() -> Viewport:
# Create viewport and viewport container
var viewport_container = ViewportContainer.new()
viewport_container.stretch = true
viewport_container.size_flags_horizontal = SIZE_EXPAND_FILL
viewport_container.size_flags_vertical = SIZE_EXPAND_FILL
var viewport = Viewport.new()
viewport.shadow_atlas_size = 1
viewport.msaa = Viewport.MSAA_4X
viewport_container.add_child(viewport)
# Add viewport container
add_child(viewport_container)
return viewport
func create_viewports():
var player_count = _players.player_count
if player_count == 1:
columns = 1
for i in range(player_count):
var viewport = _add_viewport_container()
# Create camerea and status display for player
var camera = Camera.new()
camera.fov = 50
camera.rotation_degrees.x = -70
camera.rotation_degrees.y = -90
camera.set_cull_mask_bit(2, false)
viewport.add_child(camera)
var status_display = STATUS_DISPLAY_SCENE.instance()
viewport.add_child(status_display)
# Assign camerea and status display to player
var player = _players.get_child(i)
player.camera = camera
player.status_display = status_display
if player_count == 3:
# Move minimap camera into new viewport to fill empty spot
var viewport = _add_viewport_container()
viewport.shadow_atlas_size = 0 # Disable shadows for mini map
remove_child(_minimap)
_minimap.set_players($"../Players".get_children())
viewport.add_child(_minimap)
else:
_minimap.set_process(false)
| 411 | 0.73923 | 1 | 0.73923 | game-dev | MEDIA | 0.527718 | game-dev | 0.854735 | 1 | 0.854735 |
aurorabuilder/elements | 7,396 | supplements/ghosts-of-saltmarsh/backgrounds/smuggler.xml | <?xml version="1.0" encoding="utf-8" ?>
<elements>
<info>
<name>Smuggler Background</name>
<update version="0.0.2">
<file name="smuggler.xml" url="https://raw.githubusercontent.com/aurorabuilder/elements/master/supplements/ghosts-of-saltmarsh/backgrounds/smuggler.xml" />
</update>
</info>
<element name="Smuggler" type="Background" source="Ghosts of Saltmarsh" id="ID_WOTC_GOS_BACKGROUND_SMUGGLER">
<description>
<p>On a rickety barge, you carried a hundred longswords in fish barrels right past the dock master’s oblivious lackeys. You have paddled a riverboat filled with stolen elven wine under the gaze of the moon and sold it for twice its value in the morning. In your more charitable times, you have transported innocents out of war zones of helped guide herd animals to safety on the banks of a burning river.</p>
<ul class="unstyled">
<li><strong>Skill Proficiencies:</strong> Athletics, Deception</li>
<li><strong>Tool Proficiencies:</strong> Vehicles (water)</li>
<li><strong>Equipment:</strong> A fancy leather vest of a pair of leather boots, a set of common clothes, and a leather pouch with 15 gp</li>
</ul>
<div element="ID_WOTC_GOS_BACKGROUND_FEATURE_DOWN_LOW" />
<h5>CLAIM TO FAME</h5>
<p>Every smuggler has that one tale that sets them apart from common criminals. By wits, sailing skill, or a silver tongue, you lived to tell the story—and you tell it to others. You can roll on the following table to determine your claim or choose one that best fits your character.</p>
<table>
<thead>
<tr><td>d6</td><td>Accomplishment</td></tr>
</thead>
<tr><td>1</td><td><strong>Spirit of the Whale.</strong> You smuggled stolen dwarven spirits in the body of a dead whale being pulled behind a fishing boat. When you delivered the goods the corpse suddenly exploded, sending whale meat and whiskey bottles for half a mile.</td></tr>
<tr><td>2</td><td><strong>Cart and Sword.</strong> You drove a cart filled with stolen art through the middle of a battlefield while singing sea shanties to confuse the combatants.</td></tr>
<tr><td>3</td><td><strong>The Recruit.</strong> You enlisted in another nation’s navy for the purpose of smuggling stolen jewels to a distant port. You attained a minor rank before disappearing from the navy and making your way here.</td></tr>
<tr><td>4</td><td><strong>River of Shadows.</strong> Your riverboat accidentally slipped though the veil into the Shadowfell for several hours. While you were there, you sold some stolen dragonborn artifacts before returning to this plane and paddling home.</td></tr>
<tr><td>5</td><td><strong>Gold-hearted.</strong> You agreed to transport a family escaping a war. The baby began to cry at a checkpoint and you have the guards all your gold to let you pass. The family never found out about this gesture.</td></tr>
<tr><td>6</td><td><strong>Playing Both Sides.</strong> You once smuggled crates of crossbow bolts and bundles of arrows, each destined for an opposing side in a regional war, at the same time. The buyers arrived within moments of each other but did not discover your trickery.</td></tr>
</table>
<h5>SUGGESTED CHARACTERISTICS</h5>
<p>In general, smugglers value survival and then profit, above other things. One could be a part of a larger organization, or might run a small smuggling vessel of their own. Smugglers live the lies they have told, and they have a natural ability to recall all the falsehoods and half-truths they have ever spouted.</p>
</description>
<setters>
<set name="short">Athletics, Deception, Vehicles (Water)</set>
</setters>
<rules>
<grant type="Proficiency" id="ID_PROFICIENCY_SKILL_ATHLETICS" />
<grant type="Proficiency" id="ID_PROFICIENCY_SKILL_DECEPTION" />
<grant type="Proficiency" id="ID_PROFICIENCY_TOOL_PROFICIENCY_VEHICLES_WATER" />
<grant type="Background Feature" id="ID_WOTC_GOS_BACKGROUND_FEATURE_DOWN_LOW" requirements="!ID_INTERNAL_GRANT_OPTIONAL_BACKGROUND_FEATURE"/>
<select type="Background Feature" name="Variant Feature" supports="Optional Background Feature" optional="true" />
<select type="List" name="Personality Trait" number="2">
<item id="1">I love being on the water but hate fishing.</item>
<item id="2">I think of everything in terms of monetary value.</item>
<item id="3">I never stop smiling.</item>
<item id="4">Nothing rattles me; I have a lie for every occasion.</item>
<item id="5">I love gold but won’t cheat a friend.</item>
<item id="6">I enjoy doing things others believe to be impossible.</item>
<item id="7">I become wistful when I see the sun rise over the ocean.</item>
<item id="8">I am no common criminal; I am a mastermind.</item>
</select>
<select type="List" name="Ideal">
<item id="1"><strong>Wealth.</strong> Heaps of coins in a secure vault is all I dream of. (Any)</item>
<item id="2"><strong>Smuggler’s Code.</strong> I uphold the unwritten rules of the smugglers, who do no cheat one another or directly harm innocents. (Lawful)</item>
<item id="3"><strong>All for a Coin.</strong> I’ll do nearly anything if it means I turn a profit. (Lawful)</item>
<item id="4"><strong>Peace of Prosperity.</strong> I smuggle only to achieve a greater goal that benefits my community. (Good)</item>
<item id="5"><strong>People.</strong> For all my many lies, I place a high value on friendship. (Any)</item>
<item id="6"><strong>Daring.</strong> I am most happy when risking everything. (Any)</item>
</select>
<select type="List" name="Bond">
<item id="1">My vessel was stolen from me, and I burn with the desire to recover it.</item>
<item id="2">I intend to become the leader of the network of smugglers that i belong to.</item>
<item id="3">I owe a debt that cannot be repaid in gold.</item>
<item id="4">After one last job, I will retire from the business.</item>
<item id="5">I was tricked by a fellow smuggler who stole something precious from me. I will find that thief.</item>
<item id="6">I give most of my profits to a charitable cause, and I don’t like to brag about it.</item>
</select>
<select type="List" name="Flaw">
<item id="1">Lying is reflexive, and I sometimes engage in it without realizing.</item>
<item id="2">I tend to assess my relationships in terms of profit and loss.</item>
<item id="3">I believe everyone has a price and am cynical toward those who present themselves as virtuous.</item>
<item id="4">I struggle to trust the words of others.</item>
<item id="5">Few people know the real me.</item>
<item id="6">Though I act charming, I feel nothing for others and don’t know what friendship is.</item>
</select>
</rules>
</element>
<element name="Feature: Down Low" type="Background Feature" source="Ghosts of Saltmarsh" id="ID_WOTC_GOS_BACKGROUND_FEATURE_DOWN_LOW">
<description>
<p>You are acquainted with a network of smugglers who are willing to help you out of tight situations. While in a particular town, city, or other similarly sized community (DM’s discretion) you and your companions can stay for free in safe houses. Safe houses provide a poor lifestyle. While staying at a safe house, you can choose to keep your presence (and that of your companions) a secret.</p>
</description>
<sheet alt="Down Low" />
</element>
</elements> | 411 | 0.796649 | 1 | 0.796649 | game-dev | MEDIA | 0.802703 | game-dev | 0.576534 | 1 | 0.576534 |
argotorg/solidity | 10,757 | libevmasm/ControlFlowGraph.cpp | /*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0
/**
* @file ControlFlowGraph.cpp
* @author Christian <c@ethdev.com>
* @date 2015
* Control flow analysis for the optimizer.
*/
#include <libevmasm/ControlFlowGraph.h>
#include <map>
#include <memory>
#include <algorithm>
#include <libevmasm/Exceptions.h>
#include <libevmasm/AssemblyItem.h>
#include <libevmasm/SemanticInformation.h>
#include <libevmasm/KnownState.h>
using namespace solidity;
using namespace solidity::evmasm;
BlockId::BlockId(u256 const& _id):
m_id(unsigned(_id))
{
assertThrow( _id < initial().m_id, OptimizerException, "Tag number too large.");
}
BasicBlocks ControlFlowGraph::optimisedBlocks()
{
if (m_items.empty())
return BasicBlocks();
findLargestTag();
splitBlocks();
resolveNextLinks();
removeUnusedBlocks();
setPrevLinks();
gatherKnowledge();
return rebuildCode();
}
void ControlFlowGraph::findLargestTag()
{
m_lastUsedId = 0;
for (auto const& item: m_items)
if (item.type() == Tag || item.type() == PushTag)
{
// Assert that it can be converted.
BlockId(item.data());
m_lastUsedId = std::max(unsigned(item.data()), m_lastUsedId);
}
}
void ControlFlowGraph::splitBlocks()
{
m_blocks.clear();
BlockId id = BlockId::initial();
m_blocks[id].begin = 0;
for (size_t index = 0; index < m_items.size(); ++index)
{
AssemblyItem const& item = m_items.at(index);
if (item.type() == Tag)
{
if (id)
m_blocks[id].end = static_cast<unsigned>(index);
id = BlockId::invalid();
}
if (!id)
{
id = item.type() == Tag ? BlockId(item.data()) : generateNewId();
m_blocks[id].begin = static_cast<unsigned>(index);
}
if (item.type() == PushTag)
m_blocks[id].pushedTags.emplace_back(item.data());
if (SemanticInformation::altersControlFlow(item))
{
m_blocks[id].end = static_cast<unsigned>(index + 1);
if (item == Instruction::JUMP)
m_blocks[id].endType = BasicBlock::EndType::JUMP;
else if (item == Instruction::JUMPI)
m_blocks[id].endType = BasicBlock::EndType::JUMPI;
else
m_blocks[id].endType = BasicBlock::EndType::STOP;
id = BlockId::invalid();
}
}
if (id)
{
m_blocks[id].end = static_cast<unsigned>(m_items.size());
if (m_blocks[id].endType == BasicBlock::EndType::HANDOVER)
m_blocks[id].endType = BasicBlock::EndType::STOP;
}
}
void ControlFlowGraph::resolveNextLinks()
{
std::map<unsigned, BlockId> blockByBeginPos;
for (auto const& idAndBlock: m_blocks)
if (idAndBlock.second.begin != idAndBlock.second.end)
blockByBeginPos[idAndBlock.second.begin] = idAndBlock.first;
for (auto& idAndBlock: m_blocks)
{
BasicBlock& block = idAndBlock.second;
switch (block.endType)
{
case BasicBlock::EndType::JUMPI:
case BasicBlock::EndType::HANDOVER:
assertThrow(
blockByBeginPos.count(block.end),
OptimizerException,
"Successor block not found."
);
block.next = blockByBeginPos.at(block.end);
break;
default:
break;
}
}
}
void ControlFlowGraph::removeUnusedBlocks()
{
std::vector<BlockId> blocksToProcess{BlockId::initial()};
std::set<BlockId> neededBlocks{BlockId::initial()};
while (!blocksToProcess.empty())
{
BasicBlock const& block = m_blocks.at(blocksToProcess.back());
blocksToProcess.pop_back();
for (BlockId tag: block.pushedTags)
if (!neededBlocks.count(tag) && m_blocks.count(tag))
{
neededBlocks.insert(tag);
blocksToProcess.push_back(tag);
}
if (block.next && !neededBlocks.count(block.next))
{
neededBlocks.insert(block.next);
blocksToProcess.push_back(block.next);
}
}
for (auto it = m_blocks.begin(); it != m_blocks.end();)
if (neededBlocks.count(it->first))
++it;
else
m_blocks.erase(it++);
}
void ControlFlowGraph::setPrevLinks()
{
for (auto& idAndBlock: m_blocks)
{
BasicBlock& block = idAndBlock.second;
switch (block.endType)
{
case BasicBlock::EndType::JUMPI:
case BasicBlock::EndType::HANDOVER:
assertThrow(
!m_blocks.at(block.next).prev,
OptimizerException,
"Successor already has predecessor."
);
m_blocks[block.next].prev = idAndBlock.first;
break;
default:
break;
}
}
// If block ends with jump to not yet linked block, link them removing the jump
for (auto& idAndBlock: m_blocks)
{
BlockId blockId = idAndBlock.first;
BasicBlock& block = idAndBlock.second;
if (block.endType != BasicBlock::EndType::JUMP || block.end - block.begin < 2)
continue;
AssemblyItem const& push = m_items.at(block.end - 2);
if (push.type() != PushTag)
continue;
BlockId nextId(push.data());
if (m_blocks.count(nextId) && m_blocks.at(nextId).prev)
continue;
bool hasLoop = false;
for (BlockId id = nextId; id && m_blocks.count(id) && !hasLoop; id = m_blocks.at(id).next)
hasLoop = (id == blockId);
if (hasLoop || !m_blocks.count(nextId))
continue;
m_blocks[nextId].prev = blockId;
block.next = nextId;
block.end -= 2;
assertThrow(
!block.pushedTags.empty() && block.pushedTags.back() == nextId,
OptimizerException,
"Last pushed tag not at end of pushed list."
);
block.pushedTags.pop_back();
block.endType = BasicBlock::EndType::HANDOVER;
}
}
void ControlFlowGraph::gatherKnowledge()
{
// @todo actually we know that memory is filled with zeros at the beginning,
// we could make use of that.
KnownStatePointer emptyState = std::make_shared<KnownState>();
bool unknownJumpEncountered = false;
struct WorkQueueItem {
BlockId blockId;
KnownStatePointer state;
std::set<BlockId> blocksSeen;
};
std::vector<WorkQueueItem> workQueue{WorkQueueItem{BlockId::initial(), emptyState->copy(), std::set<BlockId>()}};
auto addWorkQueueItem = [&](WorkQueueItem const& _currentItem, BlockId _to, KnownStatePointer const& _state)
{
WorkQueueItem item;
item.blockId = _to;
item.state = _state->copy();
item.blocksSeen = _currentItem.blocksSeen;
item.blocksSeen.insert(_currentItem.blockId);
workQueue.push_back(std::move(item));
};
while (!workQueue.empty())
{
WorkQueueItem item = std::move(workQueue.back());
workQueue.pop_back();
//@todo we might have to do something like incrementing the sequence number for each JUMPDEST
assertThrow(!!item.blockId, OptimizerException, "");
if (!m_blocks.count(item.blockId))
continue; // too bad, we do not know the tag, probably an invalid jump
BasicBlock& block = m_blocks.at(item.blockId);
KnownStatePointer state = item.state;
if (block.startState)
{
// We call reduceToCommonKnowledge even in the non-join setting to get the correct
// sequence number
if (!m_joinKnowledge)
state->reset();
state->reduceToCommonKnowledge(*block.startState, !item.blocksSeen.count(item.blockId));
if (*state == *block.startState)
continue;
}
block.startState = state->copy();
// Feed all items except for the final jump yet because it will erase the target tag.
unsigned pc = block.begin;
while (pc < block.end && !SemanticInformation::altersControlFlow(m_items.at(pc)))
state->feedItem(m_items.at(pc++));
if (
block.endType == BasicBlock::EndType::JUMP ||
block.endType == BasicBlock::EndType::JUMPI
)
{
assertThrow(block.begin <= pc && pc == block.end - 1, OptimizerException, "");
//@todo in the case of JUMPI, add knowledge about the condition to the state
// (for both values of the condition)
std::set<u256> tags = state->tagsInExpression(
state->stackElement(state->stackHeight(), langutil::DebugData::create())
);
state->feedItem(m_items.at(pc++));
if (tags.empty())
{
if (!unknownJumpEncountered)
{
// We do not know the target of this jump, so we have to reset the states of all
// JUMPDESTs.
unknownJumpEncountered = true;
for (auto const& it: m_blocks)
if (it.second.begin < it.second.end && m_items[it.second.begin].type() == Tag)
workQueue.push_back(WorkQueueItem{it.first, emptyState->copy(), std::set<BlockId>()});
}
}
else
for (auto tag: tags)
addWorkQueueItem(item, BlockId(tag), state);
}
else if (block.begin <= pc && pc < block.end)
state->feedItem(m_items.at(pc++));
assertThrow(block.end <= block.begin || pc == block.end, OptimizerException, "");
block.endState = state;
if (
block.endType == BasicBlock::EndType::HANDOVER ||
block.endType == BasicBlock::EndType::JUMPI
)
addWorkQueueItem(item, block.next, state);
}
// Remove all blocks we never visited here. This might happen because a tag is pushed but
// never used for a JUMP.
// Note that this invalidates some contents of pushedTags
for (auto it = m_blocks.begin(); it != m_blocks.end();)
if (!it->second.startState)
it = m_blocks.erase(it);
else
it++;
}
BasicBlocks ControlFlowGraph::rebuildCode()
{
std::map<BlockId, unsigned> pushes;
for (auto& idAndBlock: m_blocks)
for (BlockId ref: idAndBlock.second.pushedTags)
if (m_blocks.count(ref))
pushes[ref]++;
std::set<BlockId> blocksToAdd;
for (auto it: m_blocks)
blocksToAdd.insert(it.first);
std::set<BlockId> blocksAdded;
BasicBlocks blocks;
for (
BlockId blockId = BlockId::initial();
blockId;
blockId = blocksToAdd.empty() ? BlockId::invalid() : *blocksToAdd.begin()
)
{
bool previousHandedOver = (blockId == BlockId::initial());
while (m_blocks.at(blockId).prev)
blockId = m_blocks.at(blockId).prev;
for (; blockId; blockId = m_blocks.at(blockId).next)
{
BasicBlock& block = m_blocks.at(blockId);
blocksToAdd.erase(blockId);
blocksAdded.insert(blockId);
if (block.begin == block.end)
continue;
// If block starts with unused tag, skip it.
if (previousHandedOver && !pushes[blockId] && m_items[block.begin].type() == Tag)
++block.begin;
if (block.begin < block.end)
{
blocks.push_back(block);
blocks.back().startState->clearTagUnions();
blocks.back().endState->clearTagUnions();
}
previousHandedOver = (block.endType == BasicBlock::EndType::HANDOVER);
}
}
return blocks;
}
BlockId ControlFlowGraph::generateNewId()
{
BlockId id = BlockId(++m_lastUsedId);
assertThrow(id < BlockId::initial(), OptimizerException, "Out of block IDs.");
return id;
}
| 411 | 0.972737 | 1 | 0.972737 | game-dev | MEDIA | 0.636986 | game-dev | 0.984811 | 1 | 0.984811 |
Icexuegao/DeepSpace | 2,974 | src/ice/library/EventType.kt | package ice.library
import arc.Core
import arc.Events
import arc.math.Interp
import arc.scene.actions.Actions
import arc.scene.ui.layout.Table
import arc.struct.Seq
import ice.library.components.BuildInterface
import ice.library.components.block.BlockDrawSelect
import ice.library.components.block.BlockUpdate
import ice.library.scene.tex.Colors
import ice.library.scene.tex.IStyles
import ice.library.struct.ifTrue
import ice.ui.dialog.AchievementDialog
import mindustry.Vars
import mindustry.game.EventType
import mindustry.gen.Iconc
import mindustry.world.Tile
object EventType {
class AchievementUnlockEvent(var achievement: AchievementDialog.Achievement)
class LogisticsHubFire
private val updates = Seq<Tile>(Tile::class.java)
fun init() {
Events.on(AchievementUnlockEvent::class.java){ event ->
if (Vars.state.isMenu)return@on
val table = Table(IStyles.background101).margin(15f)
table.image(IStyles.achievementUnlock).size(50f)
table.add("成就: ${event.achievement.name} 已解锁 ${Iconc.lockOpen}", Colors.b4)
table.pack()
val container = Core.scene.table()
container.top().add(table)
container.setTranslation(0f, table.prefHeight)
container.actions(Actions.translateBy(0f, -table.prefHeight, 1f, Interp.fade),
Actions.delay(2.5f),
Actions.run {
container.actions(Actions.translateBy(0f, table.prefHeight, 1f, Interp.fade), Actions.remove())
})
}
Events.run(EventType.Trigger.update) {
Vars.state.isGame.ifTrue {
updates.forEach {
val block = it.block()
if (block is BlockUpdate) {
block.update(it)
} else {
updates.remove(it)
}
}
}
}
Events.run(EventType.Trigger.draw) {
Vars.state.isGame.ifTrue {
val mouseWorld = Core.input.mouseWorld()
val tileWorld = Vars.world.tileWorld(mouseWorld.x, mouseWorld.y) ?: return@ifTrue
val block = tileWorld.block()
if (block is BlockDrawSelect) {
block.draw(tileWorld)
}
}
}
Events.on(EventType.ResetEvent::class.java) {
updates.clear()
}
Events.on(EventType.WorldLoadEndEvent::class.java) {
Vars.world.tiles.forEach {
if (it == null) return@forEach
val build = it.build
if (build is BuildInterface.BuildWorldLoadEndEvent) {
build.worldLoadEvent()
}
}
}
Events.on(EventType.BlockBuildEndEvent::class.java) {
val block = it.tile.block()
if (block is BlockUpdate) updates.add(it.tile)
}
}
} | 411 | 0.923027 | 1 | 0.923027 | game-dev | MEDIA | 0.903314 | game-dev | 0.955136 | 1 | 0.955136 |
mezz/JustEnoughItems | 1,064 | Library/src/main/java/mezz/jei/library/gui/ingredients/CycleTicker.java | package mezz.jei.library.gui.ingredients;
import net.minecraft.client.Minecraft;
import org.jetbrains.annotations.Nullable;
import java.util.List;
import java.util.Optional;
public class CycleTicker implements ICycler {
private static final int MAX_INDEX = 100_000;
private static final int TICKS_PER_UPDATE = 20;
public static CycleTicker createWithRandomOffset() {
int cycleOffset = (int) (Math.random() * MAX_INDEX);
return new CycleTicker(cycleOffset);
}
private int tick = 0;
private int index;
private CycleTicker(int cycleOffset) {
this.index = cycleOffset;
}
@Override
public <T> Optional<T> getCycled(List<@Nullable T> list) {
if (list.isEmpty()) {
return Optional.empty();
}
int index = this.index % list.size();
T value = list.get(index);
return Optional.ofNullable(value);
}
public boolean tick() {
Minecraft minecraft = Minecraft.getInstance();
if (minecraft.hasShiftDown()) {
return false;
}
tick++;
if (tick >= TICKS_PER_UPDATE) {
tick = 0;
index++;
return true;
}
return false;
}
}
| 411 | 0.808834 | 1 | 0.808834 | game-dev | MEDIA | 0.968981 | game-dev | 0.914716 | 1 | 0.914716 |
abcxff/diepcustom | 7,580 | src/Gamemodes/Domination.ts | /*
DiepCustom - custom tank game server that shares diep.io's WebSocket protocol
Copyright (C) 2022 ABCxFF (github.com/ABCxFF)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>
*/
import Client from "../Client";
import { Color, ColorsHexCode, ArenaFlags, ValidScoreboardIndex, ClientBound } from "../Const/Enums";
import Dominator from "../Entity/Misc/Dominator";
import TeamBase from "../Entity/Misc/TeamBase";
import { TeamEntity } from "../Entity/Misc/TeamEntity";
import TankBody from "../Entity/Tank/TankBody";
import GameServer from "../Game";
import ArenaEntity, { ArenaState } from "../Native/Arena";
import { Entity } from "../Native/Entity";
const arenaSize = 11150;
const baseSize = arenaSize / (3 + 1/3); // 3345, must scale with arena size
const domBaseSize = baseSize / 2;
const TEAM_COLORS = [Color.TeamBlue, Color.TeamRed]; // Only supports up to 4 teams
/**
* Domination Gamemode Arena
*/
export default class DominationArena extends ArenaEntity {
/** All dominators in game */
public dominators: Dominator[] = [];
/** All team entities in game */
public teams: TeamEntity[] = [];
/** Maps clients to their teams */
public playerTeamMap: WeakMap<Client, TeamEntity> = new WeakMap();
public constructor(game: GameServer) {
super(game);
this.shapeScoreRewardMultiplier = 2.0;
this.updateBounds(arenaSize * 2, arenaSize * 2);
this.arenaData.values.flags |= ArenaFlags.hiddenScores;
let flipLeft = Math.random() > 0.5 ? 1 : -1;
let flipRight = Math.random() > 0.5 ? -1 : 1;
for (let i = 0; i < TEAM_COLORS.length; i++) {
const teamColor = TEAM_COLORS[i];
const team = new TeamEntity(this.game, teamColor);
const side = i % 2 !== 0 ? 1 : -1; // 1 = left, -1 = right
const x = side * arenaSize - side * baseSize / 2;
const y = side * (side === 1 ? flipLeft : flipRight) * (arenaSize - baseSize / 2);
flipLeft *= side
flipRight *= -side
const teamBase = new TeamBase(game, team, x, y, baseSize, baseSize);
this.teams.push(team);
}
const SE = new Dominator(this, new TeamBase(game, this, arenaSize / 2.5, arenaSize / 2.5, domBaseSize, domBaseSize, false));
SE.prefix = "SE ";
const SW = new Dominator(this, new TeamBase(game, this, arenaSize / -2.5, arenaSize / 2.5, domBaseSize, domBaseSize, false));
SW.prefix = "SW ";
const NW = new Dominator(this, new TeamBase(game, this, arenaSize / -2.5, arenaSize / -2.5, domBaseSize, domBaseSize, false));
NW.prefix = "NW ";
const NE = new Dominator(this, new TeamBase(game, this, arenaSize / 2.5, arenaSize / -2.5, domBaseSize, domBaseSize, false));
NE.prefix = "NE ";
this.dominators.push(SE, SW, NW, NE);
}
public spawnPlayer(tank: TankBody, client: Client) {
tank.positionData.values.y = arenaSize * Math.random() - arenaSize;
const xOffset = (Math.random() - 0.5) * baseSize,
yOffset = (Math.random() - 0.5) * baseSize;
const team = this.playerTeamMap.get(client) || this.teams[~~(Math.random() * this.teams.length)];
const teamBase: TeamBase = this.game.entities.inner.find((entity) => entity instanceof TeamBase && entity.relationsData.values.team === team) as TeamBase;
tank.relationsData.values.team = teamBase.relationsData.values.team;
tank.styleData.values.color = teamBase.styleData.values.color;
tank.positionData.values.x = teamBase.positionData.values.x + xOffset;
tank.positionData.values.y = teamBase.positionData.values.y + yOffset;
this.playerTeamMap.set(client, team);
if (client.camera) client.camera.relationsData.team = tank.relationsData.values.team;
}
public getTeamDominatorCount(team: TeamEntity) {
let doms: number = 0;
for (const dominator of this.dominators) {
if (dominator.relationsData.values.team === team) doms++;
}
return doms;
}
public updateScoreboard() {
// Uncomment to enable scoreboard from latest version of the game (2025)
/*
this.dominators.sort((d1, d2) => d2.healthData.values.health - d1.healthData.values.health);
const length = Math.min(10, this.dominators.length);
for (let i = 0; i < length; ++i) {
const dom = this.dominators[i];
const team = dom.relationsData.values.team;
const isTeamATeam = team instanceof TeamEntity;
if (dom.styleData.values.color === Color.Tank) this.arenaData.values.scoreboardColors[i as ValidScoreboardIndex] = Color.ScoreboardBar;
else this.arenaData.values.scoreboardColors[i as ValidScoreboardIndex] = dom.styleData.values.color;
this.arenaData.values.scoreboardNames[i as ValidScoreboardIndex] = dom.prefix || dom.nameData.values.name;
// TODO: Change id
this.arenaData.values.scoreboardTanks[i as ValidScoreboardIndex] = dom['_currentTank'];
this.arenaData.values.scoreboardScores[i as ValidScoreboardIndex] = dom.healthData.values.health;
this.arenaData.values.scoreboardSuffixes[i as ValidScoreboardIndex] = " HP";
}
this.arenaData.scoreboardAmount = length;
*/
}
public updateArenaState() {
this.updateScoreboard();
const dominatorCount = this.dominators.length; // Only count alive players for win condition
for (const team of this.teams) {
if (this.getTeamDominatorCount(team) === dominatorCount) { // If all dominators are on the same team, the game is over
if (this.state === ArenaState.OPEN) {
this.game.broadcast()
.u8(ClientBound.Notification)
.stringNT(`${team.teamName} HAS WON THE GAME!`)
.u32(ColorsHexCode[team.teamData.values.teamColor])
.float(-1)
.stringNT("").send();
this.state = ArenaState.OVER;
setTimeout(() => {
this.close();
}, 5000);
}
}
}
for (let i = this.dominators.length; i --> 0;) {
const dom = this.dominators[i];
if (!Entity.exists(dom)) {
const pop = this.dominators.pop();
if (pop && i < this.dominators.length) this.dominators[i] = pop;
}
}
if (this.state === ArenaState.CLOSING && this.getAlivePlayers().length === 0) {
this.state = ArenaState.CLOSED;
// This is a one-time, end of life event, so we just use setTimeout
setTimeout(() => {
this.game.end();
}, 10000);
return;
}
}
}
| 411 | 0.881214 | 1 | 0.881214 | game-dev | MEDIA | 0.828805 | game-dev | 0.976732 | 1 | 0.976732 |
jjbali/Extended-Experienced-PD | 3,583 | core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/actors/buffs/ArtifactRecharge.java | /*
* Pixel Dungeon
* Copyright (C) 2012-2015 Oleg Dolya
*
* Shattered Pixel Dungeon
* Copyright (C) 2014-2024 Evan Debenham
*
* Experienced Pixel Dungeon
* Copyright (C) 2019-2024 Trashbox Bobylev
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
package com.shatteredpixel.shatteredpixeldungeon.actors.buffs;
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact;
import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.HornOfPlenty;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
import com.watabou.noosa.Image;
import com.watabou.utils.Bundle;
public class ArtifactRecharge extends Buff {
public static final float DURATION = 30f;
{
type = buffType.POSITIVE;
}
private float left;
public boolean ignoreHornOfPlenty;
@Override
public boolean act() {
if (target instanceof Hero) {
float chargeAmount = Math.min(1, left);
if (chargeAmount > 0){
for (Buff b : target.buffs()) {
if (b instanceof Artifact.ArtifactBuff) {
if (b instanceof HornOfPlenty.hornRecharge && ignoreHornOfPlenty){
continue;
}
if (!((Artifact.ArtifactBuff) b).isCursed()) {
((Artifact.ArtifactBuff) b).charge((Hero) target, chargeAmount);
}
}
}
}
}
left--;
if (left < 0){ // we expire after 0 to be more consistent with wand recharging visually
detach();
} else {
spend(TICK);
}
return true;
}
public ArtifactRecharge set( float amount ){
if (left < amount) left = amount;
return this;
}
public ArtifactRecharge prolong( float amount ){
left += amount;
return this;
}
public float left(){
return left;
}
@Override
public int icon() {
return BuffIndicator.RECHARGING;
}
@Override
public void tintIcon(Image icon) {
icon.hardlight(0, 1f, 0);
}
@Override
public float iconFadePercent() {
return Math.max(0, (DURATION - left) / DURATION);
}
@Override
public String iconTextDisplay() {
return Integer.toString((int)left+1);
}
@Override
public String desc() {
return Messages.get(this, "desc", dispTurns(left+1));
}
private static final String LEFT = "left";
private static final String IGNORE_HORN = "ignore_horn";
@Override
public void storeInBundle(Bundle bundle) {
super.storeInBundle(bundle);
bundle.put( LEFT, left );
bundle.put( IGNORE_HORN, ignoreHornOfPlenty );
}
@Override
public void restoreFromBundle(Bundle bundle) {
super.restoreFromBundle(bundle);
left = bundle.getFloat(LEFT);
ignoreHornOfPlenty = bundle.getBoolean(IGNORE_HORN);
}
public static void chargeArtifacts( Hero hero, float turns ){
for (Buff b : hero.buffs()){
if (b instanceof Artifact.ArtifactBuff && !((Artifact.ArtifactBuff) b).isCursed()){
if (!((Artifact.ArtifactBuff) b).isCursed()) ((Artifact.ArtifactBuff) b).charge(hero, turns);
}
}
}
}
| 411 | 0.806135 | 1 | 0.806135 | game-dev | MEDIA | 0.98326 | game-dev | 0.994693 | 1 | 0.994693 |
AlexModGuy/Rats | 1,625 | src/main/java/com/github/alexthe666/rats/server/message/UpdateRatMusicPacket.java | package com.github.alexthe666.rats.server.message;
import com.github.alexthe666.rats.client.util.RatRecordSoundInstance;
import com.github.alexthe666.rats.server.entity.rat.TamedRat;
import net.minecraft.client.Minecraft;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.RecordItem;
import net.minecraftforge.network.NetworkEvent;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.function.Supplier;
public record UpdateRatMusicPacket(int id, RecordItem record) {
public static UpdateRatMusicPacket decode(FriendlyByteBuf buf) {
return new UpdateRatMusicPacket(buf.readInt(), (RecordItem) buf.readRegistryIdUnsafe(ForgeRegistries.ITEMS));
}
public static void encode(UpdateRatMusicPacket packet, FriendlyByteBuf buf) {
buf.writeInt(packet.id());
buf.writeRegistryIdUnsafe(ForgeRegistries.ITEMS, packet.record());
}
public static class Handler {
@SuppressWarnings("Convert2Lambda")
public static void handle(UpdateRatMusicPacket packet, Supplier<NetworkEvent.Context> context) {
context.get().enqueueWork(new Runnable() {
@Override
public void run() {
if (Minecraft.getInstance().level != null) {
Entity entity = Minecraft.getInstance().level.getEntity(packet.id());
if (entity instanceof TamedRat rat) {
Minecraft.getInstance().getSoundManager().queueTickingSound(new RatRecordSoundInstance(rat, packet.record()));
Minecraft.getInstance().gui.setNowPlaying(packet.record().getDisplayName());
}
}
}
});
context.get().setPacketHandled(true);
}
}
}
| 411 | 0.800507 | 1 | 0.800507 | game-dev | MEDIA | 0.97814 | game-dev | 0.817066 | 1 | 0.817066 |
Vawlpe/BakuganDotC-decomp | 4,359 | src/TODO/FUN_088e320c@088e320c.c | #include "ULUS10536_MYTHREAD-MAIN.BIN.h"
void FUN_088e320c(int param_1)
{
undefined4 uVar1;
undefined4 uVar2;
bool bVar3;
int iVar4;
int *piVar5;
int iVar6;
float fVar7;
undefined4 uVar8;
iVar6 = *(int *)(param_1 + 0x324);
bVar3 = false;
if (iVar6 == 0x457) {
bVar3 = true;
if (*(int *)(param_1 + 0x338) < 1) {
FUN_088e1184(param_1);
piVar5 = (int *)DONE_Get_DAT_08AAC9E0();
if (*(char *)(*piVar5 + 0x410) < '\x01') {
*(undefined4 *)(param_1 + 0x324) = 2;
*(undefined4 *)(param_1 + 0x338) = 0x2d;
}
else {
*(undefined4 *)(param_1 + 0x324) = 3;
*(undefined4 *)(param_1 + 0x338) = 0x2d;
iVar6 = FUN_089edb80();
iVar4 = FUN_089edb80();
uVar8 = *(undefined4 *)(iVar4 + 0x24);
uVar1 = *(undefined4 *)(iVar4 + 0x28);
uVar2 = *(undefined4 *)(iVar4 + 0x2c);
*(undefined4 *)(iVar6 + 0x40) = *(undefined4 *)(iVar4 + 0x20);
*(undefined4 *)(iVar6 + 0x44) = uVar8;
*(undefined4 *)(iVar6 + 0x48) = uVar1;
*(undefined4 *)(iVar6 + 0x4c) = uVar2;
iVar6 = FUN_089edb80();
*(undefined4 *)(iVar6 + 0x4c) = 0;
uVar8 = FUN_089edb80();
FUN_089ede1c(uVar8,3);
uVar8 = FUN_089edb80();
FUN_089edf24(uVar8,0x1e);
bVar3 = false;
}
}
else {
*(int *)(param_1 + 0x338) = *(int *)(param_1 + 0x338) + -1;
}
}
else if (iVar6 == 3) {
bVar3 = false;
if (*(int *)(param_1 + 0x338) < 1) {
uVar8 = FUN_089edb80();
iVar6 = FUN_089edf70(uVar8);
if (iVar6 != 0) {
*(undefined *)(param_1 + 0x355) = 1;
iVar6 = FUN_089bfa40(500);
if (*(char *)(iVar6 + 0x6e8) != '\0') {
iVar6 = FUN_089bfa40(500);
*(undefined *)(iVar6 + 0x6e8) = 0;
}
}
}
else {
*(int *)(param_1 + 0x338) = *(int *)(param_1 + 0x338) + -1;
}
}
else if (iVar6 == 2) {
bVar3 = true;
if (*(int *)(param_1 + 0x338) < 1) {
uVar8 = FUN_089edb80();
iVar6 = FUN_089edf70(uVar8);
if (iVar6 != 0) {
*(undefined *)(param_1 + 0x355) = 1;
*(undefined4 *)(param_1 + 0x324) = 3;
bVar3 = false;
}
}
else {
*(int *)(param_1 + 0x338) = *(int *)(param_1 + 0x338) + -1;
}
}
else if (iVar6 == 1) {
fVar7 = (float)FUN_089df648(param_1);
if (fVar7 == 0.0) {
FUN_088def24(0x3e4ccccd,param_1,0,1,0);
*(undefined4 *)(param_1 + 0x324) = 0x457;
*(undefined4 *)(param_1 + 0x338) = 0x1e;
}
bVar3 = true;
}
else if (iVar6 == 0) {
FUN_088def24(0x3e4ccccd,param_1,0x1b,0,0);
FUN_089df730(0x41800000,param_1);
iVar6 = FUN_089edb80();
*(undefined4 *)(iVar6 + 0x30) = 0x3f800000;
*(undefined4 *)(iVar6 + 0x34) = 0;
*(undefined4 *)(iVar6 + 0x38) = 0;
*(undefined4 *)(iVar6 + 0x3c) = 0x3e800000;
iVar6 = FUN_089edb80();
iVar4 = FUN_089edb80();
uVar8 = *(undefined4 *)(iVar4 + 0x34);
uVar1 = *(undefined4 *)(iVar4 + 0x38);
uVar2 = *(undefined4 *)(iVar4 + 0x3c);
*(undefined4 *)(iVar6 + 0x20) = *(undefined4 *)(iVar4 + 0x30);
*(undefined4 *)(iVar6 + 0x24) = uVar8;
*(undefined4 *)(iVar6 + 0x28) = uVar1;
*(undefined4 *)(iVar6 + 0x2c) = uVar2;
iVar6 = FUN_089edb80();
*(undefined4 *)(iVar6 + 0x40) = 0x3f800000;
*(undefined4 *)(iVar6 + 0x44) = 0;
*(undefined4 *)(iVar6 + 0x48) = 0;
*(undefined4 *)(iVar6 + 0x4c) = 0x3f000000;
uVar8 = FUN_089edb80();
FUN_089ede1c(uVar8,3);
uVar8 = FUN_089edb80();
FUN_089edf24(uVar8,0x1e);
uVar8 = FUN_089edb80();
FUN_089edde8(uVar8,1);
*(undefined4 *)(param_1 + 0x324) = 1;
*(undefined4 *)(param_1 + 0x338) = 0x2d;
}
if (bVar3) {
uVar8 = FUN_089edb80();
iVar6 = FUN_089edf70(uVar8);
if (iVar6 == 0) {
iVar6 = *(int *)(param_1 + 0x544);
}
else {
uVar8 = FUN_089edb80();
FUN_089ede1c(uVar8,4);
uVar8 = FUN_089edb80();
FUN_089edf24(uVar8,0x1e);
iVar6 = *(int *)(param_1 + 0x544);
}
}
else {
iVar6 = *(int *)(param_1 + 0x544);
}
if (iVar6 != 0) {
uVar8 = atan2f((*(float **)(param_1 + 0x544))[2] - *(float *)(param_1 + 0x28),
**(float **)(param_1 + 0x544) - *(float *)(param_1 + 0x20));
FUN_088defe8(uVar8,0x3f800000,0x3e0efa35,param_1);
}
return;
}
| 411 | 0.510624 | 1 | 0.510624 | game-dev | MEDIA | 0.890103 | game-dev | 0.565322 | 1 | 0.565322 |
Impostor/Impostor | 2,302 | src/Impostor.Benchmarks/Tests/EventManagerBenchmark.cs | // using System.Threading.Tasks;
// using BenchmarkDotNet.Attributes;
// using Impostor.Api.Events;
// using Impostor.Api.Events.Managers;
// using Impostor.Server.Events;
// using Microsoft.Extensions.DependencyInjection;
//
// namespace Impostor.Benchmarks.Tests
// {
// public class EventManagerBenchmark
// {
// private IEventManager _eventManager;
// private IGameEvent _event;
//
// [GlobalSetup]
// public void Setup()
// {
// var services = new ServiceCollection();
//
// services.AddLogging();
// services.AddSingleton<IEventManager, EventManager>();
//
// _event = new GameStartedEvent(null);
// _eventManager = services.BuildServiceProvider().GetRequiredService<IEventManager>();
// _eventManager.RegisterListener(new EventListener());
// _eventManager.RegisterListener(new EventListener());
// _eventManager.RegisterListener(new EventListener());
// _eventManager.RegisterListener(new EventListener());
// _eventManager.RegisterListener(new EventListener());
// }
//
// [Benchmark]
// public async Task Run_1()
// {
// for (var i = 0; i < 1; i++)
// {
// await _eventManager.CallAsync(_event);
// }
// }
//
// [Benchmark]
// public async Task Run_1000()
// {
// for (var i = 0; i < 1000; i++)
// {
// await _eventManager.CallAsync(_event);
// }
// }
//
// [Benchmark]
// public async Task Run_10000()
// {
// for (var i = 0; i < 10000; i++)
// {
// await _eventManager.CallAsync(_event);
// }
// }
//
// [Benchmark]
// public async Task Run_100000()
// {
// for (var i = 0; i < 100000; i++)
// {
// await _eventManager.CallAsync(_event);
// }
// }
//
// private class EventListener : IEventListener
// {
// [EventListener]
// public void OnGameStarted(IGameStartedEvent e)
// {
//
// }
// }
// }
// }
| 411 | 0.734616 | 1 | 0.734616 | game-dev | MEDIA | 0.514457 | game-dev | 0.803077 | 1 | 0.803077 |
lgsvl/simulator | 1,812 | Assets/Scripts/ScenarioEditor/Extensions/NavScenarioEditor/ScenarioNavSource.cs | /**
* Copyright (c) 2021 LG Electronics, Inc.
*
* This software contains code licensed as described in LICENSE.
*
*/
namespace Simulator.ScenarioEditor.Nav
{
using System.Collections.Generic;
using Agents;
using Elements;
using Input;
using Managers;
using Map;
/// <summary>
/// Scenario source of the Nav elements like <see cref="ScenarioNavOrigin"/>
/// </summary>
public class ScenarioNavSource : ScenarioElementSource
{
/// <inheritdoc/>
public override string ElementTypeName => "NavElements";
/// <inheritdoc/>
public override List<SourceVariant> Variants { get; } = new List<SourceVariant>();
/// <inheritdoc/>
public override void OnVariantSelected(SourceVariant variant)
{
var availableInstance = ScenarioManager.Instance.GetExtension<ScenarioNavExtension>()
.GetVariantInstance(variant);
if (availableInstance != null)
{
var inputManager = ScenarioManager.Instance.GetExtension<InputManager>();
inputManager.FocusOnScenarioElement(availableInstance);
}
else
{
base.OnVariantSelected(variant);
}
}
/// <inheritdoc/>
public override ScenarioElement GetElementInstance(SourceVariant variant)
{
var newPoint = Instantiate(variant.Prefab, transform);
var scenarioNavOrigin = newPoint.AddComponent<ScenarioNavOrigin>();
var navOrigin = newPoint.GetComponent<NavOrigin>();
if (navOrigin == null)
navOrigin = newPoint.AddComponent<NavOrigin>();
scenarioNavOrigin.Setup(navOrigin, false);
return scenarioNavOrigin;
}
}
} | 411 | 0.927134 | 1 | 0.927134 | game-dev | MEDIA | 0.73083 | game-dev | 0.926564 | 1 | 0.926564 |
Mogara/QSanguosha-v2 | 49,165 | src/package/god.cpp | #include "god.h"
#include "client.h"
#include "engine.h"
#include "maneuvering.h"
#include "general.h"
#include "settings.h"
#include "clientplayer.h"
#include "wrapped-card.h"
#include "room.h"
#include "roomthread.h"
class Wushen : public FilterSkill
{
public:
Wushen() : FilterSkill("wushen")
{
}
bool viewFilter(const Card *to_select) const
{
Room *room = Sanguosha->currentRoom();
Player::Place place = room->getCardPlace(to_select->getEffectiveId());
return to_select->getSuit() == Card::Heart && place == Player::PlaceHand;
}
const Card *viewAs(const Card *originalCard) const
{
Slash *slash = new Slash(originalCard->getSuit(), originalCard->getNumber());
slash->setSkillName(objectName());
WrappedCard *card = Sanguosha->getWrappedCard(originalCard->getId());
card->takeOver(slash);
return card;
}
};
class WushenTargetMod : public TargetModSkill
{
public:
WushenTargetMod() : TargetModSkill("#wushen-target")
{
}
int getDistanceLimit(const Player *from, const Card *card) const
{
if (from->hasSkill("wushen") && card->getSuit() == Card::Heart)
return 1000;
else
return 0;
}
};
class Wuhun : public TriggerSkill
{
public:
Wuhun() : TriggerSkill("wuhun")
{
events << PreDamageDone;
frequency = Compulsory;
}
bool trigger(TriggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
DamageStruct damage = data.value<DamageStruct>();
if (damage.from && damage.from != player) {
damage.from->gainMark("@nightmare", damage.damage);
damage.from->getRoom()->broadcastSkillInvoke(objectName(), 1);
room->notifySkillInvoked(player, objectName());
}
return false;
}
};
class WuhunRevenge : public TriggerSkill
{
public:
WuhunRevenge() : TriggerSkill("#wuhun")
{
events << Death;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL && target->hasSkill("wuhun");
}
bool trigger(TriggerEvent, Room *room, ServerPlayer *shenguanyu, QVariant &data) const
{
DeathStruct death = data.value<DeathStruct>();
if (death.who != shenguanyu)
return false;
QList<ServerPlayer *> players = room->getOtherPlayers(shenguanyu);
int max = 0;
foreach(ServerPlayer *player, players)
max = qMax(max, player->getMark("@nightmare"));
if (max == 0) return false;
QList<ServerPlayer *> foes;
foreach (ServerPlayer *player, players) {
if (player->getMark("@nightmare") == max)
foes << player;
}
if (foes.isEmpty())
return false;
ServerPlayer *foe;
if (foes.length() == 1)
foe = foes.first();
else
foe = room->askForPlayerChosen(shenguanyu, foes, "wuhun", "@wuhun-revenge");
room->notifySkillInvoked(shenguanyu, "wuhun");
JudgeStruct judge;
judge.pattern = "Peach,GodSalvation";
judge.good = true;
judge.negative = true;
judge.reason = "wuhun";
judge.who = foe;
room->judge(judge);
if (judge.isBad()) {
room->broadcastSkillInvoke("wuhun", 2);
//room->doLightbox("$WuhunAnimate", 3000);
room->doSuperLightbox("shenguanyu", "wuhun");
LogMessage log;
log.type = "#WuhunRevenge";
log.from = shenguanyu;
log.to << foe;
log.arg = QString::number(max);
log.arg2 = "wuhun";
room->sendLog(log);
room->killPlayer(foe);
} else
room->broadcastSkillInvoke("wuhun", 3);
QList<ServerPlayer *> killers = room->getAllPlayers();
foreach(ServerPlayer *player, killers)
player->loseAllMarks("@nightmare");
return false;
}
};
static bool CompareBySuit(int card1, int card2)
{
const Card *c1 = Sanguosha->getCard(card1);
const Card *c2 = Sanguosha->getCard(card2);
int a = static_cast<int>(c1->getSuit());
int b = static_cast<int>(c2->getSuit());
return a < b;
}
class Shelie : public PhaseChangeSkill
{
public:
Shelie() : PhaseChangeSkill("shelie")
{
}
bool onPhaseChange(ServerPlayer *shenlvmeng) const
{
if (shenlvmeng->getPhase() != Player::Draw)
return false;
Room *room = shenlvmeng->getRoom();
if (!shenlvmeng->askForSkillInvoke(this))
return false;
room->broadcastSkillInvoke(objectName());
QList<int> card_ids = room->getNCards(5);
qSort(card_ids.begin(), card_ids.end(), CompareBySuit);
room->fillAG(card_ids);
QList<int> to_get, to_throw;
while (!card_ids.isEmpty()) {
int card_id = room->askForAG(shenlvmeng, card_ids, false, "shelie");
card_ids.removeOne(card_id);
to_get << card_id;
// throw the rest cards that matches the same suit
const Card *card = Sanguosha->getCard(card_id);
Card::Suit suit = card->getSuit();
room->takeAG(shenlvmeng, card_id, false);
QList<int> _card_ids = card_ids;
foreach (int id, _card_ids) {
const Card *c = Sanguosha->getCard(id);
if (c->getSuit() == suit) {
card_ids.removeOne(id);
room->takeAG(NULL, id, false);
to_throw.append(id);
}
}
}
DummyCard *dummy = new DummyCard;
if (!to_get.isEmpty()) {
dummy->addSubcards(to_get);
shenlvmeng->obtainCard(dummy);
}
dummy->clearSubcards();
if (!to_throw.isEmpty()) {
dummy->addSubcards(to_throw);
CardMoveReason reason(CardMoveReason::S_REASON_NATURAL_ENTER, shenlvmeng->objectName(), objectName(), QString());
room->throwCard(dummy, reason, NULL);
}
delete dummy;
room->clearAG();
return true;
}
};
GongxinCard::GongxinCard()
{
}
bool GongxinCard::targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const
{
return targets.isEmpty() && to_select != Self;
}
void GongxinCard::onEffect(const CardEffectStruct &effect) const
{
Room *room = effect.from->getRoom();
if (!effect.to->isKongcheng()) {
QList<int> ids;
foreach (const Card *card, effect.to->getHandcards()) {
if (card->getSuit() == Card::Heart)
ids << card->getEffectiveId();
}
int card_id = room->doGongxin(effect.from, effect.to, ids);
if (card_id == -1) return;
QString result = room->askForChoice(effect.from, "gongxin", "discard+put");
effect.from->tag.remove("gongxin");
if (result == "discard") {
CardMoveReason reason(CardMoveReason::S_REASON_DISMANTLE, effect.from->objectName(), QString(), "gongxin", QString());
room->throwCard(Sanguosha->getCard(card_id), reason, effect.to, effect.from);
} else {
effect.from->setFlags("Global_GongxinOperator");
CardMoveReason reason(CardMoveReason::S_REASON_PUT, effect.from->objectName(), QString(), "gongxin", QString());
room->moveCardTo(Sanguosha->getCard(card_id), effect.to, NULL, Player::DrawPile, reason, true);
effect.from->setFlags("-Global_GongxinOperator");
}
}
}
class Gongxin : public ZeroCardViewAsSkill
{
public:
Gongxin() : ZeroCardViewAsSkill("gongxin")
{
}
const Card *viewAs() const
{
return new GongxinCard;
}
bool isEnabledAtPlay(const Player *player) const
{
return !player->hasUsed("GongxinCard");
}
int getEffectIndex(const ServerPlayer *player, const Card *) const
{
int index = qrand() % 2 + 1;
if (!player->hasInnateSkill(this) && player->getMark("qinxue") > 0)
index += 2;
return index;
}
};
void YeyanCard::damage(ServerPlayer *shenzhouyu, ServerPlayer *target, int point) const
{
shenzhouyu->getRoom()->damage(DamageStruct("yeyan", shenzhouyu, target, point, DamageStruct::Fire));
}
GreatYeyanCard::GreatYeyanCard()
{
mute = true;
m_skillName = "yeyan";
}
bool GreatYeyanCard::targetFilter(const QList<const Player *> &, const Player *, const Player *) const
{
Q_ASSERT(false);
return false;
}
bool GreatYeyanCard::targetsFeasible(const QList<const Player *> &targets, const Player *) const
{
if (subcards.length() != 4) return false;
QList<Card::Suit> allsuits;
foreach (int cardId, subcards) {
const Card *card = Sanguosha->getCard(cardId);
if (allsuits.contains(card->getSuit())) return false;
allsuits.append(card->getSuit());
}
//We can only assign 2 damage to one player
//If we select only one target only once, we assign 3 damage to the target
if (targets.toSet().size() == 1)
return true;
else if (targets.toSet().size() == 2)
return targets.size() == 3;
return false;
}
bool GreatYeyanCard::targetFilter(const QList<const Player *> &targets, const Player *to_select,
const Player *, int &maxVotes) const
{
int i = 0;
foreach(const Player *player, targets)
if (player == to_select) i++;
maxVotes = qMax(3 - targets.size(), 0) + i;
return maxVotes > 0;
}
void GreatYeyanCard::use(Room *room, ServerPlayer *shenzhouyu, QList<ServerPlayer *> &targets) const
{
int criticaltarget = 0;
int totalvictim = 0;
QMap<ServerPlayer *, int> map;
foreach(ServerPlayer *sp, targets)
map[sp]++;
if (targets.size() == 1)
map[targets.first()] += 2;
foreach (ServerPlayer *sp, map.keys()) {
if (map[sp] > 1) criticaltarget++;
totalvictim++;
}
if (criticaltarget > 0) {
room->removePlayerMark(shenzhouyu, "@flame");
room->loseHp(shenzhouyu, 3);
room->broadcastSkillInvoke("yeyan", (totalvictim > 1) ? 2 : 3);
//room->doLightbox("$YeyanAnimate");
room->doSuperLightbox("shenzhouyu", "yeyan");
QList<ServerPlayer *> targets = map.keys();
room->sortByActionOrder(targets);
foreach(ServerPlayer *sp, targets)
damage(shenzhouyu, sp, map[sp]);
}
}
SmallYeyanCard::SmallYeyanCard()
{
mute = true;
m_skillName = "yeyan";
}
bool SmallYeyanCard::targetsFeasible(const QList<const Player *> &targets, const Player *) const
{
return !targets.isEmpty();
}
bool SmallYeyanCard::targetFilter(const QList<const Player *> &targets, const Player *, const Player *) const
{
return targets.length() < 3;
}
void SmallYeyanCard::use(Room *room, ServerPlayer *shenzhouyu, QList<ServerPlayer *> &targets) const
{
room->broadcastSkillInvoke("yeyan", 1);
//room->doLightbox("$YeyanAnimate");
room->doSuperLightbox("shenzhouyu", "yeyan");
room->removePlayerMark(shenzhouyu, "@flame");
Card::use(room, shenzhouyu, targets);
}
void SmallYeyanCard::onEffect(const CardEffectStruct &effect) const
{
damage(effect.from, effect.to, 1);
}
class Yeyan : public ViewAsSkill
{
public:
Yeyan() : ViewAsSkill("yeyan")
{
frequency = Limited;
limit_mark = "@flame";
}
bool isEnabledAtPlay(const Player *player) const
{
return player->getMark("@flame") >= 1;
}
bool viewFilter(const QList<const Card *> &selected, const Card *to_select) const
{
if (selected.length() >= 4)
return false;
if (to_select->isEquipped())
return false;
if (Self->isJilei(to_select))
return false;
foreach (const Card *item, selected) {
if (to_select->getSuit() == item->getSuit())
return false;
}
return true;
}
const Card *viewAs(const QList<const Card *> &cards) const
{
if (cards.length() == 0)
return new SmallYeyanCard;
if (cards.length() != 4)
return NULL;
GreatYeyanCard *card = new GreatYeyanCard;
card->addSubcards(cards);
return card;
}
};
class Qinyin : public TriggerSkill
{
public:
Qinyin() : TriggerSkill("qinyin")
{
events << CardsMoveOneTime << EventPhaseEnd << EventPhaseChanging;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL;
}
void perform(ServerPlayer *shenzhouyu) const
{
Room *room = shenzhouyu->getRoom();
QStringList choices;
choices << "down" << "cancel";
QList<ServerPlayer *> all_players = room->getAllPlayers();
foreach (ServerPlayer *player, all_players) {
if (player->isWounded()) {
choices.prepend("up");
break;
}
}
QString result = room->askForChoice(shenzhouyu, objectName(), choices.join("+"));
if (result == "cancel")
return;
else
room->notifySkillInvoked(shenzhouyu, "qinyin");
if (result == "up") {
room->broadcastSkillInvoke(objectName(), 2);
foreach(ServerPlayer *player, all_players)
room->recover(player, RecoverStruct(shenzhouyu));
} else if (result == "down") {
foreach(ServerPlayer *player, all_players)
room->loseHp(player);
int index = 1;
if (room->findPlayer("caocao+shencaocao+yt_shencaocao"))
index = 3;
room->broadcastSkillInvoke(objectName(), index);
}
}
bool trigger(TriggerEvent triggerEvent, Room *, ServerPlayer *shenzhouyu, QVariant &data) const
{
if (triggerEvent == CardsMoveOneTime) {
CardsMoveOneTimeStruct move = data.value<CardsMoveOneTimeStruct>();
if (shenzhouyu->getPhase() == Player::Discard && move.from == shenzhouyu
&& (move.reason.m_reason & CardMoveReason::S_MASK_BASIC_REASON) == CardMoveReason::S_REASON_DISCARD) {
shenzhouyu->addMark("qinyin", move.card_ids.size());
}
} else if (triggerEvent == EventPhaseEnd && TriggerSkill::triggerable(shenzhouyu)
&& shenzhouyu->getPhase() == Player::Discard && shenzhouyu->getMark("qinyin") >= 2) {
perform(shenzhouyu);
} else if (triggerEvent == EventPhaseChanging) {
shenzhouyu->setMark("qinyin", 0);
}
return false;
}
};
class Guixin : public MasochismSkill
{
public:
Guixin() : MasochismSkill("guixin")
{
}
void onDamaged(ServerPlayer *shencc, const DamageStruct &damage) const
{
Room *room = shencc->getRoom();
int n = shencc->getMark("GuixinTimes"); // mark for AI
shencc->setMark("GuixinTimes", 0);
QVariant data = QVariant::fromValue(damage);
QList<ServerPlayer *> players = room->getOtherPlayers(shencc);
try {
for (int i = 0; i < damage.damage; i++) {
shencc->addMark("GuixinTimes");
if (shencc->askForSkillInvoke(this, data)) {
room->broadcastSkillInvoke(objectName());
shencc->setFlags("GuixinUsing");
/*
if (players.length() >= 4 && (shencc->getGeneralName() == "shencaocao" || shencc->getGeneral2Name() == "shencaocao"))
room->doLightbox("$GuixinAnimate");
*/
if (shencc->getGeneralName() != "shencaocao" && (shencc->getGeneralName() == "pr_shencaocao" || shencc->getGeneral2Name() == "pr_shencaocao"))
room->doSuperLightbox("pr_shencaocao", "guixin"); // todo:pr_shencaocao's avatar
else
room->doSuperLightbox("shencaocao", "guixin");
foreach (ServerPlayer *player, players) {
if (player->isAlive() && !player->isAllNude()) {
CardMoveReason reason(CardMoveReason::S_REASON_EXTRACTION, shencc->objectName());
int card_id = room->askForCardChosen(shencc, player, "hej", objectName());
room->obtainCard(shencc, Sanguosha->getCard(card_id), reason, room->getCardPlace(card_id) != Player::PlaceHand);
if (shencc->isDead()) {
shencc->setFlags("-GuixinUsing");
shencc->setMark("GuixinTimes", 0);
return;
}
}
}
shencc->turnOver();
shencc->setFlags("-GuixinUsing");
} else
break;
}
shencc->setMark("GuixinTimes", n);
}
catch (TriggerEvent triggerEvent) {
if (triggerEvent == TurnBroken || triggerEvent == StageChange) {
shencc->setFlags("-GuixinUsing");
shencc->setMark("GuixinTimes", n);
}
throw triggerEvent;
}
}
};
class Feiying : public DistanceSkill
{
public:
Feiying() : DistanceSkill("feiying")
{
}
int getCorrect(const Player *, const Player *to) const
{
if (to->hasSkill(this))
return +1;
else
return 0;
}
};
class Kuangbao : public TriggerSkill
{
public:
Kuangbao() : TriggerSkill("kuangbao")
{
events << Damage << Damaged;
frequency = Compulsory;
}
bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
DamageStruct damage = data.value<DamageStruct>();
LogMessage log;
log.type = triggerEvent == Damage ? "#KuangbaoDamage" : "#KuangbaoDamaged";
log.from = player;
log.arg = QString::number(damage.damage);
log.arg2 = objectName();
room->sendLog(log);
room->notifySkillInvoked(player, objectName());
room->addPlayerMark(player, "@wrath", damage.damage);
room->broadcastSkillInvoke(objectName());
return false;
}
};
class Wumou : public TriggerSkill
{
public:
Wumou() : TriggerSkill("wumou")
{
frequency = Compulsory;
events << CardUsed;
}
bool trigger(TriggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
CardUseStruct use = data.value<CardUseStruct>();
if (use.card->isNDTrick()) {
room->broadcastSkillInvoke(objectName());
room->sendCompulsoryTriggerLog(player, objectName());
int num = player->getMark("@wrath");
if (num >= 1 && room->askForChoice(player, objectName(), "discard+losehp") == "discard") {
player->loseMark("@wrath");
} else
room->loseHp(player);
}
return false;
}
};
class Shenfen : public ZeroCardViewAsSkill
{
public:
Shenfen() : ZeroCardViewAsSkill("shenfen")
{
}
bool isEnabledAtPlay(const Player *player) const
{
return player->getMark("@wrath") >= 6 && !player->hasUsed("ShenfenCard");
}
const Card *viewAs() const
{
return new ShenfenCard;
}
};
ShenfenCard::ShenfenCard()
{
target_fixed = true;
mute = true;
}
void ShenfenCard::use(Room *room, ServerPlayer *shenlvbu, QList<ServerPlayer *> &) const
{
shenlvbu->setFlags("ShenfenUsing");
room->broadcastSkillInvoke("shenfen");
QString name = "shenlvbu";
if (shenlvbu->getGeneralName() != "shenlvbu" && (shenlvbu->getGeneralName() == "sp_shenlvbu" || shenlvbu->getGeneral2Name() == "sp_shenlvbu"))
name = "sp_shenlvbu";
room->doSuperLightbox(name, "shenfen");
shenlvbu->loseMark("@wrath", 6);
try {
QList<ServerPlayer *> players = room->getOtherPlayers(shenlvbu);
foreach (ServerPlayer *player, players) {
room->damage(DamageStruct("shenfen", shenlvbu, player));
room->getThread()->delay();
}
foreach (ServerPlayer *player, players) {
QList<const Card *> equips = player->getEquips();
player->throwAllEquips();
if (!equips.isEmpty())
room->getThread()->delay();
}
foreach (ServerPlayer *player, players) {
bool delay = !player->isKongcheng();
room->askForDiscard(player, "shenfen", 4, 4);
if (delay)
room->getThread()->delay();
}
shenlvbu->turnOver();
shenlvbu->setFlags("-ShenfenUsing");
}
catch (TriggerEvent triggerEvent) {
if (triggerEvent == TurnBroken || triggerEvent == StageChange)
shenlvbu->setFlags("-ShenfenUsing");
throw triggerEvent;
}
}
WuqianCard::WuqianCard()
{
}
bool WuqianCard::targetFilter(const QList<const Player *> &targets, const Player *to_select, const Player *Self) const
{
return targets.isEmpty() && to_select != Self;
}
void WuqianCard::onEffect(const CardEffectStruct &effect) const
{
Room *room = effect.to->getRoom();
effect.from->loseMark("@wrath", 2);
room->acquireSkill(effect.from, "wushuang");
effect.from->setFlags("WuqianSource");
effect.to->setFlags("WuqianTarget");
room->addPlayerMark(effect.to, "Armor_Nullified");
}
class WuqianViewAsSkill : public ZeroCardViewAsSkill
{
public:
WuqianViewAsSkill() : ZeroCardViewAsSkill("wuqian")
{
}
bool isEnabledAtPlay(const Player *player) const
{
return player->getMark("@wrath") >= 2;
}
const Card *viewAs() const
{
return new WuqianCard;
}
};
class Wuqian : public TriggerSkill
{
public:
Wuqian() : TriggerSkill("wuqian")
{
events << EventPhaseChanging << Death;
view_as_skill = new WuqianViewAsSkill;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL && target->hasFlag("WuqianSource");
}
bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
if (triggerEvent == EventPhaseChanging) {
PhaseChangeStruct change = data.value<PhaseChangeStruct>();
if (change.to != Player::NotActive)
return false;
}
if (triggerEvent == Death) {
DeathStruct death = data.value<DeathStruct>();
if (death.who != player)
return false;
}
foreach (ServerPlayer *p, room->getAllPlayers()) {
if (p->hasFlag("WuqianTarget")) {
p->setFlags("-WuqianTarget");
if (p->getMark("Armor_Nullified") > 0)
room->removePlayerMark(p, "Armor_Nullified");
}
}
room->detachSkillFromPlayer(player, "wushuang", false, true);
return false;
}
};
QixingCard::QixingCard()
{
will_throw = false;
handling_method = Card::MethodNone;
target_fixed = true;
}
void QixingCard::onUse(Room *room, const CardUseStruct &card_use) const
{
QList<int> pile = card_use.from->getPile("stars");
QList<int> subCards = card_use.card->getSubcards();
QList<int> to_handcard;
QList<int> to_pile;
foreach (int id, (subCards + pile).toSet()) {
if (!subCards.contains(id))
to_handcard << id;
else if (!pile.contains(id))
to_pile << id;
}
Q_ASSERT(to_handcard.length() == to_pile.length());
if (to_pile.length() == 0 || to_handcard.length() != to_pile.length())
return;
room->broadcastSkillInvoke("qixing");
room->notifySkillInvoked(card_use.from, "qixing");
card_use.from->addToPile("stars", to_pile, false);
DummyCard to_handcard_x(to_handcard);
CardMoveReason reason(CardMoveReason::S_REASON_EXCHANGE_FROM_PILE, card_use.from->objectName());
room->obtainCard(card_use.from, &to_handcard_x, reason, false);
LogMessage log;
log.type = "#QixingExchange";
log.from = card_use.from;
log.arg = to_pile.length();
log.arg2 = "qixing";
room->sendLog(log);
}
class QixingVS : public ViewAsSkill
{
public:
QixingVS() : ViewAsSkill("qixing")
{
response_pattern = "@@qixing";
expand_pile = "stars";
}
bool viewFilter(const QList<const Card *> &selected, const Card *to_select) const
{
if (selected.length() < Self->getPile("stars").length())
return !to_select->isEquipped();
return false;
}
const Card *viewAs(const QList<const Card *> &cards) const
{
if (cards.length() == Self->getPile("stars").length()) {
QixingCard *c = new QixingCard;
c->addSubcards(cards);
return c;
}
return NULL;
}
};
class Qixing : public TriggerSkill
{
public:
Qixing() : TriggerSkill("qixing")
{
view_as_skill = new QixingVS;
events << EventPhaseEnd;
}
bool triggerable(const ServerPlayer *target) const
{
return TriggerSkill::triggerable(target) && target->getPile("stars").length() > 0
&& target->getPhase() == Player::Draw;
}
bool trigger(TriggerEvent, Room *room, ServerPlayer *shenzhuge, QVariant &) const
{
room->askForUseCard(shenzhuge, "@@qixing", "@qixing-exchange", -1, Card::MethodNone);
return false;
}
};
class QixingStart : public TriggerSkill
{
public:
QixingStart() : TriggerSkill("#qixing")
{
events << DrawInitialCards << AfterDrawInitialCards;
}
bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *shenzhuge, QVariant &data) const
{
if (triggerEvent == DrawInitialCards) {
room->sendCompulsoryTriggerLog(shenzhuge, "qixing");
data = data.toInt() + 7;
} else if (triggerEvent == AfterDrawInitialCards) {
room->broadcastSkillInvoke("qixing");
const Card *exchange_card = room->askForExchange(shenzhuge, "qixing", 7, 7);
shenzhuge->addToPile("stars", exchange_card->getSubcards(), false);
delete exchange_card;
}
return false;
}
};
class QixingAsk : public PhaseChangeSkill
{
public:
QixingAsk() : PhaseChangeSkill("#qixing-ask")
{
}
bool onPhaseChange(ServerPlayer *target) const
{
Room *room = target->getRoom();
if (target->getPhase() == Player::Finish) {
if (target->getPile("stars").length() > 0 && target->hasSkill("kuangfeng"))
room->askForUseCard(target, "@@kuangfeng", "@kuangfeng-card", -1, Card::MethodNone);
if (target->getPile("stars").length() > 0 && target->hasSkill("dawu"))
room->askForUseCard(target, "@@dawu", "@dawu-card", -1, Card::MethodNone);
}
return false;
}
};
class QixingClear : public TriggerSkill
{
public:
QixingClear() : TriggerSkill("#qixing-clear")
{
events << EventPhaseStart << Death << EventLoseSkill;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL;
}
bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
if (triggerEvent == EventPhaseStart || triggerEvent == Death) {
if (triggerEvent == Death) {
DeathStruct death = data.value<DeathStruct>();
if (death.who != player)
return false;
}
if (!player->tag.value("Qixing_user", false).toBool())
return false;
bool invoke = false;
if ((triggerEvent == EventPhaseStart && player->getPhase() == Player::RoundStart) || triggerEvent == Death)
invoke = true;
if (!invoke)
return false;
QList<ServerPlayer *> players = room->getAllPlayers();
foreach (ServerPlayer *player, players) {
player->loseAllMarks("@gale");
player->loseAllMarks("@fog");
}
player->tag.remove("Qixing_user");
} else if (triggerEvent == EventLoseSkill && data.toString() == "qixing") {
player->clearOnePrivatePile("stars");
}
return false;
}
};
KuangfengCard::KuangfengCard()
{
handling_method = Card::MethodNone;
will_throw = false;
}
bool KuangfengCard::targetFilter(const QList<const Player *> &targets, const Player *, const Player *) const
{
return targets.isEmpty();
}
void KuangfengCard::onEffect(const CardEffectStruct &effect) const
{
CardMoveReason reason(CardMoveReason::S_REASON_REMOVE_FROM_PILE, QString(), "kuangfeng", QString());
effect.to->getRoom()->throwCard(this, reason, NULL);
effect.from->tag["Qixing_user"] = true;
effect.to->gainMark("@gale");
}
class KuangfengViewAsSkill : public OneCardViewAsSkill
{
public:
KuangfengViewAsSkill() : OneCardViewAsSkill("kuangfeng")
{
response_pattern = "@@kuangfeng";
filter_pattern = ".|.|.|stars";
expand_pile = "stars";
}
const Card *viewAs(const Card *originalCard) const
{
KuangfengCard *kf = new KuangfengCard;
kf->addSubcard(originalCard);
return kf;
}
};
class Kuangfeng : public TriggerSkill
{
public:
Kuangfeng() : TriggerSkill("kuangfeng")
{
events << DamageForseen;
view_as_skill = new KuangfengViewAsSkill;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL && target->getMark("@gale") > 0;
}
bool trigger(TriggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
DamageStruct damage = data.value<DamageStruct>();
if (damage.nature == DamageStruct::Fire) {
LogMessage log;
log.type = "#GalePower";
log.from = player;
log.arg = QString::number(damage.damage);
log.arg2 = QString::number(++damage.damage);
room->sendLog(log);
data = QVariant::fromValue(damage);
}
return false;
}
};
DawuCard::DawuCard()
{
handling_method = Card::MethodNone;
will_throw = false;
}
bool DawuCard::targetFilter(const QList<const Player *> &targets, const Player *, const Player *) const
{
return targets.length() < subcards.length();
}
bool DawuCard::targetsFeasible(const QList<const Player *> &targets, const Player *) const
{
return targets.length() == subcards.length();
}
void DawuCard::use(Room *room, ServerPlayer *source, QList<ServerPlayer *> &targets) const
{
CardMoveReason reason(CardMoveReason::S_REASON_REMOVE_FROM_PILE, QString(), "dawu", QString());
room->throwCard(this, reason, NULL);
source->tag["Qixing_user"] = true;
foreach(ServerPlayer *target, targets)
target->gainMark("@fog");
}
class DawuViewAsSkill : public ViewAsSkill
{
public:
DawuViewAsSkill() : ViewAsSkill("dawu")
{
response_pattern = "@@dawu";
expand_pile = "stars";
}
bool viewFilter(const QList<const Card *> &, const Card *to_select) const
{
return Self->getPile("stars").contains(to_select->getId());
}
const Card *viewAs(const QList<const Card *> &cards) const
{
if (!cards.isEmpty()) {
DawuCard *dw = new DawuCard;
dw->addSubcards(cards);
return dw;
}
return NULL;
}
};
class Dawu : public TriggerSkill
{
public:
Dawu() : TriggerSkill("dawu")
{
events << DamageForseen;
view_as_skill = new DawuViewAsSkill;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL && target->getMark("@fog") > 0;
}
bool trigger(TriggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
DamageStruct damage = data.value<DamageStruct>();
if (damage.nature != DamageStruct::Thunder) {
LogMessage log;
log.type = "#FogProtect";
log.from = player;
log.arg = QString::number(damage.damage);
if (damage.nature == DamageStruct::Normal)
log.arg2 = "normal_nature";
else if (damage.nature == DamageStruct::Fire)
log.arg2 = "fire_nature";
room->sendLog(log);
return true;
} else
return false;
}
};
class Renjie : public TriggerSkill
{
public:
Renjie() : TriggerSkill("renjie")
{
events << Damaged << CardsMoveOneTime;
frequency = Compulsory;
}
bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
if (triggerEvent == CardsMoveOneTime) {
if (player->getPhase() == Player::Discard) {
CardsMoveOneTimeStruct move = data.value<CardsMoveOneTimeStruct>();
if (move.from == player && (move.reason.m_reason & CardMoveReason::S_MASK_BASIC_REASON) == CardMoveReason::S_REASON_DISCARD) {
int n = move.card_ids.length();
if (n > 0) {
room->broadcastSkillInvoke(objectName());
room->notifySkillInvoked(player, objectName());
player->gainMark("@bear", n);
}
}
}
} else if (triggerEvent == Damaged) {
room->broadcastSkillInvoke(objectName());
room->notifySkillInvoked(player, objectName());
DamageStruct damage = data.value<DamageStruct>();
player->gainMark("@bear", damage.damage);
}
return false;
}
};
class Baiyin : public PhaseChangeSkill
{
public:
Baiyin() : PhaseChangeSkill("baiyin")
{
frequency = Wake;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL && PhaseChangeSkill::triggerable(target)
&& target->getPhase() == Player::Start
&& target->getMark("baiyin") == 0
&& target->getMark("@bear") >= 4;
}
bool onPhaseChange(ServerPlayer *shensimayi) const
{
Room *room = shensimayi->getRoom();
room->broadcastSkillInvoke(objectName());
room->notifySkillInvoked(shensimayi, objectName());
//room->doLightbox("$BaiyinAnimate");
room->doSuperLightbox("shensimayi", "baiyin");
LogMessage log;
log.type = "#BaiyinWake";
log.from = shensimayi;
log.arg = QString::number(shensimayi->getMark("@bear"));
room->sendLog(log);
room->setPlayerMark(shensimayi, "baiyin", 1);
if (room->changeMaxHpForAwakenSkill(shensimayi) && shensimayi->getMark("baiyin") == 1)
room->acquireSkill(shensimayi, "jilve");
return false;
}
};
JilveCard::JilveCard()
{
target_fixed = true;
mute = true;
}
void JilveCard::onUse(Room *room, const CardUseStruct &card_use) const
{
ServerPlayer *shensimayi = card_use.from;
QStringList choices;
if (!shensimayi->hasFlag("JilveZhiheng") && shensimayi->canDiscard(shensimayi, "he"))
choices << "zhiheng";
if (!shensimayi->hasFlag("JilveWansha"))
choices << "wansha";
choices << "cancel";
if (choices.length() == 1)
return;
QString choice = room->askForChoice(shensimayi, "jilve", choices.join("+"));
if (choice == "cancel") {
room->addPlayerHistory(shensimayi, "JilveCard", -1);
return;
}
shensimayi->loseMark("@bear");
room->notifySkillInvoked(shensimayi, "jilve");
if (choice == "wansha") {
room->setPlayerFlag(shensimayi, "JilveWansha");
room->acquireSkill(shensimayi, "wansha");
} else {
room->setPlayerFlag(shensimayi, "JilveZhiheng");
room->askForUseCard(shensimayi, "@zhiheng", "@jilve-zhiheng", -1, Card::MethodDiscard);
}
}
class JilveViewAsSkill : public ZeroCardViewAsSkill
{
public: // wansha & zhiheng
JilveViewAsSkill() : ZeroCardViewAsSkill("jilve")
{
}
bool isEnabledAtPlay(const Player *player) const
{
return player->usedTimes("JilveCard") < 2 && player->getMark("@bear") > 0;
}
const Card *viewAs() const
{
return new JilveCard;
}
};
class Jilve : public TriggerSkill
{
public:
Jilve() : TriggerSkill("jilve")
{
events << CardUsed // JiZhi
<< AskForRetrial // GuiCai
<< Damaged; // FangZhu
view_as_skill = new JilveViewAsSkill;
}
bool triggerable(const ServerPlayer *target) const
{
return TriggerSkill::triggerable(target) && target->getMark("@bear") > 0;
}
bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
player->setMark("JilveEvent", (int)triggerEvent);
try {
if (triggerEvent == CardUsed) {
const TriggerSkill *jizhi = Sanguosha->getTriggerSkill("jizhi");
CardUseStruct use = data.value<CardUseStruct>();
if (jizhi && use.card && use.card->getTypeId() == Card::TypeTrick && player->askForSkillInvoke("jilve_jizhi", data)) {
room->notifySkillInvoked(player, objectName());
player->loseMark("@bear");
jizhi->trigger(triggerEvent, room, player, data);
}
} else if (triggerEvent == AskForRetrial) {
const TriggerSkill *guicai = Sanguosha->getTriggerSkill("guicai");
if (guicai && !player->isKongcheng() && player->askForSkillInvoke("jilve_guicai", data)) {
room->notifySkillInvoked(player, objectName());
player->loseMark("@bear");
guicai->trigger(triggerEvent, room, player, data);
}
} else if (triggerEvent == Damaged) {
const TriggerSkill *fangzhu = Sanguosha->getTriggerSkill("fangzhu");
if (fangzhu && player->askForSkillInvoke("jilve_fangzhu", data)) {
room->notifySkillInvoked(player, objectName());
player->loseMark("@bear");
fangzhu->trigger(triggerEvent, room, player, data);
}
}
player->setMark("JilveEvent", 0);
}
catch (TriggerEvent triggerEvent) {
if (triggerEvent == StageChange || triggerEvent == TurnBroken)
player->setMark("JilveEvent", 0);
throw triggerEvent;
}
return false;
}
};
class JilveClear : public TriggerSkill
{
public:
JilveClear() : TriggerSkill("#jilve-clear")
{
events << EventPhaseChanging;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL && target->hasFlag("JilveWansha");
}
bool trigger(TriggerEvent, Room *room, ServerPlayer *target, QVariant &data) const
{
PhaseChangeStruct change = data.value<PhaseChangeStruct>();
if (change.to != Player::NotActive)
return false;
room->detachSkillFromPlayer(target, "wansha", false, true);
return false;
}
};
class LianpoCount : public TriggerSkill
{
public:
LianpoCount() : TriggerSkill("#lianpo-count")
{
events << Death << TurnStart;
global = true;
}
bool trigger(TriggerEvent triggerEvent, Room *room, ServerPlayer *player, QVariant &data) const
{
if (triggerEvent == Death) {
DeathStruct death = data.value<DeathStruct>();
if (death.who != player)
return false;
ServerPlayer *killer = death.damage ? death.damage->from : NULL;
ServerPlayer *current = room->getCurrent();
if (killer && current && (current->isAlive() || death.who == current)
&& current->getPhase() != Player::NotActive) {
killer->addMark("lianpo");
if (player->isAlive() && player->hasSkill("lianpo")) {
LogMessage log;
log.type = "#LianpoRecord";
log.from = killer;
log.to << player;
log.arg = current->getGeneralName();
room->sendLog(log);
}
}
} else {
foreach(ServerPlayer *p, room->getAlivePlayers())
p->setMark("lianpo", 0);
}
return false;
}
};
class Lianpo : public PhaseChangeSkill
{
public:
Lianpo() : PhaseChangeSkill("lianpo")
{
frequency = Frequent;
}
int getPriority(TriggerEvent) const
{
return 1;
}
bool triggerable(const ServerPlayer *target) const
{
return target != NULL;
}
bool onPhaseChange(ServerPlayer *player) const
{
Room *room = player->getRoom();
if (player->getPhase() == Player::NotActive) {
ServerPlayer *shensimayi = room->findPlayerBySkillName("lianpo");
if (shensimayi == NULL || shensimayi->getMark("lianpo") <= 0 || !shensimayi->askForSkillInvoke("lianpo"))
return false;
LogMessage log;
log.type = "#LianpoCanInvoke";
log.from = shensimayi;
log.arg = QString::number(shensimayi->getMark("lianpo"));
log.arg2 = objectName();
room->sendLog(log);
room->broadcastSkillInvoke(objectName());
shensimayi->gainAnExtraTurn();
}
return false;
}
};
class Juejing : public DrawCardsSkill
{
public:
Juejing() : DrawCardsSkill("#juejing-draw")
{
frequency = Compulsory;
}
int getDrawNum(ServerPlayer *player, int n) const
{
if (player->isWounded()) {
Room *room = player->getRoom();
room->notifySkillInvoked(player, "juejing");
room->broadcastSkillInvoke("juejing");
LogMessage log;
log.type = "#YongsiGood";
log.from = player;
log.arg = QString::number(player->getLostHp());
log.arg2 = "juejing";
room->sendLog(log);
}
return n + player->getLostHp();
}
};
class JuejingKeep : public MaxCardsSkill
{
public:
JuejingKeep() : MaxCardsSkill("juejing")
{
}
int getExtra(const Player *target) const
{
if (target->hasSkill(this))
return 2;
else
return 0;
}
};
Longhun::Longhun() : ViewAsSkill("longhun")
{
response_or_use = true;
}
bool Longhun::isEnabledAtResponse(const Player *player, const QString &pattern) const
{
return pattern == "slash"
|| pattern == "jink"
|| (pattern.contains("peach") && player->getMark("Global_PreventPeach") == 0)
|| pattern == "nullification";
}
bool Longhun::isEnabledAtPlay(const Player *player) const
{
return player->isWounded() || Slash::IsAvailable(player);
}
bool Longhun::viewFilter(const QList<const Card *> &selected, const Card *card) const
{
int n = qMax(1, Self->getHp());
if (selected.length() >= n || card->hasFlag("using"))
return false;
if (n > 1 && !selected.isEmpty()) {
Card::Suit suit = selected.first()->getSuit();
return card->getSuit() == suit;
}
switch (Sanguosha->currentRoomState()->getCurrentCardUseReason()) {
case CardUseStruct::CARD_USE_REASON_PLAY: {
if (Self->isWounded() && card->getSuit() == Card::Heart)
return true;
else if (card->getSuit() == Card::Diamond) {
FireSlash *slash = new FireSlash(Card::SuitToBeDecided, -1);
slash->addSubcards(selected);
slash->addSubcard(card->getEffectiveId());
slash->deleteLater();
return slash->isAvailable(Self);
} else
return false;
}
case CardUseStruct::CARD_USE_REASON_RESPONSE:
case CardUseStruct::CARD_USE_REASON_RESPONSE_USE: {
QString pattern = Sanguosha->currentRoomState()->getCurrentCardUsePattern();
if (pattern == "jink")
return card->getSuit() == Card::Club;
else if (pattern == "nullification")
return card->getSuit() == Card::Spade;
else if (pattern == "peach" || pattern == "peach+analeptic")
return card->getSuit() == Card::Heart;
else if (pattern == "slash")
return card->getSuit() == Card::Diamond;
}
default:
break;
}
return false;
}
const Card *Longhun::viewAs(const QList<const Card *> &cards) const
{
int n = getEffHp(Self);
if (cards.length() != n)
return NULL;
const Card *card = cards.first();
Card *new_card = NULL;
switch (card->getSuit()) {
case Card::Spade: {
new_card = new Nullification(Card::SuitToBeDecided, 0);
break;
}
case Card::Heart: {
new_card = new Peach(Card::SuitToBeDecided, 0);
break;
}
case Card::Club: {
new_card = new Jink(Card::SuitToBeDecided, 0);
break;
}
case Card::Diamond: {
new_card = new FireSlash(Card::SuitToBeDecided, 0);
break;
}
default:
break;
}
if (new_card) {
new_card->setSkillName(objectName());
new_card->addSubcards(cards);
}
return new_card;
}
int Longhun::getEffectIndex(const ServerPlayer *player, const Card *card) const
{
return static_cast<int>(player->getRoom()->getCard(card->getSubcards().first())->getSuit()) + 1;
}
bool Longhun::isEnabledAtNullification(const ServerPlayer *player) const
{
int n = getEffHp(player), count = 0;
foreach (const Card *card, player->getHandcards() + player->getEquips()) {
if (card->getSuit() == Card::Spade)
count++;
}
foreach (int id, player->getHandPile()) {
if (Sanguosha->getCard(id)->getSuit() == Card::Spade)
count++;
}
if (count >= n) return true;
return false;
}
int Longhun::getEffHp(const Player *zhaoyun) const
{
return qMax(1, zhaoyun->getHp());
}
GodPackage::GodPackage()
: Package("god")
{
General *shenguanyu = new General(this, "shenguanyu", "god", 5); // LE 001
shenguanyu->addSkill(new Wushen);
shenguanyu->addSkill(new WushenTargetMod);
shenguanyu->addSkill(new Wuhun);
shenguanyu->addSkill(new WuhunRevenge);
related_skills.insertMulti("wushen", "#wushen-target");
related_skills.insertMulti("wuhun", "#wuhun");
General *shenlvmeng = new General(this, "shenlvmeng", "god", 3); // LE 002
shenlvmeng->addSkill(new Shelie);
shenlvmeng->addSkill(new Gongxin);
General *shenzhouyu = new General(this, "shenzhouyu", "god"); // LE 003
shenzhouyu->addSkill(new Qinyin);
shenzhouyu->addSkill(new Yeyan);
General *shenzhugeliang = new General(this, "shenzhugeliang", "god", 3); // LE 004
shenzhugeliang->addSkill(new Qixing);
shenzhugeliang->addSkill(new QixingStart);
shenzhugeliang->addSkill(new QixingAsk);
shenzhugeliang->addSkill(new QixingClear);
shenzhugeliang->addSkill(new FakeMoveSkill("qixing"));
shenzhugeliang->addSkill(new Kuangfeng);
shenzhugeliang->addSkill(new Dawu);
related_skills.insertMulti("qixing", "#qixing");
related_skills.insertMulti("qixing", "#qixing-ask");
related_skills.insertMulti("qixing", "#qixing-clear");
related_skills.insertMulti("qixing", "#qixing-fake-move");
General *shencaocao = new General(this, "shencaocao", "god", 3); // LE 005
shencaocao->addSkill(new Guixin);
shencaocao->addSkill(new Feiying);
General *shenlvbu = new General(this, "shenlvbu", "god", 5); // LE 006
shenlvbu->addSkill(new Kuangbao);
shenlvbu->addSkill(new MarkAssignSkill("@wrath", 2));
shenlvbu->addSkill(new Wumou);
shenlvbu->addSkill(new Wuqian);
shenlvbu->addSkill(new Shenfen);
related_skills.insertMulti("kuangbao", "#@wrath-2");
General *shenzhaoyun = new General(this, "shenzhaoyun", "god", 2); // LE 007
shenzhaoyun->addSkill(new JuejingKeep);
shenzhaoyun->addSkill(new Juejing);
shenzhaoyun->addSkill(new Longhun);
related_skills.insertMulti("juejing", "#juejing-draw");
General *shensimayi = new General(this, "shensimayi", "god", 4); // LE 008
shensimayi->addSkill(new Renjie);
shensimayi->addSkill(new Baiyin);
shensimayi->addRelateSkill("jilve");
related_skills.insertMulti("jilve", "#jilve-clear");
shensimayi->addSkill(new Lianpo);
shensimayi->addSkill(new LianpoCount);
related_skills.insertMulti("lianpo", "#lianpo-count");
addMetaObject<GongxinCard>();
addMetaObject<YeyanCard>();
addMetaObject<ShenfenCard>();
addMetaObject<GreatYeyanCard>();
addMetaObject<SmallYeyanCard>();
addMetaObject<QixingCard>();
addMetaObject<KuangfengCard>();
addMetaObject<DawuCard>();
addMetaObject<WuqianCard>();
addMetaObject<JilveCard>();
skills << new Jilve << new JilveClear;
}
ADD_PACKAGE(God)
| 411 | 0.954441 | 1 | 0.954441 | game-dev | MEDIA | 0.944227 | game-dev | 0.984541 | 1 | 0.984541 |
LmeSzinc/AzurLaneAutoScript | 2,266 | campaign/war_archives_20210325_cn/cs1.py | from module.logger import logger
from module.map.map_base import CampaignMap
from module.map.map_grids import RoadGrids, SelectedGrids
from .campaign_base import CampaignBase
MAP = CampaignMap('CS1')
MAP.shape = 'H6'
MAP.camera_data = ['D2', 'D4', 'E2', 'E4']
MAP.camera_data_spawn_point = ['D2', 'E2']
MAP.map_data = """
-- ++ -- ME ME -- -- ME
ME ++ -- -- -- ++ ++ --
-- -- SP -- SP -- ++ Me
-- -- -- ME -- __ -- --
ME ME -- -- -- MS -- ME
ME ++ MS ME MB -- MB --
"""
MAP.weight_data = """
50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50
50 50 50 50 50 50 50 50
"""
MAP.spawn_data = [
{'battle': 0, 'enemy': 3, 'siren': 2},
{'battle': 1, 'enemy': 1},
{'battle': 2, 'enemy': 2},
{'battle': 3, 'enemy': 1},
{'battle': 4, 'enemy': 2, 'boss': 1},
{'battle': 5, 'enemy': 1},
]
A1, B1, C1, D1, E1, F1, G1, H1, \
A2, B2, C2, D2, E2, F2, G2, H2, \
A3, B3, C3, D3, E3, F3, G3, H3, \
A4, B4, C4, D4, E4, F4, G4, H4, \
A5, B5, C5, D5, E5, F5, G5, H5, \
A6, B6, C6, D6, E6, F6, G6, H6, \
= MAP.flatten()
class Config:
# ===== Start of generated config =====
MAP_SIREN_TEMPLATE = ['CL', 'CA']
MOVABLE_ENEMY_TURN = (2, 3)
MAP_HAS_SIREN = True
MAP_HAS_MOVABLE_ENEMY = True
MAP_HAS_MAP_STORY = False
MAP_HAS_FLEET_STEP = True
MAP_HAS_AMBUSH = False
STAR_REQUIRE_1 = 0
STAR_REQUIRE_2 = 0
STAR_REQUIRE_3 = 0
# ===== End of generated config =====
MAP_IS_ONE_TIME_STAGE = True
INTERNAL_LINES_FIND_PEAKS_PARAMETERS = {
'height': (150, 255 - 24),
'width': (1.5, 10),
'prominence': 10,
'distance': 35,
}
EDGE_LINES_FIND_PEAKS_PARAMETERS = {
'height': (255 - 24, 255),
'prominence': 10,
'distance': 50,
'wlen': 1000
}
HOMO_EDGE_HOUGHLINES_THRESHOLD = 120
HOMO_EDGE_COLOR_RANGE = (0, 12)
INTERNAL_LINES_HOUGHLINES_THRESHOLD = 40
EDGE_LINES_HOUGHLINES_THRESHOLD = 40
class Campaign(CampaignBase):
MAP = MAP
def battle_0(self):
if self.clear_siren():
return True
return self.battle_default()
def battle_4(self):
return self.clear_boss()
| 411 | 0.720067 | 1 | 0.720067 | game-dev | MEDIA | 0.474766 | game-dev,cli-devtools | 0.615635 | 1 | 0.615635 |
FlightGear/flightgear | 6,528 | src/Scripting/NasalAddons.cxx | // -*- coding: utf-8 -*-
//
// NasalAddons.cxx --- Expose add-on classes to Nasal
// Copyright (C) 2017, 2018 Florent Rougon
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <memory>
#include <string>
#include <cassert>
#include <simgear/nasal/cppbind/Ghost.hxx>
#include <simgear/nasal/cppbind/NasalCallContext.hxx>
#include <simgear/nasal/cppbind/NasalHash.hxx>
#include <simgear/nasal/nasal.h>
#include <simgear/structure/exception.hxx>
#include <Add-ons/addon_fwd.hxx>
#include <Add-ons/Addon.hxx>
#include <Add-ons/AddonManager.hxx>
#include <Add-ons/AddonVersion.hxx>
#include <Add-ons/contacts.hxx>
namespace flightgear
{
namespace addons
{
// ***************************************************************************
// * AddonManager *
// ***************************************************************************
static const std::unique_ptr<AddonManager>& getAddonMgrWithCheck()
{
const auto& addonMgr = AddonManager::instance();
if (!addonMgr) {
throw sg_exception("trying to access the AddonManager from Nasal, "
"however it is not initialized");
}
return addonMgr;
}
static naRef f_registeredAddons(const nasal::CallContext& ctx)
{
const auto& addonMgr = getAddonMgrWithCheck();
return ctx.to_nasal(addonMgr->registeredAddons());
}
static naRef f_isAddonRegistered(const nasal::CallContext& ctx)
{
const auto& addonMgr = getAddonMgrWithCheck();
std::string addonId = ctx.requireArg<std::string>(0);
return ctx.to_nasal(addonMgr->isAddonRegistered(addonId));
}
static naRef f_loadedAddons(const nasal::CallContext& ctx)
{
const auto& addonMgr = getAddonMgrWithCheck();
return ctx.to_nasal(addonMgr->loadedAddons());
}
static naRef f_isAddonLoaded(const nasal::CallContext& ctx)
{
const auto& addonMgr = getAddonMgrWithCheck();
std::string addonId = ctx.requireArg<std::string>(0);
return ctx.to_nasal(addonMgr->isAddonLoaded(addonId));
}
static naRef f_getAddon(const nasal::CallContext& ctx)
{
const auto& addonMgr = getAddonMgrWithCheck();
return ctx.to_nasal(addonMgr->getAddon(ctx.requireArg<std::string>(0)));
}
static void wrapAddonManagerMethods(nasal::Hash& addonsModule)
{
addonsModule.set("registeredAddons", &f_registeredAddons);
addonsModule.set("isAddonRegistered", &f_isAddonRegistered);
addonsModule.set("loadedAddons", &f_loadedAddons);
addonsModule.set("isAddonLoaded", &f_isAddonLoaded);
addonsModule.set("getAddon", &f_getAddon);
}
// ***************************************************************************
// * AddonVersion *
// ***************************************************************************
// Create a new AddonVersion instance.
//
// addons.AddonVersion.new(versionString)
// addons.AddonVersion.new(major[, minor[, patchLevel[, suffix]]])
//
// where:
// - 'major', 'minor' and 'patchLevel' are integers;
// - 'suffix' is a string such as "", "a3", "b12" or "rc4" (resp. meaning:
// release, alpha 3, beta 12, release candidate 4) Suffixes for
// development releases are also allowed, such as ".dev4" (sorts before
// the release as well as any alphas, betas and rcs for the release) and
// "a3.dev10" (sorts before "a3.dev11", "a3.dev12", "a3", etc.).
//
// For details, see <https://www.python.org/dev/peps/pep-0440/> which is a
// proper superset of what is allowed here.
naRef f_createAddonVersion(const nasal::CallContext& ctx)
{
int major = 0, minor = 0, patchLevel = 0;
std::string suffix;
if (ctx.argc == 0 || ctx.argc > 4) {
ctx.runtimeError(
"AddonVersion.new(versionString) or "
"AddonVersion.new(major[, minor[, patchLevel[, suffix]]])"
);
}
if (ctx.argc == 1) {
naRef arg1 = ctx.args[0];
if (naIsString(arg1)) {
return ctx.to_nasal(AddonVersionRef(new AddonVersion(naStr_data(arg1))));
} else if (naIsNum(arg1)) {
AddonVersionRef ref{new AddonVersion(arg1.num, minor, patchLevel,
AddonVersionSuffix(suffix))};
return ctx.to_nasal(std::move(ref));
} else {
ctx.runtimeError(
"AddonVersion.new(versionString) or "
"AddonVersion.new(major[, minor[, patchLevel[, suffix]]])"
);
}
}
assert(ctx.argc > 0);
if (!ctx.isNumeric(0)) {
ctx.runtimeError(
"addons.AddonVersion.new() requires major number as an integer"
);
}
major = ctx.requireArg<int>(0);
if (ctx.argc > 1) {
if (!ctx.isNumeric(1)) {
ctx.runtimeError(
"addons.AddonVersion.new() requires minor number as an integer"
);
}
minor = ctx.requireArg<int>(1);
}
if (ctx.argc > 2) {
if (!ctx.isNumeric(2)) {
ctx.runtimeError(
"addons.AddonVersion.new() requires patch level as an integer"
);
}
patchLevel = ctx.requireArg<int>(2);
}
if (ctx.argc > 3) {
if (!ctx.isString(3)) {
ctx.runtimeError(
"addons.AddonVersion.new() requires suffix as a string"
);
}
suffix = ctx.requireArg<std::string>(3);
}
assert(ctx.argc <= 4);
return ctx.to_nasal(
AddonVersionRef(new AddonVersion(major, minor, patchLevel,
AddonVersionSuffix(suffix))));
}
void initAddonClassesForNasal(naRef globals, naContext c)
{
nasal::Hash globalsModule(globals, c);
nasal::Hash addonsModule = globalsModule.createHash("addons");
wrapAddonManagerMethods(addonsModule);
Addon::setupGhost(addonsModule);
Contact::setupGhost(addonsModule);
Author::setupGhost(addonsModule);
Maintainer::setupGhost(addonsModule);
AddonVersion::setupGhost(addonsModule);
addonsModule.createHash("AddonVersion").set("new", &f_createAddonVersion);
}
} // of namespace addons
} // of namespace flightgear
| 411 | 0.807406 | 1 | 0.807406 | game-dev | MEDIA | 0.408338 | game-dev | 0.543763 | 1 | 0.543763 |
hadashiA/VContainer | 4,266 | tests/VContainer.Benchmark/Library/PackageCache/com.svermeulen.extenject@9.2.0-stcf3/Source/Binding/Binders/Factory/FactoryFromBinder/SubContainerBinder/FactorySubContainerBinderWithParams.cs | using System;
using ModestTree;
namespace Zenject
{
[NoReflectionBaking]
public class FactorySubContainerBinderWithParams<TContract> : FactorySubContainerBinderBase<TContract>
{
public FactorySubContainerBinderWithParams(
DiContainer bindContainer, BindInfo bindInfo, FactoryBindInfo factoryBindInfo, object subIdentifier)
: base(bindContainer, bindInfo, factoryBindInfo, subIdentifier)
{
}
#if !NOT_UNITY3D
[System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")]
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab(Type installerType, UnityEngine.Object prefab)
{
return ByNewContextPrefab(installerType, prefab);
}
[System.Obsolete("ByNewPrefab has been renamed to ByNewContextPrefab to avoid confusion with ByNewPrefabInstaller and ByNewPrefabMethod")]
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefab<TInstaller>(UnityEngine.Object prefab)
where TInstaller : IInstaller
{
return ByNewContextPrefab<TInstaller>(prefab);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab<TInstaller>(UnityEngine.Object prefab)
where TInstaller : IInstaller
{
return ByNewContextPrefab(typeof(TInstaller), prefab);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefab(Type installerType, UnityEngine.Object prefab)
{
BindingUtil.AssertIsValidPrefab(prefab);
Assert.That(installerType.DerivesFrom<MonoInstaller>(),
"Invalid installer type given during bind command. Expected type '{0}' to derive from 'MonoInstaller'", installerType);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabWithParams(
installerType,
container,
new PrefabProvider(prefab),
gameObjectInfo), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
[System.Obsolete("ByNewPrefabResource has been renamed to ByNewContextPrefabResource to avoid confusion with ByNewPrefabResourceInstaller and ByNewPrefabResourceMethod")]
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource<TInstaller>(string resourcePath)
where TInstaller : IInstaller
{
return ByNewContextPrefabResource<TInstaller>(resourcePath);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewPrefabResource(
Type installerType, string resourcePath)
{
return ByNewContextPrefabResource(installerType, resourcePath);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource<TInstaller>(string resourcePath)
where TInstaller : IInstaller
{
return ByNewContextPrefabResource(typeof(TInstaller), resourcePath);
}
public NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder ByNewContextPrefabResource(
Type installerType, string resourcePath)
{
BindingUtil.AssertIsValidResourcePath(resourcePath);
var gameObjectInfo = new GameObjectCreationParameters();
ProviderFunc =
(container) => new SubContainerDependencyProvider(
ContractType, SubIdentifier,
new SubContainerCreatorByNewPrefabWithParams(
installerType,
container,
new PrefabProviderResource(resourcePath),
gameObjectInfo), false);
return new NameTransformScopeConcreteIdArgConditionCopyNonLazyBinder(BindInfo, gameObjectInfo);
}
#endif
}
}
| 411 | 0.796406 | 1 | 0.796406 | game-dev | MEDIA | 0.49694 | game-dev | 0.640981 | 1 | 0.640981 |
Mr-Tony921/xju-autopilot | 13,790 | pnc/simulator/debug_tool/planning_debug/planning_debug_tool.cpp |
/******************************************************************************
* Copyright 2023 The XJU AutoPilot Authors. All Rights Reserved.
*****************************************************************************/
#include "simulator/debug_tool/planning_debug/planning_debug_tool.h"
namespace xju {
namespace simulator {
void DebugTool::InitParam() {
// load yaml param
this->declare_parameter<std::string>("gflag_config_file_path", "");
this->declare_parameter<std::string>("control_mode", "KINEMATICS");
this->declare_parameter<std::string>("vehicle_config_file", "");
this->declare_parameter<bool>("publish_clock", false);
std::string gflag_config_file_path, vehicle_config_file;
this->get_parameter("gflag_config_file_path", gflag_config_file_path);
this->get_parameter("control_mode", control_mode_);
if (control_mode_ == "p") {
control_mode_ = "PERFECT";
} else if (control_mode_ == "k") {
control_mode_ = "KINEMATICS";
} else if (control_mode_ == "t") {
control_mode_ = "TORQUE";
}
this->get_parameter("vehicle_config_file", vehicle_config_file);
this->get_parameter("publish_clock", publish_clock_);
// init gflag param
xju::pnc::File::GetGflagConfig(gflag_config_file_path);
xju::pnc::FLAGS_vehicle_config_file = vehicle_config_file;
// get vehicle config
auto vehicle_config = xju::pnc::VehicleConfigProvider::GetConfig();
rear_to_back_ = vehicle_config.back_overhang_length();
car_length_ = vehicle_config.length();
car_width_ = vehicle_config.width();
car_height_ = vehicle_config.height();
rear_axle_to_hitch_ =
vehicle_config.rear_axle_to_hitch(); // d>0 lizhou //d<0 guozhou
}
void DebugTool::SimCmdCallback(
const geometry_msgs::msg::PoseWithCovarianceStamped::SharedPtr msg) {
if (msg->header.frame_id == "planning_chart") {
ADEBUG << "Receive SimCmd msg: " << msg->header.frame_id << " "
<< msg->pose.covariance[0];
if (msg->pose.covariance[0] > 0) {
open_debug = true;
} else {
open_debug = false;
}
} else if (msg->header.frame_id == "change_sim_rate") {
ADEBUG << "Receive SimCmd msg: " << msg->header.frame_id
<< " sim_rate:" << msg->pose.covariance[0];
sim_rate_ = msg->pose.covariance[0];
}
}
void DebugTool::LocalizationCallback(
const localization_msgs::msg::LocalizeOutput::SharedPtr msg) {
if (!localization_) {
localization_ =
std::make_unique<localization_msgs::msg::LocalizeOutput>(*msg);
} else {
*localization_ = *msg;
}
}
void DebugTool::PlanningTrajCallback(
const planning_msgs::msg::Planning::SharedPtr msg) {
if (!planning_traj_) {
planning_traj_ = std::make_unique<planning_msgs::msg::Planning>(*msg);
} else {
*planning_traj_ = *msg;
}
}
void DebugTool::GenerateChart() {
std::chrono::seconds sleep_duration(1);
while (rclcpp::ok()) {
if (!open_debug) {
if (figure_has_opened) {
plt::close();
figure_has_opened = false;
}
std::this_thread::sleep_for(sleep_duration);
continue;
}
if (!planning_traj_) {
std::this_thread::sleep_for(sleep_duration);
continue;
}
const auto planning_traj = *planning_traj_;
const auto& charts = planning_traj.debug.charts;
int size = charts.size();
if (size == 0) {
continue;
} else {
if (size <= 4) {
row_num = size;
col_num = 1;
} else if (size == 5 || size == 6) {
row_num = 3;
col_num = 2;
} else if (size == 7 || size == 8) {
row_num = 4;
col_num = 2;
} else if (size == 9) {
row_num = 3;
col_num = 3;
} else {
row_num = 4;
if ((size % 4) != 0) {
col_num = int(size / 4) + 1;
} else {
col_num = int(size / 4);
}
}
}
if (!figure_has_opened) {
plt::figure_size("Planning Debug Charts", 400 * col_num, 400 * row_num);
plt::ioff();
figure_has_opened = true;
}
plt::clf();
plt::figtext(
0, 0, pnc::Time::NowInDateWithSec(planning_traj.header.timestamp_sec));
for (int i = 0; i < size; i++) {
plt::subplot(row_num, col_num, i + 1);
// plt::subplots_adjust({{"hspace", 0.4}});
plt::title(charts[i].title);
plt::xlim(charts[i].options.x.min, charts[i].options.x.max);
plt::ylim(charts[i].options.y.min, charts[i].options.y.max);
if (charts[i].title == "x-y") {
plt::axis("equal");
}
// plt::axis("square");
plt::xlabel(charts[i].options.x.label_string);
plt::ylabel(charts[i].options.y.label_string);
// lines
for (const auto& line : charts[i].lines) {
std::vector<double> xx, yy;
for (const auto& point : line.point) {
xx.push_back(point.x);
yy.push_back(point.y);
}
auto color = ToColorKeyWord(line.color.r, line.color.g, line.color.b);
auto line_type = ToLineTypeKeyWord(line.line_type);
plt::plot(xx, yy,
{{"color", color},
{"linestyle", line_type},
{"label", line.label}});
if (!line.hide_label_in_legend) {
plt::legend();
}
}
// polygons
for (const auto& polygon : charts[i].polygons) {
std::vector<double> xx, yy;
for (const auto& point : polygon.point) {
xx.push_back(point.x);
yy.push_back(point.y);
}
if (!xx.empty()) {
xx.push_back(xx.front());
yy.push_back(yy.front());
}
auto color =
ToColorKeyWord(polygon.color.r, polygon.color.g, polygon.color.b);
plt::plot(xx, yy, {{"color", color}, {"label", polygon.label}});
if (!polygon.hide_label_in_legend) {
plt::legend();
}
}
}
plt::tight_layout();
// plt::draw();
plt::pause(0.000011);
}
}
void DebugTool::PublishClock() {
while (rclcpp::ok()) {
auto t = this->get_clock()->now();
double sec = double(msg_.clock.sec) + double(msg_.clock.nanosec) / 1.0e9 +
(t - real_time_).seconds() * sim_rate_;
msg_.clock.sec = sec;
msg_.clock.nanosec = 1.0e9 * (sec - msg_.clock.sec);
clock_pub_->publish(msg_);
real_time_ = t;
usleep(1000);
}
}
std::string DebugTool::ToColorKeyWord(const float r, const float g,
const float b) {
if (r < 1e-3 && g < 1e-3 && b < 1e-3) {
return "black";
}
if (r > 1e-3) {
return "red";
}
if (g > 1e-3) {
return "green";
}
if (b > 1e-3) {
return "blue";
}
return "black";
}
std::string DebugTool::ToLineTypeKeyWord(const uint val) {
if (val == 0) {
return "solid";
}
if (val == 1) {
return "dashed";
}
if (val == 2) {
return "dotted";
}
return "solid";
}
void DebugTool::PublishOverlayText() {
// planning overlay
rviz_2d_overlay_msgs::msg::OverlayText planning_ov_msg;
std::stringstream planning_ss;
planning_ss << std::fixed;
if (planning_traj_) {
planning_ss << "traj_timestamp: "
<< pnc::Time::NowInDateWithSec(
planning_traj_->header.timestamp_sec)
<< "\n";
planning_ss << "scenario_type: ";
if (planning_traj_->scenario_type ==
planning_msgs::msg::Planning::LANE_FOLLOW) {
planning_ss << "LANE_FOLLOW";
} else if (planning_traj_->scenario_type ==
planning_msgs::msg::Planning::ROAD_CHANGE) {
planning_ss << "ROAD_CHANGE";
} else if (planning_traj_->scenario_type ==
planning_msgs::msg::Planning::EMERGENCY_PULL_OVER) {
planning_ss << "EMERGENCY_PULL_OVER";
} else if (planning_traj_->scenario_type ==
planning_msgs::msg::Planning::EMERGENCY_STOP) {
planning_ss << "EMERGENCY_STOP";
}
planning_ss << "\n";
planning_ss << "stage_type: ";
if (planning_traj_->stage_type == planning_msgs::msg::Planning::NO_STAGE) {
planning_ss << "NO_STAGE";
} else if (planning_traj_->stage_type ==
planning_msgs::msg::Planning::LANE_FOLLOW_DEFAULT_STAGE) {
planning_ss << "LANE_FOLLOW_DEFAULT_STAGE";
} else if (planning_traj_->stage_type ==
planning_msgs::msg::Planning::ROAD_CHANGE_DEFAULT_STAGE) {
planning_ss << "ROAD_CHANGE_DEFAULT_STAGE";
} else if (planning_traj_->stage_type ==
planning_msgs::msg::Planning::EMERGENCY_PULL_OVER_LANE_CHANGE) {
planning_ss << "EMERGENCY_PULL_OVER_LANE_CHANGE";
} else if (planning_traj_->stage_type ==
planning_msgs::msg::Planning::EMERGENCY_PULL_OVER_SLOW_DOWN) {
planning_ss << "EMERGENCY_PULL_OVER_SLOW_DOWN";
} else if (planning_traj_->stage_type ==
planning_msgs::msg::Planning::EMERGENCY_PULL_OVER_APPROACH) {
planning_ss << "EMERGENCY_PULL_OVER_APPROACH";
} else if (planning_traj_->stage_type ==
planning_msgs::msg::Planning::EMERGENCY_PULL_OVER_STANDBY) {
planning_ss << "EMERGENCY_PULL_OVER_STANDBY";
} else if (planning_traj_->stage_type ==
planning_msgs::msg::Planning::EMERGENCY_STOP_APPROACH) {
planning_ss << "EMERGENCY_STOP_APPROACH";
} else if (planning_traj_->stage_type ==
planning_msgs::msg::Planning::EMERGENCY_STOP_STANDBY) {
planning_ss << "EMERGENCY_STOP_STANDBY";
}
planning_ss << "\n";
planning_ss << "trajectory_type: ";
if (planning_traj_->trajectory_type ==
planning_msgs::msg::Planning::NORMAL) {
planning_ss << "NORMAL";
} else if (planning_traj_->trajectory_type ==
planning_msgs::msg::Planning::PATH_FALLBACK) {
planning_ss << "PATH_FALLBACK";
} else if (planning_traj_->trajectory_type ==
planning_msgs::msg::Planning::SPEED_FALLBACK) {
planning_ss << "SPEED_FALLBACK";
} else if (planning_traj_->trajectory_type ==
planning_msgs::msg::Planning::TRAJECTORY_FALLBACK) {
planning_ss << "TRAJECTORY_FALLBACK";
}
planning_ss << "\n";
planning_ss << "target_lane_id: " << planning_traj_->target_lane_id << "\n"
<< "lane_id: " << planning_traj_->lane_id << "\n"
<< "is_replan: "
<< (planning_traj_->is_replan ? "true" : "false") << " "
<< planning_traj_->replan_reason << "\n"
<< "total_path_length: " << planning_traj_->total_path_length
<< "\n"
<< "total_path_time: " << planning_traj_->total_path_time;
planning_ss << "\n";
planning_ss << "lat_shift id: " << planning_traj_->lateral_shift_obstacle.id
<< " dir: "
<< (planning_traj_->lateral_shift_obstacle.direction == 0
? "NONE"
: (planning_traj_->lateral_shift_obstacle.direction == 1
? "LEFT"
: "RIGHT"))
<< " dis: " << planning_traj_->lateral_shift_obstacle.distance;
planning_ss << "\n";
planning_ss << "lane_change status: ";
if (planning_traj_->lane_change_status.status ==
planning_msgs::msg::LaneChangeStatus::LANE_FOLLOW) {
planning_ss << "LANE_FOLLOW";
} else if (planning_traj_->lane_change_status.status ==
planning_msgs::msg::LaneChangeStatus::LANE_CHANGE_PREPARE) {
planning_ss << "LANE_CHANGE_PREPARE";
} else if (planning_traj_->lane_change_status.status ==
planning_msgs::msg::LaneChangeStatus::LANE_CHANGE) {
planning_ss << "LANE_CHANGE";
}
planning_ss << " path_id: " << planning_traj_->lane_change_status.path_id;
planning_ss << "\n";
planning_ss << "turn_signal: ";
if (planning_traj_->turn_signal ==
common_msgs::msg::VehicleSignal::TURN_NONE) {
planning_ss << "TURN_NONE";
} else if (planning_traj_->turn_signal ==
common_msgs::msg::VehicleSignal::TURN_LEFT) {
planning_ss << "TURN_LEFT";
} else if (planning_traj_->turn_signal ==
common_msgs::msg::VehicleSignal::TURN_RIGHT) {
planning_ss << "TURN_RIGHT";
}
planning_ss << "\n";
planning_ss << "target_speed: " << planning_traj_->target_speed;
planning_ss << "\n";
planning_ss << "error_code: " << planning_traj_->error_code;
planning_ss << "\n";
}
planning_ov_msg.text = planning_ss.str();
planning_ov_msg.fg_color.a = 1.0;
planning_ov_msg.fg_color.r = 0.96f;
planning_ov_msg.fg_color.g = 0.22f;
planning_ov_msg.fg_color.b = 0.06f;
planning_ov_msg.width = 200;
planning_ov_msg.height = 40;
planning_overlay_pub_->publish(planning_ov_msg);
// chassis overlay
rviz_2d_overlay_msgs::msg::OverlayText chassis_ov_msg;
std::stringstream chassis_ss;
chassis_ss << std::fixed;
if (localization_) {
chassis_ss << "x: " << localization_->local_localize_result.position.x
<< "\n"
<< "y: " << localization_->local_localize_result.position.y
<< "\n"
<< "Θ: "
<< localization_->local_localize_result.euler_ypr.z << "\n"
<< "v: "
<< localization_->local_localize_result.velocity_in_vehicle.x
<< "\n"
<< "a: "
<< localization_->local_localize_result
.linear_acceleration_in_vehicle.x;
}
chassis_ov_msg.text = chassis_ss.str();
chassis_ov_msg.fg_color.a = 1.0;
chassis_ov_msg.fg_color.r = 0.96f;
chassis_ov_msg.fg_color.g = 0.22f;
chassis_ov_msg.fg_color.b = 0.06f;
chassis_ov_msg.width = 200;
chassis_ov_msg.height = 40;
chassis_overlay_pub_->publish(chassis_ov_msg);
}
} // namespace simulator
} // namespace xju | 411 | 0.893539 | 1 | 0.893539 | game-dev | MEDIA | 0.519738 | game-dev | 0.975853 | 1 | 0.975853 |
joshwyant/game-creator | 2,135 | GameCreator.Api.Resources/IndexedResourceManager.cs | using System;
using System.Collections;
using System.Collections.Generic;
namespace GameCreator.Api.Resources
{
public class IndexedResourceManager<T> : IIndexedResourceManager<T> where T : IIndexedResource
{
private readonly SortedDictionary<int, T> instances = new SortedDictionary<int, T>();
private int nextIndex;
public IndexedResourceManager(int startingIndex)
{
nextIndex = startingIndex;
}
public IndexedResourceManager(IEnumerable<T> initialItems, int startingIndex = 0)
: this(startingIndex)
{
foreach (var item in initialItems)
{
if (item.Id == -1)
{
BaseAdd(item);
}
else
{
this[item.Id] = item;
nextIndex = Math.Max(startingIndex, item.Id + 1);
}
}
}
public bool ContainsKey(int id)
{
return instances.ContainsKey(id);
}
public int NextIndex
{
get => nextIndex;
set => SetNextIndex(value);
}
public void SetNextIndex(int nextIndex)
{
this.nextIndex = Math.Max(this.nextIndex, nextIndex);
}
public int GenerateId()
{
return nextIndex++;
}
private int BaseAdd(T obj)
{
int idx;
instances[idx = nextIndex++] = obj;
obj.Id = idx;
return idx;
}
public virtual int Add(T obj)
{
return BaseAdd(obj);
}
public T this[int id]
{
get => instances[id];
set => instances[id] = value;
}
public virtual void Remove(int id)
{
instances.Remove(id);
}
public virtual IEnumerator<T> GetEnumerator()
{
return instances.Values.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
} | 411 | 0.882395 | 1 | 0.882395 | game-dev | MEDIA | 0.307267 | game-dev | 0.978595 | 1 | 0.978595 |
peeweek/HDSimpleGame | 20,539 | LocalPackages/net.peeweek.gameplay-ingredients/Editor/CallTree/CallTreeWindow.cs | using System.Collections;
using System.Linq;
using System.Collections.Generic;
using System;
using System.Reflection;
using UnityEngine;
using UnityEditor;
using UnityEditor.IMGUI.Controls;
using UnityEditor.SceneManagement;
using GameplayIngredients.Events;
using GameplayIngredients.Logic;
using GameplayIngredients.Actions;
using GameplayIngredients.StateMachines;
using UnityEngine.SceneManagement;
namespace GameplayIngredients.Editor
{
public class CallTreeWindow : EditorWindow
{
CallTreeView m_TreeView;
[MenuItem("Window/Gameplay Ingredients/Callable Tree Explorer", priority = MenuItems.kWindowMenuPriority)]
static void OpenWindow()
{
s_Instance = GetWindow<CallTreeWindow>();
}
public static bool visible = false;
static CallTreeWindow s_Instance;
private void OnDisable()
{
visible = false;
s_Instance = null;
}
private void OnEnable()
{
nodeRoots = new Dictionary<string, List<CallTreeNode>>();
m_TreeView = new CallTreeView(nodeRoots);
titleContent = new GUIContent("Callable Tree Explorer", CallTreeView.Styles.Callable);
ReloadCallHierarchy();
EditorSceneManager.sceneOpened += Reload;
EditorSceneSetup.onSetupLoaded += ReloadSetup;
visible = true;
}
void Reload(Scene scene, OpenSceneMode mode)
{
ReloadCallHierarchy();
}
void ReloadSetup(EditorSceneSetup setup)
{
ReloadCallHierarchy();
}
public static void Refresh()
{
s_Instance.ReloadCallHierarchy();
s_Instance.Repaint();
}
private void OnGUI()
{
int tbHeight = 24;
using (new GUILayout.HorizontalScope(EditorStyles.toolbar, GUILayout.Height(tbHeight)))
{
if (GUILayout.Button("Reload", EditorStyles.toolbarButton))
{
ReloadCallHierarchy();
}
GUILayout.FlexibleSpace();
EditorGUI.BeginChangeCheck();
string filter = EditorGUILayout.DelayedTextField(m_TreeView.stringFilter, EditorStyles.toolbarSearchField);
if (EditorGUI.EndChangeCheck())
{
m_TreeView.SetStringFilter(filter);
}
Rect buttonRect = GUILayoutUtility.GetRect(52, 16);
if (GUI.Button(buttonRect, "Filter", EditorStyles.toolbarDropDown))
{
GenericMenu menu = new GenericMenu();
menu.AddItem(new GUIContent("Filter Selected"), false, () => {
m_TreeView.SetAutoFilter(false);
m_TreeView.SetObjectFilter(Selection.activeGameObject);
});
menu.AddItem(new GUIContent("Clear Filter"), false, () => {
m_TreeView.SetAutoFilter(false);
m_TreeView.SetObjectFilter(null);
m_TreeView.SetStringFilter(string.Empty);
});
menu.AddSeparator("");
menu.AddItem(new GUIContent("Automatic Filter"), m_TreeView.AutoFilter, () => {
m_TreeView.ToggleAutoFilter();
});
menu.DropDown(buttonRect);
}
}
Rect r = GUILayoutUtility.GetRect(position.width, position.height - tbHeight);
m_TreeView.OnGUI(r);
}
Dictionary<string, List<CallTreeNode>> nodeRoots;
List<MonoBehaviour> erroneous;
void ReloadCallHierarchy()
{
if (nodeRoots == null)
nodeRoots = new Dictionary<string, List<CallTreeNode>>();
else
nodeRoots.Clear();
erroneous = new List<MonoBehaviour>();
AddToCategory<EventBase>("Events");
AddToCategory<StateMachine>("State Machines");
AddToCategory<Factory>("Factories");
AddToCategory<SendMessageAction>("Messages");
CollectErroneousCallables();
m_TreeView.Reload();
}
void CollectErroneousCallables()
{
if (erroneous == null || erroneous.Count == 0)
return;
var root = new List<CallTreeNode>();
nodeRoots.Add("Erroneous Callables", root);
foreach(var callable in erroneous)
{
root.Add(new CallTreeNode(callable, CallTreeNodeType.Callable, callable.name));
}
}
void AddErroneous(MonoBehaviour bhv)
{
if (!erroneous.Contains(bhv))
erroneous.Add(bhv);
}
void AddToCategory<T>(string name) where T:MonoBehaviour
{
var list = Resources.FindObjectsOfTypeAll<T>().ToList();
if (list.Count > 0)
nodeRoots.Add(name, new List<CallTreeNode>());
else
return;
var listRoot = nodeRoots[name];
foreach (var item in list)
{
if (item.gameObject.scene == null || !item.gameObject.scene.isLoaded)
continue;
var stack = new Stack<object>();
if(typeof(T) == typeof(StateMachine))
{
listRoot.Add(GetStateMachineNode(item as StateMachine, stack));
}
else if(typeof(T) == typeof(SendMessageAction))
{
listRoot.Add(GetMessageNode(item as SendMessageAction, stack));
}
else
{
listRoot.Add(GetNode(item, stack));
}
}
}
CallTreeNode GetNode(MonoBehaviour bhv, Stack<object> stack)
{
if(!stack.Contains(bhv))
{
stack.Push(bhv);
var rootNode = new CallTreeNode(bhv, GetType(bhv), $"{bhv.gameObject.name} ({bhv.GetType().Name})");
var type = bhv.GetType();
foreach (var field in type.GetFields())
{
// Find Fields that are Callable[]
if (field.FieldType.IsAssignableFrom(typeof(Callable[])))
{
var node = new CallTreeNode(bhv, CallTreeNodeType.Callable, field.Name);
var value = (Callable[])field.GetValue(bhv);
if (value != null && value.Length > 0)
{
rootNode.Children.Add(node);
// Add Callables from this Callable[] array
foreach (var call in value)
{
if (call != null)
node.Children.Add(GetCallableNode(call, stack));
else
AddErroneous(node.Target);
}
}
}
}
return rootNode;
}
else
{
return new CallTreeNode(bhv, GetType(bhv), $"RECURSED : {bhv.gameObject.name} ({bhv.GetType().Name})");
}
}
CallTreeNode GetCallableNode(Callable c, Stack<object> stack)
{
if (!stack.Contains(c))
{
stack.Push(c);
var rootNode = new CallTreeNode(c, GetType(c), $"{c.Name} ({c.gameObject.name} : {c.GetType().Name})");
var type = c.GetType();
foreach (var field in type.GetFields())
{
// Find Fields that are Callable[]
if (field.FieldType.IsAssignableFrom(typeof(Callable[])))
{
var node = new CallTreeNode(c, CallTreeNodeType.Callable, field.Name);
var value = (Callable[])field.GetValue(c);
if (value != null && value.Length > 0)
{
rootNode.Children.Add(node);
// Add Callables from this Callable[] array
foreach (var call in value)
{
if (call != null)
node.Children.Add(GetCallableNode(call, stack));
else
AddErroneous(node.Target);
}
}
}
}
return rootNode;
}
else
{
return new CallTreeNode(c, GetType(c), $"RECURSED : {c.Name} ({c.gameObject.name} : {c.GetType().Name})");
}
}
CallTreeNode GetMessageNode(SendMessageAction msg, Stack<object> stack)
{
if (!stack.Contains(msg))
{
stack.Push(msg);
var rootNode = new CallTreeNode(msg, CallTreeNodeType.Message, $"{msg.MessageToSend} : ({msg.gameObject.name}.{msg.Name})");
var all = Resources.FindObjectsOfTypeAll<OnMessageEvent>().Where(o=> o.MessageName == msg.MessageToSend).ToList();
foreach(var evt in all)
{
rootNode.Children.Add(GetNode(evt, stack));
}
return rootNode;
}
else
{
return new CallTreeNode(msg, GetType(msg), $"RECURSED :{msg.MessageToSend} : ({msg.gameObject.name}.{msg.Name})");
}
}
CallTreeNode GetStateMachineNode(StateMachine sm, Stack<object> stack)
{
if (!stack.Contains(sm))
{
stack.Push(sm);
var rootNode = new CallTreeNode(sm, CallTreeNodeType.StateMachine, sm.gameObject.name);
var type = sm.GetType();
foreach (var field in type.GetFields())
{
// Find Fields that are State[]
if (field.FieldType.IsAssignableFrom(typeof(State[])))
{
// Add Callables from this Callable[] array
var value = (State[])field.GetValue(sm);
foreach (var state in value)
{
if (state != null)
rootNode.Children.Add(GetStateNode(state, stack));
else
AddErroneous(rootNode.Target);
}
}
}
return rootNode;
}
else
{
return new CallTreeNode(sm, GetType(sm), $"RECURSED :{sm.gameObject.name}");
}
}
CallTreeNode GetStateNode(State st, Stack<object> stack)
{
if (!stack.Contains(st))
{
stack.Push(st);
var rootNode = new CallTreeNode(st, CallTreeNodeType.State, st.gameObject.name);
var type = st.GetType();
foreach (var field in type.GetFields())
{
// Find Fields that are Callable[]
if (field.FieldType.IsAssignableFrom(typeof(Callable[])))
{
var node = new CallTreeNode(st, CallTreeNodeType.Callable, field.Name);
rootNode.Children.Add(node);
// Add Callables from this Callable[] array
var value = (Callable[])field.GetValue(st);
foreach (var call in value)
{
if (call != null)
node.Children.Add(GetNode(call, stack));
else
AddErroneous(rootNode.Target);
}
}
}
return rootNode;
}
else
{
return new CallTreeNode(st, GetType(st), $"RECURSED :{st.gameObject.name}");
}
}
CallTreeNodeType GetType(MonoBehaviour bhv)
{
if (bhv == null)
return CallTreeNodeType.Callable;
else if (bhv is EventBase)
return CallTreeNodeType.Event;
else if (bhv is LogicBase)
return CallTreeNodeType.Logic;
else if (bhv is ActionBase)
return CallTreeNodeType.Action;
else if (bhv is StateMachine)
return CallTreeNodeType.StateMachine;
else if (bhv is State)
return CallTreeNodeType.State;
else if (bhv is Factory)
return CallTreeNodeType.Factory;
else if (bhv is OnMessageEvent || bhv is SendMessageAction)
return CallTreeNodeType.Message;
else
return CallTreeNodeType.Callable;
}
class CallTreeNode
{
public string Name;
public MonoBehaviour Target;
public List<CallTreeNode> Children;
public CallTreeNodeType Type;
public CallTreeNode(MonoBehaviour target, CallTreeNodeType type, string name = "")
{
Name = string.IsNullOrEmpty(name) ? target.GetType().Name : name;
Target = target;
Type = type;
Children = new List<CallTreeNode>();
}
public bool Filter(GameObject go, string filter)
{
bool keep = (go == null || this.Target.gameObject == go)
&& (string.IsNullOrEmpty(filter) ? true : this.Name.Contains(filter));
if(!keep)
{
foreach (var node in Children)
keep = keep || node.Filter(go, filter);
}
return keep;
}
}
public enum CallTreeNodeType
{
Callable,
Event,
Logic,
Action,
Message,
StateMachine,
State,
Factory
}
class CallTreeView : TreeView
{
Dictionary<string, List<CallTreeNode>> m_Roots;
Dictionary<int, CallTreeNode> m_Bindings;
public CallTreeView(Dictionary<string, List<CallTreeNode>> roots) : base(new TreeViewState())
{
m_Roots = roots;
m_Bindings = new Dictionary<int, CallTreeNode>();
}
public string stringFilter { get { return m_StringFilter; } }
[SerializeField]
GameObject m_filter = null;
[SerializeField]
string m_StringFilter = "";
public bool AutoFilter { get; private set; }
public void ToggleAutoFilter()
{
SetAutoFilter(!AutoFilter);
}
public void SetAutoFilter(bool value)
{
AutoFilter = value;
if (AutoFilter)
{
Selection.selectionChanged += UpdateAutoFilter;
if(this.HasSelection())
{
SetObjectFilter(m_Bindings[this.GetSelection()[0]].Target.gameObject);
}
}
else
Selection.selectionChanged -= UpdateAutoFilter;
}
void UpdateAutoFilter()
{
if (Selection.activeGameObject != null)
SetObjectFilter(Selection.activeGameObject);
}
public void SetObjectFilter(GameObject filter = null)
{
m_filter = filter;
Reload();
}
public void SetStringFilter(string stringFilter)
{
m_StringFilter = stringFilter;
Reload();
}
protected override TreeViewItem BuildRoot()
{
int id = -1;
m_Bindings.Clear();
var treeRoot = new TreeViewItem(++id, -1, "~Root");
foreach(var kvp in m_Roots)
{
if (kvp.Value == null || kvp.Value.Count == 0)
continue;
var currentRoot = new TreeViewItem(++id, 0, kvp.Key);
treeRoot.AddChild(currentRoot);
foreach (var node in kvp.Value)
{
if (node.Filter(m_filter, m_StringFilter))
{
currentRoot.AddChild(GetNode(node, ref id, 1));
}
}
}
if (treeRoot.children == null)
{
treeRoot.AddChild(new TreeViewItem(1, 0, "(No Results)"));
}
return treeRoot;
}
TreeViewItem GetNode(CallTreeNode node, ref int id, int depth)
{
id++;
var item = new TreeViewItem(id, depth, $"{node.Name}");
item.icon = GetIcon(node.Target, node.Type);
m_Bindings.Add(id, node);
foreach(var child in node.Children)
{
item.AddChild(GetNode(child, ref id, depth + 1));
}
return item;
}
Texture2D GetIcon(MonoBehaviour bhv, CallTreeNodeType type)
{
if(bhv != null && type != CallTreeNodeType.Callable)
{
var texture = EditorGUIUtility.ObjectContent(bhv, bhv.GetType()).image;
if (texture != null)
return texture as Texture2D;
}
switch(type)
{
default:
case CallTreeNodeType.Callable:
return Styles.Callable;
case CallTreeNodeType.Action:
return Styles.Action;
case CallTreeNodeType.Logic:
return Styles.Logic;
case CallTreeNodeType.Event:
return Styles.Event;
case CallTreeNodeType.Message:
return Styles.Message;
case CallTreeNodeType.State:
return Styles.State;
case CallTreeNodeType.Factory:
return Styles.Factory;
case CallTreeNodeType.StateMachine:
return Styles.StateMachine;
}
}
protected override void SelectionChanged(IList<int> selectedIds)
{
if (AutoFilter)
return;
base.SelectionChanged(selectedIds);
if (selectedIds.Count > 0 && m_Bindings.ContainsKey(selectedIds[0]))
Selection.activeObject = m_Bindings[selectedIds[0]].Target.gameObject;
}
public static class Styles
{
public static Texture2D Callable = Icon("Misc/ic-callable.png");
public static Texture2D Action = Icon("Actions/ic-action-generic.png");
public static Texture2D Logic = Icon("Logic/ic-generic-logic.png");
public static Texture2D Event = Icon("Events/ic-event-generic.png");
public static Texture2D Message = Icon("Events/ic-event-message .png");
public static Texture2D StateMachine = Icon("Misc/ic-StateMachine.png");
public static Texture2D State = Icon("Misc/ic-State.png");
public static Texture2D Factory = Icon("Misc/ic-Factory.png");
static Texture2D Icon(string path)
{
return AssetDatabase.LoadAssetAtPath<Texture2D>($"Packages/net.peeweek.gameplay-ingredients/Icons/{path}");
}
}
}
}
}
| 411 | 0.935782 | 1 | 0.935782 | game-dev | MEDIA | 0.53781 | game-dev | 0.967381 | 1 | 0.967381 |
Dimbreath/AzurLaneData | 9,539 | ko-KR/view/equipment/resolveequipmentlayer.lua | slot0 = class("ResolveEquipmentLayer", import("..base.BaseUI"))
function slot0.getUIName(slot0)
return "ResolveEquipmentUI"
end
function slot0.setPlayer(slot0, slot1)
slot0.player = slot1
end
function slot0.setEquipments(slot0, slot1)
slot0.equipmentVOs = slot1
slot0:setEquipmentByIds(slot1)
end
function slot0.setEquipmentByIds(slot0, slot1)
slot0.equipmentVOByIds = {}
for slot5, slot6 in ipairs(slot1) do
slot0.equipmentVOByIds[slot6.id] = slot6
end
end
function slot0.init(slot0)
slot0.mainPanel = slot0:findTF("main")
setActive(slot0.mainPanel, true)
slot0.viewRect = slot0:findTF("main/frame/view"):GetComponent("LScrollRect")
slot0.backBtn = slot0:findTF("main/top/btnBack")
slot0.cancelBtn = slot0:findTF("main/cancel_btn")
slot0.okBtn = slot0:findTF("main/ok_btn")
pg.UIMgr.GetInstance():BlurPanel(slot0._tf)
slot0.selectedIds = {}
slot0.selecteAllTF = slot0:findTF("main/all_toggle")
slot0.selecteAllToggle = slot0.selecteAllTF:GetComponent(typeof(Toggle))
slot0.destroyConfirm = slot0:findTF("destroy_confirm")
slot0.destroyBonusList = slot0.destroyConfirm:Find("got/scrollview/list")
slot0.destroyBonusItem = slot0.destroyConfirm:Find("got/scrollview/item")
setActive(slot0.destroyConfirm, false)
setActive(slot0.destroyBonusItem, false)
end
function slot0.didEnter(slot0)
slot0:initEquipments()
onButton(slot0, slot0.backBtn, function ()
uv0:emit(uv1.ON_CLOSE)
end, SFX_CANCEL)
onButton(slot0, slot0.cancelBtn, function ()
uv0:emit(uv1.ON_CLOSE)
end, SFX_CANCEL)
onButton(slot0, slot0.okBtn, function ()
if not _.all(uv0:hasEliteEquips(uv0.selectedIds, uv0.equipmentVOByIds), function (slot0)
return slot0 == ""
end) then
pg.MsgboxMgr.GetInstance():ShowMsgBox({
content = i18n("destroy_eliteequipment_tip", string.gsub(table.concat(slot1, ""), "$1", slot1[1] == "" and "" or ",")),
onYes = function ()
if #uv0.selectedIds <= 0 then
pg.TipsMgr.GetInstance():ShowTips(i18n("err_resloveequip_nochoice"))
return
end
setActive(uv0.mainPanel, false)
setActive(uv0.destroyConfirm, true)
uv0:displayDestroyBonus()
end
})
else
slot0()
end
end, SFX_CONFIRM)
onButton(slot0, findTF(slot0.destroyConfirm, "actions/cancel_button"), function ()
setActive(uv0.destroyConfirm, false)
setActive(uv0.mainPanel, true)
pg.UIMgr.GetInstance():UnblurPanel(uv0.destroyConfirm, uv0._tf)
end, SFX_CANCEL)
onButton(slot0, findTF(slot0.destroyConfirm, "actions/destroy_button"), function ()
seriesAsync({}, function ()
uv0:emit(ResolveEquipmentMediator.ON_RESOLVE, uv0.selectedIds)
setActive(uv0.destroyConfirm, false)
pg.UIMgr.GetInstance():UnblurPanel(uv0.destroyConfirm, uv0._tf)
setActive(uv0.mainPanel, false)
uv0:unselecteAllEquips()
end)
end, SFX_UI_EQUIPMENT_RESOLVE)
onToggle(slot0, slot0.selecteAllTF, function (slot0)
if uv0.isManual then
return
end
if slot0 then
uv0:selecteAllEquips()
else
uv0:unselecteAllEquips()
end
end, SFX_PANEL)
end
function slot0.OnResolveEquipDone(slot0)
setActive(slot0.destroyConfirm, false)
pg.UIMgr.GetInstance():UnblurPanel(slot0.destroyConfirm, slot0._tf)
setActive(slot0.mainPanel, false)
slot0:unselecteAllEquips()
end
function slot0.onBackPressed(slot0)
pg.CriMgr.GetInstance():PlaySoundEffect_V3(SFX_CANCEL)
if isActive(slot0.destroyConfirm) then
triggerButton(findTF(slot0.destroyConfirm, "actions/cancel_button"))
return
end
triggerButton(slot0.cancelBtn)
end
function slot0.selectedLowRarityEquipment(slot0)
slot0.selectedIds = {}
for slot4, slot5 in ipairs(slot0.equipmentVOs) do
if slot5.config.level <= 1 and slot5.config.rarity < 4 then
slot0:selectEquip(slot5, slot5.count)
end
end
slot0:updateSelected()
end
function slot0.selecteAllEquips(slot0)
slot0.selectedIds = {}
for slot4, slot5 in ipairs(slot0.equipmentVOs) do
slot0:selectEquip(slot5, slot5.count)
end
slot0:updateSelected()
end
function slot0.unselecteAllEquips(slot0)
slot0.selectedIds = {}
slot0:updateSelected()
end
function slot0.displayDestroyBonus(slot0)
slot1 = {}
for slot6, slot7 in ipairs(slot0.selectedIds) do
if pg.equip_data_template[slot7[1]] then
slot2 = 0 + (slot8.destory_gold or 0) * slot7[2]
for slot14, slot15 in ipairs(slot8.destory_item or {}) do
slot16 = false
for slot20, slot21 in ipairs(slot1) do
if slot15[1] == slot1[slot20].id then
slot1[slot20].count = slot1[slot20].count + slot15[2] * slot7[2]
slot16 = true
break
end
end
if not slot16 then
table.insert(slot1, {
type = DROP_TYPE_ITEM,
id = slot15[1],
count = slot15[2] * slot7[2]
})
end
end
end
end
if slot2 > 0 then
table.insert(slot1, {
id = 1,
type = DROP_TYPE_RESOURCE,
count = slot2
})
end
for slot6 = #slot1, slot0.destroyBonusList.childCount - 1 do
Destroy(slot0.destroyBonusList:GetChild(slot6))
end
for slot6 = slot0.destroyBonusList.childCount, #slot1 - 1 do
cloneTplTo(slot0.destroyBonusItem, slot0.destroyBonusList)
end
for slot6 = 1, #slot1 do
slot7 = slot0.destroyBonusList:GetChild(slot6 - 1)
if slot1[slot6].type == DROP_TYPE_SHIP then
slot0.hasShip = true
end
GetComponent(slot7:Find("icon_bg/icon"), typeof(Image)).enabled = true
if not IsNil(slot7:Find("icon_bg/icon/icon")) then
setActive(slot9, false)
end
updateDrop(slot7, slot8)
slot11, slot12 = contentWrap(slot8.cfg.name, 10, 2)
if slot11 then
slot12 = slot12 .. "..."
end
setText(slot7:Find("name"), slot12)
onButton(slot0, slot7, function ()
if uv0.type == DROP_TYPE_RESOURCE or uv0.type == DROP_TYPE_ITEM then
uv1:emit(AwardInfoMediator.ON_ITEM, uv0.cfg.id)
elseif uv0.type == DROP_TYPE_EQUIP then
uv1:emit(uv2.ON_EQUIPMENT, {
equipmentId = uv0.cfg.id,
type = EquipmentInfoMediator.TYPE_DISPLAY
})
end
end, SFX_PANEL)
end
end
function slot0.hasEliteEquips(slot0, slot1, slot2)
function slot4(slot0, slot1)
if not _.include(uv0, slot0) then
uv0[slot1] = slot0
end
end
_.each(slot1, function (slot0)
if uv0[slot0[1]].config.level > 1 then
uv1(i18n("destroy_high_intensify_tip"), 2)
end
if slot2.config.rarity >= 4 then
uv1(i18n("destroy_high_rarity_tip"), 1)
end
end)
return {
"",
""
}
end
function slot0.initEquipments(slot0)
function slot0.viewRect.onInitItem(slot0)
uv0:onInitItem(slot0)
end
function slot0.viewRect.onUpdateItem(slot0, slot1)
uv0:onUpdateItem(slot0, slot1)
end
function slot0.viewRect.onStart()
uv0:selectedLowRarityEquipment()
end
slot0.cards = {}
slot0:filterEquipments()
end
function slot0.filterEquipments(slot0)
table.sort(slot0.equipmentVOs, function (slot0, slot1)
if slot0.config.rarity == slot1.config.rarity then
return slot0.id < slot1.id
else
return slot1.config.rarity < slot0.config.rarity
end
end)
slot0.viewRect:SetTotalCount(#slot0.equipmentVOs, -1)
end
function slot0.onInitItem(slot0, slot1)
slot2 = EquipmentItem.New(slot1)
onButton(slot0, slot2.go, function ()
uv0:selectEquip(uv1.equipmentVO, uv1.equipmentVO.count)
end, SFX_PANEL)
onButton(slot0, slot2.reduceBtn, function ()
uv0:selectEquip(uv1.equipmentVO, 1)
end, SFX_PANEL)
slot0.cards[slot1] = slot2
end
function slot0.onUpdateItem(slot0, slot1, slot2)
if not slot0.cards[slot2] then
slot0:onInitItem(slot2)
slot3 = slot0.cards[slot2]
end
slot3:update(slot0.equipmentVOs[slot1 + 1], true)
end
function slot0.isSelectedAll(slot0)
for slot4, slot5 in pairs(slot0.equipmentVOByIds) do
slot6 = false
for slot10, slot11 in pairs(slot0.selectedIds) do
if slot11[1] == slot5.id and slot5.count == slot11[2] then
slot6 = true
end
end
if slot6 == false then
return false
end
end
return true
end
function slot0.selectEquip(slot0, slot1, slot2)
if not slot0:checkDestroyGold(slot1, slot2) then
return
end
slot3 = false
slot4 = nil
slot5 = 0
for slot9, slot10 in pairs(slot0.selectedIds) do
if slot10[1] == slot1.id then
slot3 = true
slot4 = slot9
slot5 = slot10[2]
break
end
end
if not slot3 then
table.insert(slot0.selectedIds, {
slot1.id,
slot2
})
elseif slot5 - slot2 > 0 then
slot0.selectedIds[slot4][2] = slot5 - slot2
else
table.remove(slot0.selectedIds, slot4)
end
slot0:updateSelected()
slot0.isManual = true
triggerToggle(slot0.selecteAllTF, slot0:isSelectedAll())
slot0.isManual = nil
end
function slot0.updateSelected(slot0)
for slot4, slot5 in pairs(slot0.cards) do
if slot5.equipmentVO then
slot6 = false
slot7 = 0
for slot11, slot12 in pairs(slot0.selectedIds) do
if slot5.equipmentVO.id == slot12[1] then
slot6 = true
slot7 = slot12[2]
break
end
end
slot5:updateSelected(slot6, slot7)
end
end
end
function slot0.checkDestroyGold(slot0, slot1, slot2)
slot4 = false
for slot8, slot9 in pairs(slot0.selectedIds) do
if pg.equip_data_template[slot9[1]] then
slot3 = 0 + (slot11.destory_gold or 0) * slot9[2]
end
if slot1 and slot9[1] == slot1.configId then
slot4 = true
end
end
if not slot4 and slot1 and slot2 > 0 then
slot3 = slot3 + (pg.equip_data_template[slot1.configId].destory_gold or 0) * slot2
end
if slot0.player:GoldMax(slot3) then
pg.TipsMgr.GetInstance():ShowTips(i18n("gold_max_tip_title") .. i18n("resource_max_tip_destroy"))
return false
end
return true
end
function slot0.willExit(slot0)
pg.UIMgr.GetInstance():UnblurPanel(slot0._tf, pg.UIMgr.GetInstance().UIMain)
end
return slot0
| 411 | 0.594376 | 1 | 0.594376 | game-dev | MEDIA | 0.959839 | game-dev | 0.90272 | 1 | 0.90272 |
retroroyale/ClashRoyale | 33,029 | src/ClashRoyale/Protocol/Messages/Server/Sector/HomeBattleReplayDataMessage.cs | using System.IO;
using ClashRoyale.Logic;
using ClashRoyale.Utilities.Netty;
namespace ClashRoyale.Protocol.Messages.Server
{
public class HomeBattleReplayDataMessage : PiranhaMessage
{
public HomeBattleReplayDataMessage(Device device) : base(device)
{
Id = 24114;
Device.CurrentState = Device.State.Battle;
}
public override void Encode()
{
Writer.WriteVInt(0);
/*
// Decompressed:
//Writer.WriteHex(
//"7B22626174746C65223A7B22676D74223A312C2267616D656D6F6465223A37323030303030362C226465636B30223A5B7B2264223A32363030303032312C2274223A32343335333838342C2263223A3231392C226C223A382C2272636E74223A32327D2C7B2264223A32383030303030382C2274223A32343339333736322C2263223A313239352C226C223A31302C226E657763223A31322C2272636E74223A32307D2C7B2264223A32383030303031312C2274223A32343438333030332C2263223A322C226C223A312C2272636E74223A32327D2C7B2264223A32363030303034362C2274223A32343834313733382C226C223A312C2272636E74223A32367D2C7B2264223A32363030303034332C2274223A32343636373539382C2263223A3230302C226C223A31312C226E657763223A322C2272636E74223A32317D2C7B2264223A32363030303031352C2274223A32343331333833302C2263223A352C226C223A342C226E657763223A312C2272636E74223A31337D2C7B2264223A32363030303033392C2274223A32343537333630372C2263223A32332C226C223A382C226E657763223A322C2272636E74223A32357D2C7B2264223A32363030303034312C2274223A32343739383735332C2263223A3336302C226C223A31302C226E657763223A3131322C2272636E74223A32397D5D2C226465636B31223A5B7B2264223A32363030303031302C2274223A32343238383836332C2263223A333731342C226C223A392C226E657763223A3139372C2272636E74223A31347D2C7B2264223A32363030303033302C2274223A32343436303430312C2263223A333734372C226C223A392C226E657763223A3135372C2272636E74223A31357D2C7B2264223A32363030303034362C2274223A2D312C226C223A312C2272636E74223A31357D2C7B2264223A32373030303030392C2274223A32343239303637362C2263223A3433322C226C223A362C226E657763223A32372C2272636E74223A31337D2C7B2264223A32383030303030302C2263223A3430302C226C223A372C2272636E74223A367D2C7B2264223A32363030303034322C2274223A32343732303536332C2263223A312C226C223A312C2272636E74223A32367D2C7B2264223A32363030303032312C2274223A32343330303731322C2263223A322C226C223A382C226E657763223A33312C2272636E74223A33337D2C7B2264223A32383030303031312C2274223A2D312C2263223A312C226C223A312C2272636E74223A32367D5D2C2261766174617230223A7B226163636F756E7449442E6869223A32302C226163636F756E7449442E6C6F223A32323634332C226578704C6576656C223A31322C22657870506F696E7473223A343130332C226E616D65223A22E5B9B8E7A68FE5AEB6E59BAD222C22636C616E5F6E616D65223A22E58C97E4BAAC222C226172656E61223A35343030303031322C226261646765223A31363030303134332C22636C616E5F69645F6869223A382C22636C616E5F69645F6C6F223A33313838387D2C2261766174617231223A7B226163636F756E7449442E6869223A31362C226163636F756E7449442E6C6F223A3532343234322C226578704C6576656C223A31322C22657870506F696E7473223A353334382C226E616D65223A224C6959616E67222C22636C616E5F6E616D65223A22E890ACE9A19EE58D9A222C226172656E61223A35343030303031322C226261646765223A31363030303130372C22636C616E5F69645F6869223A31332C22636C616E5F69645F6C6F223A3139343438367D2C226C6F636174696F6E223A31353030303031332C226172656E61223A35343030303031327D2C22656E645469636B223A333638312C22636D64223A5B7B226374223A312C2263223A7B2274223A3238312C227432223A3330312C2269644869223A32302C2269644C6F223A32323634332C22696478223A362C22676964223A32363030303033392C227078223A383530302C227079223A3530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3238322C227432223A3330322C2269644869223A31362C2269644C6F223A3532343234322C22696478223A332C22676964223A32373030303030392C227078223A393530302C227079223A32323530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3436312C227432223A3438312C2269644869223A32302C2269644C6F223A32323634332C22696478223A372C22676964223A32363030303034312C227078223A333439392C227079223A383530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3436312C227432223A3438312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A302C22676964223A32363030303031302C227078223A373439392C227079223A33313439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3532312C227432223A3534312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A372C22676964223A32383030303031312C227078223A333530302C227079223A31383530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3631362C227432223A3633362C2269644869223A31362C2269644C6F223A3532343234322C22696478223A322C22676964223A32363030303034362C227078223A323439392C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3633322C227432223A3635322C2269644869223A32302C2269644C6F223A32323634332C22696478223A332C22676964223A32363030303034362C227078223A373439392C227079223A3530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3639312C227432223A3731312C2269644869223A32302C2269644C6F223A32323634332C22696478223A342C22676964223A32363030303034332C227078223A323439392C227079223A383530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3830342C227432223A3832342C2269644869223A31362C2269644C6F223A3532343234322C22696478223A312C22676964223A32363030303033302C227078223A373439392C227079223A32323439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3831352C227432223A3833352C2269644869223A32302C2269644C6F223A32323634332C22696478223A322C22676964223A32383030303031312C227078223A383530302C227079223A31343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3838312C227432223A3930312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A332C22676964223A32373030303030392C227078223A363530302C227079223A32323530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3932332C227432223A3934332C2269644869223A32302C2269644C6F223A32323634332C22696478223A312C22676964223A32383030303030382C227078223A343530302C227079223A32333530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3933312C227432223A3935312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A302C22676964223A32363030303031302C227078223A343439392C227079223A32303439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A3936352C227432223A3938352C2269644869223A31362C2269644C6F223A3532343234322C22696478223A352C22676964223A32363030303034322C227078223A353439392C227079223A32313439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313030312C227432223A313032312C2269644869223A32302C2269644C6F223A32323634332C22696478223A372C22676964223A32363030303034312C227078223A333439392C227079223A31343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313035312C227432223A313037312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A372C22676964223A32383030303031312C227078223A343530302C227079223A32323530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313433342C227432223A313435342C2269644869223A31362C2269644C6F223A3532343234322C22696478223A362C22676964223A32363030303032312C227078223A31363530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313434312C227432223A313436312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A312C22676964223A32363030303033302C227078223A31353530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313434362C227432223A313436362C2269644869223A31362C2269644C6F223A3532343234322C22696478223A322C22676964223A32363030303034362C227078223A31343530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313439322C227432223A313531322C2269644869223A32302C2269644C6F223A32323634332C22696478223A332C22676964223A32363030303034362C227078223A31303530302C227079223A383530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313534312C227432223A313536312C2269644869223A32302C2269644C6F223A32323634332C22696478223A342C22676964223A32363030303034332C227078223A31333530302C227079223A393530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313636312C227432223A313638312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A332C22676964223A32373030303030392C227078223A393530302C227079223A32323530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313731322C227432223A313733322C2269644869223A32302C2269644C6F223A32323634332C22696478223A322C22676964223A32383030303031312C227078223A31303530302C227079223A31343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313732332C227432223A313734332C2269644869223A31362C2269644C6F223A3532343234322C22696478223A372C22676964223A32383030303031312C227078223A31323530302C227079223A32323530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313737322C227432223A313739322C2269644869223A31362C2269644C6F223A3532343234322C22696478223A302C22676964223A32363030303031302C227078223A31333530302C227079223A32303439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313831312C227432223A313833312C2269644869223A32302C2269644C6F223A32323634332C22696478223A312C22676964223A32383030303030382C227078223A31323530302C227079223A32313530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A313934342C227432223A313936342C2269644869223A31362C2269644C6F223A3532343234322C22696478223A362C22676964223A32363030303032312C227078223A31363530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323031382C227432223A323033382C2269644869223A32302C2269644C6F223A32323634332C22696478223A372C22676964223A32363030303034312C227078223A31303530302C227079223A383530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323139352C227432223A323231352C2269644869223A31362C2269644C6F223A3532343234322C22696478223A352C22676964223A32363030303034322C227078223A31343530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323236372C227432223A323238372C2269644869223A32302C2269644C6F223A32323634332C22696478223A362C22676964223A32363030303033392C227078223A31333530302C227079223A31343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323439372C227432223A323531372C2269644869223A32302C2269644C6F223A32323634332C22696478223A352C22676964223A32363030303031352C227078223A31303530302C227079223A3530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323533312C227432223A323535312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A332C22676964223A32373030303030392C227078223A393530302C227079223A32323530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323632352C227432223A323634352C2269644869223A32302C2269644C6F223A32323634332C22696478223A332C22676964223A32363030303034362C227078223A31303530302C227079223A3530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323633342C227432223A323635342C2269644869223A31362C2269644C6F223A3532343234322C22696478223A322C22676964223A32363030303034362C227078223A333439392C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323731312C227432223A323733312C2269644869223A32302C2269644C6F223A32323634332C22696478223A342C22676964223A32363030303034332C227078223A333439392C227079223A383530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323738312C227432223A323830312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A302C22676964223A32363030303031302C227078223A363439392C227079223A32383439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323739342C227432223A323831342C2269644869223A32302C2269644C6F223A32323634332C22696478223A372C22676964223A32363030303034312C227078223A31343530302C227079223A31343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323832352C227432223A323834352C2269644869223A32302C2269644C6F223A32323634332C22696478223A302C22676964223A32363030303032312C227078223A333439392C227079223A31343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323834312C227432223A323836312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A372C22676964223A32383030303031312C227078223A31343530302C227079223A32303530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323836312C227432223A323838312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A312C22676964223A32363030303033302C227078223A393530302C227079223A32313439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323838342C227432223A323930342C2269644869223A32302C2269644C6F223A32323634332C22696478223A312C22676964223A32383030303030382C227078223A343530302C227079223A32333530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323930332C227432223A323932332C2269644869223A31362C2269644C6F223A3532343234322C22696478223A352C22676964223A32363030303034322C227078223A343439392C227079223A31393439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323934352C227432223A323936352C2269644869223A31362C2269644C6F223A3532343234322C22696478223A322C22676964223A32363030303034362C227078223A343439392C227079223A32313439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323936312C227432223A323938312C2269644869223A32302C2269644C6F223A32323634332C22696478223A332C22676964223A32363030303034362C227078223A31333530302C227079223A31343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A323937362C227432223A323939362C2269644869223A31362C2269644C6F223A3532343234322C22696478223A342C22676964223A32383030303030302C227078223A343530302C227079223A32323530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333033312C227432223A333035312C2269644869223A31362C2269644C6F223A3532343234322C22696478223A302C22676964223A32363030303031302C227078223A31323530302C227079223A32303439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333131372C227432223A333133372C2269644869223A31362C2269644C6F223A3532343234322C22696478223A362C22676964223A32363030303032312C227078223A31363530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333132362C227432223A333134362C2269644869223A32302C2269644C6F223A32323634332C22696478223A342C22676964223A32363030303034332C227078223A323439392C227079223A31343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333135392C227432223A333137392C2269644869223A31362C2269644C6F223A3532343234322C22696478223A312C22676964223A32363030303033302C227078223A31343530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333231312C227432223A333233312C2269644869223A32302C2269644C6F223A32323634332C22696478223A372C22676964223A32363030303034312C227078223A31343530302C227079223A383530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333232372C227432223A333234372C2269644869223A31362C2269644C6F223A3532343234322C22696478223A332C22676964223A32373030303030392C227078223A353530302C227079223A32323530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333236362C227432223A333238362C2269644869223A32302C2269644C6F223A32323634332C22696478223A322C22676964223A32383030303031312C227078223A31343530302C227079223A383530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333239352C227432223A333331352C2269644869223A31362C2269644C6F223A3532343234322C22696478223A372C22676964223A32383030303031312C227078223A313530302C227079223A32353530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333332322C227432223A333334322C2269644869223A32302C2269644C6F223A32323634332C22696478223A312C22676964223A32383030303030382C227078223A333530302C227079223A32343530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333337322C227432223A333339322C2269644869223A31362C2269644C6F223A3532343234322C22696478223A302C22676964223A32363030303031302C227078223A31303530302C227079223A32343439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333434342C227432223A333436342C2269644869223A31362C2269644C6F223A3532343234322C22696478223A362C22676964223A32363030303032312C227078223A31363530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333435312C227432223A333437312C2269644869223A32302C2269644C6F223A32323634332C22696478223A332C22676964223A32363030303034362C227078223A31323530302C227079223A393530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333530382C227432223A333532382C2269644869223A31362C2269644C6F223A3532343234322C22696478223A322C22676964223A32363030303034362C227078223A31333530302C227079223A31373439392C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333531312C227432223A333533312C2269644869223A32302C2269644C6F223A32323634332C22696478223A362C22676964223A32363030303033392C227078223A31343530302C227079223A393530302C22736964223A2D317D7D2C7B226374223A312C2263223A7B2274223A333537342C227432223A333539342C2269644869223A32302C2269644C6F223A32323634332C22696478223A372C22676964223A32363030303034312C227078223A31343530302C227079223A383530302C22736964223A2D317D7D5D2C22657674223A5B7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B38355D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B39395D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B3234355D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3233365D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3434315D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B3434355D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3435345D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3530335D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3531325D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B3535365D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3630385D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3631305D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B3632315D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3638355D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B3636355D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3737385D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3739385D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B3739395D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3833395D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3837345D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3931365D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B3834395D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3932335D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3935315D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B3936305D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B3938385D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313034305D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313034345D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313236325D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313335345D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313433335D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313433355D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313434305D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313434325D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B313438305D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B313532345D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313634385D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313635355D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B313637365D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313731325D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313731375D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313736345D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313736375D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B313734365D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313933325D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313933395D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313935355D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313939355D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B313939385D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323030305D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323030345D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323030355D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323032325D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323033355D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323036335D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323132345D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323130315D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323133355D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323134335D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323134395D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323135335D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323139305D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323234325D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323437355D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323438315D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323438345D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323439365D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323630315D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323632315D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323630365D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323632395D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323638385D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323736345D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323737365D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323736315D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323831375D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323830375D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323833375D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323833385D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323835355D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323835385D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323837375D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323836335D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323839355D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323931355D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323932365D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323934305D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323935365D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B323934325D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B323936345D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333030335D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333032325D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333032365D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333034355D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333130395D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333131315D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333039355D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333135325D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333135335D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333138335D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333139395D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333230325D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333230355D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333138385D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333230385D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333231315D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333231345D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333231375D2C22706172616D73223A5B305D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333235305D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333238345D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333239305D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333330345D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333335355D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333336375D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333430335D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333432315D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333433395D2C22706172616D73223A5B335D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333433325D2C22706172616D73223A5B315D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333437365D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333438305D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333438345D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333438335D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333439375D2C22706172616D73223A5B325D7D2C7B2274797065223A312C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333534395D2C22706172616D73223A5B325D7D2C7B2274797065223A332C2269645F6869223A32302C2269645F6C6F223A32323634332C227469636B73223A5B333633305D2C22706172616D73223A5B32305D7D2C7B2274797065223A332C2269645F6869223A31362C2269645F6C6F223A3532343234322C227469636B73223A5B333636335D2C22706172616D73223A5B32305D7D5D2C22726E6453656564223A2D3233373130303638392C2274696D65223A313439343431313531387D");
*/
var replay = File.ReadAllText("replay.json");
Writer.WriteCompressedString(replay);
}
}
} | 411 | 0.889096 | 1 | 0.889096 | game-dev | MEDIA | 0.60428 | game-dev | 0.740798 | 1 | 0.740798 |
JoaoBaptMG/gba-modern | 1,154 | source/gameplay/Player.hpp | //--------------------------------------------------------------------------------
// Player.hpp
//--------------------------------------------------------------------------------
// The class for the player
//--------------------------------------------------------------------------------
#pragma once
#include "graphics/graphics.hpp"
#include "graphics/ObjectTilePointer.hpp"
#include "graphics/PalettePointer.hpp"
#include "math/stdfixed.hpp"
#include "math/vec2.hpp"
class GameScene;
constexpr int PlayerWidth = 16;
constexpr int PlayerHeight = 16;
constexpr vec2 PlayerSize(PlayerWidth, PlayerHeight);
constexpr int PlayerTargetRadius = 3;
class Player final
{
GameScene& gameScene();
ObjectTilePointer playerPtr;
SinglePalettePointer palPtr;
u16 health, maxHealth, invCounter;
u16 shootCooldown;
UniqueOamHandle oamHandle;
public:
vec2<s32f16> pos;
Player() {}
void init(s32f16 x, s32f16 y);
void update();
void updateGraphics();
u16 getHealth() const { return health; }
u16 getMaxHealth() const { return maxHealth; }
void heal(int amount = 1);
void damage(int amount = 1);
};
| 411 | 0.880168 | 1 | 0.880168 | game-dev | MEDIA | 0.89005 | game-dev | 0.603602 | 1 | 0.603602 |
DarkstarProject/darkstar | 2,071 | scripts/zones/Valkurm_Dunes/Zone.lua | -----------------------------------
--
-- Zone: Valkurm_Dunes (103)
--
-----------------------------------
local ID = require("scripts/zones/Valkurm_Dunes/IDs");
require("scripts/globals/icanheararainbow");
require("scripts/globals/chocobo_digging");
require("scripts/globals/conquest");
require("scripts/globals/missions");
require("scripts/globals/weather");
require("scripts/globals/status");
-----------------------------------
function onChocoboDig(player, precheck)
return dsp.chocoboDig.start(player, precheck)
end;
function onInitialize(zone)
dsp.conq.setRegionalConquestOverseers(zone:getRegionID())
end;
function onZoneIn( player, prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos( 60.989, -4.898, -151.001, 198);
end
if (triggerLightCutscene(player)) then -- Quest: I Can Hear A Rainbow
cs = 3;
elseif (player:getCurrentMission(WINDURST) == dsp.mission.id.windurst.VAIN and player:getCharVar("MissionStatus") ==1) then
cs = 5;
end
return cs;
end;
function onConquestUpdate(zone, updatetype)
dsp.conq.onConquestUpdate(zone, updatetype)
end;
function onRegionEnter( player, region)
end;
function onEventUpdate( player, csid, option)
if (csid == 3) then
lightCutsceneUpdate(player); -- Quest: I Can Hear A Rainbow
elseif (csid == 5) then
if (player:getZPos() > 45) then
if (player:getZPos() > -301) then
player:updateEvent(0,0,0,0,0,1);
else
player:updateEvent(0,0,0,0,0,3);
end
end
end
end;
function onEventFinish( player, csid, option)
if (csid == 3) then
lightCutsceneFinish(player); -- Quest: I Can Hear A Rainbow
end
end;
function onZoneWeatherChange(weather)
local qm1 = GetNPCByID(ID.npc.SUNSAND_QM); -- Quest: An Empty Vessel
if (weather == dsp.weather.DUST_STORM) then
qm1:setStatus(dsp.status.NORMAL);
else
qm1:setStatus(dsp.status.DISAPPEAR);
end
end;
| 411 | 0.959494 | 1 | 0.959494 | game-dev | MEDIA | 0.989121 | game-dev | 0.997823 | 1 | 0.997823 |
beyond-aion/aion-server | 3,211 | game-server/data/handlers/quest/verteron/_1192VerteronReinforcements.java | package quest.verteron;
import static com.aionemu.gameserver.model.DialogAction.*;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.model.gameobjects.player.Player;
import com.aionemu.gameserver.network.aion.serverpackets.SM_DIALOG_WINDOW;
import com.aionemu.gameserver.questEngine.handlers.AbstractQuestHandler;
import com.aionemu.gameserver.questEngine.model.QuestEnv;
import com.aionemu.gameserver.questEngine.model.QuestState;
import com.aionemu.gameserver.questEngine.model.QuestStatus;
import com.aionemu.gameserver.utils.PacketSendUtility;
/**
* @author Balthazar
*/
public class _1192VerteronReinforcements extends AbstractQuestHandler {
public _1192VerteronReinforcements() {
super(1192);
}
@Override
public void register() {
qe.registerQuestNpc(203098).addOnQuestStart(questId);
qe.registerQuestNpc(203098).addOnTalkEvent(questId);
qe.registerQuestNpc(203701).addOnTalkEvent(questId);
qe.registerQuestNpc(203833).addOnTalkEvent(questId);
}
@Override
public boolean onDialogEvent(QuestEnv env) {
final Player player = env.getPlayer();
QuestState qs = player.getQuestStateList().getQuestState(questId);
int targetId = 0;
if (env.getVisibleObject() instanceof Npc)
targetId = ((Npc) env.getVisibleObject()).getNpcId();
if (qs == null || qs.isStartable()) {
if (targetId == 203098) {
if (env.getDialogActionId() == QUEST_SELECT) {
return sendQuestDialog(env, 1011);
} else
return sendQuestStartDialog(env);
}
}
if (qs == null)
return false;
if (qs.getStatus() == QuestStatus.START) {
switch (targetId) {
case 203701:
switch (env.getDialogActionId()) {
case QUEST_SELECT: {
return sendQuestDialog(env, 1352);
}
case SETPRO1: {
qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
updateQuestStatus(env);
PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
return true;
}
}
return false;
case 203833:
switch (env.getDialogActionId()) {
case QUEST_SELECT: {
return sendQuestDialog(env, 1693);
}
case SETPRO2: {
qs.setQuestVarById(0, qs.getQuestVarById(0) + 1);
updateQuestStatus(env);
PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
return true;
}
default: {
return sendQuestEndDialog(env);
}
}
case 203098:
switch (env.getDialogActionId()) {
case QUEST_SELECT: {
return sendQuestDialog(env, 2375);
}
case SELECT_QUEST_REWARD: {
qs.setQuestVar(3);
qs.setStatus(QuestStatus.REWARD);
updateQuestStatus(env);
PacketSendUtility.sendPacket(player, new SM_DIALOG_WINDOW(env.getVisibleObject().getObjectId(), 10));
return true;
}
default: {
return sendQuestEndDialog(env);
}
}
}
} else if (qs.getStatus() == QuestStatus.REWARD) {
if (targetId == 203098) {
if (env.getDialogActionId() == SELECT_QUEST_REWARD)
return sendQuestDialog(env, 5);
else
return sendQuestEndDialog(env);
}
}
return false;
}
}
| 411 | 0.860325 | 1 | 0.860325 | game-dev | MEDIA | 0.919659 | game-dev | 0.954165 | 1 | 0.954165 |
michael811125/OxGFrame | 2,359 | Assets/OxGFrame/Samples~/UIFrameDemo/Scripts/Demo2UI.cs | using UnityEngine;
using OxGFrame.CoreFrame.UIFrame;
using Cysharp.Threading.Tasks;
using UnityEngine.UI;
using OxGFrame.CoreFrame;
public class Demo2UI : UIBase
{
// Use _Node@XXX to Bind
#region Binding Components
protected Button _openBtn;
protected Image _viewImg;
/// <summary>
/// Auto Binding Section
/// </summary>
protected override void OnAutoBind()
{
base.OnAutoBind();
this._openBtn = this.collector.GetNodeComponent<Button>("Open*Btn");
this._viewImg = this.collector.GetNodeComponent<Image>("View*Img");
}
#endregion
public override void OnCreate()
{
}
protected override async UniTask OnPreShow()
{
/**
* Open Sub With Async
*/
}
protected override void OnPreClose()
{
/**
* Close Sub
*/
}
protected override void OnShow(object obj)
{
Debug.Log(string.Format("{0} - Do Somethings OnShow.", this.gameObject.name));
}
protected override void OnBind()
{
this._openBtn.onClick.AddListener(this._ShowDemoPopup3UI);
}
protected override void OnUpdate(float dt)
{
/**
* Do Update Per FrameRate
*/
}
public override void OnReceiveAndRefresh(object obj = null)
{
/**
* Do Update Once After Protocol Handle
*/
}
protected override void OnShowAnimation(AnimationEnd animationEnd)
{
animationEnd(); // Must call if animation end
}
protected override void OnCloseAnimation(AnimationEnd animationEnd)
{
animationEnd(); // Must call if animation end
}
protected override void OnClose()
{
Debug.Log(string.Format("{0} - Do Somethings OnClose.", this.gameObject.name));
}
protected override void OnHide()
{
Debug.Log(string.Format("{0} - Do Somethings OnHide.", this.gameObject.name));
}
private async void _ShowDemoPopup3UI()
{
if (this.uiSetting.canvasName == UIFrameDemo.CanvasCamera)
await CoreFrames.UIFrame.Show(ScreenUIs.Id, ScreenUIs.Demo3UI, null, ScreenUIs.DemoLoadingUI, 0);
else if (this.uiSetting.canvasName == UIFrameDemo.CanvasWorld)
await CoreFrames.UIFrame.Show(WorldUIs.Id, WorldUIs.Demo3UI, null, WorldUIs.DemoLoadingUI, 0);
}
}
| 411 | 0.865399 | 1 | 0.865399 | game-dev | MEDIA | 0.621786 | game-dev | 0.892692 | 1 | 0.892692 |
ProjectIgnis/CardScripts | 1,956 | official/c48608796.lua | --LL-アセンブリー・ナイチンゲール
--Lyrilusc - Assembled Nightingale
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
Xyz.AddProcedure(c,nil,1,2,nil,nil,Xyz.InfiniteMats)
--ATK Up
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(s.atkval)
c:RegisterEffect(e1)
--Direct Attack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DIRECT_ATTACK)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
c:RegisterEffect(e2)
--multi attack
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EXTRA_ATTACK)
e3:SetValue(s.raval)
c:RegisterEffect(e3)
--Protection
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,0))
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCost(Cost.DetachFromSelf(1))
e4:SetOperation(s.indop)
c:RegisterEffect(e4)
end
s.listed_series={SET_LYRILUSC}
function s.atkval(e,c)
return c:GetOverlayCount()*200
end
function s.raval(e,c)
local oc=e:GetHandler():GetOverlayCount()
return math.max(0,oc-1)
end
function s.indop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_LYRILUSC))
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,0)
e3:SetValue(1)
e3:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e3,tp)
end
| 411 | 0.790133 | 1 | 0.790133 | game-dev | MEDIA | 0.982454 | game-dev | 0.807418 | 1 | 0.807418 |
osgcc/no-one-lives-forever | 4,090 | NOLF/ObjectDLL/AITarget.cpp | // (c) 1997-2000 Monolith Productions, Inc. All Rights Reserved
#include "StdAfx.h"
#include "AI.h"
#include "AITarget.h"
#include "AISense.h"
IMPLEMENT_FACTORY(CAITarget, 0)
// ----------------------------------------------------------------------- //
//
// ROUTINE: CAITarget::Constructor/Destructor
//
// PURPOSE: Factory con/destructor
//
// ----------------------------------------------------------------------- //
void CAITarget::Constructor()
{
m_bValid = LTFALSE;
m_bVisibleFromEye = LTFALSE;
m_bVisibleFromWeapon = LTFALSE;
m_hObject = LTNULL;
VEC_INIT(m_vPosition);
VEC_INIT(m_vShootPosition);
VEC_INIT(m_vNextShootPosition);
m_bAttacking = LTFALSE;
m_bHack = LTFALSE;
m_nPhase = 0;
m_nResetPhase = 0;
}
void CAITarget::Destructor()
{
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: CAITarget::Save
//
// PURPOSE: Saves our data
//
// ----------------------------------------------------------------------- //
void CAITarget::Save(HMESSAGEWRITE hWrite)
{
if ( !g_pLTServer || !hWrite ) return;
SAVE_BOOL(m_bValid);
SAVE_BOOL(m_bVisibleFromEye);
SAVE_BOOL(m_bVisibleFromWeapon);
SAVE_HOBJECT(m_hObject);
SAVE_VECTOR(m_vPosition);
SAVE_VECTOR(m_vShootPosition);
SAVE_VECTOR(m_vNextShootPosition);
SAVE_BOOL(m_bAttacking);
SAVE_BOOL(m_bHack);
SAVE_INT(m_nPhase);
SAVE_INT(m_nResetPhase);
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: CAITarget::Load
//
// PURPOSE: Loads our data
//
// ----------------------------------------------------------------------- //
void CAITarget::Load(HMESSAGEREAD hRead)
{
if ( !g_pLTServer || !hRead ) return;
LOAD_BOOL(m_bValid);
LOAD_BOOL(m_bVisibleFromEye);
LOAD_BOOL(m_bVisibleFromWeapon);
LOAD_HOBJECT(m_hObject);
LOAD_VECTOR(m_vPosition);
LOAD_VECTOR(m_vShootPosition);
LOAD_VECTOR(m_vNextShootPosition);
LOAD_BOOL(m_bAttacking);
LOAD_BOOL(m_bHack);
LOAD_INT(m_nPhase);
LOAD_INT(m_nResetPhase);
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: CAITarget::UpdateShootPosition
//
// PURPOSE: Shuffle the new shooting position into place
//
// ----------------------------------------------------------------------- //
void CAITarget::UpdateShootPosition(const LTVector& vShootPosition, LTFLOAT fError, LTBOOL bNewError /* = LTFALSE */)
{
if ( bNewError || !m_bHack )
{
m_vNextShootPosition = LTVector(GetRandom(-1.0f,1.0f), GetRandom(-.5f,.5f), GetRandom(-1.0f,1.0f));
m_vNextShootPosition.Norm();
m_bHack = LTTRUE;
}
m_vShootPosition = vShootPosition + m_vNextShootPosition*fError*100.0f;
// m_vShootPosition = m_vNextShootPosition;
// m_vNextShootPosition = vShootPosition;
}
// ----------------------------------------------------------------------- //
//
// ROUTINE: CAITarget::UpdateVisibility
//
// PURPOSE: Updates the target's visibility
//
// ----------------------------------------------------------------------- //
void CAITarget::UpdateVisibility()
{
_ASSERT(IsValid());
LTVector vPosition;
g_pLTServer->GetObjectPos(m_hObject, &vPosition);
if ( m_nPhase == m_nResetPhase )
{
m_nPhase = 0;
m_nResetPhase = 0;
m_vPosition = vPosition;
SetVisibleFromEye(LTFALSE);
SetVisibleFromWeapon(LTFALSE);
}
vPosition.y += (-53.0f + LTFLOAT(m_nPhase)*13.25f);
LTFLOAT fSeeEnemyDistanceSqr = GetAI()->GetSenseMgr()->GetSense(stSeeEnemy)->GetDistanceSqr();
if ( !GetAI()->CanShootThrough() )
{
if ( GetAI()->IsObjectPositionVisibleFromEye(CAI::DefaultFilterFn, NULL, m_hObject, vPosition, fSeeEnemyDistanceSqr, LTFALSE) )
{
m_nResetPhase = m_nPhase;
m_vPosition = vPosition;
SetVisibleFromEye(LTTRUE);
SetVisibleFromWeapon(LTTRUE);
}
}
else
{
if ( GetAI()->IsObjectPositionVisibleFromEye(CAI::ShootThroughFilterFn, CAI::ShootThroughPolyFilterFn, m_hObject, vPosition, fSeeEnemyDistanceSqr, LTFALSE) )
{
m_nResetPhase = m_nPhase;
m_vPosition = vPosition;
SetVisibleFromEye(LTTRUE);
SetVisibleFromWeapon(LTTRUE);
}
}
m_nPhase = (m_nPhase+1)&7;
}
| 411 | 0.936045 | 1 | 0.936045 | game-dev | MEDIA | 0.958772 | game-dev | 0.861738 | 1 | 0.861738 |
piesku/goodluck | 1,524 | Platformer2D/components/com_rigid_body2d.ts | /**
* # RigidBody2D
*
* The `RigidBody2D` component allows the entity to collide and interact with
* other rigid bodies
*
* The physics simulation is simplified. Among others, it assumes mass = 1,
* which means that acceleration and force are numerically equal.
*/
import {Vec2} from "../../lib/math.js";
import {clamp} from "../../lib/number.js";
import {Entity} from "../../lib/world.js";
import {Game} from "../game.js";
import {Has} from "../world.js";
export const enum RigidKind {
Static,
Dynamic,
}
export interface RigidBody2D {
Kind: RigidKind;
Drag: number;
Bounciness: number;
Acceleration: Vec2;
VelocityLinear: Vec2;
VelocityResolved: Vec2;
VelocityAngular: number;
IsGrounded: boolean;
}
/**
* Add `RigidBody2D` to an entity.
*
* @param kind The type of the rigid body (static, dynamic).
* @param bounciness Bounciness factor (0 = no bounce, 1 = full bounce).
* @param drag Drag factor (0 = no drag, 1 = entity never moves).
*/
export function rigid_body2d(kind: RigidKind, bounciness = 1, drag = 0.001) {
return (game: Game, entity: Entity) => {
game.World.Signature[entity] |= Has.RigidBody2D;
game.World.RigidBody2D[entity] = {
Kind: kind,
Drag: clamp(0, 1, drag),
Bounciness: clamp(0, 1, bounciness),
Acceleration: [0, 0],
VelocityLinear: [0, 0],
VelocityResolved: [0, 0],
VelocityAngular: 0,
IsGrounded: false,
};
};
}
| 411 | 0.564259 | 1 | 0.564259 | game-dev | MEDIA | 0.981567 | game-dev | 0.805123 | 1 | 0.805123 |
MBU-Team/OpenMBU | 13,811 | engine/source/game/marble/marble.h | //-----------------------------------------------------------------------------
// Torque Shader Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
#ifndef _MARBLE_H_
#define _MARBLE_H_
#ifndef _SHAPEBASE_H_
#include "game/shapeBase.h"
#endif
#ifndef _DECALMANAGER_H_
#include "sim/decalManager.h"
#endif
#ifndef _CONCRETEPOLYLIST_H_
#include "collision/concretePolyList.h"
#endif
#ifndef _H_PATHEDINTERIOR
#include "interior/pathedInterior.h"
#endif
#ifndef _POWERUP_H_
#include "game/marble/powerup.h"
#endif
#ifndef _STATICSHAPE_H_
#include <game/staticShape.h>
#endif
extern Point3F gMarbleMotionDir;
extern bool gMarbleAxisSet;
extern Point3F gWorkGravityDir;
extern Point3F gMarbleSideDir;
// These might be useful later
//#include <cmath>
//#define CheckNAN(c) { if(isnan(c)) __debugbreak(); }
//#define CheckNAN3(c) { CheckNAN(c.x) CheckNAN(c.y) CheckNAN(c.z) }
//#define CheckNAN3p(c) { CheckNAN(c->x) CheckNAN(c->y) CheckNAN(c->z) }
//#define CheckNANBox(c) { Check3(c.min) Check3(c.min) }
//#define CheckNANBoxp(c) { Check3(c->min) Check3(c->min) }
//#define CheckNANAng(c) { CheckNAN(c.axis.x) CheckNAN(c.axis.y) CheckNAN(c.axis.z) CheckNAN(c.angle) }
//#define CheckNANAngp(c) { CheckNAN(c->axis.x) CheckNAN(c->axis.y) CheckNAN(c->axis.z) CheckNAN(c->angle) }
class MarbleData;
class Marble : public ShapeBase
{
private:
typedef ShapeBase Parent;
friend class ShapeBase;
public:
enum MarbleModeFlags
{
MoveMode = 0x1,
RestrictXYZMode = 0x2,
CameraHoverMode = 0x4,
TimerMode = 0x8,
StartingMode = 0x10,
StoppingMode = 0x20,
FinishMode = 0x40
};
enum MBPhysics
{
MBU,
MBG,
XNA,
MBUSlopes,
MBGSlopes,
MBPhysics_Count
};
enum UpdateMaskBits
{
ActiveModeBits = 0x4,
ActiveModeMask = 0xF,
ModeBits = 0x7,
MaxModeTicks = 0x1F
};
private:
enum MaskBits
{
MoveMask = Parent::NextFreeMask,
WarpMask = Parent::NextFreeMask << 1,
PowerUpMask = Parent::NextFreeMask << 2,
GravityMask = Parent::NextFreeMask << 3,
GravitySnapMask = Parent::NextFreeMask << 4,
OOBMask = Parent::NextFreeMask << 5,
NextFreeMask = Parent::NextFreeMask << 6
};
struct Contact
{
SimObject* object;
Point3D position;
Point3D normal;
Point3F actualNormal;
Point3D surfaceVelocity;
Point3D surfaceFrictionVelocity;
F64 staticFriction;
F64 kineticFriction;
Point3D vAtC;
F64 vAtCMag;
F64 normalForce;
F64 contactDistance;
F32 friction;
F32 restitution;
F32 force;
S32 material;
Contact();
};
struct SinglePrecision
{
Point3F mPosition;
Point3F mVelocity;
Point3F mOmega;
SinglePrecision();
};
struct StateDelta
{
Point3D pos;
Point3D posVec;
F32 prevMouseX;
F32 prevMouseY;
Move move;
StateDelta();
};
struct EndPadEffect
{
F32 effectTime;
Point3F lastCamFocus;
EndPadEffect();
};
struct MaterialCollision
{
U32 ghostIndex;
U32 materialId;
NetObject* object;
};
struct PowerUpState
{
bool active;
U32 ticksLeft;
S32 imageSlot;
SimObjectPtr<ParticleEmitter> emitter;
PowerUpState();
~PowerUpState();
};
Marble::SinglePrecision mSinglePrecision;
Vector<Marble::Contact> mContacts;
Marble::Contact mBestContact;
Marble::Contact mLastContact;
Point3F mMovePath[2];
F32 mMovePathTime[2];
U32 mMovePathSize;
Marble::StateDelta delta;
Point3F mLastRenderPos;
Point3F mLastRenderVel;
MarbleData* mDataBlock;
S32 mBounceEmitDelay;
U32 mPowerUpId;
U32 mPowerUpTimer;
U32 mBlastTimer;
U32 mBlastEnergy;
F32 mRenderBlastPercent;
GFXVertexBufferHandle<GFXVertexP> mVertBuff;
GFXPrimitiveBufferHandle mPrimBuff;
U32 mMarbleTime;
U32 mMarbleBonusTime;
U32 mFullMarbleTime;
bool mUseFullMarbleTime;
U32 mMode;
U32 mModeTimer;
SFXSource* mRollHandle;
SFXSource* mSlipHandle;
SFXSource* mMegaHandle;
F32 mRadius;
QuatF mGravityFrame;
QuatF mGravityRenderFrame;
Point3D mVelocity;
Point3D mPosition;
Point3D mOmega;
F32 mMouseX;
F32 mMouseY;
bool mControllable;
bool mOOB;
Point3F mOOBCamPos;
U32 mSuperSpeedDoneTime;
F32 mLastYaw;
Point3F mNetSmoothPos;
bool mCenteringCamera;
F32 mRadsLeftToCenter;
F32 mRadsStartingToCenter;
U32 mCheckPointNumber;
Marble::EndPadEffect mEffect;
Point3F mLastCamPos;
F32 mCameraDist;
bool mCameraInit;
SceneObject* mPadPtr;
bool mOnPad;
Marble::PowerUpState mPowerUpState[PowerUpData::MaxPowerUps];
PowerUpData::ActiveParams mPowerUpParams;
SimObjectPtr<ParticleEmitter> mTrailEmitter;
SimObjectPtr<ParticleEmitter> mMudEmitter;
SimObjectPtr<ParticleEmitter> mGrassEmitter;
Point3F mShadowPoints[33];
bool mShadowGenerated;
MatInstance* mStencilMaterial;
U32 mPhysics;
F32 mSize;
Point3F mCameraPosition;
public:
DECLARE_CONOBJECT(Marble);
Marble();
~Marble();
static void initPersistFields();
// consoleInit was not overriden in the original decompile
// if you want it to match MBO exactly, then remove it.
static void consoleInit();
SceneObject* getPad();
S32 getPowerUpId();
const QuatF& getGravityFrame();
const QuatF& getGravityRenderFrame() const { return mGravityRenderFrame; }
const Point3F& getGravityDir(Point3F* result);
U32 getMaxNaturalBlastEnergy();
U32 getMaxBlastEnergy();
F32 getBlastPercent();
F32 getRenderBlastPercent() { return mRenderBlastPercent; }
F32 getBlastEnergy() const;
void setBlastEnergy(F32 energy);
void setUseFullMarbleTime(bool useFull);
void setMarbleTime(U32 time);
U32 getMarbleTime();
void setMarbleBonusTime(U32 time);
U32 getMarbleBonusTime();
U32 getFullMarbleTime();
Marble::Contact& getLastContact();
void setGravityFrame(const QuatF& q, bool snap);
virtual void onSceneRemove();
void setPosition(const Point3D& pos, bool doWarp);
void setPosition(const Point3D& pos, const AngAxisF& angAxis, float mouseY);
Point3F& getPosition();
void victorySequence();
void setMode(U32 mode);
void setPhysics(U32 physics);
void setSize(F32 size);
U32 getMode() { return mMode; }
void setOOB(bool isOOB);
virtual void interpolateTick(F32 delta);
S32 mountPowerupImage(ShapeBaseImageData* imageData);
void updatePowerUpParams();
virtual bool getForce(Point3F& pos, Point3F* force);
virtual U32 packUpdate(NetConnection* conn, U32 mask, BitStream* stream);
virtual void unpackUpdate(NetConnection* conn, BitStream* stream);
virtual U32 filterMaskBits(U32 mask, NetConnection* connection);
virtual void writePacketData(GameConnection* conn, BitStream* stream);
virtual void readPacketData(GameConnection* conn, BitStream* stream);
void renderShadow(F32 dist, F32 fogAmount);
void renderShadow(SceneState* state, RenderInst* ri);
void calcClassRenderData(); // used for marble shadow
virtual void renderImage(SceneState* state);
void bounceEmitter(F32 speed, const Point3F& normal);
virtual void setVelocity(const Point3F& vel);
virtual Point3F getVelocity() const;
Point3F getGravityRenderDir();
virtual MatrixF getShadowTransform() const;
virtual Point3F getShadowScale() const;
virtual void getShadowLightVectorHack(Point3F& lightVec);
virtual bool onSceneAdd(SceneGraph* graph);
virtual bool onNewDataBlock(GameBaseData* dptr);
virtual void onRemove();
bool updatePadState();
void doPowerUpBoost(S32 powerUpId);
void doPowerUpPower(S32 powerUpId);
void updatePowerups();
virtual void updateMass();
void trailEmitter(U32 timeDelta);
void updateRollSound(F32 contactPct, F32 slipAmount);
void playBounceSound(Marble::Contact& contactSurface, F64 contactVel);
void setPad(SceneObject* obj);
void findRenderPos(F32 dt);
virtual void advanceTime(F32 dt);
virtual void computeNetSmooth(F32 backDelta);
void doPowerUp(S32 powerUpId);
void prepShadows();
virtual bool onAdd();
void processMoveTriggers(const Move* move);
void processItemsAndTriggers(const Point3F& startPos, const Point3F& endPos);
void setPowerUpId(U32 id, bool reset);
virtual void processTick(const Move* move);
#ifdef MB_CLIENT_PHYSICS_EVERY_FRAME
virtual void processPhysicsTick(const Move* move, F32 dt);
#endif
// Marble Physics
Point3D getVelocityD() const;
void setVelocityD(const Point3D& vel);
void setVelocityRotD(const Point3D& rot);
virtual void applyImpulse(const Point3F& pos, const Point3F& vec);
void clearMarbleAxis();
void applyContactForces(const Move* move, bool isCentered, Point3D& aControl, const Point3D& desiredOmega, F64 timeStep, Point3D& A, Point3D& a, F32& slipAmount);
void getMarbleAxis(Point3D& sideDir, Point3D& motionDir, Point3D& upDir);
const Point3F& getMotionDir();
bool computeMoveForces(Point3D& aControl, Point3D& desiredOmega, const Move* move);
void velocityCancel(bool surfaceSlide, bool noBounce, bool& bouncedYet, bool& stoppedPaths, Vector<PathedInterior*>& pitrVec);
Point3D getExternalForces(const Move* move, F64 timeStep);
void advancePhysics(const Move* move, U32 timeDelta);
// Marble Collision
void clearObjectsAndPolys();
void findObjectsAndPolys(U32 collisionMask, const Box3F& testBox, bool testPIs);
bool testMove(Point3D velocity, Point3D& position, F64& deltaT, F64 radius, U32 collisionMask, bool testPIs);
void findContacts(U32 contactMask, const Point3D* inPos, const F32* inRad);
void computeFirstPlatformIntersect(F64& dt, Vector<PathedInterior*>& pitrVec);
void resetObjectsAndPolys(U32 collisionMask, const Box3F& testBox);
// Marble Camera
bool moveCamera(Point3F start, Point3F end, Point3F& result, U32 maxIterations, F32 timeStep);
void processCameraMove(const Move* move);
void startCenterCamera();
bool isCameraClear(Point3F start, Point3F end);
void getLookMatrix(MatrixF* camMat);
void cameraLookAtPt(const Point3F& pt);
void resetPlatformsForCamera();
void getOOBCamera(MatrixF* mat);
void setPlatformsForCamera(const Point3F& marblePos, const Point3F& startCam, const Point3F& endCam);
virtual void getCameraTransform(F32* pos, MatrixF* mat);
static U32 smEndPadId;
static SimObjectPtr<StaticShape> smEndPad;
static Vector<PathedInterior*> smPathItrVec;
static Vector<Marble*> marbles;
static ConcretePolyList polyList;
#ifdef MBXP_EMOTIVES
static bool smUseEmotives;
#endif
#ifdef MB_PHYSICS_SWITCHABLE
static bool smTrapLaunch;
#endif
private:
virtual void setTransform(const MatrixF& mat);
void renderShadowVolumes(SceneState* state);
// Marble Collision
bool pointWithinPoly(const ConcretePolyList::Poly& poly, const Point3F& point);
bool pointWithinPolyZ(const ConcretePolyList::Poly& poly, const Point3F& point, const Point3F& upDir);
};
class MarbleData : public ShapeBaseData
{
private:
typedef ShapeBaseData Parent;
friend class Marble;
enum Sounds {
RollHard,
RollMega,
RollIce,
Slip,
Bounce1,
Bounce2,
Bounce3,
Bounce4,
MegaBounce1,
MegaBounce2,
MegaBounce3,
MegaBounce4,
Jump,
MaxSounds,
};
SFXProfile* sound[MaxSounds];
F32 maxRollVelocity;
F32 minVelocityBounceSoft;
F32 minVelocityBounceHard;
F32 minVelocityMegaBounceSoft;
F32 minVelocityMegaBounceHard;
F32 bounceMinGain;
F32 bounceMegaMinGain;
F32 angularAcceleration;
F32 brakingAcceleration;
F32 staticFriction;
F32 kineticFriction;
F32 bounceKineticFriction;
F32 gravity;
//F32 size;
F32 megaSize;
F32 maxDotSlide;
F32 bounceRestitution;
F32 airAcceleration;
F32 energyRechargeRate;
F32 jumpImpulse;
F32 cameraDistance;
U32 maxJumpTicks;
F32 maxForceRadius;
F32 minBounceVel;
U32 startModeTime;
U32 stopModeTime;
F32 minBounceSpeed;
F32 minMediumBounceSpeed;
F32 minHardBounceSpeed;
F32 minTrailSpeed;
ParticleEmitterData* bounceEmitter;
ParticleEmitterData* trailEmitter;
ParticleEmitterData* mudEmitter;
ParticleEmitterData* grassEmitter;
PowerUpData* powerUps;
U32 blastRechargeTime;
U32 maxNaturalBlastRecharge;
DecalData* mDecalData;
S32 mDecalID;
F32 cameraLag;
F32 cameraDecay;
F32 cameraLagMaxOffset;
Point3F SoftBounceImpactShakeFreq;
Point3F SoftBounceImpactShakeAmp;
F32 SoftBounceImpactShakeDuration;
F32 SoftBounceImpactShakeFalloff;
Point3F MediumBounceImpactShakeFreq;
Point3F MediumBounceImpactShakeAmp;
F32 MediumBounceImpactShakeDuration;
F32 MediumBounceImpactShakeFalloff;
Point3F HardBounceImpactShakeFreq;
Point3F HardBounceImpactShakeAmp;
F32 HardBounceImpactShakeDuration;
F32 HardBounceImpactShakeFalloff;
F32 slipEmotiveThreshold;
public:
DECLARE_CONOBJECT(MarbleData);
MarbleData();
static void initPersistFields();
virtual bool preload(bool server, char errorBuffer[256]);
virtual void packData(BitStream*);
virtual void unpackData(BitStream*);
};
#endif // _MARBLE_H_
| 411 | 0.805973 | 1 | 0.805973 | game-dev | MEDIA | 0.735241 | game-dev,graphics-rendering | 0.624489 | 1 | 0.624489 |
EvoEsports/EvoSC | 3,493 | core/TemplateComponents/Scripts/drag.latte.xml | {contentType text}
<script><!--
declare CMlFrame handle;
declare Text handleId;
declare Text D_Centered;
Void __dragSetFocus(Text id){
declare Text EvoSC_Focused_Window_ID for This;
declare Boolean[Text] EvoSC_Window_Focus for This;
declare Boolean[Text] focus;
foreach(ScriptId => Focused in EvoSC_Window_Focus){
focus[ScriptId] = False;
}
focus[EVO_SCRIPT_ID] = True;
EvoSC_Window_Focus = focus;
EvoSC_Focused_Window_ID = EVO_SCRIPT_ID;
}
Void maniaLinkDrag(){
declare Text EvoSC_Focused_Window_ID for This = "";
declare Boolean[Text] EvoSC_Window_Focus for This;
declare Vec2[Text] lastFramePosition for This;
declare Boolean G_Drag_Active for This = False;
if(D_Centered == ""){
handle <=> (Page.MainFrame.GetFirstChild("handle") as CMlFrame);
if(lastFramePosition.existskey(handleId)){
handle.Parent.RelativePosition_V3 = lastFramePosition[handleId];
}else{
handle.Parent.RelativePosition_V3 = <handle.Parent.Size[0]*-0.5, handle.Parent.Size[1]*0.5>;
}
handleId = handle.DataAttributeGet("id");
if(handleId == ""){
//fallback if unset
handleId = "" ^ handle.Id;
}
D_Centered = "x";
}
if(!handle.Parent.Visible){
return;
}
declare framePos = handle.AbsolutePosition_V3;
declare frameSize = handle.Size;
if(handle.Parent.DataAttributeGet("centered") != "centered"){
if(lastFramePosition.existskey(handleId)){
handle.Parent.RelativePosition_V3 = lastFramePosition[handleId];
}else{
handle.Parent.RelativePosition_V3 = <handle.Parent.Size[0]/-2.0, handle.Parent.Size[1]/2.0>;
}
if(handle.Parent.RelativePosition_V3[1] > 150){
handle.Parent.RelativePosition_V3 = <handle.Parent.RelativePosition_V3[0], handle.Parent.RelativePosition_V3[1] - 10>;
}
if(handle.Parent.RelativePosition_V3[1] < -150){
handle.Parent.RelativePosition_V3 = <handle.Parent.RelativePosition_V3[0], handle.Parent.RelativePosition_V3[1] + 10>;
}
handle.Parent.DataAttributeSet("centered", "centered");
}
declare window <=> (Page.MainFrame.GetFirstChild("window") as CMlFrame);
if(EvoSC_Focused_Window_ID != "" && EvoSC_Focused_Window_ID != EVO_SCRIPT_ID){
return;
}
if(MouseLeftButton && !G_Drag_Active){
if(MouseX >= framePos[0]){
if(MouseY <= framePos[1]){
if(MouseX <= (framePos[0] + frameSize[0]) && MouseY >= (framePos[1] - frameSize[1])){
declare Real ZIndex for UI = 305.0;
declare startPos = handle.Parent.RelativePosition_V3;
declare startX = MouseX;
declare startY = MouseY;
G_Drag_Active = True;
__dragSetFocus(EVO_SCRIPT_ID);
window.ZIndex = 310.0;
while(MouseLeftButton){
yield;
declare newPosX = startPos[0] + (MouseX - startX);
declare newPosY = startPos[1] + (MouseY - startY);
handle.Parent.RelativePosition_V3 = <newPosX, newPosY>;
}
lastFramePosition[handleId] = handle.Parent.RelativePosition_V3;
G_Drag_Active = False;
}
}
}
}
}
--></script> | 411 | 0.970035 | 1 | 0.970035 | game-dev | MEDIA | 0.540528 | game-dev | 0.951228 | 1 | 0.951228 |
sanyouyugan/Mas | 9,205 | plugin/src/main/groovy/com/mas/plugin/Logger.groovy | package com.mas.plugin
import java.lang.reflect.Array
class Logger {
private static boolean debug = false
public static HashMap<Integer, String> accCodeMap = new HashMap<>()
public static HashMap<Integer, String> opCodeMap = new HashMap<>()
/**
* 设置是否打印日志
*/
static void setDebug(boolean isDebug) {
this.debug = isDebug
}
static boolean isDebug() {
return debug
}
/**
* 打印日志
*/
def static info(Object msg) {
if (!debug) {
return
}
try {
println "[SensorsAnalytics]: ${msg}"
} catch (Exception e) {
e.printStackTrace()
}
}
def static logForEach(Object... msg) {
if (!debug) {
return
}
msg.each {
Object m ->
try {
if (m != null) {
if (m.class.isArray()) {
print "["
def length = Array.getLength(m);
if (length > 0) {
for (int i = 0; i < length; i++) {
def get = Array.get(m, i);
if (get != null) {
print "${get}\t"
} else {
print "null\t"
}
}
}
print "]\t"
} else {
print "${m}\t"
}
} else {
print "null\t"
}
} catch (Exception e) {
e.printStackTrace()
}
}
println ""
}
static String getOpName(int opCode) {
return getOpMap().get(opCode);
}
static String accCode2String(int access) {
def builder = new StringBuilder()
def map = getAccCodeMap()
map.entrySet().each {
entry ->
if ((entry.getKey().intValue() & access) > 0) {
builder.append(entry.getValue() + ' ')
}
}
return builder.toString()
}
public static Map<Integer, String> getAccCodeMap() {
if (accCodeMap.size() == 0) {
HashMap<String, Integer> map = new HashMap<>()
map.put("ACC_PUBLIC", 1)
map.put("ACC_PRIVATE", 2)
map.put("ACC_PROTECTED", 4)
map.put("ACC_STATIC", 8)
map.put("ACC_FINAL", 16)
map.put("ACC_SUPER", 32)
map.put("ACC_SYNCHRONIZED", 32)
map.put("ACC_VOLATILE", 64)
map.put("ACC_BRIDGE", 64)
map.put("ACC_VARARGS", 128)
map.put("ACC_TRANSIENT", 128)
map.put("ACC_NATIVE", 256)
map.put("ACC_INTERFACE", 512)
map.put("ACC_ABSTRACT", 1024)
map.put("ACC_STRICT", 2048)
map.put("ACC_SYNTHETIC", 4096)
map.put("ACC_ANNOTATION", 8192)
map.put("ACC_ENUM", 16384)
map.put("ACC_DEPRECATED", 131072)
for (Map.Entry<String, Integer> entry : map.entrySet()) {
accCodeMap.put(entry.getValue(), entry.getKey())
}
}
return accCodeMap
}
static Map<Integer, String> getOpMap() {
if (opCodeMap.size() == 0) {
HashMap<String, Integer> map = new HashMap<>()
map.put("NOP", 0)
map.put("ACONST_NULL", 1)
map.put("ICONST_M1", 2)
map.put("ICONST_0", 3)
map.put("ICONST_1", 4)
map.put("ICONST_2", 5)
map.put("ICONST_3", 6)
map.put("ICONST_4", 7)
map.put("ICONST_5", 8)
map.put("LCONST_0", 9)
map.put("LCONST_1", 10)
map.put("FCONST_0", 11)
map.put("FCONST_1", 12)
map.put("FCONST_2", 13)
map.put("DCONST_0", 14)
map.put("DCONST_1", 15)
map.put("BIPUSH", 16)
map.put("SIPUSH", 17)
map.put("LDC", 18)
map.put("ILOAD", 21)
map.put("LLOAD", 22)
map.put("FLOAD", 23)
map.put("DLOAD", 24)
map.put("ALOAD", 25)
map.put("IALOAD", 46)
map.put("LALOAD", 47)
map.put("FALOAD", 48)
map.put("DALOAD", 49)
map.put("AALOAD", 50)
map.put("BALOAD", 51)
map.put("CALOAD", 52)
map.put("SALOAD", 53)
map.put("ISTORE", 54)
map.put("LSTORE", 55)
map.put("FSTORE", 56)
map.put("DSTORE", 57)
map.put("ASTORE", 58)
map.put("IASTORE", 79)
map.put("LASTORE", 80)
map.put("FASTORE", 81)
map.put("DASTORE", 82)
map.put("AASTORE", 83)
map.put("BASTORE", 84)
map.put("CASTORE", 85)
map.put("SASTORE", 86)
map.put("POP", 87)
map.put("POP2", 88)
map.put("DUP", 89)
map.put("DUP_X1", 90)
map.put("DUP_X2", 91)
map.put("DUP2", 92)
map.put("DUP2_X1", 93)
map.put("DUP2_X2", 94)
map.put("SWAP", 95)
map.put("IADD", 96)
map.put("LADD", 97)
map.put("FADD", 98)
map.put("DADD", 99)
map.put("ISUB", 100)
map.put("LSUB", 101)
map.put("FSUB", 102)
map.put("DSUB", 103)
map.put("IMUL", 104)
map.put("LMUL", 105)
map.put("FMUL", 106)
map.put("DMUL", 107)
map.put("IDIV", 108)
map.put("LDIV", 109)
map.put("FDIV", 110)
map.put("DDIV", 111)
map.put("IREM", 112)
map.put("LREM", 113)
map.put("FREM", 114)
map.put("DREM", 115)
map.put("INEG", 116)
map.put("LNEG", 117)
map.put("FNEG", 118)
map.put("DNEG", 119)
map.put("ISHL", 120)
map.put("LSHL", 121)
map.put("ISHR", 122)
map.put("LSHR", 123)
map.put("IUSHR", 124)
map.put("LUSHR", 125)
map.put("IAND", 126)
map.put("LAND", 127)
map.put("IOR", 128)
map.put("LOR", 129)
map.put("IXOR", 130)
map.put("LXOR", 131)
map.put("IINC", 132)
map.put("I2L", 133)
map.put("I2F", 134)
map.put("I2D", 135)
map.put("L2I", 136)
map.put("L2F", 137)
map.put("L2D", 138)
map.put("F2I", 139)
map.put("F2L", 140)
map.put("F2D", 141)
map.put("D2I", 142)
map.put("D2L", 143)
map.put("D2F", 144)
map.put("I2B", 145)
map.put("I2C", 146)
map.put("I2S", 147)
map.put("LCMP", 148)
map.put("FCMPL", 149)
map.put("FCMPG", 150)
map.put("DCMPL", 151)
map.put("DCMPG", 152)
map.put("IFEQ", 153)
map.put("IFNE", 154)
map.put("IFLT", 155)
map.put("IFGE", 156)
map.put("IFGT", 157)
map.put("IFLE", 158)
map.put("IF_ICMPEQ", 159)
map.put("IF_ICMPNE", 160)
map.put("IF_ICMPLT", 161)
map.put("IF_ICMPGE", 162)
map.put("IF_ICMPGT", 163)
map.put("IF_ICMPLE", 164)
map.put("IF_ACMPEQ", 165)
map.put("IF_ACMPNE", 166)
map.put("GOTO", 167)
map.put("JSR", 168)
map.put("RET", 169)
map.put("TABLESWITCH", 170)
map.put("LOOKUPSWITCH", 171)
map.put("IRETURN", 172)
map.put("LRETURN", 173)
map.put("FRETURN", 174)
map.put("DRETURN", 175)
map.put("ARETURN", 176)
map.put("RETURN", 177)
map.put("GETSTATIC", 178)
map.put("PUTSTATIC", 179)
map.put("GETFIELD", 180)
map.put("PUTFIELD", 181)
map.put("INVOKEVIRTUAL", 182)
map.put("INVOKESPECIAL", 183)
map.put("INVOKESTATIC", 184)
map.put("INVOKEINTERFACE", 185)
map.put("INVOKEDYNAMIC", 186)
map.put("NEW", 187)
map.put("NEWARRAY", 188)
map.put("ANEWARRAY", 189)
map.put("ARRAYLENGTH", 190)
map.put("ATHROW", 191)
map.put("CHECKCAST", 192)
map.put("INSTANCEOF", 193)
map.put("MONITORENTER", 194)
map.put("MONITOREXIT", 195)
map.put("MULTIANEWARRAY", 197)
map.put("IFNULL", 198)
map.put("IFNONNULL", 199)
for (Map.Entry<String, Integer> entry : map.entrySet()) {
opCodeMap.put(entry.getValue(), entry.getKey())
}
}
return opCodeMap
}
} | 411 | 0.589026 | 1 | 0.589026 | game-dev | MEDIA | 0.24662 | game-dev | 0.88665 | 1 | 0.88665 |
ReactiveDrop/reactivedrop_public_src | 1,365 | src/game/server/swarm/asw_objective_kill_eggs.cpp | #include "cbase.h"
#include "asw_objective_kill_eggs.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
LINK_ENTITY_TO_CLASS( asw_objective_kill_eggs, CASW_Objective_Kill_Eggs );
BEGIN_DATADESC( CASW_Objective_Kill_Eggs )
DEFINE_KEYFIELD( m_iTargetKills, FIELD_INTEGER, "NumEggs" ),
DEFINE_FIELD( m_iCurrentKills, FIELD_INTEGER ),
END_DATADESC()
IMPLEMENT_SERVERCLASS_ST(CASW_Objective_Kill_Eggs, DT_ASW_Objective_Kill_Eggs)
SendPropInt (SENDINFO(m_iTargetKills)),
SendPropInt (SENDINFO(m_iCurrentKills)),
END_SEND_TABLE()
CASW_Objective_Kill_Eggs::CASW_Objective_Kill_Eggs()
{
m_iCurrentKills = 0; // how many eggs killed so far
}
CASW_Objective_Kill_Eggs::~CASW_Objective_Kill_Eggs()
{
}
void CASW_Objective_Kill_Eggs::EggKilled(CASW_Egg* pEgg)
{
if (IsObjectiveComplete())
return;
m_iCurrentKills++;
if (m_iCurrentKills >= m_iTargetKills)
{
SetComplete(true);
}
else
{
CReliableBroadcastRecipientFilter filter;
UserMessageBegin( filter, "ShowObjectives" );
WRITE_FLOAT( 5.0f );
MessageEnd();
}
}
float CASW_Objective_Kill_Eggs::GetObjectiveProgress()
{
if ( m_iTargetKills <= 0 )
return BaseClass::GetObjectiveProgress();
float flProgress = (float) m_iCurrentKills.Get() / (float) m_iTargetKills.Get();
flProgress = clamp<float>( flProgress, 0.0f, 1.0f );
return flProgress;
} | 411 | 0.839958 | 1 | 0.839958 | game-dev | MEDIA | 0.330054 | game-dev | 0.794989 | 1 | 0.794989 |
cliqz-oss/browser-f | 46,907 | mozilla-release/third_party/python/pytest/src/_pytest/fixtures.py | from __future__ import absolute_import, division, print_function
import functools
import inspect
import sys
import warnings
from collections import OrderedDict, deque, defaultdict
from more_itertools import flatten
import attr
import py
from py._code.code import FormattedExcinfo
import _pytest
from _pytest import nodes
from _pytest._code.code import TerminalRepr
from _pytest.compat import (
NOTSET,
exc_clear,
_format_args,
getfslineno,
get_real_func,
is_generator,
isclass,
getimfunc,
getlocation,
getfuncargnames,
safe_getattr,
FuncargnamesCompatAttr,
)
from _pytest.outcomes import fail, TEST_OUTCOME
FIXTURE_MSG = 'fixtures cannot have "pytest_funcarg__" prefix and be decorated with @pytest.fixture:\n{}'
@attr.s(frozen=True)
class PseudoFixtureDef(object):
cached_result = attr.ib()
scope = attr.ib()
def pytest_sessionstart(session):
import _pytest.python
import _pytest.nodes
scopename2class.update(
{
"class": _pytest.python.Class,
"module": _pytest.python.Module,
"function": _pytest.nodes.Item,
"session": _pytest.main.Session,
}
)
session._fixturemanager = FixtureManager(session)
scopename2class = {}
scope2props = dict(session=())
scope2props["module"] = ("fspath", "module")
scope2props["class"] = scope2props["module"] + ("cls",)
scope2props["instance"] = scope2props["class"] + ("instance",)
scope2props["function"] = scope2props["instance"] + ("function", "keywords")
def scopeproperty(name=None, doc=None):
def decoratescope(func):
scopename = name or func.__name__
def provide(self):
if func.__name__ in scope2props[self.scope]:
return func(self)
raise AttributeError(
"%s not available in %s-scoped context" % (scopename, self.scope)
)
return property(provide, None, None, func.__doc__)
return decoratescope
def get_scope_node(node, scope):
cls = scopename2class.get(scope)
if cls is None:
raise ValueError("unknown scope")
return node.getparent(cls)
def add_funcarg_pseudo_fixture_def(collector, metafunc, fixturemanager):
# this function will transform all collected calls to a functions
# if they use direct funcargs (i.e. direct parametrization)
# because we want later test execution to be able to rely on
# an existing FixtureDef structure for all arguments.
# XXX we can probably avoid this algorithm if we modify CallSpec2
# to directly care for creating the fixturedefs within its methods.
if not metafunc._calls[0].funcargs:
return # this function call does not have direct parametrization
# collect funcargs of all callspecs into a list of values
arg2params = {}
arg2scope = {}
for callspec in metafunc._calls:
for argname, argvalue in callspec.funcargs.items():
assert argname not in callspec.params
callspec.params[argname] = argvalue
arg2params_list = arg2params.setdefault(argname, [])
callspec.indices[argname] = len(arg2params_list)
arg2params_list.append(argvalue)
if argname not in arg2scope:
scopenum = callspec._arg2scopenum.get(argname, scopenum_function)
arg2scope[argname] = scopes[scopenum]
callspec.funcargs.clear()
# register artificial FixtureDef's so that later at test execution
# time we can rely on a proper FixtureDef to exist for fixture setup.
arg2fixturedefs = metafunc._arg2fixturedefs
for argname, valuelist in arg2params.items():
# if we have a scope that is higher than function we need
# to make sure we only ever create an according fixturedef on
# a per-scope basis. We thus store and cache the fixturedef on the
# node related to the scope.
scope = arg2scope[argname]
node = None
if scope != "function":
node = get_scope_node(collector, scope)
if node is None:
assert scope == "class" and isinstance(collector, _pytest.python.Module)
# use module-level collector for class-scope (for now)
node = collector
if node and argname in node._name2pseudofixturedef:
arg2fixturedefs[argname] = [node._name2pseudofixturedef[argname]]
else:
fixturedef = FixtureDef(
fixturemanager,
"",
argname,
get_direct_param_fixture_func,
arg2scope[argname],
valuelist,
False,
False,
)
arg2fixturedefs[argname] = [fixturedef]
if node is not None:
node._name2pseudofixturedef[argname] = fixturedef
def getfixturemarker(obj):
""" return fixturemarker or None if it doesn't exist or raised
exceptions."""
try:
return getattr(obj, "_pytestfixturefunction", None)
except TEST_OUTCOME:
# some objects raise errors like request (from flask import request)
# we don't expect them to be fixture functions
return None
def get_parametrized_fixture_keys(item, scopenum):
""" return list of keys for all parametrized arguments which match
the specified scope. """
assert scopenum < scopenum_function # function
try:
cs = item.callspec
except AttributeError:
pass
else:
# cs.indices.items() is random order of argnames. Need to
# sort this so that different calls to
# get_parametrized_fixture_keys will be deterministic.
for argname, param_index in sorted(cs.indices.items()):
if cs._arg2scopenum[argname] != scopenum:
continue
if scopenum == 0: # session
key = (argname, param_index)
elif scopenum == 1: # module
key = (argname, param_index, item.fspath)
elif scopenum == 2: # class
key = (argname, param_index, item.fspath, item.cls)
yield key
# algorithm for sorting on a per-parametrized resource setup basis
# it is called for scopenum==0 (session) first and performs sorting
# down to the lower scopes such as to minimize number of "high scope"
# setups and teardowns
def reorder_items(items):
argkeys_cache = {}
items_by_argkey = {}
for scopenum in range(0, scopenum_function):
argkeys_cache[scopenum] = d = {}
items_by_argkey[scopenum] = item_d = defaultdict(deque)
for item in items:
keys = OrderedDict.fromkeys(get_parametrized_fixture_keys(item, scopenum))
if keys:
d[item] = keys
for key in keys:
item_d[key].append(item)
items = OrderedDict.fromkeys(items)
return list(reorder_items_atscope(items, argkeys_cache, items_by_argkey, 0))
def fix_cache_order(item, argkeys_cache, items_by_argkey):
for scopenum in range(0, scopenum_function):
for key in argkeys_cache[scopenum].get(item, []):
items_by_argkey[scopenum][key].appendleft(item)
def reorder_items_atscope(items, argkeys_cache, items_by_argkey, scopenum):
if scopenum >= scopenum_function or len(items) < 3:
return items
ignore = set()
items_deque = deque(items)
items_done = OrderedDict()
scoped_items_by_argkey = items_by_argkey[scopenum]
scoped_argkeys_cache = argkeys_cache[scopenum]
while items_deque:
no_argkey_group = OrderedDict()
slicing_argkey = None
while items_deque:
item = items_deque.popleft()
if item in items_done or item in no_argkey_group:
continue
argkeys = OrderedDict.fromkeys(
k for k in scoped_argkeys_cache.get(item, []) if k not in ignore
)
if not argkeys:
no_argkey_group[item] = None
else:
slicing_argkey, _ = argkeys.popitem()
# we don't have to remove relevant items from later in the deque because they'll just be ignored
matching_items = [
i for i in scoped_items_by_argkey[slicing_argkey] if i in items
]
for i in reversed(matching_items):
fix_cache_order(i, argkeys_cache, items_by_argkey)
items_deque.appendleft(i)
break
if no_argkey_group:
no_argkey_group = reorder_items_atscope(
no_argkey_group, argkeys_cache, items_by_argkey, scopenum + 1
)
for item in no_argkey_group:
items_done[item] = None
ignore.add(slicing_argkey)
return items_done
def fillfixtures(function):
""" fill missing funcargs for a test function. """
try:
request = function._request
except AttributeError:
# XXX this special code path is only expected to execute
# with the oejskit plugin. It uses classes with funcargs
# and we thus have to work a bit to allow this.
fm = function.session._fixturemanager
fi = fm.getfixtureinfo(function.parent, function.obj, None)
function._fixtureinfo = fi
request = function._request = FixtureRequest(function)
request._fillfixtures()
# prune out funcargs for jstests
newfuncargs = {}
for name in fi.argnames:
newfuncargs[name] = function.funcargs[name]
function.funcargs = newfuncargs
else:
request._fillfixtures()
def get_direct_param_fixture_func(request):
return request.param
class FuncFixtureInfo(object):
def __init__(self, argnames, names_closure, name2fixturedefs):
self.argnames = argnames
self.names_closure = names_closure
self.name2fixturedefs = name2fixturedefs
class FixtureRequest(FuncargnamesCompatAttr):
""" A request for a fixture from a test or fixture function.
A request object gives access to the requesting test context
and has an optional ``param`` attribute in case
the fixture is parametrized indirectly.
"""
def __init__(self, pyfuncitem):
self._pyfuncitem = pyfuncitem
#: fixture for which this request is being performed
self.fixturename = None
#: Scope string, one of "function", "class", "module", "session"
self.scope = "function"
self._fixture_defs = {} # argname -> FixtureDef
fixtureinfo = pyfuncitem._fixtureinfo
self._arg2fixturedefs = fixtureinfo.name2fixturedefs.copy()
self._arg2index = {}
self._fixturemanager = pyfuncitem.session._fixturemanager
@property
def fixturenames(self):
# backward incompatible note: now a readonly property
return list(self._pyfuncitem._fixtureinfo.names_closure)
@property
def node(self):
""" underlying collection node (depends on current request scope)"""
return self._getscopeitem(self.scope)
def _getnextfixturedef(self, argname):
fixturedefs = self._arg2fixturedefs.get(argname, None)
if fixturedefs is None:
# we arrive here because of a dynamic call to
# getfixturevalue(argname) usage which was naturally
# not known at parsing/collection time
parentid = self._pyfuncitem.parent.nodeid
fixturedefs = self._fixturemanager.getfixturedefs(argname, parentid)
self._arg2fixturedefs[argname] = fixturedefs
# fixturedefs list is immutable so we maintain a decreasing index
index = self._arg2index.get(argname, 0) - 1
if fixturedefs is None or (-index > len(fixturedefs)):
raise FixtureLookupError(argname, self)
self._arg2index[argname] = index
return fixturedefs[index]
@property
def config(self):
""" the pytest config object associated with this request. """
return self._pyfuncitem.config
@scopeproperty()
def function(self):
""" test function object if the request has a per-function scope. """
return self._pyfuncitem.obj
@scopeproperty("class")
def cls(self):
""" class (can be None) where the test function was collected. """
clscol = self._pyfuncitem.getparent(_pytest.python.Class)
if clscol:
return clscol.obj
@property
def instance(self):
""" instance (can be None) on which test function was collected. """
# unittest support hack, see _pytest.unittest.TestCaseFunction
try:
return self._pyfuncitem._testcase
except AttributeError:
function = getattr(self, "function", None)
return getattr(function, "__self__", None)
@scopeproperty()
def module(self):
""" python module object where the test function was collected. """
return self._pyfuncitem.getparent(_pytest.python.Module).obj
@scopeproperty()
def fspath(self):
""" the file system path of the test module which collected this test. """
return self._pyfuncitem.fspath
@property
def keywords(self):
""" keywords/markers dictionary for the underlying node. """
return self.node.keywords
@property
def session(self):
""" pytest session object. """
return self._pyfuncitem.session
def addfinalizer(self, finalizer):
""" add finalizer/teardown function to be called after the
last test within the requesting test context finished
execution. """
# XXX usually this method is shadowed by fixturedef specific ones
self._addfinalizer(finalizer, scope=self.scope)
def _addfinalizer(self, finalizer, scope):
colitem = self._getscopeitem(scope)
self._pyfuncitem.session._setupstate.addfinalizer(
finalizer=finalizer, colitem=colitem
)
def applymarker(self, marker):
""" Apply a marker to a single test function invocation.
This method is useful if you don't want to have a keyword/marker
on all function invocations.
:arg marker: a :py:class:`_pytest.mark.MarkDecorator` object
created by a call to ``pytest.mark.NAME(...)``.
"""
self.node.add_marker(marker)
def raiseerror(self, msg):
""" raise a FixtureLookupError with the given message. """
raise self._fixturemanager.FixtureLookupError(None, self, msg)
def _fillfixtures(self):
item = self._pyfuncitem
fixturenames = getattr(item, "fixturenames", self.fixturenames)
for argname in fixturenames:
if argname not in item.funcargs:
item.funcargs[argname] = self.getfixturevalue(argname)
def cached_setup(self, setup, teardown=None, scope="module", extrakey=None):
""" (deprecated) Return a testing resource managed by ``setup`` &
``teardown`` calls. ``scope`` and ``extrakey`` determine when the
``teardown`` function will be called so that subsequent calls to
``setup`` would recreate the resource. With pytest-2.3 you often
do not need ``cached_setup()`` as you can directly declare a scope
on a fixture function and register a finalizer through
``request.addfinalizer()``.
:arg teardown: function receiving a previously setup resource.
:arg setup: a no-argument function creating a resource.
:arg scope: a string value out of ``function``, ``class``, ``module``
or ``session`` indicating the caching lifecycle of the resource.
:arg extrakey: added to internal caching key of (funcargname, scope).
"""
if not hasattr(self.config, "_setupcache"):
self.config._setupcache = {} # XXX weakref?
cachekey = (self.fixturename, self._getscopeitem(scope), extrakey)
cache = self.config._setupcache
try:
val = cache[cachekey]
except KeyError:
self._check_scope(self.fixturename, self.scope, scope)
val = setup()
cache[cachekey] = val
if teardown is not None:
def finalizer():
del cache[cachekey]
teardown(val)
self._addfinalizer(finalizer, scope=scope)
return val
def getfixturevalue(self, argname):
""" Dynamically run a named fixture function.
Declaring fixtures via function argument is recommended where possible.
But if you can only decide whether to use another fixture at test
setup time, you may use this function to retrieve it inside a fixture
or test function body.
"""
return self._get_active_fixturedef(argname).cached_result[0]
def getfuncargvalue(self, argname):
""" Deprecated, use getfixturevalue. """
from _pytest import deprecated
warnings.warn(deprecated.GETFUNCARGVALUE, DeprecationWarning, stacklevel=2)
return self.getfixturevalue(argname)
def _get_active_fixturedef(self, argname):
try:
return self._fixture_defs[argname]
except KeyError:
try:
fixturedef = self._getnextfixturedef(argname)
except FixtureLookupError:
if argname == "request":
cached_result = (self, [0], None)
scope = "function"
return PseudoFixtureDef(cached_result, scope)
raise
# remove indent to prevent the python3 exception
# from leaking into the call
self._compute_fixture_value(fixturedef)
self._fixture_defs[argname] = fixturedef
return fixturedef
def _get_fixturestack(self):
current = self
values = []
while 1:
fixturedef = getattr(current, "_fixturedef", None)
if fixturedef is None:
values.reverse()
return values
values.append(fixturedef)
current = current._parent_request
def _compute_fixture_value(self, fixturedef):
"""
Creates a SubRequest based on "self" and calls the execute method of the given fixturedef object. This will
force the FixtureDef object to throw away any previous results and compute a new fixture value, which
will be stored into the FixtureDef object itself.
:param FixtureDef fixturedef:
"""
# prepare a subrequest object before calling fixture function
# (latter managed by fixturedef)
argname = fixturedef.argname
funcitem = self._pyfuncitem
scope = fixturedef.scope
try:
param = funcitem.callspec.getparam(argname)
except (AttributeError, ValueError):
param = NOTSET
param_index = 0
if fixturedef.params is not None:
frame = inspect.stack()[3]
frameinfo = inspect.getframeinfo(frame[0])
source_path = frameinfo.filename
source_lineno = frameinfo.lineno
source_path = py.path.local(source_path)
if source_path.relto(funcitem.config.rootdir):
source_path = source_path.relto(funcitem.config.rootdir)
msg = (
"The requested fixture has no parameter defined for the "
"current test.\n\nRequested fixture '{}' defined in:\n{}"
"\n\nRequested here:\n{}:{}".format(
fixturedef.argname,
getlocation(fixturedef.func, funcitem.config.rootdir),
source_path,
source_lineno,
)
)
fail(msg)
else:
# indices might not be set if old-style metafunc.addcall() was used
param_index = funcitem.callspec.indices.get(argname, 0)
# if a parametrize invocation set a scope it will override
# the static scope defined with the fixture function
paramscopenum = funcitem.callspec._arg2scopenum.get(argname)
if paramscopenum is not None:
scope = scopes[paramscopenum]
subrequest = SubRequest(self, scope, param, param_index, fixturedef)
# check if a higher-level scoped fixture accesses a lower level one
subrequest._check_scope(argname, self.scope, scope)
# clear sys.exc_info before invoking the fixture (python bug?)
# if its not explicitly cleared it will leak into the call
exc_clear()
try:
# call the fixture function
fixturedef.execute(request=subrequest)
finally:
# if fixture function failed it might have registered finalizers
self.session._setupstate.addfinalizer(
functools.partial(fixturedef.finish, request=subrequest),
subrequest.node,
)
def _check_scope(self, argname, invoking_scope, requested_scope):
if argname == "request":
return
if scopemismatch(invoking_scope, requested_scope):
# try to report something helpful
lines = self._factorytraceback()
fail(
"ScopeMismatch: You tried to access the %r scoped "
"fixture %r with a %r scoped request object, "
"involved factories\n%s"
% ((requested_scope, argname, invoking_scope, "\n".join(lines))),
pytrace=False,
)
def _factorytraceback(self):
lines = []
for fixturedef in self._get_fixturestack():
factory = fixturedef.func
fs, lineno = getfslineno(factory)
p = self._pyfuncitem.session.fspath.bestrelpath(fs)
args = _format_args(factory)
lines.append("%s:%d: def %s%s" % (p, lineno, factory.__name__, args))
return lines
def _getscopeitem(self, scope):
if scope == "function":
# this might also be a non-function Item despite its attribute name
return self._pyfuncitem
node = get_scope_node(self._pyfuncitem, scope)
if node is None and scope == "class":
# fallback to function item itself
node = self._pyfuncitem
assert node, 'Could not obtain a node for scope "{}" for function {!r}'.format(
scope, self._pyfuncitem
)
return node
def __repr__(self):
return "<FixtureRequest for %r>" % (self.node)
class SubRequest(FixtureRequest):
""" a sub request for handling getting a fixture from a
test function/fixture. """
def __init__(self, request, scope, param, param_index, fixturedef):
self._parent_request = request
self.fixturename = fixturedef.argname
if param is not NOTSET:
self.param = param
self.param_index = param_index
self.scope = scope
self._fixturedef = fixturedef
self._pyfuncitem = request._pyfuncitem
self._fixture_defs = request._fixture_defs
self._arg2fixturedefs = request._arg2fixturedefs
self._arg2index = request._arg2index
self._fixturemanager = request._fixturemanager
def __repr__(self):
return "<SubRequest %r for %r>" % (self.fixturename, self._pyfuncitem)
def addfinalizer(self, finalizer):
self._fixturedef.addfinalizer(finalizer)
class ScopeMismatchError(Exception):
""" A fixture function tries to use a different fixture function which
which has a lower scope (e.g. a Session one calls a function one)
"""
scopes = "session module class function".split()
scopenum_function = scopes.index("function")
def scopemismatch(currentscope, newscope):
return scopes.index(newscope) > scopes.index(currentscope)
def scope2index(scope, descr, where=None):
"""Look up the index of ``scope`` and raise a descriptive value error
if not defined.
"""
try:
return scopes.index(scope)
except ValueError:
raise ValueError(
"{} {}has an unsupported scope value '{}'".format(
descr, "from {} ".format(where) if where else "", scope
)
)
class FixtureLookupError(LookupError):
""" could not return a requested Fixture (missing or invalid). """
def __init__(self, argname, request, msg=None):
self.argname = argname
self.request = request
self.fixturestack = request._get_fixturestack()
self.msg = msg
def formatrepr(self):
tblines = []
addline = tblines.append
stack = [self.request._pyfuncitem.obj]
stack.extend(map(lambda x: x.func, self.fixturestack))
msg = self.msg
if msg is not None:
# the last fixture raise an error, let's present
# it at the requesting side
stack = stack[:-1]
for function in stack:
fspath, lineno = getfslineno(function)
try:
lines, _ = inspect.getsourcelines(get_real_func(function))
except (IOError, IndexError, TypeError):
error_msg = "file %s, line %s: source code not available"
addline(error_msg % (fspath, lineno + 1))
else:
addline("file %s, line %s" % (fspath, lineno + 1))
for i, line in enumerate(lines):
line = line.rstrip()
addline(" " + line)
if line.lstrip().startswith("def"):
break
if msg is None:
fm = self.request._fixturemanager
available = []
parentid = self.request._pyfuncitem.parent.nodeid
for name, fixturedefs in fm._arg2fixturedefs.items():
faclist = list(fm._matchfactories(fixturedefs, parentid))
if faclist and name not in available:
available.append(name)
msg = "fixture %r not found" % (self.argname,)
msg += "\n available fixtures: %s" % (", ".join(sorted(available)),)
msg += "\n use 'pytest --fixtures [testpath]' for help on them."
return FixtureLookupErrorRepr(fspath, lineno, tblines, msg, self.argname)
class FixtureLookupErrorRepr(TerminalRepr):
def __init__(self, filename, firstlineno, tblines, errorstring, argname):
self.tblines = tblines
self.errorstring = errorstring
self.filename = filename
self.firstlineno = firstlineno
self.argname = argname
def toterminal(self, tw):
# tw.line("FixtureLookupError: %s" %(self.argname), red=True)
for tbline in self.tblines:
tw.line(tbline.rstrip())
lines = self.errorstring.split("\n")
if lines:
tw.line(
"{} {}".format(FormattedExcinfo.fail_marker, lines[0].strip()),
red=True,
)
for line in lines[1:]:
tw.line(
"{} {}".format(FormattedExcinfo.flow_marker, line.strip()),
red=True,
)
tw.line()
tw.line("%s:%d" % (self.filename, self.firstlineno + 1))
def fail_fixturefunc(fixturefunc, msg):
fs, lineno = getfslineno(fixturefunc)
location = "%s:%s" % (fs, lineno + 1)
source = _pytest._code.Source(fixturefunc)
fail(msg + ":\n\n" + str(source.indent()) + "\n" + location, pytrace=False)
def call_fixture_func(fixturefunc, request, kwargs):
yieldctx = is_generator(fixturefunc)
if yieldctx:
it = fixturefunc(**kwargs)
res = next(it)
def teardown():
try:
next(it)
except StopIteration:
pass
else:
fail_fixturefunc(
fixturefunc, "yield_fixture function has more than one 'yield'"
)
request.addfinalizer(teardown)
else:
res = fixturefunc(**kwargs)
return res
class FixtureDef(object):
""" A container for a factory definition. """
def __init__(
self,
fixturemanager,
baseid,
argname,
func,
scope,
params,
unittest=False,
ids=None,
):
self._fixturemanager = fixturemanager
self.baseid = baseid or ""
self.has_location = baseid is not None
self.func = func
self.argname = argname
self.scope = scope
self.scopenum = scope2index(
scope or "function", descr="fixture {}".format(func.__name__), where=baseid
)
self.params = params
self.argnames = getfuncargnames(func, is_method=unittest)
self.unittest = unittest
self.ids = ids
self._finalizers = []
def addfinalizer(self, finalizer):
self._finalizers.append(finalizer)
def finish(self, request):
exceptions = []
try:
while self._finalizers:
try:
func = self._finalizers.pop()
func()
except: # noqa
exceptions.append(sys.exc_info())
if exceptions:
e = exceptions[0]
del exceptions # ensure we don't keep all frames alive because of the traceback
py.builtin._reraise(*e)
finally:
hook = self._fixturemanager.session.gethookproxy(request.node.fspath)
hook.pytest_fixture_post_finalizer(fixturedef=self, request=request)
# even if finalization fails, we invalidate
# the cached fixture value and remove
# all finalizers because they may be bound methods which will
# keep instances alive
if hasattr(self, "cached_result"):
del self.cached_result
self._finalizers = []
def execute(self, request):
# get required arguments and register our own finish()
# with their finalization
for argname in self.argnames:
fixturedef = request._get_active_fixturedef(argname)
if argname != "request":
fixturedef.addfinalizer(functools.partial(self.finish, request=request))
my_cache_key = request.param_index
cached_result = getattr(self, "cached_result", None)
if cached_result is not None:
result, cache_key, err = cached_result
if my_cache_key == cache_key:
if err is not None:
py.builtin._reraise(*err)
else:
return result
# we have a previous but differently parametrized fixture instance
# so we need to tear it down before creating a new one
self.finish(request)
assert not hasattr(self, "cached_result")
hook = self._fixturemanager.session.gethookproxy(request.node.fspath)
return hook.pytest_fixture_setup(fixturedef=self, request=request)
def __repr__(self):
return (
"<FixtureDef name=%r scope=%r baseid=%r >"
% (self.argname, self.scope, self.baseid)
)
def pytest_fixture_setup(fixturedef, request):
""" Execution of fixture setup. """
kwargs = {}
for argname in fixturedef.argnames:
fixdef = request._get_active_fixturedef(argname)
result, arg_cache_key, exc = fixdef.cached_result
request._check_scope(argname, request.scope, fixdef.scope)
kwargs[argname] = result
fixturefunc = fixturedef.func
if fixturedef.unittest:
if request.instance is not None:
# bind the unbound method to the TestCase instance
fixturefunc = fixturedef.func.__get__(request.instance)
else:
# the fixture function needs to be bound to the actual
# request.instance so that code working with "fixturedef" behaves
# as expected.
if request.instance is not None:
fixturefunc = getimfunc(fixturedef.func)
if fixturefunc != fixturedef.func:
fixturefunc = fixturefunc.__get__(request.instance)
my_cache_key = request.param_index
try:
result = call_fixture_func(fixturefunc, request, kwargs)
except TEST_OUTCOME:
fixturedef.cached_result = (None, my_cache_key, sys.exc_info())
raise
fixturedef.cached_result = (result, my_cache_key, None)
return result
def _ensure_immutable_ids(ids):
if ids is None:
return
if callable(ids):
return ids
return tuple(ids)
@attr.s(frozen=True)
class FixtureFunctionMarker(object):
scope = attr.ib()
params = attr.ib(converter=attr.converters.optional(tuple))
autouse = attr.ib(default=False)
ids = attr.ib(default=None, converter=_ensure_immutable_ids)
name = attr.ib(default=None)
def __call__(self, function):
if isclass(function):
raise ValueError("class fixtures not supported (may be in the future)")
if getattr(function, "_pytestfixturefunction", False):
raise ValueError(
"fixture is being applied more than once to the same function"
)
function._pytestfixturefunction = self
return function
def fixture(scope="function", params=None, autouse=False, ids=None, name=None):
"""Decorator to mark a fixture factory function.
This decorator can be used (with or without parameters) to define a
fixture function. The name of the fixture function can later be
referenced to cause its invocation ahead of running tests: test
modules or classes can use the pytest.mark.usefixtures(fixturename)
marker. Test functions can directly use fixture names as input
arguments in which case the fixture instance returned from the fixture
function will be injected.
:arg scope: the scope for which this fixture is shared, one of
"function" (default), "class", "module" or "session".
:arg params: an optional list of parameters which will cause multiple
invocations of the fixture function and all of the tests
using it.
:arg autouse: if True, the fixture func is activated for all tests that
can see it. If False (the default) then an explicit
reference is needed to activate the fixture.
:arg ids: list of string ids each corresponding to the params
so that they are part of the test id. If no ids are provided
they will be generated automatically from the params.
:arg name: the name of the fixture. This defaults to the name of the
decorated function. If a fixture is used in the same module in
which it is defined, the function name of the fixture will be
shadowed by the function arg that requests the fixture; one way
to resolve this is to name the decorated function
``fixture_<fixturename>`` and then use
``@pytest.fixture(name='<fixturename>')``.
Fixtures can optionally provide their values to test functions using a ``yield`` statement,
instead of ``return``. In this case, the code block after the ``yield`` statement is executed
as teardown code regardless of the test outcome. A fixture function must yield exactly once.
"""
if callable(scope) and params is None and autouse is False:
# direct decoration
return FixtureFunctionMarker("function", params, autouse, name=name)(scope)
if params is not None and not isinstance(params, (list, tuple)):
params = list(params)
return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
def yield_fixture(scope="function", params=None, autouse=False, ids=None, name=None):
""" (return a) decorator to mark a yield-fixture factory function.
.. deprecated:: 3.0
Use :py:func:`pytest.fixture` directly instead.
"""
if callable(scope) and params is None and not autouse:
# direct decoration
return FixtureFunctionMarker("function", params, autouse, ids=ids, name=name)(
scope
)
else:
return FixtureFunctionMarker(scope, params, autouse, ids=ids, name=name)
defaultfuncargprefixmarker = fixture()
@fixture(scope="session")
def pytestconfig(request):
"""Session-scoped fixture that returns the :class:`_pytest.config.Config` object.
Example::
def test_foo(pytestconfig):
if pytestconfig.getoption("verbose"):
...
"""
return request.config
class FixtureManager(object):
"""
pytest fixtures definitions and information is stored and managed
from this class.
During collection fm.parsefactories() is called multiple times to parse
fixture function definitions into FixtureDef objects and internal
data structures.
During collection of test functions, metafunc-mechanics instantiate
a FuncFixtureInfo object which is cached per node/func-name.
This FuncFixtureInfo object is later retrieved by Function nodes
which themselves offer a fixturenames attribute.
The FuncFixtureInfo object holds information about fixtures and FixtureDefs
relevant for a particular function. An initial list of fixtures is
assembled like this:
- ini-defined usefixtures
- autouse-marked fixtures along the collection chain up from the function
- usefixtures markers at module/class/function level
- test function funcargs
Subsequently the funcfixtureinfo.fixturenames attribute is computed
as the closure of the fixtures needed to setup the initial fixtures,
i. e. fixtures needed by fixture functions themselves are appended
to the fixturenames list.
Upon the test-setup phases all fixturenames are instantiated, retrieved
by a lookup of their FuncFixtureInfo.
"""
_argprefix = "pytest_funcarg__"
FixtureLookupError = FixtureLookupError
FixtureLookupErrorRepr = FixtureLookupErrorRepr
def __init__(self, session):
self.session = session
self.config = session.config
self._arg2fixturedefs = {}
self._holderobjseen = set()
self._arg2finish = {}
self._nodeid_and_autousenames = [("", self.config.getini("usefixtures"))]
session.config.pluginmanager.register(self, "funcmanage")
def getfixtureinfo(self, node, func, cls, funcargs=True):
if funcargs and not getattr(node, "nofuncargs", False):
argnames = getfuncargnames(func, cls=cls)
else:
argnames = ()
usefixtures = flatten(
mark.args for mark in node.iter_markers(name="usefixtures")
)
initialnames = argnames
initialnames = tuple(usefixtures) + initialnames
fm = node.session._fixturemanager
names_closure, arg2fixturedefs = fm.getfixtureclosure(initialnames, node)
return FuncFixtureInfo(argnames, names_closure, arg2fixturedefs)
def pytest_plugin_registered(self, plugin):
nodeid = None
try:
p = py.path.local(plugin.__file__)
except AttributeError:
pass
else:
# construct the base nodeid which is later used to check
# what fixtures are visible for particular tests (as denoted
# by their test id)
if p.basename.startswith("conftest.py"):
nodeid = p.dirpath().relto(self.config.rootdir)
if p.sep != nodes.SEP:
nodeid = nodeid.replace(p.sep, nodes.SEP)
self.parsefactories(plugin, nodeid)
def _getautousenames(self, nodeid):
""" return a tuple of fixture names to be used. """
autousenames = []
for baseid, basenames in self._nodeid_and_autousenames:
if nodeid.startswith(baseid):
if baseid:
i = len(baseid)
nextchar = nodeid[i:i + 1]
if nextchar and nextchar not in ":/":
continue
autousenames.extend(basenames)
return autousenames
def getfixtureclosure(self, fixturenames, parentnode):
# collect the closure of all fixtures , starting with the given
# fixturenames as the initial set. As we have to visit all
# factory definitions anyway, we also return an arg2fixturedefs
# mapping so that the caller can reuse it and does not have
# to re-discover fixturedefs again for each fixturename
# (discovering matching fixtures for a given name/node is expensive)
parentid = parentnode.nodeid
fixturenames_closure = self._getautousenames(parentid)
def merge(otherlist):
for arg in otherlist:
if arg not in fixturenames_closure:
fixturenames_closure.append(arg)
merge(fixturenames)
arg2fixturedefs = {}
lastlen = -1
while lastlen != len(fixturenames_closure):
lastlen = len(fixturenames_closure)
for argname in fixturenames_closure:
if argname in arg2fixturedefs:
continue
fixturedefs = self.getfixturedefs(argname, parentid)
if fixturedefs:
arg2fixturedefs[argname] = fixturedefs
merge(fixturedefs[-1].argnames)
def sort_by_scope(arg_name):
try:
fixturedefs = arg2fixturedefs[arg_name]
except KeyError:
return scopes.index("function")
else:
return fixturedefs[-1].scopenum
fixturenames_closure.sort(key=sort_by_scope)
return fixturenames_closure, arg2fixturedefs
def pytest_generate_tests(self, metafunc):
for argname in metafunc.fixturenames:
faclist = metafunc._arg2fixturedefs.get(argname)
if faclist:
fixturedef = faclist[-1]
if fixturedef.params is not None:
parametrize_func = getattr(metafunc.function, "parametrize", None)
if parametrize_func is not None:
parametrize_func = parametrize_func.combined
func_params = getattr(parametrize_func, "args", [[None]])
func_kwargs = getattr(parametrize_func, "kwargs", {})
# skip directly parametrized arguments
if "argnames" in func_kwargs:
argnames = parametrize_func.kwargs["argnames"]
else:
argnames = func_params[0]
if not isinstance(argnames, (tuple, list)):
argnames = [x.strip() for x in argnames.split(",") if x.strip()]
if argname not in func_params and argname not in argnames:
metafunc.parametrize(
argname,
fixturedef.params,
indirect=True,
scope=fixturedef.scope,
ids=fixturedef.ids,
)
else:
continue # will raise FixtureLookupError at setup time
def pytest_collection_modifyitems(self, items):
# separate parametrized setups
items[:] = reorder_items(items)
def parsefactories(self, node_or_obj, nodeid=NOTSET, unittest=False):
if nodeid is not NOTSET:
holderobj = node_or_obj
else:
holderobj = node_or_obj.obj
nodeid = node_or_obj.nodeid
if holderobj in self._holderobjseen:
return
self._holderobjseen.add(holderobj)
autousenames = []
for name in dir(holderobj):
# The attribute can be an arbitrary descriptor, so the attribute
# access below can raise. safe_getatt() ignores such exceptions.
obj = safe_getattr(holderobj, name, None)
# fixture functions have a pytest_funcarg__ prefix (pre-2.3 style)
# or are "@pytest.fixture" marked
marker = getfixturemarker(obj)
if marker is None:
if not name.startswith(self._argprefix):
continue
if not callable(obj):
continue
marker = defaultfuncargprefixmarker
from _pytest import deprecated
self.config.warn(
"C1", deprecated.FUNCARG_PREFIX.format(name=name), nodeid=nodeid
)
name = name[len(self._argprefix):]
elif not isinstance(marker, FixtureFunctionMarker):
# magic globals with __getattr__ might have got us a wrong
# fixture attribute
continue
else:
if marker.name:
name = marker.name
assert not name.startswith(self._argprefix), FIXTURE_MSG.format(name)
fixture_def = FixtureDef(
self,
nodeid,
name,
obj,
marker.scope,
marker.params,
unittest=unittest,
ids=marker.ids,
)
faclist = self._arg2fixturedefs.setdefault(name, [])
if fixture_def.has_location:
faclist.append(fixture_def)
else:
# fixturedefs with no location are at the front
# so this inserts the current fixturedef after the
# existing fixturedefs from external plugins but
# before the fixturedefs provided in conftests.
i = len([f for f in faclist if not f.has_location])
faclist.insert(i, fixture_def)
if marker.autouse:
autousenames.append(name)
if autousenames:
self._nodeid_and_autousenames.append((nodeid or "", autousenames))
def getfixturedefs(self, argname, nodeid):
"""
Gets a list of fixtures which are applicable to the given node id.
:param str argname: name of the fixture to search for
:param str nodeid: full node id of the requesting test.
:return: list[FixtureDef]
"""
try:
fixturedefs = self._arg2fixturedefs[argname]
except KeyError:
return None
else:
return tuple(self._matchfactories(fixturedefs, nodeid))
def _matchfactories(self, fixturedefs, nodeid):
for fixturedef in fixturedefs:
if nodes.ischildnode(fixturedef.baseid, nodeid):
yield fixturedef
| 411 | 0.910845 | 1 | 0.910845 | game-dev | MEDIA | 0.302642 | game-dev | 0.866083 | 1 | 0.866083 |
ME3Tweaks/LegendaryExplorer | 11,529 | LegendaryExplorer/LegendaryExplorerCore/Unreal/PhysX/PhysXCooker.cs | using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace LegendaryExplorerCore.Unreal.PhysX
{
public sealed unsafe class PhysXCooker : IDisposable
{
[DllImport(PhysXDllLoader.PHYSXCOOKING64_DLL)]
private static extern byte NxCookConvexMesh(ConvexMeshDesc* desc, PhysXStream* stream);
[DllImport(PhysXDllLoader.PHYSXCOOKING64_DLL)]
private static extern byte NxInitCooking(void* allocator, void* outputstream);
[DllImport(PhysXDllLoader.PHYSXCOOKING64_DLL)]
private static extern void NxCloseCooking();
private bool isDisposed;
public PhysXCooker()
{
if (!PhysXDllLoader.EnsureCookingDll())
{
isDisposed = true;
throw new Exception($"Unable to load {PhysXDllLoader.PHYSXCOOKING64_DLL}");
}
NxInitCooking(null, null);
}
// needs to be an instance method to ensure NXInitCooking has been called
// ReSharper disable once MemberCanBeMadeStatic.Global
public byte[] GenerateCachedPhysicsData(ReadOnlySpan<Vector3> verts)
{
fixed (Vector3* data = verts)
{
var meshDesc = new ConvexMeshDesc
{
NumVertices = (uint)verts.Length,
PointStrideBytes = 12u,
Points = data,
Flags = ConvexFlags.ComputeConvex | ConvexFlags.InflateConvex | ConvexFlags.UseUncompressedNormals
};
using var stream = new PhysXStream();
if (NxCookConvexMesh(&meshDesc, &stream) is 0)
{
throw new Exception("Convex Mesh cooking failed!");
}
byte[] cachedData = new byte[stream.Count];
new Span<byte>(stream.Data, (int)stream.Count).CopyTo(cachedData);
return cachedData;
}
}
private void InternalDispose()
{
if (!isDisposed)
{
NxCloseCooking();
isDisposed = true;
}
}
public void Dispose()
{
InternalDispose();
GC.SuppressFinalize(this);
}
~PhysXCooker()
{
InternalDispose();
}
[Flags]
private enum ConvexFlags : uint
{
FlipNormals = 1,
SixteenBitIndices = 1 << 1,
ComputeConvex = 1 << 2,
InflateConvex = 1 << 3,
UseUncompressedNormals = 1 << 5
}
[StructLayout(LayoutKind.Sequential)]
private struct ConvexMeshDesc
{
public uint NumVertices;
public uint NumTriangles;
public uint PointStrideBytes;
public uint TriangleStrideBytes;
public void* Points;
public void* Triangles;
public ConvexFlags Flags;
}
[StructLayout(LayoutKind.Sequential)]
private struct PhysXStream : IDisposable
{
private void** VFTable;
public byte* Data;
private uint Capacity;
public uint Count;
private uint ReadPos;
public PhysXStream()
{
VFTable = PhysXStreamVTable;
}
public void Dispose()
{
if (Data is not null)
{
NativeMemory.Free(Data);
Data = null;
}
}
private static readonly void** PhysXStreamVTable;
static PhysXStream()
{
PhysXStreamVTable = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(PhysXStream), sizeof(void*) * 13);
PhysXStreamVTable[0] = (delegate* unmanaged[MemberFunction]<PhysXStream*, void>)&Destructor;
PhysXStreamVTable[1] = (delegate* unmanaged[MemberFunction]<PhysXStream*, byte>)&ReadByte;
PhysXStreamVTable[2] = (delegate* unmanaged[MemberFunction]<PhysXStream*, ushort>)&ReadWord;
PhysXStreamVTable[3] = (delegate* unmanaged[MemberFunction]<PhysXStream*, uint>)&ReadDWord;
PhysXStreamVTable[4] = (delegate* unmanaged[MemberFunction]<PhysXStream*, float>)&ReadFloat;
PhysXStreamVTable[5] = (delegate* unmanaged[MemberFunction]<PhysXStream*, double>)&ReadDouble;
PhysXStreamVTable[6] = (delegate* unmanaged[MemberFunction]<PhysXStream*, void*, uint, void>)&ReadBuffer;
PhysXStreamVTable[7] = (delegate* unmanaged[MemberFunction]<PhysXStream*, byte, PhysXStream*>)&StoreByte;
PhysXStreamVTable[8] = (delegate* unmanaged[MemberFunction]<PhysXStream*, ushort, PhysXStream*>)&StoreWord;
PhysXStreamVTable[9] = (delegate* unmanaged[MemberFunction]<PhysXStream*, uint, PhysXStream*>)&StoreDWord;
PhysXStreamVTable[10] = (delegate* unmanaged[MemberFunction]<PhysXStream*, float, PhysXStream*>)&StoreFloat;
PhysXStreamVTable[11] = (delegate* unmanaged[MemberFunction]<PhysXStream*, double, PhysXStream*>)&StoreDouble;
PhysXStreamVTable[12] = (delegate* unmanaged[MemberFunction]<PhysXStream*, void*, uint, PhysXStream*>)&StoreBuffer;
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static void Destructor(PhysXStream* @this)
{
if (@this->Data is not null)
{
NativeMemory.Free(@this->Data);
@this->Data = null;
}
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static byte ReadByte(PhysXStream* @this)
{
uint pos = @this->ReadPos;
@this->ReadPos += 1;
if (pos > @this->Count)
{
@this->ReadPos = pos;
return 0;
}
return @this->Data[pos];
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static ushort ReadWord(PhysXStream* @this)
{
uint pos = @this->ReadPos;
@this->ReadPos += sizeof(ushort);
if (pos > @this->Count)
{
@this->ReadPos = pos;
return 0;
}
return *(ushort*)(@this->Data + pos);
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static uint ReadDWord(PhysXStream* @this)
{
uint pos = @this->ReadPos;
@this->ReadPos += sizeof(uint);
if (pos > @this->Count)
{
@this->ReadPos = pos;
return 0;
}
return *(uint*)(@this->Data + pos);
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static float ReadFloat(PhysXStream* @this)
{
uint pos = @this->ReadPos;
@this->ReadPos += sizeof(float);
if (pos > @this->Count)
{
@this->ReadPos = pos;
return 0;
}
return *(float*)(@this->Data + pos);
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static double ReadDouble(PhysXStream* @this)
{
uint pos = @this->ReadPos;
@this->ReadPos += sizeof(double);
if (pos > @this->Count)
{
@this->ReadPos = pos;
return 0;
}
return *(double*)(@this->Data + pos);
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static void ReadBuffer(PhysXStream* @this, void* buffer, uint size)
{
uint endPos = @this->ReadPos + size;
if (endPos <= @this->Count)
{
Buffer.MemoryCopy(@this->Data + @this->ReadPos, buffer, size, size);
}
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static PhysXStream* StoreByte(PhysXStream* @this, byte b)
{
EnsureCapacity(@this, sizeof(byte));
*(@this->Data + @this->Count) = b;
@this->Count += sizeof(byte);
return @this;
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static PhysXStream* StoreWord(PhysXStream* @this, ushort w)
{
EnsureCapacity(@this, sizeof(ushort));
*(ushort*)(@this->Data + @this->Count) = w;
@this->Count += sizeof(ushort);
return @this;
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static PhysXStream* StoreDWord(PhysXStream* @this, uint d)
{
EnsureCapacity(@this, sizeof(uint));
*(uint*)(@this->Data + @this->Count) = d;
@this->Count += sizeof(uint);
return @this;
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static PhysXStream* StoreFloat(PhysXStream* @this, float f)
{
EnsureCapacity(@this, sizeof(float));
*(float*)(@this->Data + @this->Count) = f;
@this->Count += sizeof(float);
return @this;
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static PhysXStream* StoreDouble(PhysXStream* @this, double f)
{
EnsureCapacity(@this, sizeof(double));
*(double*)(@this->Data + @this->Count) = f;
@this->Count += sizeof(double);
return @this;
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvMemberFunction) })]
public static PhysXStream* StoreBuffer(PhysXStream* @this, void* buffer, uint size)
{
EnsureCapacity(@this, size);
Buffer.MemoryCopy(buffer, @this->Data + @this->Count, @this->Capacity - @this->Count, size);
@this->Count += size;
return @this;
}
private static void EnsureCapacity(PhysXStream* @this, uint size)
{
if (@this->Data is null)
{
@this->Data = (byte*)NativeMemory.Alloc(@this->Capacity = BitOperations.RoundUpToPowerOf2(size));
@this->Count = 0;
}
uint newCount = @this->Count + size;
if (newCount > @this->Capacity)
{
@this->Data = (byte*)NativeMemory.Realloc(@this->Data, @this->Capacity = BitOperations.RoundUpToPowerOf2(newCount));
}
}
}
}
}
| 411 | 0.834578 | 1 | 0.834578 | game-dev | MEDIA | 0.638266 | game-dev | 0.64293 | 1 | 0.64293 |
SavageLabs/SavageFactions | 1,568 | src/main/java/com/massivecraft/factions/zcore/ffly/ParticleGUI.java | package com.massivecraft.factions.zcore.ffly;
import com.github.stefvanschie.inventoryframework.Gui;
import com.github.stefvanschie.inventoryframework.GuiItem;
import com.github.stefvanschie.inventoryframework.pane.PaginatedPane;
import com.massivecraft.factions.Conf;
import com.massivecraft.factions.FPlayer;
import com.massivecraft.factions.SavageFactions;
import com.massivecraft.factions.zcore.util.TL;
import org.bukkit.ChatColor;
import java.util.ArrayList;
import java.util.List;
public class ParticleGUI {
private Gui gui;
public ParticleGUI(SavageFactions instance, String title, int rows) {
gui = new Gui(instance, rows, ChatColor.translateAlternateColorCodes('&', title));
}
public void buildGUI(FPlayer fplayer) {
PaginatedPane pane = new PaginatedPane(0, 0, 9, gui.getRows());
List<GuiItem> particleEffectItems = new ArrayList<>();
Conf.particleEffectSettings.forEach((particle, data) ->
// TODO: Enchantment for isGlowing in itembuilder breaks itemstack equal check on 1.12.2. Fix it.
particleEffectItems.add(new GuiItem(data.getItem().buildItemStack(false), inventoryClickEvent -> {
inventoryClickEvent.setCancelled(true);
fplayer.setSelectedParticle(particle);
fplayer.msg(TL.COMMAND_PARTICLE_SELECTED_PARTICLE.toString().replace("{particle}", particle.name()));
})));
pane.populateWithGuiItems(particleEffectItems);
gui.addPane(pane);
gui.update();
gui.show(fplayer.getPlayer());
}
}
| 411 | 0.793308 | 1 | 0.793308 | game-dev | MEDIA | 0.960757 | game-dev | 0.882035 | 1 | 0.882035 |
followingthefasciaplane/source-engine-diff-check | 56,695 | misc/vphysics/physics_vehicle.cpp | //========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifdef _WIN32
#pragma warning (disable:4127)
#pragma warning (disable:4244)
#endif
#include "cbase.h"
#include "ivp_controller.hxx"
#include "ivp_cache_object.hxx"
#include "ivp_car_system.hxx"
#include "ivp_constraint_car.hxx"
#include "ivp_material.hxx"
#include "vphysics/vehicles.h"
#include "vphysics/friction.h"
#include "physics_vehicle.h"
#include "physics_controller_raycast_vehicle.h"
#include "physics_airboat.h"
#include "ivp_car_system.hxx"
#include "ivp_listener_object.hxx"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
#define THROTTLE_OPPOSING_FORCE_EPSILON 5.0f
#define VEHICLE_SKID_EPSILON 0.1f
// y in/s = x miles/hour * (5280 * 12 (in / mile)) * (1 / 3600 (hour / sec) )
//#define MPH2INS(x) ( (x) * 5280.0f * 12.0f / 3600.0f )
//#define INS2MPH(x) ( (x) * 3600 * (1/5280.0f) * (1/12.0f) )
#define MPH_TO_METERSPERSECOND 0.44707f
#define METERSPERSECOND_TO_MPH (1.0f / MPH_TO_METERSPERSECOND)
#define MPH_TO_GAMEVEL(x) (ConvertDistanceToHL( (x) * MPH_TO_METERSPERSECOND ))
#define GAMEVEL_TO_MPH(x) (ConvertDistanceToIVP(x) * METERSPERSECOND_TO_MPH)
#define FVEHICLE_THROTTLE_STOPPED 0x00000001
#define FVEHICLE_HANDBRAKE_ON 0x00000002
struct vphysics_save_cvehiclecontroller_t
{
CPhysicsObject *m_pCarBody;
int m_wheelCount;
vehicleparams_t m_vehicleData;
vehicle_operatingparams_t m_currentState;
float m_wheelRadius;
float m_bodyMass;
float m_totalWheelMass;
float m_gravityLength;
float m_torqueScale;
CPhysicsObject *m_pWheels[VEHICLE_MAX_WHEEL_COUNT];
Vector m_wheelPosition_Bs[VEHICLE_MAX_WHEEL_COUNT];
Vector m_tracePosition_Bs[VEHICLE_MAX_WHEEL_COUNT];
int m_vehicleFlags;
unsigned int m_nTireType;
unsigned int m_nVehicleType;
bool m_bTraceData;
bool m_bOccupied;
bool m_bEngineDisable;
float m_flVelocity[3];
DECLARE_SIMPLE_DATADESC();
};
BEGIN_SIMPLE_DATADESC( vphysics_save_cvehiclecontroller_t )
DEFINE_VPHYSPTR( m_pCarBody ),
DEFINE_FIELD( m_wheelCount, FIELD_INTEGER ),
DEFINE_EMBEDDED( m_vehicleData ),
DEFINE_EMBEDDED( m_currentState ),
DEFINE_FIELD( m_wheelCount, FIELD_INTEGER ),
DEFINE_FIELD( m_bodyMass, FIELD_FLOAT ),
DEFINE_FIELD( m_totalWheelMass, FIELD_FLOAT ),
DEFINE_FIELD( m_gravityLength, FIELD_FLOAT ),
DEFINE_FIELD( m_torqueScale, FIELD_FLOAT ),
DEFINE_VPHYSPTR_ARRAY( m_pWheels, VEHICLE_MAX_WHEEL_COUNT ),
DEFINE_ARRAY( m_wheelPosition_Bs, FIELD_VECTOR, VEHICLE_MAX_WHEEL_COUNT ),
DEFINE_ARRAY( m_tracePosition_Bs, FIELD_VECTOR, VEHICLE_MAX_WHEEL_COUNT ),
DEFINE_FIELD( m_vehicleFlags, FIELD_INTEGER ),
DEFINE_FIELD( m_nTireType, FIELD_INTEGER ),
DEFINE_FIELD( m_nVehicleType, FIELD_INTEGER ),
DEFINE_FIELD( m_bTraceData, FIELD_BOOLEAN ),
DEFINE_FIELD( m_bOccupied, FIELD_BOOLEAN ),
DEFINE_FIELD( m_bEngineDisable, FIELD_BOOLEAN ),
DEFINE_ARRAY( m_flVelocity, FIELD_FLOAT, 3 ),
END_DATADESC()
BEGIN_SIMPLE_DATADESC( vehicle_operatingparams_t )
DEFINE_FIELD( speed, FIELD_FLOAT ),
DEFINE_FIELD( engineRPM, FIELD_FLOAT ),
DEFINE_FIELD( gear, FIELD_INTEGER ),
DEFINE_FIELD( boostDelay, FIELD_FLOAT ),
DEFINE_FIELD( boostTimeLeft, FIELD_INTEGER ),
DEFINE_FIELD( skidSpeed, FIELD_FLOAT ),
DEFINE_CUSTOM_FIELD( skidMaterial, MaterialIndexDataOps() ),
DEFINE_FIELD( steeringAngle, FIELD_FLOAT ),
DEFINE_FIELD( wheelsInContact, FIELD_INTEGER ),
DEFINE_FIELD( wheelsNotInContact,FIELD_INTEGER ),
DEFINE_FIELD( isTorqueBoosting, FIELD_BOOLEAN ),
END_DATADESC()
BEGIN_SIMPLE_DATADESC( vehicle_bodyparams_t )
DEFINE_FIELD( massCenterOverride, FIELD_VECTOR ),
DEFINE_FIELD( massOverride, FIELD_FLOAT ),
DEFINE_FIELD( addGravity, FIELD_FLOAT ),
DEFINE_FIELD( maxAngularVelocity, FIELD_FLOAT ),
DEFINE_FIELD( tiltForce, FIELD_FLOAT ),
DEFINE_FIELD( tiltForceHeight, FIELD_FLOAT ),
DEFINE_FIELD( counterTorqueFactor, FIELD_FLOAT ),
DEFINE_FIELD( keepUprightTorque, FIELD_FLOAT ),
END_DATADESC()
BEGIN_SIMPLE_DATADESC( vehicle_wheelparams_t )
DEFINE_FIELD( radius, FIELD_FLOAT ),
DEFINE_FIELD( mass, FIELD_FLOAT ),
DEFINE_FIELD( inertia, FIELD_FLOAT ),
DEFINE_FIELD( damping, FIELD_FLOAT ),
DEFINE_FIELD( rotdamping, FIELD_FLOAT ),
DEFINE_FIELD( frictionScale, FIELD_FLOAT ),
DEFINE_CUSTOM_FIELD( materialIndex, MaterialIndexDataOps() ),
DEFINE_CUSTOM_FIELD( brakeMaterialIndex, MaterialIndexDataOps() ),
DEFINE_CUSTOM_FIELD( skidMaterialIndex, MaterialIndexDataOps() ),
DEFINE_FIELD( springAdditionalLength, FIELD_FLOAT ),
END_DATADESC()
BEGIN_SIMPLE_DATADESC( vehicle_suspensionparams_t )
DEFINE_FIELD( springConstant, FIELD_FLOAT ),
DEFINE_FIELD( springDamping, FIELD_FLOAT ),
DEFINE_FIELD( stabilizerConstant, FIELD_FLOAT ),
DEFINE_FIELD( springDampingCompression, FIELD_FLOAT ),
DEFINE_FIELD( maxBodyForce, FIELD_FLOAT ),
END_DATADESC()
BEGIN_SIMPLE_DATADESC( vehicle_axleparams_t )
DEFINE_FIELD( offset, FIELD_VECTOR ),
DEFINE_FIELD( wheelOffset, FIELD_VECTOR ),
DEFINE_FIELD( raytraceCenterOffset, FIELD_VECTOR ),
DEFINE_FIELD( raytraceOffset, FIELD_VECTOR ),
DEFINE_EMBEDDED( wheels ),
DEFINE_EMBEDDED( suspension ),
DEFINE_FIELD( torqueFactor, FIELD_FLOAT ),
DEFINE_FIELD( brakeFactor, FIELD_FLOAT ),
END_DATADESC()
BEGIN_SIMPLE_DATADESC( vehicle_steeringparams_t )
DEFINE_FIELD( degreesSlow, FIELD_FLOAT ),
DEFINE_FIELD( degreesFast, FIELD_FLOAT ),
DEFINE_FIELD( degreesBoost, FIELD_FLOAT ),
DEFINE_FIELD( steeringRateSlow, FIELD_FLOAT ),
DEFINE_FIELD( steeringRateFast, FIELD_FLOAT ),
DEFINE_FIELD( steeringRestRateSlow, FIELD_FLOAT ),
DEFINE_FIELD( steeringRestRateFast, FIELD_FLOAT ),
DEFINE_FIELD( throttleSteeringRestRateFactor, FIELD_FLOAT ),
DEFINE_FIELD( boostSteeringRestRateFactor, FIELD_FLOAT ),
DEFINE_FIELD( boostSteeringRateFactor, FIELD_FLOAT ),
DEFINE_FIELD( steeringExponent, FIELD_FLOAT ),
DEFINE_FIELD( speedSlow, FIELD_FLOAT ),
DEFINE_FIELD( speedFast, FIELD_FLOAT ),
DEFINE_FIELD( turnThrottleReduceSlow, FIELD_FLOAT ),
DEFINE_FIELD( turnThrottleReduceFast, FIELD_FLOAT ),
DEFINE_FIELD( powerSlideAccel, FIELD_FLOAT ),
DEFINE_FIELD( brakeSteeringRateFactor, FIELD_FLOAT ),
DEFINE_FIELD( isSkidAllowed, FIELD_BOOLEAN ),
DEFINE_FIELD( dustCloud, FIELD_BOOLEAN ),
END_DATADESC()
BEGIN_SIMPLE_DATADESC( vehicle_engineparams_t )
DEFINE_FIELD( horsepower, FIELD_FLOAT ),
DEFINE_FIELD( maxSpeed, FIELD_FLOAT ),
DEFINE_FIELD( maxRevSpeed, FIELD_FLOAT ),
DEFINE_FIELD( maxRPM, FIELD_FLOAT ),
DEFINE_FIELD( axleRatio, FIELD_FLOAT ),
DEFINE_FIELD( throttleTime, FIELD_FLOAT ),
DEFINE_FIELD( maxRPM, FIELD_FLOAT ),
DEFINE_FIELD( isAutoTransmission, FIELD_BOOLEAN ),
DEFINE_FIELD( gearCount, FIELD_INTEGER ),
DEFINE_AUTO_ARRAY( gearRatio, FIELD_FLOAT ),
DEFINE_FIELD( shiftUpRPM, FIELD_FLOAT ),
DEFINE_FIELD( shiftDownRPM, FIELD_FLOAT ),
DEFINE_FIELD( boostForce, FIELD_FLOAT ),
DEFINE_FIELD( boostDuration, FIELD_FLOAT ),
DEFINE_FIELD( boostDelay, FIELD_FLOAT ),
DEFINE_FIELD( boostMaxSpeed, FIELD_FLOAT ),
DEFINE_FIELD( autobrakeSpeedGain, FIELD_FLOAT ),
DEFINE_FIELD( autobrakeSpeedFactor, FIELD_FLOAT ),
DEFINE_FIELD( torqueBoost, FIELD_BOOLEAN ),
END_DATADESC()
BEGIN_SIMPLE_DATADESC( vehicleparams_t )
DEFINE_FIELD( axleCount, FIELD_INTEGER ),
DEFINE_FIELD( wheelsPerAxle, FIELD_INTEGER ),
DEFINE_EMBEDDED( body ),
DEFINE_EMBEDDED_AUTO_ARRAY( axles ),
DEFINE_EMBEDDED( engine ),
DEFINE_EMBEDDED( steering ),
END_DATADESC()
bool IsVehicleWheel( IVP_Real_Object *pivp )
{
CPhysicsObject *pObject = static_cast<CPhysicsObject *>(pivp->client_data);
// FIXME: Check why this is null! It occurs when jumping the ravine in seafloor
if (!pObject)
return false;
return (pObject->CallbackFlags() & CALLBACK_IS_VEHICLE_WHEEL) ? true : false;
}
inline bool IsMoveable( IVP_Real_Object *pObject )
{
IVP_Core *pCore = pObject->get_core();
if ( pCore->pinned || pCore->physical_unmoveable )
return false;
return true;
}
inline bool IVPFloatPointIsZero( const IVP_U_Float_Point &test )
{
const float eps = 1e-4f;
return test.quad_length() < eps ? true : false;
}
bool ShouldOverrideWheelContactFriction( float *pFrictionOut, IVP_Real_Object *pivp0, IVP_Real_Object *pivp1, IVP_U_Float_Point *pNormal )
{
if ( !pivp0->get_core()->car_wheel && !pivp1->get_core()->car_wheel )
return false;
if ( !IsVehicleWheel(pivp0) )
{
if ( !IsVehicleWheel(pivp1) )
return false;
// swap so pivp0 is a wheel
IVP_Real_Object *pTmp = pivp0;
pivp0 = pivp1;
pivp1 = pTmp;
}
// if we got here then pivp0 is a car wheel object
// BUGBUG: IVP sometimes sends us a bogus normal
// when doing a material realc on existing contacts!
if ( !IVPFloatPointIsZero(pNormal) )
{
IVP_U_Float_Point normalWheelSpace;
pivp0->get_core()->get_m_world_f_core_PSI()->vimult3( pNormal, &normalWheelSpace );
if ( fabs(normalWheelSpace.k[0]) > 0.2588f ) // 15 degree wheel cone
{
// adjust friction here, this isn't a valid part of the wheel for contact, set friction to zero
//Vector tmp;ConvertDirectionToHL( normalWheelSpace, tmp );Msg("Wheel sliding on surface %.2f %.2f %.2f\n", tmp.x, tmp.y, tmp.z );
*pFrictionOut = 0;
return true;
}
}
// was car wheel, but didn't adjust - use default friction
return false;
}
class CVehicleController : public IPhysicsVehicleController, public IVP_Listener_Object
{
public:
CVehicleController( );
CVehicleController( const vehicleparams_t ¶ms, CPhysicsEnvironment *pEnv, unsigned int nVehicleType, IPhysicsGameTrace *pGameTrace );
~CVehicleController();
// CVehicleController
void InitCarSystem( CPhysicsObject *pBodyObject );
// IPhysicsVehicleController
void Update( float dt, vehicle_controlparams_t &controls );
float UpdateBooster( float dt );
void SetSpringLength(int wheelIndex, float length);
const vehicle_operatingparams_t &GetOperatingParams() { return m_currentState; }
const vehicleparams_t &GetVehicleParams() { return m_vehicleData; }
vehicleparams_t &GetVehicleParamsForChange() { return m_vehicleData; }
int GetWheelCount(void) { return m_wheelCount; };
IPhysicsObject* GetWheel(int index);
virtual bool GetWheelContactPoint( int index, Vector *pContactPoint, int *pSurfaceProps );
void SetWheelFriction(int wheelIndex, float friction);
void SetEngineDisabled( bool bDisable ) { m_bEngineDisable = bDisable; }
bool IsEngineDisabled( void ) { return m_bEngineDisable; }
// Save/load
void WriteToTemplate( vphysics_save_cvehiclecontroller_t &controllerTemplate );
void InitFromTemplate( CPhysicsEnvironment *pEnv, void *pGameData, IPhysicsGameTrace *pGameTrace, const vphysics_save_cvehiclecontroller_t &controllerTemplate );
void VehicleDataReload();
// Debug
void GetCarSystemDebugData( vehicle_debugcarsystem_t &debugCarSystem );
// IVP_Listener_Object
// Object listener, only hook delete
virtual void event_object_deleted( IVP_Event_Object *);
virtual void event_object_created( IVP_Event_Object *) {}
virtual void event_object_revived( IVP_Event_Object *) {}
virtual void event_object_frozen ( IVP_Event_Object *) {}
// Entry/Exit
void OnVehicleEnter( void );
void OnVehicleExit( void );
protected:
void CreateIVPObjects( );
void ShutdownCarSystem();
void InitVehicleData( const vehicleparams_t ¶ms );
void InitCarSystemBody( IVP_Template_Car_System &ivpVehicleData );
void InitCarSystemWheels( IVP_Template_Car_System &ivpVehicleData );
void AttachListener();
IVP_Real_Object *CreateWheel( int wheelIndex, vehicle_axleparams_t &axle );
void CreateTraceData( int wheelIndex, vehicle_axleparams_t &axle );
// Update.
void UpdateSteering( const vehicle_controlparams_t &controls, float flDeltaTime, float flSpeed );
void UpdatePowerslide( const vehicle_controlparams_t &controls, bool bPowerslide, float flSpeed );
void UpdateEngine( const vehicle_controlparams_t &controls, float flDeltaTime, float flThrottle, float flBrake, bool bHandbrake, bool bPowerslide );
bool UpdateEngineTurboStart( const vehicle_controlparams_t &controls, float flDeltaTime );
void UpdateEngineTurboFinish( void );
void UpdateHandbrake( const vehicle_controlparams_t &controls, float flThrottle, bool bHandbrake, bool bPowerslide );
void UpdateSkidding( bool bHandbrake );
void UpdateExtraForces( void );
void UpdateWheelPositions( void );
float CalcSteering( float dt, float speed, float steering, bool bAnalog );
void CalcEngine( float throttle, float brake_val, bool handbrake, float steeringVal, bool torqueBoost );
void CalcEngineTransmission( float flThrottle );
virtual bool IsBoosting( void );
private:
void ResetState();
IVP_Car_System *m_pCarSystem;
CPhysicsObject *m_pCarBody;
CPhysicsEnvironment *m_pEnv;
IPhysicsGameTrace *m_pGameTrace;
int m_wheelCount;
vehicleparams_t m_vehicleData;
vehicle_operatingparams_t m_currentState;
float m_wheelRadius;
float m_bodyMass;
float m_totalWheelMass;
float m_gravityLength;
float m_torqueScale;
CPhysicsObject *m_pWheels[VEHICLE_MAX_WHEEL_COUNT];
IVP_U_Float_Point m_wheelPosition_Bs[VEHICLE_MAX_WHEEL_COUNT];
IVP_U_Float_Point m_tracePosition_Bs[VEHICLE_MAX_WHEEL_COUNT];
int m_vehicleFlags;
unsigned int m_nTireType;
unsigned int m_nVehicleType;
bool m_bTraceData;
bool m_bOccupied;
bool m_bEngineDisable;
float m_flVelocity[3];
};
CVehicleController::CVehicleController( const vehicleparams_t ¶ms, CPhysicsEnvironment *pEnv, unsigned int nVehicleType, IPhysicsGameTrace *pGameTrace )
{
m_pEnv = pEnv;
m_pGameTrace = pGameTrace;
m_nVehicleType = nVehicleType;
InitVehicleData( params );
ResetState();
}
CVehicleController::CVehicleController()
{
ResetState();
}
void CVehicleController::ResetState()
{
m_pCarSystem = NULL;
m_flVelocity[0] = m_flVelocity[1]= m_flVelocity[2] = 0.0f;
for ( int i = 0; i < VEHICLE_MAX_WHEEL_COUNT; i++ )
{
m_pWheels[i] = NULL;
}
m_pCarBody = NULL;
m_torqueScale = 1;
m_wheelCount = 0;
m_wheelRadius = 0;
memset( &m_currentState, 0, sizeof(m_currentState) );
m_bodyMass = 0;
m_vehicleFlags = 0;
memset( m_wheelPosition_Bs, 0, sizeof(m_wheelPosition_Bs) );
memset( m_tracePosition_Bs, 0, sizeof(m_tracePosition_Bs) );
m_bTraceData = false;
if ( m_nVehicleType == VEHICLE_TYPE_AIRBOAT_RAYCAST )
{
m_bTraceData = true;
}
m_nTireType = VEHICLE_TIRE_NORMAL;
m_bOccupied = false;
m_bEngineDisable = false;
}
CVehicleController::~CVehicleController()
{
ShutdownCarSystem();
}
IPhysicsObject* CVehicleController::GetWheel( int index )
{
// TODO: This is getting messy.
if ( m_nVehicleType == VEHICLE_TYPE_CAR_WHEELS )
{
return m_pWheels[index];
}
else if ( m_nVehicleType == VEHICLE_TYPE_CAR_RAYCAST && m_pCarSystem )
{
return static_cast<CPhysics_Car_System_Raycast_Wheels*>( m_pCarSystem )->GetWheel( index );
}
else if ( m_nVehicleType == VEHICLE_TYPE_AIRBOAT_RAYCAST && m_pCarSystem )
{
return static_cast<CPhysics_Airboat*>( m_pCarSystem )->GetWheel( index );
}
return NULL;
}
void CVehicleController::SetWheelFriction(int wheelIndex, float friction)
{
CPhysics_Airboat *pAirboat = static_cast<CPhysics_Airboat*>( m_pCarSystem );
if ( !pAirboat )
return;
pAirboat->SetWheelFriction( wheelIndex, friction );
}
bool CVehicleController::GetWheelContactPoint( int index, Vector *pContactPoint, int *pSurfaceProps )
{
bool bSet = false;
if ( index < m_wheelCount )
{
IPhysicsFrictionSnapshot *pSnapshot = m_pWheels[index]->CreateFrictionSnapshot();
float forceMax = -1.0f;
m_pWheels[index]->GetPosition( pContactPoint, NULL );
while ( pSnapshot->IsValid() )
{
float thisForce = pSnapshot->GetNormalForce();
if ( thisForce > forceMax )
{
forceMax = thisForce;
if ( pContactPoint )
{
pSnapshot->GetContactPoint( *pContactPoint );
}
if ( pSurfaceProps )
{
*pSurfaceProps = pSnapshot->GetMaterial(1);
}
bSet = true;
}
pSnapshot->NextFrictionData();
}
m_pWheels[index]->DestroyFrictionSnapshot(pSnapshot);
}
else
{
if ( pContactPoint )
{
pContactPoint->Init();
}
if ( pSurfaceProps )
{
*pSurfaceProps = 0;
}
}
return bSet;
}
void CVehicleController::AttachListener()
{
m_pCarBody->GetObject()->add_listener_object( this );
}
void CVehicleController::event_object_deleted( IVP_Event_Object *pEvent )
{
// the car system's constraint solver is going to delete itself now, so NULL the car system.
m_pCarSystem->event_object_deleted( pEvent );
m_pCarSystem = NULL;
ShutdownCarSystem();
}
IVP_Real_Object *CVehicleController::CreateWheel( int wheelIndex, vehicle_axleparams_t &axle )
{
if ( wheelIndex >= VEHICLE_MAX_WHEEL_COUNT )
return NULL;
// HACKHACK: In Save/load, the wheel was reloaded, so pretend to create it
// ALSO NOTE: Save/load puts the results into m_pWheels regardless of vehicle type!!!
// That's why I'm not calling GetWheel().
if ( m_pWheels[wheelIndex] )
{
CPhysicsObject *pWheelObject = static_cast<CPhysicsObject *>(m_pWheels[wheelIndex]);
return pWheelObject->GetObject();
}
objectparams_t params;
memset( ¶ms, 0, sizeof(params) );
Vector bodyPosition;
QAngle bodyAngles;
m_pCarBody->GetPosition( &bodyPosition, &bodyAngles );
matrix3x4_t matrix;
AngleMatrix( bodyAngles, bodyPosition, matrix );
Vector position = axle.offset;
// BUGBUG: This only works with 2 wheels per axle
if ( wheelIndex & 1 )
{
position += axle.wheelOffset;
}
else
{
position -= axle.wheelOffset;
}
Vector wheelPositionHL;
VectorTransform( position, matrix, wheelPositionHL );
params.damping = axle.wheels.damping;
params.dragCoefficient = 0;
params.enableCollisions = false;
params.inertia = axle.wheels.inertia;
params.mass = axle.wheels.mass;
params.pGameData = m_pCarBody->GetGameData();
params.pName = "VehicleWheel";
params.rotdamping = axle.wheels.rotdamping;
params.rotInertiaLimit = 0;
params.massCenterOverride = NULL;
// needs to be in HL units because we're calling through the "outer" interface to create
// the wheels
float radius = axle.wheels.radius;
float r3 = radius * radius * radius;
params.volume = (4 / 3) * M_PI * r3;
CPhysicsObject *pWheel = (CPhysicsObject *)m_pEnv->CreateSphereObject( radius, axle.wheels.materialIndex, wheelPositionHL, bodyAngles, ¶ms, false );
pWheel->Wake();
// UNDONE: only mask off some of these flags?
unsigned int flags = pWheel->CallbackFlags();
flags = 0;
pWheel->SetCallbackFlags( flags );
// copy the body's game flags
pWheel->SetGameFlags( m_pCarBody->GetGameFlags() );
// cache the wheel object pointer
m_pWheels[wheelIndex] = pWheel;
IVP_U_Point wheelPositionIVP, wheelPositionBs;
ConvertPositionToIVP( wheelPositionHL, wheelPositionIVP );
TransformIVPToLocal( wheelPositionIVP, wheelPositionBs, m_pCarBody->GetObject(), true );
m_wheelPosition_Bs[wheelIndex].set_to_zero();
m_wheelPosition_Bs[wheelIndex].set( &wheelPositionBs );
pWheel->AddCallbackFlags( CALLBACK_IS_VEHICLE_WHEEL );
return pWheel->GetObject();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleController::CreateTraceData( int wheelIndex, vehicle_axleparams_t &axle )
{
if ( wheelIndex >= VEHICLE_MAX_WHEEL_COUNT )
return;
objectparams_t params;
memset( ¶ms, 0, sizeof( params ) );
Vector bodyPosition;
QAngle bodyAngles;
matrix3x4_t matrix;
m_pCarBody->GetPosition( &bodyPosition, &bodyAngles );
AngleMatrix( bodyAngles, bodyPosition, matrix );
Vector tracePosition = axle.raytraceCenterOffset;
// BUGBUG: This only works with 2 wheels per axle
if ( wheelIndex & 1 )
{
tracePosition += axle.raytraceOffset;
}
else
{
tracePosition -= axle.raytraceOffset;
}
Vector tracePositionHL;
VectorTransform( tracePosition, matrix, tracePositionHL );
IVP_U_Point tracePositionIVP, tracePositionBs;
ConvertPositionToIVP( tracePositionHL, tracePositionIVP );
TransformIVPToLocal( tracePositionIVP, tracePositionBs, m_pCarBody->GetObject(), true );
m_tracePosition_Bs[wheelIndex].set_to_zero();
m_tracePosition_Bs[wheelIndex].set( &tracePositionBs );
}
void CVehicleController::CreateIVPObjects( )
{
// Initialize the car system (body and wheels).
IVP_Template_Car_System ivpVehicleData( m_wheelCount, m_vehicleData.axleCount );
InitCarSystemBody( ivpVehicleData );
InitCarSystemWheels( ivpVehicleData );
BEGIN_IVP_ALLOCATION();
// Raycast Car
switch ( m_nVehicleType )
{
case VEHICLE_TYPE_CAR_WHEELS:
m_pCarSystem = new IVP_Car_System_Real_Wheels( m_pEnv->GetIVPEnvironment(), &ivpVehicleData );
break
;
case VEHICLE_TYPE_CAR_RAYCAST:
m_pCarSystem = new CPhysics_Car_System_Raycast_Wheels( m_pEnv->GetIVPEnvironment(), &ivpVehicleData );
break;
case VEHICLE_TYPE_AIRBOAT_RAYCAST:
m_pCarSystem = new CPhysics_Airboat( m_pEnv->GetIVPEnvironment(), &ivpVehicleData, m_pGameTrace );
break;
}
AttachListener();
END_IVP_ALLOCATION();
}
void CVehicleController::InitCarSystem( CPhysicsObject *pBodyObject )
{
if ( m_pCarSystem )
{
ShutdownCarSystem();
}
// Car body.
m_pCarBody = pBodyObject;
m_bodyMass = m_pCarBody->GetMass();
m_gravityLength = m_pEnv->GetIVPEnvironment()->get_gravity()->real_length();
// Setup axle/wheel counts.
m_wheelCount = m_vehicleData.axleCount * m_vehicleData.wheelsPerAxle;
CreateIVPObjects();
if ( m_nVehicleType == VEHICLE_TYPE_AIRBOAT_RAYCAST )
{
float flDampSpeed = 1.0f;
float flDampRotSpeed = 1.0f;
m_pCarBody->SetDamping( &flDampSpeed, &flDampRotSpeed );
}
}
void CVehicleController::VehicleDataReload()
{
// compute torque normalization factor
m_torqueScale = 1;
// Clear accumulation.
float totalTorqueDistribution = 0.0f;
for ( int i = 0; i < m_vehicleData.axleCount; i++ )
{
totalTorqueDistribution += m_vehicleData.axles[i].torqueFactor;
}
if ( totalTorqueDistribution > 0 )
{
m_torqueScale /= totalTorqueDistribution;
}
// input speed is in miles/hour. Convert to in/s
m_vehicleData.engine.maxSpeed = MPH_TO_GAMEVEL(m_vehicleData.engine.maxSpeed);
m_vehicleData.engine.maxRevSpeed = MPH_TO_GAMEVEL(m_vehicleData.engine.maxRevSpeed);
m_vehicleData.engine.boostMaxSpeed = MPH_TO_GAMEVEL(m_vehicleData.engine.boostMaxSpeed);
}
//-----------------------------------------------------------------------------
// Purpose: Setup the body parameters.
//-----------------------------------------------------------------------------
void CVehicleController::InitCarSystemBody( IVP_Template_Car_System &ivpVehicleData )
{
ivpVehicleData.car_body = m_pCarBody->GetObject();
ivpVehicleData.index_x = IVP_INDEX_X;
ivpVehicleData.index_y = IVP_INDEX_Y;
ivpVehicleData.index_z = IVP_INDEX_Z;
ivpVehicleData.body_counter_torque_factor = m_vehicleData.body.counterTorqueFactor;
ivpVehicleData.body_down_force_vertical_offset = ConvertDistanceToIVP( m_vehicleData.body.tiltForceHeight );
ivpVehicleData.extra_gravity_force_value = m_vehicleData.body.addGravity * m_gravityLength * m_bodyMass;
ivpVehicleData.extra_gravity_height_offset = 0;
#if 0
// HACKHACK: match example
ivpVehicleData.extra_gravity_force_value = 1.2;
ivpVehicleData.body_down_force_vertical_offset = 2;
#endif
}
//-----------------------------------------------------------------------------
// Purpose: Setup the wheel paramters.
//-----------------------------------------------------------------------------
void CVehicleController::InitCarSystemWheels( IVP_Template_Car_System &ivpVehicleData )
{
int wheelIndex = 0;
m_wheelRadius = 0;
m_totalWheelMass = 0;
int i;
for ( i = 0; i < m_vehicleData.axleCount; i++ )
{
for ( int w = 0; w < m_vehicleData.wheelsPerAxle; w++, wheelIndex++ )
{
IVP_Real_Object *pWheel = CreateWheel( wheelIndex, m_vehicleData.axles[i] );
if ( pWheel )
{
// Create ray trace data for wheel.
if ( m_bTraceData )
{
CreateTraceData( wheelIndex, m_vehicleData.axles[i] );
}
ivpVehicleData.car_wheel[wheelIndex] = pWheel;
ivpVehicleData.wheel_radius[wheelIndex] = pWheel->get_core()->upper_limit_radius;
ivpVehicleData.wheel_reversed_sign[wheelIndex] = 1.0;
// only for raycast car
ivpVehicleData.friction_of_wheel[wheelIndex] = m_vehicleData.axles[i].wheels.frictionScale;
ivpVehicleData.spring_constant[wheelIndex] = m_vehicleData.axles[i].suspension.springConstant * m_bodyMass;
ivpVehicleData.spring_dampening[wheelIndex] = m_vehicleData.axles[i].suspension.springDamping * m_bodyMass;
ivpVehicleData.spring_dampening_compression[wheelIndex] = m_vehicleData.axles[i].suspension.springDampingCompression * m_bodyMass;
ivpVehicleData.max_body_force[wheelIndex] = m_vehicleData.axles[i].suspension.maxBodyForce * m_bodyMass;
ivpVehicleData.spring_pre_tension[wheelIndex] = -ConvertDistanceToIVP( m_vehicleData.axles[i].wheels.springAdditionalLength );
ivpVehicleData.wheel_pos_Bos[wheelIndex] = m_wheelPosition_Bs[wheelIndex];
if ( m_bTraceData )
{
ivpVehicleData.trace_pos_Bos[wheelIndex] = m_tracePosition_Bs[wheelIndex];
}
m_totalWheelMass += m_vehicleData.axles[i].wheels.mass;
}
}
ivpVehicleData.stabilizer_constant[i] = m_vehicleData.axles[i].suspension.stabilizerConstant * m_bodyMass;
// this should output in radians per second
float radius = ConvertDistanceToIVP( m_vehicleData.axles[i].wheels.radius );
float totalMaxSpeed = max( m_vehicleData.engine.boostMaxSpeed, m_vehicleData.engine.maxSpeed );
ivpVehicleData.wheel_max_rotation_speed[i] = totalMaxSpeed / radius;
if ( radius > m_wheelRadius )
{
m_wheelRadius = radius;
}
}
for ( i = 0; i < m_wheelCount; i++ )
{
m_pWheels[i]->EnableCollisions( true );
}
}
void CVehicleController::ShutdownCarSystem()
{
delete m_pCarSystem;
m_pCarSystem = NULL;
for ( int i = 0; i < m_wheelCount; i++ )
{
if ( m_pWheels[i] )
{
m_pEnv->DestroyObject( m_pWheels[i] );
}
m_pWheels[i] = NULL;
}
}
void CVehicleController::InitVehicleData( const vehicleparams_t ¶ms )
{
m_vehicleData = params;
VehicleDataReload();
}
void CVehicleController::SetSpringLength(int wheelIndex, float length)
{
m_pCarSystem->change_spring_length((IVP_POS_WHEEL)wheelIndex, length);
}
//-----------------------------------------------------------------------------
// Purpose: Allows booster timer to run,
// Returns: true if time still exists
// false if timer has run out (i.e. can use boost again)
//-----------------------------------------------------------------------------
float CVehicleController::UpdateBooster( float dt )
{
m_pCarSystem->update_booster( dt );
m_currentState.boostDelay = m_pCarSystem->get_booster_delay();
return m_currentState.boostDelay;
}
//-----------------------------------------------------------------------------
// Purpose: Are whe boosting?
//-----------------------------------------------------------------------------
bool CVehicleController::IsBoosting( void )
{
return ( m_pCarSystem->get_booster_time_to_go() > 0.0f );
}
//-----------------------------------------------------------------------------
// Purpose: Update the vehicle controller.
//-----------------------------------------------------------------------------
void CVehicleController::Update( float dt, vehicle_controlparams_t &controlsIn )
{
vehicle_controlparams_t controls = controlsIn;
// Speed.
m_currentState.speed = ConvertDistanceToHL( m_pCarSystem->get_body_speed() );
float flSpeed = GAMEVEL_TO_MPH( m_currentState.speed );
float flAbsSpeed = fabsf( flSpeed );
// Calculate the throttle and brake values.
float flThrottle = controls.throttle;
bool bHandbrake = controls.handbrake;
float flBrake = controls.brake;
bool bPowerslide = bHandbrake && ( flAbsSpeed > 18.0f );
if ( bHandbrake )
{
flThrottle = 0.0f;
}
if ( IsBoosting() )
{
controls.boost = true;
flThrottle = flThrottle < 0.0f ? -1.0f : 1.0f;
}
if ( flThrottle == 0.0f && flBrake == 0.0f && !bHandbrake )
{
flBrake = 0.1f;
}
// Update steering.
UpdateSteering( controls, dt, flAbsSpeed );
// Update powerslide.
UpdatePowerslide( controls, bPowerslide, flSpeed );
// Update engine.
UpdateEngine( controls, dt, flThrottle, flBrake, bHandbrake, bPowerslide );
// Update handbrake.
UpdateHandbrake( controls, flThrottle, bHandbrake, bPowerslide );
// Update skidding.
UpdateSkidding( bHandbrake );
// Apply the extra forces to the car (downward, counter-torque, etc.)
UpdateExtraForces();
// Update the physical position of the wheels for raycast vehicles.
UpdateWheelPositions();
}
//-----------------------------------------------------------------------------
// Purpose: Update the steering on the vehicle.
//-----------------------------------------------------------------------------
void CVehicleController::UpdateSteering( const vehicle_controlparams_t &controls, float flDeltaTime, float flSpeed )
{
// Steering - IVP steering is in radians.
float flSteeringAngle = CalcSteering( flDeltaTime, flSpeed, controls.steering, controls.bAnalogSteering );
m_pCarSystem->do_steering( DEG2RAD( flSteeringAngle ), controls.bAnalogSteering );
m_currentState.steeringAngle = flSteeringAngle;
}
//-----------------------------------------------------------------------------
// Purpose: Update the powerslide state (wheel materials).
//-----------------------------------------------------------------------------
void CVehicleController::UpdatePowerslide( const vehicle_controlparams_t &controls, bool bPowerslide, float flSpeed )
{
// Only allow skidding if it is allowed by the vehicle type.
if ( !m_vehicleData.steering.isSkidAllowed )
return;
// Check to see if the vehicle is occupied.
if ( !m_bOccupied )
return;
// Set the powerslide left/right.
bool bPowerslideLeft = bPowerslide && controls.handbrakeLeft;
bool bPowerslideRight = bPowerslide && controls.handbrakeRight;
int iWheel = 0;
unsigned int newTireType = VEHICLE_TIRE_NORMAL;
if ( bPowerslideLeft || bPowerslideRight )
{
newTireType = VEHICLE_TIRE_POWERSLIDE;
}
else if ( bPowerslide )
{
newTireType = VEHICLE_TIRE_BRAKING;
}
if ( newTireType != m_nTireType )
{
for ( int iAxle = 0; iAxle < m_vehicleData.axleCount; ++iAxle )
{
int materialIndex = m_vehicleData.axles[iAxle].wheels.materialIndex;
if ( newTireType == VEHICLE_TIRE_POWERSLIDE && ( m_vehicleData.axles[iAxle].wheels.skidMaterialIndex != - 1 ) )
{
materialIndex = m_vehicleData.axles[iAxle].wheels.skidMaterialIndex;
}
else if ( newTireType == VEHICLE_TIRE_BRAKING && ( m_vehicleData.axles[iAxle].wheels.brakeMaterialIndex != -1 ) )
{
materialIndex = m_vehicleData.axles[iAxle].wheels.brakeMaterialIndex;
}
for ( int iAxleWheel = 0; iAxleWheel < m_vehicleData.wheelsPerAxle; ++iAxleWheel, ++iWheel )
{
m_pWheels[iWheel]->SetMaterialIndex( materialIndex );
}
m_nTireType = newTireType;
}
}
// Push the car a little.
float flFrontAccel = 0.0f;
float flRearAccel = 0.0f;
if ( flSpeed > 0 && (bPowerslideLeft != bPowerslideRight) )
{
// NOTE: positive acceleration is to the left
float powerSlide = RemapValClamped( flSpeed, m_vehicleData.steering.speedSlow, m_vehicleData.steering.speedFast, 0, 1 );
float powerSlideAccel = ConvertDistanceToIVP( m_vehicleData.steering.powerSlideAccel);
if ( bPowerslideLeft )
{
flFrontAccel = powerSlideAccel * powerSlide;
flRearAccel = -powerSlideAccel * powerSlide;
}
else
{
flFrontAccel = -powerSlideAccel * powerSlide;
flRearAccel = powerSlideAccel * powerSlide;
}
}
m_pCarSystem->set_powerslide( flFrontAccel, flRearAccel );
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleController::UpdateEngine( const vehicle_controlparams_t &controls, float flDeltaTime,
float flThrottle, float flBrake, bool bHandbrake, bool bPowerslide )
{
bool bTorqueBoost = UpdateEngineTurboStart( controls, flDeltaTime );
CalcEngine( flThrottle, flBrake, bHandbrake, controls.steering, bTorqueBoost );
UpdateEngineTurboFinish();
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CVehicleController::UpdateEngineTurboStart( const vehicle_controlparams_t &controls, float flDeltaTime )
{
bool bTorqueBoost = false;
if ( controls.boost > 0 )
{
if ( m_vehicleData.engine.torqueBoost )
{
// Turbo will be applied at the engine level.
bTorqueBoost = true;
m_pCarSystem->activate_booster( 0.0f, m_vehicleData.engine.boostDuration, m_vehicleData.engine.boostDelay );
}
else
{
// Activate the turbo force booster - applied to vehicle body.
m_pCarSystem->activate_booster( m_vehicleData.engine.boostForce * controls.boost, m_vehicleData.engine.boostDuration, m_vehicleData.engine.boostDelay );
}
}
m_pCarSystem->update_booster( flDeltaTime );
m_currentState.boostDelay = m_pCarSystem->get_booster_delay();
m_currentState.isTorqueBoosting = bTorqueBoost;
return bTorqueBoost;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleController::UpdateEngineTurboFinish( void )
{
if ( m_vehicleData.engine.boostDuration + m_vehicleData.engine.boostDelay > 0 ) // watch out for div by zero
{
if ( m_currentState.boostDelay > 0 )
{
m_currentState.boostTimeLeft = 100 - 100 * ( m_currentState.boostDelay / ( m_vehicleData.engine.boostDuration + m_vehicleData.engine.boostDelay ) );
}
else
{
m_currentState.boostTimeLeft = 100; // ready to go any time
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Update the handbrake.
//-----------------------------------------------------------------------------
void CVehicleController::UpdateHandbrake( const vehicle_controlparams_t &controls, float flThrottle, bool bHandbrake, bool bPowerslide )
{
// Get the current vehicle speed.
m_currentState.speed = ConvertDistanceToHL( m_pCarSystem->get_body_speed() );
if ( !bPowerslide )
{
// HACK! Allowing you to overcome gravity at low throttle.
if ( ( flThrottle < 0.0f && m_currentState.speed > THROTTLE_OPPOSING_FORCE_EPSILON ) ||
( flThrottle > 0.0f && m_currentState.speed < -THROTTLE_OPPOSING_FORCE_EPSILON ) )
{
bHandbrake = true;
}
}
if ( bHandbrake )
{
// HACKHACK: only allow the handbrake when the wheels have contact with something
// otherwise they will affect the car in an undesirable way
bHandbrake = false;
for ( int iWheel = 0; iWheel < m_wheelCount; ++iWheel )
{
if ( m_pWheels[iWheel]->GetContactPoint(NULL, NULL) )
{
bHandbrake = true;
break;
}
}
}
bool currentHandbrake = (m_vehicleFlags & FVEHICLE_HANDBRAKE_ON) ? true : false;
if ( bHandbrake != currentHandbrake )
{
if ( bHandbrake )
{
m_vehicleFlags |= FVEHICLE_HANDBRAKE_ON;
}
else
{
m_vehicleFlags &= ~FVEHICLE_HANDBRAKE_ON;
}
for ( int iWheel = 0; iWheel < m_wheelCount; ++iWheel )
{
m_pCarSystem->fix_wheel( ( IVP_POS_WHEEL )iWheel, bHandbrake ? IVP_TRUE : IVP_FALSE );
}
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleController::UpdateSkidding( bool bHandbrake )
{
m_currentState.skidSpeed = 0.0f;
m_currentState.skidMaterial = 0;
m_currentState.wheelsInContact = m_wheelCount;
m_currentState.wheelsNotInContact = 0;
if ( m_vehicleData.steering.isSkidAllowed )
{
// Estimate rot speed based on current speed and the front wheels radius
float flAbsSpeed = fabs( m_currentState.speed );
Vector contact;
Vector velocity;
int surfaceProps;
m_currentState.wheelsInContact = 0;
m_currentState.wheelsNotInContact = 0;
for( int iWheel = 0; iWheel < m_wheelCount; ++iWheel )
{
if ( GetWheelContactPoint( iWheel, &contact, &surfaceProps ) )
{
// NOTE: The wheel should be translating by the negative of the speed a point in contact with the surface
// is moving. So the net velocity on the surface is zero if that wheel is 100% engaged in driving the car
// any velocity in excess of this gets compared against the threshold for skidding
m_pWheels[iWheel]->GetVelocityAtPoint( contact, &velocity );
float speed = velocity.Length();
if ( speed > m_currentState.skidSpeed || m_currentState.skidSpeed <= 0.0f )
{
m_currentState.skidSpeed = speed;
m_currentState.skidMaterial = surfaceProps;
}
m_currentState.wheelsInContact++;
}
else
{
m_currentState.wheelsNotInContact++;
}
}
// Check for locked wheels.
if ( bHandbrake && ( flAbsSpeed > 30 ) )
{
m_currentState.skidSpeed = flAbsSpeed;
}
}
}
//-----------------------------------------------------------------------------
// Purpose: Apply extra forces to the vehicle. The downward force, counter-
// torque etc.
//-----------------------------------------------------------------------------
void CVehicleController::UpdateExtraForces( void )
{
// Extra downward force.
IVP_Cache_Object *co = m_pCarBody->GetObject()->get_cache_object();
float y_val = co->m_world_f_object.get_elem( IVP_INDEX_Y, IVP_INDEX_Y );
if ( fabs( y_val ) < 0.05 )
{
m_pCarSystem->change_body_downforce( m_vehicleData.body.tiltForce * m_gravityLength * m_bodyMass );
}
else
{
m_pCarSystem->change_body_downforce( 0.0 );
}
co->remove_reference();
// Counter-torque.
if ( m_nVehicleType == VEHICLE_TYPE_CAR_WHEELS )
{
m_pCarSystem->update_body_countertorque();
}
// if the car has a global angular velocity limit, apply that constraint
AngularImpulse angVel;
m_pCarBody->GetVelocity( NULL, &angVel );
if ( m_vehicleData.body.maxAngularVelocity > 0 && angVel.Length() > m_vehicleData.body.maxAngularVelocity )
{
VectorNormalize(angVel);
angVel *= m_vehicleData.body.maxAngularVelocity;
m_pCarBody->SetVelocityInstantaneous( NULL, &angVel );
}
}
//-----------------------------------------------------------------------------
// Purpose: Update the physical position of the wheels for raycast vehicles.
// NOTE: Raycast boat doesn't have wheels.
//-----------------------------------------------------------------------------
void CVehicleController::UpdateWheelPositions( void )
{
if ( m_nVehicleType == VEHICLE_TYPE_CAR_RAYCAST )
{
m_pCarSystem->update_wheel_positions();
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
float CVehicleController::CalcSteering( float dt, float speed, float steering, bool bAnalog )
{
float degrees = RemapValClamped( speed, m_vehicleData.steering.speedSlow, m_vehicleData.steering.speedFast, m_vehicleData.steering.degreesSlow, m_vehicleData.steering.degreesFast );
float speedGame = MPH_TO_GAMEVEL(speed);
if ( speedGame > m_vehicleData.engine.maxSpeed )
{
degrees = RemapValClamped( speedGame, m_vehicleData.engine.maxSpeed, m_vehicleData.engine.boostMaxSpeed, m_vehicleData.steering.degreesFast, m_vehicleData.steering.degreesBoost );
}
if ( m_vehicleData.steering.steeringExponent != 0 )
{
float sign = steering < 0 ? -1 : 1;
float absSteering = fabs(steering);
if ( bAnalog )
{
// analog steering is directly mapped, not integrated, so go ahead and map the full range using the exponent
// then clamp to the output cone - keeps stick position:turn rate constant
// NOTE: Also hardcode exponent to 2 because we can't add a script entry at this point
float output = pow(absSteering, 2.0f) * sign * m_vehicleData.steering.degreesSlow;
return clamp(output, -degrees, degrees );
}
// digital steering is integrated, keep time to full turn rate constant
return pow(absSteering, m_vehicleData.steering.steeringExponent) * sign * degrees;
}
return steering * degrees;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleController::CalcEngineTransmission( float flThrottle )
{
// Automatic Transmission?
if ( !m_vehicleData.engine.isAutoTransmission )
return;
// Calculate the average rotational speed of the vehicle's wheels.
float flAvgRotSpeed = 0.0;
for( int iWheel = 0; iWheel < m_wheelCount; ++iWheel )
{
float flRotSpeed = fabs( m_pCarSystem->get_wheel_angular_velocity( IVP_POS_WHEEL( iWheel ) ) );
flAvgRotSpeed += flRotSpeed;
}
flAvgRotSpeed *= 0.5f / ( float )IVP_PI / m_wheelCount;
float flEstEngineRPM = flAvgRotSpeed * m_vehicleData.engine.axleRatio * m_vehicleData.engine.gearRatio[m_currentState.gear] * 60;
// Only shift up when going forward (throttling).
if ( flThrottle > 0.0f )
{
// Shift up?, top gear is gearcount-1 (0 based)
while ( ( flEstEngineRPM > m_vehicleData.engine.shiftUpRPM ) && ( m_currentState.gear < m_vehicleData.engine.gearCount-1 ) )
{
m_currentState.gear++;
flEstEngineRPM = flAvgRotSpeed * m_vehicleData.engine.axleRatio * m_vehicleData.engine.gearRatio[m_currentState.gear] * 60;
}
}
// Downshift?
while ( ( flEstEngineRPM < m_vehicleData.engine.shiftDownRPM ) && ( m_currentState.gear > 0 ) )
{
m_currentState.gear--;
flEstEngineRPM = flAvgRotSpeed * m_vehicleData.engine.axleRatio * m_vehicleData.engine.gearRatio[m_currentState.gear] * 60;
}
m_currentState.engineRPM = flEstEngineRPM;
}
//-----------------------------------------------------------------------------
// Purpose:
// throttle goes forward and backward, [-1, 1]
// brake_val [0..1]
//-----------------------------------------------------------------------------
void CVehicleController::CalcEngine( float throttle, float brake_val, bool handbrake, float steeringVal, bool torqueBoost )
{
// Update the engine transmission.
CalcEngineTransmission( throttle );
// Get the speed of the vehicle.
float flAbsSpeed = fabs( m_currentState.speed );
// Speed governor
if ( IsPC() )
{
float maxSpeed = torqueBoost ? m_vehicleData.engine.boostMaxSpeed : m_vehicleData.engine.maxSpeed;
maxSpeed = max(1.f,maxSpeed); // make sure this is non-zero before the divide
if ( (throttle > 0) && (flAbsSpeed > maxSpeed) )
{
float frac = flAbsSpeed / maxSpeed;
if ( frac > m_vehicleData.engine.autobrakeSpeedGain )
{
throttle = 0;
brake_val = (frac - 1.0f) * m_vehicleData.engine.autobrakeSpeedFactor;
if ( m_currentState.wheelsInContact == 0 )
{
brake_val = 0;
}
}
throttle *= 0.1f;
}
}
else // consoles
{
if ( ( throttle > 0 ) && ( ( !torqueBoost && flAbsSpeed > (m_vehicleData.engine.maxSpeed * throttle) ) ||
( torqueBoost && flAbsSpeed > m_vehicleData.engine.boostMaxSpeed) ) )
{
throttle *= 0.1f;
}
}
// Check for reverse - both of these "governors" or horrible and need to be redone before we ship!
if ( ( throttle < 0 ) && ( !torqueBoost && ( flAbsSpeed > m_vehicleData.engine.maxRevSpeed ) ) )
{
throttle *= 0.1f;
}
if ( throttle != 0.0 )
{
m_vehicleFlags &= ~FVEHICLE_THROTTLE_STOPPED;
// calculate the force that propels the car
const float watt_per_hp = 745.0f;
const float seconds_per_minute = 60.0f;
float wheel_force_by_throttle = throttle *
m_vehicleData.engine.horsepower * (watt_per_hp * seconds_per_minute) *
m_vehicleData.engine.gearRatio[m_currentState.gear] * m_vehicleData.engine.axleRatio /
(m_vehicleData.engine.maxRPM * m_wheelRadius * (2 * IVP_PI));
if ( m_currentState.engineRPM >= m_vehicleData.engine.maxRPM )
{
wheel_force_by_throttle = 0;
}
int wheelIndex = 0;
for ( int i = 0; i < m_vehicleData.axleCount; i++ )
{
float axleFactor = m_vehicleData.axles[i].torqueFactor * m_torqueScale;
float boostFactor = 0.5f;
if ( torqueBoost && IsBoosting() )
{
// reduce the boost at low speeds and high turns since this usually just makes the tires spin
// this means you only get the full boost when travelling in a straight line at high speed
float speedFactor = RemapValClamped( flAbsSpeed, 0, m_vehicleData.engine.maxSpeed, 0.1f, 1.0f );
float turnFactor = 1.0f - (fabs(steeringVal) * 0.95f);
float dampedBoost = m_vehicleData.engine.boostForce * speedFactor * turnFactor;
if ( dampedBoost > boostFactor )
{
boostFactor = dampedBoost;
}
//Msg("Boost applied %.2f, speed %.2f, turn %.2f\n", boostFactor, speedFactor, turnFactor );
}
float axleTorque = boostFactor * wheel_force_by_throttle * axleFactor * ConvertDistanceToIVP( m_vehicleData.axles[i].wheels.radius );
for ( int w = 0; w < m_vehicleData.wheelsPerAxle; w++, wheelIndex++ )
{
float torqueVal = axleTorque;
m_pCarSystem->change_wheel_torque((IVP_POS_WHEEL)wheelIndex, torqueVal);
}
}
}
else if ( brake_val != 0 )
{
m_vehicleFlags &= ~FVEHICLE_THROTTLE_STOPPED;
// Brake to slow down the wheel.
float wheel_force_by_brake = brake_val * m_gravityLength * ( m_bodyMass + m_totalWheelMass );
float sign = m_currentState.speed >= 0.0f ? -1.0f : 1.0f;
int wheelIndex = 0;
for ( int i = 0; i < m_vehicleData.axleCount; i++ )
{
float torque_val = 0.5 * sign * wheel_force_by_brake * m_vehicleData.axles[i].brakeFactor * ConvertDistanceToIVP( m_vehicleData.axles[i].wheels.radius );
for ( int w = 0; w < m_vehicleData.wheelsPerAxle; w++, wheelIndex++ )
{
m_pCarSystem->change_wheel_torque( ( IVP_POS_WHEEL )wheelIndex, torque_val );
}
}
}
else if ( !(m_vehicleFlags & FVEHICLE_THROTTLE_STOPPED) )
{
m_vehicleFlags |= FVEHICLE_THROTTLE_STOPPED;
for ( int w = 0; w < m_wheelCount; w++ )
{
m_pCarSystem->change_wheel_torque((IVP_POS_WHEEL)w, 0);
}
}
// Update the throttle - primarily for the airboat!
m_pCarSystem->update_throttle( throttle );
}
//-----------------------------------------------------------------------------
// Purpose: Get debug rendering data from the ipion physics system.
//-----------------------------------------------------------------------------
void CVehicleController::GetCarSystemDebugData( vehicle_debugcarsystem_t &debugCarSystem )
{
IVP_CarSystemDebugData_t carSystemDebugData;
memset(&carSystemDebugData,0,sizeof(carSystemDebugData));
m_pCarSystem->GetCarSystemDebugData( carSystemDebugData );
// Raycast car wheel trace data.
for ( int iWheel = 0; iWheel < VEHICLE_DEBUGRENDERDATA_MAX_WHEELS; ++iWheel )
{
debugCarSystem.vecWheelRaycasts[iWheel][0].x = carSystemDebugData.wheelRaycasts[iWheel][0].k[0];
debugCarSystem.vecWheelRaycasts[iWheel][0].y = carSystemDebugData.wheelRaycasts[iWheel][0].k[1];
debugCarSystem.vecWheelRaycasts[iWheel][0].z = carSystemDebugData.wheelRaycasts[iWheel][0].k[2];
debugCarSystem.vecWheelRaycasts[iWheel][1].x = carSystemDebugData.wheelRaycasts[iWheel][1].k[0];
debugCarSystem.vecWheelRaycasts[iWheel][1].y = carSystemDebugData.wheelRaycasts[iWheel][1].k[1];
debugCarSystem.vecWheelRaycasts[iWheel][1].z = carSystemDebugData.wheelRaycasts[iWheel][1].k[2];
debugCarSystem.vecWheelRaycastImpacts[iWheel] = debugCarSystem.vecWheelRaycasts[iWheel][0] + ( carSystemDebugData.wheelRaycastImpacts[iWheel] *
( debugCarSystem.vecWheelRaycasts[iWheel][1] - debugCarSystem.vecWheelRaycasts[iWheel][0] ) );
}
ConvertPositionToHL( carSystemDebugData.backActuatorLeft, debugCarSystem.vecAxlePos[0] );
ConvertPositionToHL( carSystemDebugData.backActuatorRight, debugCarSystem.vecAxlePos[1] );
ConvertPositionToHL( carSystemDebugData.frontActuatorLeft, debugCarSystem.vecAxlePos[2] );
// vecAxlePos only has three elements so this line is illegal. The mapping of actuators
// to axles seems dodgy anyway.
//ConvertPositionToHL( carSystemDebugData.frontActuatorRight, debugCarSystem.vecAxlePos[3] );
}
//-----------------------------------------------------------------------------
// Save/load
//-----------------------------------------------------------------------------
void CVehicleController::WriteToTemplate( vphysics_save_cvehiclecontroller_t &controllerTemplate )
{
// Get rid of the handbrake flag. The car keeps the flag and will reset it fixing wheels,
// else the system thinks it already fixed the wheels on load and the car roles.
m_vehicleFlags &= ~FVEHICLE_HANDBRAKE_ON;
controllerTemplate.m_pCarBody = m_pCarBody;
controllerTemplate.m_wheelCount = m_wheelCount;
controllerTemplate.m_wheelRadius = m_wheelRadius;
controllerTemplate.m_bodyMass = m_bodyMass;
controllerTemplate.m_totalWheelMass = m_totalWheelMass;
controllerTemplate.m_gravityLength = m_gravityLength;
controllerTemplate.m_torqueScale = m_torqueScale;
controllerTemplate.m_vehicleFlags = m_vehicleFlags;
controllerTemplate.m_nTireType = m_nTireType;
controllerTemplate.m_nVehicleType = m_nVehicleType;
controllerTemplate.m_bTraceData = m_bTraceData;
controllerTemplate.m_bOccupied = m_bOccupied;
controllerTemplate.m_bEngineDisable = m_bEngineDisable;
memcpy( &controllerTemplate.m_currentState, &m_currentState, sizeof(m_currentState) );
memcpy( &controllerTemplate.m_vehicleData, &m_vehicleData, sizeof(m_vehicleData) );
for (int i = 0; i < VEHICLE_MAX_WHEEL_COUNT; ++i )
{
controllerTemplate.m_pWheels[i] = m_pWheels[i];
ConvertPositionToHL( m_wheelPosition_Bs[i], controllerTemplate.m_wheelPosition_Bs[i] );
ConvertPositionToHL( m_tracePosition_Bs[i], controllerTemplate.m_tracePosition_Bs[i] );
}
m_flVelocity[0] = m_flVelocity[1] = m_flVelocity[2] = 0.0f;
if ( m_pCarBody )
{
IVP_U_Float_Point &speed = m_pCarBody->GetObject()->get_core()->speed;
controllerTemplate.m_flVelocity[0] = speed.k[0];
controllerTemplate.m_flVelocity[1] = speed.k[1];
controllerTemplate.m_flVelocity[2] = speed.k[2];
}
}
// JAY: Keep this around for now while we still have a bunch of games saved with the old
// vehicle controls. We won't ship this, but it lets us debug
#define OLD_SAVED_GAME 1
#if OLD_SAVED_GAME
#define SET_DEFAULT(x,y) { if ( x == 0 ) x = y; }
#endif
void CVehicleController::InitFromTemplate( CPhysicsEnvironment *pEnv, void *pGameData,
IPhysicsGameTrace *pGameTrace, const vphysics_save_cvehiclecontroller_t &controllerTemplate )
{
m_pEnv = pEnv;
m_pGameTrace = pGameTrace;
m_pCarBody = controllerTemplate.m_pCarBody;
m_wheelCount = controllerTemplate.m_wheelCount;
m_wheelRadius = controllerTemplate.m_wheelRadius;
m_bodyMass = controllerTemplate.m_bodyMass;
m_totalWheelMass = controllerTemplate.m_totalWheelMass;
m_gravityLength = controllerTemplate.m_gravityLength;
m_torqueScale = controllerTemplate.m_torqueScale;
m_vehicleFlags = controllerTemplate.m_vehicleFlags;
m_nTireType = controllerTemplate.m_nTireType;
m_nVehicleType = controllerTemplate.m_nVehicleType;
m_bTraceData = controllerTemplate.m_bTraceData;
m_bOccupied = controllerTemplate.m_bOccupied;
m_bEngineDisable = controllerTemplate.m_bEngineDisable;
m_pCarSystem = NULL;
memcpy( &m_currentState, &controllerTemplate.m_currentState, sizeof(m_currentState) );
memcpy( &m_vehicleData, &controllerTemplate.m_vehicleData, sizeof(m_vehicleData) );
memcpy( &m_flVelocity, controllerTemplate.m_flVelocity, sizeof(m_flVelocity) );
#if OLD_SAVED_GAME
SET_DEFAULT( m_torqueScale, 1.0 );
SET_DEFAULT( m_vehicleData.steering.steeringRateSlow, 4.5 );
SET_DEFAULT( m_vehicleData.steering.steeringRateFast, 0.5 );
SET_DEFAULT( m_vehicleData.steering.steeringRestRateSlow, 3.0 );
SET_DEFAULT( m_vehicleData.steering.steeringRestRateFast, 1.8 );
SET_DEFAULT( m_vehicleData.steering.speedSlow, m_vehicleData.engine.maxSpeed*0.25 );
SET_DEFAULT( m_vehicleData.steering.speedFast, m_vehicleData.engine.maxSpeed*0.75 );
SET_DEFAULT( m_vehicleData.steering.degreesSlow, 50 );
SET_DEFAULT( m_vehicleData.steering.degreesFast, 18 );
SET_DEFAULT( m_vehicleData.steering.degreesBoost, 10 );
SET_DEFAULT( m_vehicleData.steering.turnThrottleReduceSlow, 0.3 );
SET_DEFAULT( m_vehicleData.steering.turnThrottleReduceFast, 3 );
SET_DEFAULT( m_vehicleData.steering.brakeSteeringRateFactor, 6 );
SET_DEFAULT( m_vehicleData.steering.throttleSteeringRestRateFactor, 2 );
SET_DEFAULT( m_vehicleData.steering.boostSteeringRestRateFactor, 1 );
SET_DEFAULT( m_vehicleData.steering.boostSteeringRateFactor, 1 );
SET_DEFAULT( m_vehicleData.steering.powerSlideAccel, 200 );
SET_DEFAULT( m_vehicleData.engine.autobrakeSpeedGain, 1.0 );
SET_DEFAULT( m_vehicleData.engine.autobrakeSpeedFactor, 2.0 );
#endif
for (int i = 0; i < VEHICLE_MAX_WHEEL_COUNT; ++i )
{
m_pWheels[i] = controllerTemplate.m_pWheels[i];
ConvertPositionToIVP( controllerTemplate.m_wheelPosition_Bs[i], m_wheelPosition_Bs[i] );
ConvertPositionToIVP( controllerTemplate.m_tracePosition_Bs[i], m_tracePosition_Bs[i] );
}
CreateIVPObjects( );
// HACKHACK: vehicle wheels don't have valid friction at startup, clearing the body's angular velocity keeps
// this fact from affecting the vehicle dynamics in any noticeable way
// using growFriction will re-establish the contact point with moveable objects, but the friction that
// occurs afterward is not the same across the save even when that is extended to include static objects
if ( m_pCarBody )
{
// clear angVel
m_pCarBody->SetVelocity( NULL, &vec3_origin );
m_pCarBody->GetObject()->get_core()->speed_change.set( m_flVelocity[0], m_flVelocity[1], m_flVelocity[2] );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleController::OnVehicleEnter( void )
{
m_bOccupied = true;
if ( m_nVehicleType == VEHICLE_TYPE_AIRBOAT_RAYCAST )
{
float flDampSpeed = 0.0f;
float flDampRotSpeed = 0.0f;
m_pCarBody->SetDamping( &flDampSpeed, &flDampRotSpeed );
}
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CVehicleController::OnVehicleExit( void )
{
m_bOccupied = false;
// Reset the vehicle tires when exiting the vehicle.
if ( m_vehicleData.steering.isSkidAllowed )
{
int iWheel = 0;
for ( int iAxle = 0; iAxle < m_vehicleData.axleCount; ++iAxle )
{
for ( int iAxleWheel = 0; iAxleWheel < m_vehicleData.wheelsPerAxle; ++iAxleWheel, ++iWheel )
{
// Change back to normal tires.
if ( m_nTireType != VEHICLE_TIRE_NORMAL )
{
m_pWheels[iWheel]->SetMaterialIndex( m_vehicleData.axles[iAxle].wheels.materialIndex );
}
m_pCarSystem->fix_wheel( ( IVP_POS_WHEEL )iWheel, IVP_TRUE );
}
}
m_nTireType = VEHICLE_TIRE_NORMAL;
m_currentState.skidSpeed = 0.0f;
}
if ( m_nVehicleType == VEHICLE_TYPE_AIRBOAT_RAYCAST )
{
float flDampSpeed = 1.0f;
float flDampRotSpeed = 1.0f;
m_pCarBody->SetDamping( &flDampSpeed, &flDampRotSpeed );
}
SetEngineDisabled( false );
}
//-----------------------------------------------------------------------------
// Class factory
//-----------------------------------------------------------------------------
IPhysicsVehicleController *CreateVehicleController( CPhysicsEnvironment *pEnv, CPhysicsObject *pBodyObject, const vehicleparams_t ¶ms, unsigned int nVehicleType, IPhysicsGameTrace *pGameTrace )
{
CVehicleController *pController = new CVehicleController( params, pEnv, nVehicleType, pGameTrace );
pController->InitCarSystem( pBodyObject );
return pController;
}
bool SavePhysicsVehicleController( const physsaveparams_t ¶ms, CVehicleController *pVehicleController )
{
vphysics_save_cvehiclecontroller_t controllerTemplate;
memset( &controllerTemplate, 0, sizeof(controllerTemplate) );
pVehicleController->WriteToTemplate( controllerTemplate );
params.pSave->WriteAll( &controllerTemplate );
return true;
}
bool RestorePhysicsVehicleController( const physrestoreparams_t ¶ms, CVehicleController **ppVehicleController )
{
*ppVehicleController = new CVehicleController;
vphysics_save_cvehiclecontroller_t controllerTemplate;
memset( &controllerTemplate, 0, sizeof(controllerTemplate) );
params.pRestore->ReadAll( &controllerTemplate );
(*ppVehicleController)->InitFromTemplate( static_cast<CPhysicsEnvironment *>(params.pEnvironment),
params.pGameData, params.pGameTrace, controllerTemplate );
return true;
}
| 411 | 0.760523 | 1 | 0.760523 | game-dev | MEDIA | 0.954397 | game-dev | 0.902811 | 1 | 0.902811 |
buildwiththeta/buildwiththeta | 1,122 | playground/lib/src/presentation/editor/blocs/panels/panels_cubit.dart | import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'panels_cubit.freezed.dart';
part 'panels_state.dart';
enum PanelsEnum {
closed,
styles,
tree,
add,
}
class PanelsCubit extends Cubit<PanelsState> {
PanelsCubit() : super(const PanelsState.closed());
void update(PanelsEnum panel) {
switch (panel) {
case PanelsEnum.closed:
emit(const PanelsState.closed());
break;
case PanelsEnum.add:
emit(
state.maybeMap(
add: (x) => const PanelsState.closed(),
orElse: () => const PanelsState.add(),
),
);
break;
case PanelsEnum.styles:
emit(
state.maybeMap(
styles: (x) => const PanelsState.closed(),
orElse: () => const PanelsState.styles(),
),
);
break;
case PanelsEnum.tree:
emit(
state.maybeMap(
tree: (x) => const PanelsState.closed(),
orElse: () => const PanelsState.tree(),
),
);
break;
}
}
}
| 411 | 0.924488 | 1 | 0.924488 | game-dev | MEDIA | 0.623582 | game-dev | 0.849168 | 1 | 0.849168 |
Wouterdek/NodeNetwork | 2,249 | NodeNetwork/NNViewRegistrar.cs | using System;
using System.Collections.Generic;
using NodeNetwork.ViewModels;
using NodeNetwork.Views;
using ReactiveUI;
using Splat;
namespace NodeNetwork
{
/// <summary>
/// A locator is used to find the correct view corresponding to a viewmodel.
/// In ReactiveUI, usually Splat is used, but others exist. This class acts as an intermediate registrar.
/// It gathers registrations and registers them to the preferred locator.
/// </summary>
public sealed class NNViewRegistrar
{
private static readonly List<Tuple<Func<object>, Type>> PendingRegistrations = new List<Tuple<Func<object>, Type>>();
private static Action<Func<object>, Type> _registerAction;
public static void AddRegistration(Func<object> factory, Type serviceType)
{
if (factory == null)
{
throw new ArgumentNullException(nameof(factory));
}
else if (serviceType == null)
{
throw new ArgumentNullException(nameof(serviceType));
}
if (_registerAction == null)
{
PendingRegistrations.Add(Tuple.Create(factory, serviceType));
}
else
{
_registerAction(factory, serviceType);
}
}
public static void RegisterToLocator(Action<Func<object>, Type> newRegisterAction)
{
if (newRegisterAction == null)
{
throw new ArgumentNullException(nameof(newRegisterAction));
}
else if (_registerAction != null)
{
throw new InvalidOperationException("A locator has already been set");
}
_registerAction = newRegisterAction;
foreach (var t in PendingRegistrations)
{
_registerAction(t.Item1, t.Item2);
}
PendingRegistrations.Clear();
}
/// <summary>
/// Register all NodeNetwork view/viewmodel pairs to Locator.CurrentMutable.
/// </summary>
public static void RegisterSplat()
{
RegisterToLocator((f, t) => Locator.CurrentMutable.Register(f, t));
}
}
}
| 411 | 0.892365 | 1 | 0.892365 | game-dev | MEDIA | 0.309771 | game-dev | 0.792509 | 1 | 0.792509 |
Darkrp-community/OpenKeep | 16,467 | code/modules/mining/equipment/kinetic_crusher.dm | /*********************Mining Hammer****************/
/obj/item/twohanded/kinetic_crusher
icon = 'icons/obj/mining.dmi'
icon_state = "crusher"
item_state = "crusher0"
lefthand_file = 'icons/mob/inhands/weapons/hammers_lefthand.dmi'
righthand_file = 'icons/mob/inhands/weapons/hammers_righthand.dmi'
name = "proto-kinetic crusher"
desc = "An early design of the proto-kinetic accelerator, it is little more than a combination of various mining tools cobbled together, forming a high-tech club. \
While it is an effective mining tool, it did little to aid any but the most skilled and/or suicidal miners against local fauna."
force = 0 //You can't hit stuff unless wielded
w_class = WEIGHT_CLASS_BULKY
slot_flags = ITEM_SLOT_BACK
force_unwielded = 0
force_wielded = 20
throwforce = 5
throw_speed = 4
armor_penetration = 10
custom_materials = list(/datum/material/iron=1150, /datum/material/glass=2075)
hitsound = list('sound/blank.ogg')
attack_verb = list("smashed", "crushed", "cleaved", "chopped", "pulped")
sharpness = IS_SHARP
actions_types = list(/datum/action/item_action/toggle_light)
var/list/trophies = list()
var/charged = TRUE
var/charge_time = 15
var/detonation_damage = 50
var/backstab_bonus = 30
var/brightness_on = 5
/obj/item/twohanded/kinetic_crusher/Initialize()
. = ..()
AddComponent(/datum/component/butchering, 60, 110) //technically it's huge and bulky, but this provides an incentive to use it
/obj/item/twohanded/kinetic_crusher/Destroy()
QDEL_LIST(trophies)
return ..()
/obj/item/twohanded/kinetic_crusher/examine(mob/living/user)
. = ..()
. += "<span class='notice'>Mark a large creature with the destabilizing force, then hit them in melee to do <b>[force + detonation_damage]</b> damage.</span>"
. += "<span class='notice'>Does <b>[force + detonation_damage + backstab_bonus]</b> damage if the target is backstabbed, instead of <b>[force + detonation_damage]</b>.</span>"
for(var/t in trophies)
var/obj/item/crusher_trophy/T = t
. += "<span class='notice'>It has \a [T] attached, which causes [T.effect_desc()].</span>"
/obj/item/twohanded/kinetic_crusher/attackby(obj/item/I, mob/living/user)
if(I.tool_behaviour == TOOL_CROWBAR)
if(LAZYLEN(trophies))
to_chat(user, "<span class='notice'>I remove [src]'s trophies.</span>")
I.play_tool_sound(src)
for(var/t in trophies)
var/obj/item/crusher_trophy/T = t
T.remove_from(src, user)
else
to_chat(user, "<span class='warning'>There are no trophies on [src].</span>")
else if(istype(I, /obj/item/crusher_trophy))
var/obj/item/crusher_trophy/T = I
T.add_to(src, user)
else
return ..()
/obj/item/twohanded/kinetic_crusher/attack(mob/living/target, mob/living/carbon/user)
if(!wielded)
to_chat(user, "<span class='warning'>[src] is too heavy to use with one hand! You fumble and drop everything.</span>")
user.drop_all_held_items()
return
var/datum/status_effect/crusher_damage/C = target.has_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING)
var/target_health = target.health
..()
for(var/t in trophies)
if(!QDELETED(target))
var/obj/item/crusher_trophy/T = t
T.on_melee_hit(target, user)
if(!QDELETED(C) && !QDELETED(target))
C.total_damage += target_health - target.health //we did some damage, but let's not assume how much we did
/obj/item/twohanded/kinetic_crusher/afterattack(atom/target, mob/living/user, proximity_flag, clickparams)
. = ..()
if(!wielded)
return
if(!proximity_flag && charged)//Mark a target, or mine a tile.
var/turf/proj_turf = user.loc
if(!isturf(proj_turf))
return
var/obj/projectile/destabilizer/D = new /obj/projectile/destabilizer(proj_turf)
for(var/t in trophies)
var/obj/item/crusher_trophy/T = t
T.on_projectile_fire(D, user)
D.preparePixelProjectile(target, user, clickparams)
D.firer = user
D.hammer_synced = src
playsound(user, 'sound/blank.ogg', 100, TRUE)
D.fire()
charged = FALSE
update_icon()
addtimer(CALLBACK(src, PROC_REF(Recharge)), charge_time)
return
if(proximity_flag && isliving(target))
var/mob/living/L = target
var/datum/status_effect/crusher_mark/CM = L.has_status_effect(STATUS_EFFECT_CRUSHERMARK)
if(!CM || CM.hammer_synced != src || !L.remove_status_effect(STATUS_EFFECT_CRUSHERMARK))
return
var/datum/status_effect/crusher_damage/C = L.has_status_effect(STATUS_EFFECT_CRUSHERDAMAGETRACKING)
var/target_health = L.health
for(var/t in trophies)
var/obj/item/crusher_trophy/T = t
T.on_mark_detonation(target, user)
if(!QDELETED(L))
if(!QDELETED(C))
C.total_damage += target_health - L.health //we did some damage, but let's not assume how much we did
new /obj/effect/temp_visual/kinetic_blast(get_turf(L))
var/backstab_dir = get_dir(user, L)
var/def_check = L.getarmor(type = "bomb")
if((user.dir & backstab_dir) && (L.dir & backstab_dir))
if(!QDELETED(C))
C.total_damage += detonation_damage + backstab_bonus //cheat a little and add the total before killing it, so certain mobs don't have much lower chances of giving an item
L.apply_damage(detonation_damage + backstab_bonus, BRUTE, blocked = def_check)
playsound(user, 'sound/blank.ogg', 100, TRUE) //Seriously who spelled it wrong
else
if(!QDELETED(C))
C.total_damage += detonation_damage
L.apply_damage(detonation_damage, BRUTE, blocked = def_check)
/obj/item/twohanded/kinetic_crusher/proc/Recharge()
if(!charged)
charged = TRUE
update_icon()
playsound(src.loc, 'sound/blank.ogg', 60, TRUE)
/obj/item/twohanded/kinetic_crusher/ui_action_click(mob/user, actiontype)
light_on = !light_on
playsound(user, 'sound/blank.ogg', 100, TRUE)
update_brightness(user)
update_icon()
/obj/item/twohanded/kinetic_crusher/proc/update_brightness(mob/user = null)
if(light_on)
set_light(brightness_on)
else
set_light(0)
/obj/item/twohanded/kinetic_crusher/update_icon()
..()
cut_overlays()
if(!charged)
add_overlay("[icon_state]_uncharged")
if(light_on)
add_overlay("[icon_state]_lit")
spawn(1)
for(var/X in actions)
var/datum/action/A = X
A.UpdateButtonIcon()
item_state = "crusher[wielded]"
//destablizing force
/obj/projectile/destabilizer
name = "destabilizing force"
icon_state = "pulse1"
nodamage = TRUE
damage = 0 //We're just here to mark people. This is still a melee weapon.
damage_type = BRUTE
flag = "bomb"
range = 6
log_override = TRUE
var/obj/item/twohanded/kinetic_crusher/hammer_synced
/obj/projectile/destabilizer/Destroy()
hammer_synced = null
return ..()
/obj/projectile/destabilizer/on_hit(atom/target, blocked = FALSE)
if(isliving(target))
var/mob/living/L = target
var/had_effect = (L.has_status_effect(STATUS_EFFECT_CRUSHERMARK)) //used as a boolean
var/datum/status_effect/crusher_mark/CM = L.apply_status_effect(STATUS_EFFECT_CRUSHERMARK, hammer_synced)
if(hammer_synced)
for(var/t in hammer_synced.trophies)
var/obj/item/crusher_trophy/T = t
T.on_mark_application(target, CM, had_effect)
var/target_turf = get_turf(target)
if(ismineralturf(target_turf))
var/turf/closed/mineral/M = target_turf
new /obj/effect/temp_visual/kinetic_blast(M)
M.gets_drilled(firer)
..()
//trophies
/obj/item/crusher_trophy
name = "tail spike"
desc = ""
icon = 'icons/obj/lavaland/artefacts.dmi'
icon_state = "tail_spike"
var/bonus_value = 10 //if it has a bonus effect, this is how much that effect is
var/denied_type = /obj/item/crusher_trophy
/obj/item/crusher_trophy/examine(mob/living/user)
. = ..()
. += "<span class='notice'>Causes [effect_desc()] when attached to a kinetic crusher.</span>"
/obj/item/crusher_trophy/proc/effect_desc()
return "errors"
/obj/item/crusher_trophy/attackby(obj/item/A, mob/living/user)
if(istype(A, /obj/item/twohanded/kinetic_crusher))
add_to(A, user)
else
..()
/obj/item/crusher_trophy/proc/add_to(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
for(var/t in H.trophies)
var/obj/item/crusher_trophy/T = t
if(istype(T, denied_type) || istype(src, T.denied_type))
to_chat(user, "<span class='warning'>I can't seem to attach [src] to [H]. Maybe remove a few trophies?</span>")
return FALSE
if(!user.transferItemToLoc(src, H))
return
H.trophies += src
to_chat(user, "<span class='notice'>I attach [src] to [H].</span>")
return TRUE
/obj/item/crusher_trophy/proc/remove_from(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
forceMove(get_turf(H))
H.trophies -= src
return TRUE
/obj/item/crusher_trophy/proc/on_melee_hit(mob/living/target, mob/living/user) //the target and the user
/obj/item/crusher_trophy/proc/on_projectile_fire(obj/projectile/destabilizer/marker, mob/living/user) //the projectile fired and the user
/obj/item/crusher_trophy/proc/on_mark_application(mob/living/target, datum/status_effect/crusher_mark/mark, had_mark) //the target, the mark applied, and if the target had a mark before
/obj/item/crusher_trophy/proc/on_mark_detonation(mob/living/target, mob/living/user) //the target and the user
//goliath
/obj/item/crusher_trophy/goliath_tentacle
name = "goliath tentacle"
desc = ""
icon_state = "goliath_tentacle"
denied_type = /obj/item/crusher_trophy/goliath_tentacle
bonus_value = 2
var/missing_health_ratio = 0.1
var/missing_health_desc = 10
/obj/item/crusher_trophy/goliath_tentacle/effect_desc()
return "mark detonation to do <b>[bonus_value]</b> more damage for every <b>[missing_health_desc]</b> health you are missing"
/obj/item/crusher_trophy/goliath_tentacle/on_mark_detonation(mob/living/target, mob/living/user)
var/missing_health = user.health - user.maxHealth
missing_health *= missing_health_ratio //bonus is active at all times, even if you're above 90 health
missing_health *= bonus_value //multiply the remaining amount by bonus_value
if(missing_health > 0)
target.adjustBruteLoss(missing_health) //and do that much damage
//watcher
/obj/item/crusher_trophy/watcher_wing
name = "watcher wing"
desc = ""
icon_state = "watcher_wing"
denied_type = /obj/item/crusher_trophy/watcher_wing
bonus_value = 5
/obj/item/crusher_trophy/watcher_wing/effect_desc()
return "mark detonation to prevent certain creatures from using certain attacks for <b>[bonus_value*0.1]</b> second\s"
/obj/item/crusher_trophy/watcher_wing/on_mark_detonation(mob/living/target, mob/living/user)
if(ishostile(target))
var/mob/living/simple_animal/hostile/H = target
if(H.ranged) //briefly delay ranged attacks
if(H.ranged_cooldown >= world.time)
H.ranged_cooldown += bonus_value
else
H.ranged_cooldown = bonus_value + world.time
//magmawing watcher
/obj/item/crusher_trophy/blaster_tubes/magma_wing
name = "magmawing watcher wing"
desc = ""
icon_state = "magma_wing"
gender = NEUTER
bonus_value = 5
/obj/item/crusher_trophy/blaster_tubes/magma_wing/effect_desc()
return "mark detonation to make the next destabilizer shot deal <b>[bonus_value]</b> damage"
/obj/item/crusher_trophy/blaster_tubes/magma_wing/on_projectile_fire(obj/projectile/destabilizer/marker, mob/living/user)
if(deadly_shot)
marker.name = "heated [marker.name]"
marker.icon_state = "lava"
marker.damage = bonus_value
marker.nodamage = FALSE
deadly_shot = FALSE
//icewing watcher
/obj/item/crusher_trophy/watcher_wing/ice_wing
name = "icewing watcher wing"
desc = ""
icon_state = "ice_wing"
bonus_value = 8
//legion
/obj/item/crusher_trophy/legion_skull
name = "legion skull"
desc = ""
icon_state = "legion_skull"
denied_type = /obj/item/crusher_trophy/legion_skull
bonus_value = 3
/obj/item/crusher_trophy/legion_skull/effect_desc()
return "a kinetic crusher to recharge <b>[bonus_value*0.1]</b> second\s faster"
/obj/item/crusher_trophy/legion_skull/add_to(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
. = ..()
if(.)
H.charge_time -= bonus_value
/obj/item/crusher_trophy/legion_skull/remove_from(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
. = ..()
if(.)
H.charge_time += bonus_value
//blood-drunk hunter
/obj/item/crusher_trophy/miner_eye
name = "eye of a blood-drunk hunter"
desc = ""
icon_state = "hunter_eye"
denied_type = /obj/item/crusher_trophy/miner_eye
/obj/item/crusher_trophy/miner_eye/effect_desc()
return "mark detonation to grant stun immunity and <b>90%</b> damage reduction for <b>1</b> second"
/obj/item/crusher_trophy/miner_eye/on_mark_detonation(mob/living/target, mob/living/user)
user.apply_status_effect(STATUS_EFFECT_BLOODDRUNK)
//ash drake
/obj/item/crusher_trophy/tail_spike
desc = ""
denied_type = /obj/item/crusher_trophy/tail_spike
bonus_value = 5
/obj/item/crusher_trophy/tail_spike/effect_desc()
return "mark detonation to do <b>[bonus_value]</b> damage to nearby creatures and push them back"
/obj/item/crusher_trophy/tail_spike/on_mark_detonation(mob/living/target, mob/living/user)
for(var/mob/living/L in oview(2, user))
if(L.stat == DEAD)
continue
playsound(L, 'sound/blank.ogg', 20, TRUE)
new /obj/effect/temp_visual/fire(L.loc)
addtimer(CALLBACK(src, PROC_REF(pushback), L, user), 1) //no free backstabs, we push AFTER module stuff is done
L.adjustFireLoss(bonus_value, forced = TRUE)
/obj/item/crusher_trophy/tail_spike/proc/pushback(mob/living/target, mob/living/user)
if(!QDELETED(target) && !QDELETED(user) && (!target.anchored || ismegafauna(target))) //megafauna will always be pushed
step(target, get_dir(user, target))
//bubblegum
/obj/item/crusher_trophy/demon_claws
name = "demon claws"
desc = ""
icon_state = "demon_claws"
gender = PLURAL
denied_type = /obj/item/crusher_trophy/demon_claws
bonus_value = 10
var/static/list/damage_heal_order = list(BRUTE, BURN, OXY)
/obj/item/crusher_trophy/demon_claws/effect_desc()
return "melee hits to do <b>[bonus_value * 0.2]</b> more damage and heal you for <b>[bonus_value * 0.1]</b>, with <b>5X</b> effect on mark detonation"
/obj/item/crusher_trophy/demon_claws/add_to(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
. = ..()
if(.)
H.force += bonus_value * 0.2
H.force_unwielded += bonus_value * 0.2
H.force_wielded += bonus_value * 0.2
H.detonation_damage += bonus_value * 0.8
/obj/item/crusher_trophy/demon_claws/remove_from(obj/item/twohanded/kinetic_crusher/H, mob/living/user)
. = ..()
if(.)
H.force -= bonus_value * 0.2
H.force_unwielded -= bonus_value * 0.2
H.force_wielded -= bonus_value * 0.2
H.detonation_damage -= bonus_value * 0.8
/obj/item/crusher_trophy/demon_claws/on_melee_hit(mob/living/target, mob/living/user)
user.heal_ordered_damage(bonus_value * 0.1, damage_heal_order)
/obj/item/crusher_trophy/demon_claws/on_mark_detonation(mob/living/target, mob/living/user)
user.heal_ordered_damage(bonus_value * 0.4, damage_heal_order)
//colossus
/obj/item/crusher_trophy/blaster_tubes
name = "blaster tubes"
desc = ""
icon_state = "blaster_tubes"
gender = PLURAL
denied_type = /obj/item/crusher_trophy/blaster_tubes
bonus_value = 15
var/deadly_shot = FALSE
/obj/item/crusher_trophy/blaster_tubes/effect_desc()
return "mark detonation to make the next destabilizer shot deal <b>[bonus_value]</b> damage but move slower"
/obj/item/crusher_trophy/blaster_tubes/on_projectile_fire(obj/projectile/destabilizer/marker, mob/living/user)
if(deadly_shot)
marker.name = "deadly [marker.name]"
marker.icon_state = "chronobolt"
marker.damage = bonus_value
marker.nodamage = FALSE
marker.speed = 2
deadly_shot = FALSE
/obj/item/crusher_trophy/blaster_tubes/on_mark_detonation(mob/living/target, mob/living/user)
deadly_shot = TRUE
addtimer(CALLBACK(src, PROC_REF(reset_deadly_shot)), 300, TIMER_UNIQUE|TIMER_OVERRIDE)
/obj/item/crusher_trophy/blaster_tubes/proc/reset_deadly_shot()
deadly_shot = FALSE
//hierophant
/obj/item/crusher_trophy/vortex_talisman
name = "vortex talisman"
desc = ""
icon_state = "vortex_talisman"
denied_type = /obj/item/crusher_trophy/vortex_talisman
/obj/item/crusher_trophy/vortex_talisman/effect_desc()
return "mark detonation to create a barrier you can pass"
/obj/item/crusher_trophy/vortex_talisman/on_mark_detonation(mob/living/target, mob/living/user)
var/turf/T = get_turf(user)
new /obj/effect/temp_visual/hierophant/wall/crusher(T, user) //a wall only you can pass!
var/turf/otherT = get_step(T, turn(user.dir, 90))
if(otherT)
new /obj/effect/temp_visual/hierophant/wall/crusher(otherT, user)
otherT = get_step(T, turn(user.dir, -90))
if(otherT)
new /obj/effect/temp_visual/hierophant/wall/crusher(otherT, user)
/obj/effect/temp_visual/hierophant/wall/crusher
duration = 75
| 411 | 0.953294 | 1 | 0.953294 | game-dev | MEDIA | 0.990415 | game-dev | 0.993035 | 1 | 0.993035 |
vangogih/unity-empty-project-template | 1,612 | UEPT.Unity/Assets/_Project/Develop/CompanyName/UEPT/Runtime/Utilities/SceneManager.cs | using CompanyName.UEPT.Runtime.Utilities.Logging;
using Cysharp.Threading.Tasks;
using UnityEngine.SceneManagement;
using UnitySceneManager = UnityEngine.SceneManagement.SceneManager;
namespace CompanyName.UEPT.Runtime.Utilities
{
public class SceneManager
{
private const string LogTag = "SCENE";
public async UniTask LoadScene(int toLoadIndex)
{
int currentSceneIndex = UnitySceneManager.GetActiveScene().buildIndex;
bool isSkipEmpty = currentSceneIndex == RuntimeConstants.Scenes.Loading || currentSceneIndex == RuntimeConstants.Scenes.Bootstrap || toLoadIndex == currentSceneIndex;
if (isSkipEmpty)
{
Log.Default.D(LogTag, $"Empty scene skipped. {SceneUtility.GetScenePathByBuildIndex(toLoadIndex)} is loading.");
UnitySceneManager.LoadScene(toLoadIndex);
return;
}
bool needLoadEmpty = toLoadIndex == RuntimeConstants.Scenes.Meta || toLoadIndex == RuntimeConstants.Scenes.Core || toLoadIndex == RuntimeConstants.Scenes.Loading;
if (needLoadEmpty)
{
Log.Default.D(LogTag, $"{SceneUtility.GetScenePathByBuildIndex(RuntimeConstants.Scenes.Empty)} is loading.");
UnitySceneManager.LoadScene(RuntimeConstants.Scenes.Empty);
}
await UniTask.NextFrame();
Log.Default.D(LogTag, $"{SceneUtility.GetScenePathByBuildIndex(toLoadIndex)} is loading.");
UnitySceneManager.LoadScene(toLoadIndex);
}
}
} | 411 | 0.525579 | 1 | 0.525579 | game-dev | MEDIA | 0.95277 | game-dev | 0.904846 | 1 | 0.904846 |
Rearth/Oritech | 5,231 | common/src/main/java/rearth/oritech/block/blocks/arcane/EnchantmentCatalystBlock.java | package rearth.oritech.block.blocks.arcane;
import com.mojang.serialization.MapCodec;
import dev.architectury.registry.menu.ExtendedMenuProvider;
import dev.architectury.registry.menu.MenuRegistry;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.EntityBlock;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.BlockHitResult;
import org.jetbrains.annotations.Nullable;
import rearth.oritech.block.entity.arcane.EnchantmentCatalystBlockEntity;
import rearth.oritech.util.ComparatorOutputProvider;
import java.util.List;
import java.util.Objects;
public class EnchantmentCatalystBlock extends HorizontalDirectionalBlock implements EntityBlock {
public EnchantmentCatalystBlock(Properties settings) {
super(settings);
registerDefaultState(defaultBlockState().setValue(BlockStateProperties.HORIZONTAL_FACING, Direction.NORTH));
}
@Override
protected boolean hasAnalogOutputSignal(BlockState state) {
return true;
}
@Override
protected int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {
return ((ComparatorOutputProvider) world.getBlockEntity(pos)).getComparatorOutput();
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(BlockStateProperties.HORIZONTAL_FACING);
}
@Nullable
@Override
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
return Objects.requireNonNull(super.getStateForPlacement(ctx)).setValue(BlockStateProperties.HORIZONTAL_FACING, ctx.getHorizontalDirection().getOpposite());
}
@Override
protected MapCodec<? extends HorizontalDirectionalBlock> codec() {
return null;
}
@Override
public RenderShape getRenderShape(BlockState state) {
return RenderShape.ENTITYBLOCK_ANIMATED;
}
@Override
public InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
if (!world.isClientSide) {
var handler = (ExtendedMenuProvider) world.getBlockEntity(pos);
MenuRegistry.openExtendedMenu((ServerPlayer) player, handler);
}
return InteractionResult.SUCCESS;
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return new EnchantmentCatalystBlockEntity(pos, state);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@Nullable
@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level world, BlockState state, BlockEntityType<T> type) {
return (world1, pos, state1, blockEntity) -> {
if (blockEntity instanceof BlockEntityTicker ticker)
ticker.tick(world1, pos, state1, blockEntity);
};
}
// drop inv
@Override
public BlockState playerWillDestroy(Level world, BlockPos pos, BlockState state, Player player) {
if (!world.isClientSide) {
var entity = (EnchantmentCatalystBlockEntity) world.getBlockEntity(pos);
var stacks = entity.inventory.heldStacks;
for (var stack : stacks) {
if (!stack.isEmpty()) {
var itemEntity = new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), stack);
world.addFreshEntity(itemEntity);
}
}
entity.inventory.heldStacks.clear();
entity.inventory.setChanged();
}
return super.playerWillDestroy(world, pos, state, player);
}
@Override
public void appendHoverText(ItemStack stack, Item.TooltipContext context, List<Component> tooltip, TooltipFlag options) {
super.appendHoverText(stack, context, tooltip, options);
tooltip.add(Component.translatable("tooltip.oritech.catalyst").withStyle(ChatFormatting.GRAY));
tooltip.add(Component.translatable("tooltip.oritech.catalyst_warning").withStyle(ChatFormatting.DARK_PURPLE));
}
}
| 411 | 0.833423 | 1 | 0.833423 | game-dev | MEDIA | 0.999394 | game-dev | 0.910979 | 1 | 0.910979 |
mim1q/MineCells | 5,032 | src/main/java/com/github/mim1q/minecells/entity/ai/goal/conjunctivius/ConjunctiviusBarrageGoal.java | package com.github.mim1q.minecells.entity.ai.goal.conjunctivius;
import com.github.mim1q.minecells.entity.boss.ConjunctiviusEntity;
import com.github.mim1q.minecells.entity.nonliving.projectile.ConjunctiviusProjectileEntity;
import com.github.mim1q.minecells.registry.MineCellsSounds;
import com.github.mim1q.minecells.util.MathUtils;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.s2c.play.PlaySoundS2CPacket;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import java.util.function.Consumer;
import java.util.function.Supplier;
public abstract class ConjunctiviusBarrageGoal extends ConjunctiviusMoveAroundGoal {
protected int ticks = 0;
private Entity target;
protected final BarrageSettings settings;
public ConjunctiviusBarrageGoal(ConjunctiviusEntity entity, Consumer<BarrageSettings> settings) {
super(entity);
var settingsObj = new BarrageSettings();
settings.accept(settingsObj);
this.settings = settingsObj;
this.speed = this.settings.speed;
}
@Override
public boolean canStart() {
this.target = entity.getTarget();
return super.canStart()
&& this.entity.barrageCooldown <= 0
&& this.target != null
&& this.entity.moving
&& this.entity.canAttack()
&& this.entity.getRandom().nextFloat() < settings.chance;
}
@Override
public boolean shouldContinue() {
this.target = entity.getTarget();
return this.target != null && this.ticks < settings.length + 60 && this.entity.canAttack();
}
@Override
public void start() {
super.start();
this.entity.getDataTracker().set(ConjunctiviusEntity.BARRAGE_ACTIVE, true);
this.entity.playSound(MineCellsSounds.CHARGE, 2.0F, 1.0F);
}
@Override
public void tick() {
if (this.entity.getWorld().isClient) return;
if (this.ticks > 60) {
super.tick();
if (this.ticks % 6 == 0) {
var serverWorld = ((ServerWorld) this.entity.getWorld());
serverWorld.getServer().getPlayerManager().sendToAround(
null, entity.getX(), entity.getY(), entity.getZ(), 32.0D, entity.getWorld().getRegistryKey(),
new PlaySoundS2CPacket(RegistryEntry.of(MineCellsSounds.CONJUNCTIVIUS_SHOT), SoundCategory.HOSTILE, entity.getX(), entity.getY(), entity.getZ(), 0.25F, 1.0F, 0)
);
}
if (this.ticks % settings.interval == 0) {
this.shoot(this.entity, this.target);
}
}
this.ticks++;
}
protected abstract void shoot(ConjunctiviusEntity entity, Entity target);
@Override
protected int getNextCooldown() {
return entity.getRandom().nextBetween(settings.minPause, settings.maxPause);
}
@Override
public void stop() {
this.ticks = 0;
this.entity.barrageCooldown = settings.cooldown;
this.entity.getDataTracker().set(ConjunctiviusEntity.BARRAGE_ACTIVE, false);
super.stop();
}
public static class Targeted extends ConjunctiviusBarrageGoal {
public Targeted(ConjunctiviusEntity entity, Consumer<BarrageSettings> settings) {
super(entity, settings);
}
@Override
protected void shoot(ConjunctiviusEntity entity, Entity target) {
if (target != null) {
Vec3d targetPos = target.getPos().add(
(entity.getRandom().nextDouble() - 0.5D) * 2.0D,
(entity.getRandom().nextDouble() - 0.5D) * 2.0D + 2.0D,
(entity.getRandom().nextDouble() - 0.5D) * 2.0D
);
ConjunctiviusProjectileEntity.spawn(entity.getWorld(), entity.getPos().add(0.0D, 2.5D, 0.0D), targetPos, this.entity);
}
}
}
public static class Around extends ConjunctiviusBarrageGoal {
public Around(ConjunctiviusEntity entity, Consumer<BarrageSettings> settings) {
super(entity, settings);
}
@Override
protected void shoot(ConjunctiviusEntity entity, Entity target) {
if (target != null) {
for (int i = 0; i < settings.count.get(); i++) {
var yaw = MathUtils.radians(entity.getYaw());
yaw += (float) (entity.getRandom().nextDouble() - 0.5) * MathHelper.PI * 1.5F;
var pitch = (float) (entity.getRandom().nextDouble() - 0.8) * MathHelper.PI;
var offset = new Vec3d(
MathHelper.sin(yaw) * MathHelper.cos(pitch),
MathHelper.sin(pitch) + 2.5,
MathHelper.cos(yaw) * MathHelper.cos(pitch)
);
Vec3d targetPos = entity.getPos().add(offset);
ConjunctiviusProjectileEntity.spawn(entity.getWorld(), entity.getPos().add(0.0D, 2.5D, 0.0D), targetPos, this.entity);
}
}
}
}
public static class BarrageSettings {
public float chance = 0.5f;
public float speed = 0.05f;
public int interval = 8;
public int length = 40;
public int cooldown = 200;
public int minPause = 40;
public int maxPause = 80;
public Supplier<Integer> count = () -> 1;
}
}
| 411 | 0.745917 | 1 | 0.745917 | game-dev | MEDIA | 0.90294 | game-dev | 0.927822 | 1 | 0.927822 |
gubicsz/Solitaire | 24,352 | Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableTriggerExtensions.Component.cs | using System; // require keep for Windows Universal App
using UnityEngine;
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
using UnityEngine.EventSystems;
#endif
namespace UniRx.Triggers
{
// for Component
public static partial class ObservableTriggerExtensions
{
#region ObservableAnimatorTrigger
/// <summary>Callback for setting up animation IK (inverse kinematics).</summary>
public static IObservable<int> OnAnimatorIKAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<int>();
return GetOrAddComponent<ObservableAnimatorTrigger>(component.gameObject).OnAnimatorIKAsObservable();
}
/// <summary>Callback for processing animation movements for modifying root motion.</summary>
public static IObservable<Unit> OnAnimatorMoveAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableAnimatorTrigger>(component.gameObject).OnAnimatorMoveAsObservable();
}
#endregion
#region ObservableCollision2DTrigger
/// <summary>Sent when an incoming collider makes contact with this object's collider (2D physics only).</summary>
public static IObservable<Collision2D> OnCollisionEnter2DAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collision2D>();
return GetOrAddComponent<ObservableCollision2DTrigger>(component.gameObject).OnCollisionEnter2DAsObservable();
}
/// <summary>Sent when a collider on another object stops touching this object's collider (2D physics only).</summary>
public static IObservable<Collision2D> OnCollisionExit2DAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collision2D>();
return GetOrAddComponent<ObservableCollision2DTrigger>(component.gameObject).OnCollisionExit2DAsObservable();
}
/// <summary>Sent each frame where a collider on another object is touching this object's collider (2D physics only).</summary>
public static IObservable<Collision2D> OnCollisionStay2DAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collision2D>();
return GetOrAddComponent<ObservableCollision2DTrigger>(component.gameObject).OnCollisionStay2DAsObservable();
}
#endregion
#region ObservableCollisionTrigger
/// <summary>OnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.</summary>
public static IObservable<Collision> OnCollisionEnterAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collision>();
return GetOrAddComponent<ObservableCollisionTrigger>(component.gameObject).OnCollisionEnterAsObservable();
}
/// <summary>OnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.</summary>
public static IObservable<Collision> OnCollisionExitAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collision>();
return GetOrAddComponent<ObservableCollisionTrigger>(component.gameObject).OnCollisionExitAsObservable();
}
/// <summary>OnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.</summary>
public static IObservable<Collision> OnCollisionStayAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collision>();
return GetOrAddComponent<ObservableCollisionTrigger>(component.gameObject).OnCollisionStayAsObservable();
}
#endregion
#region ObservableDestroyTrigger
/// <summary>This function is called when the MonoBehaviour will be destroyed.</summary>
public static IObservable<Unit> OnDestroyAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Return(Unit.Default); // send destroy message
return GetOrAddComponent<ObservableDestroyTrigger>(component.gameObject).OnDestroyAsObservable();
}
#endregion
#region ObservableEnableTrigger
/// <summary>This function is called when the object becomes enabled and active.</summary>
public static IObservable<Unit> OnEnableAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableEnableTrigger>(component.gameObject).OnEnableAsObservable();
}
/// <summary>This function is called when the behaviour becomes disabled () or inactive.</summary>
public static IObservable<Unit> OnDisableAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableEnableTrigger>(component.gameObject).OnDisableAsObservable();
}
#endregion
#region ObservableFixedUpdateTrigger
/// <summary>This function is called every fixed framerate frame, if the MonoBehaviour is enabled.</summary>
public static IObservable<Unit> FixedUpdateAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableFixedUpdateTrigger>(component.gameObject).FixedUpdateAsObservable();
}
#endregion
#region ObservableLateUpdateTrigger
/// <summary>LateUpdate is called every frame, if the Behaviour is enabled.</summary>
public static IObservable<Unit> LateUpdateAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableLateUpdateTrigger>(component.gameObject).LateUpdateAsObservable();
}
#endregion
#if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_METRO)
#region ObservableMouseTrigger
/// <summary>OnMouseDown is called when the user has pressed the mouse button while over the GUIElement or Collider.</summary>
public static IObservable<Unit> OnMouseDownAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableMouseTrigger>(component.gameObject).OnMouseDownAsObservable();
}
/// <summary>OnMouseDrag is called when the user has clicked on a GUIElement or Collider and is still holding down the mouse.</summary>
public static IObservable<Unit> OnMouseDragAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableMouseTrigger>(component.gameObject).OnMouseDragAsObservable();
}
/// <summary>OnMouseEnter is called when the mouse entered the GUIElement or Collider.</summary>
public static IObservable<Unit> OnMouseEnterAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableMouseTrigger>(component.gameObject).OnMouseEnterAsObservable();
}
/// <summary>OnMouseExit is called when the mouse is not any longer over the GUIElement or Collider.</summary>
public static IObservable<Unit> OnMouseExitAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableMouseTrigger>(component.gameObject).OnMouseExitAsObservable();
}
/// <summary>OnMouseOver is called every frame while the mouse is over the GUIElement or Collider.</summary>
public static IObservable<Unit> OnMouseOverAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableMouseTrigger>(component.gameObject).OnMouseOverAsObservable();
}
/// <summary>OnMouseUp is called when the user has released the mouse button.</summary>
public static IObservable<Unit> OnMouseUpAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableMouseTrigger>(component.gameObject).OnMouseUpAsObservable();
}
/// <summary>OnMouseUpAsButton is only called when the mouse is released over the same GUIElement or Collider as it was pressed.</summary>
public static IObservable<Unit> OnMouseUpAsButtonAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableMouseTrigger>(component.gameObject).OnMouseUpAsButtonAsObservable();
}
#endregion
#endif
#region ObservableTrigger2DTrigger
/// <summary>Sent when another object enters a trigger collider attached to this object (2D physics only).</summary>
public static IObservable<Collider2D> OnTriggerEnter2DAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collider2D>();
return GetOrAddComponent<ObservableTrigger2DTrigger>(component.gameObject).OnTriggerEnter2DAsObservable();
}
/// <summary>Sent when another object leaves a trigger collider attached to this object (2D physics only).</summary>
public static IObservable<Collider2D> OnTriggerExit2DAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collider2D>();
return GetOrAddComponent<ObservableTrigger2DTrigger>(component.gameObject).OnTriggerExit2DAsObservable();
}
/// <summary>Sent each frame where another object is within a trigger collider attached to this object (2D physics only).</summary>
public static IObservable<Collider2D> OnTriggerStay2DAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collider2D>();
return GetOrAddComponent<ObservableTrigger2DTrigger>(component.gameObject).OnTriggerStay2DAsObservable();
}
#endregion
#region ObservableTriggerTrigger
/// <summary>OnTriggerEnter is called when the Collider other enters the trigger.</summary>
public static IObservable<Collider> OnTriggerEnterAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collider>();
return GetOrAddComponent<ObservableTriggerTrigger>(component.gameObject).OnTriggerEnterAsObservable();
}
/// <summary>OnTriggerExit is called when the Collider other has stopped touching the trigger.</summary>
public static IObservable<Collider> OnTriggerExitAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collider>();
return GetOrAddComponent<ObservableTriggerTrigger>(component.gameObject).OnTriggerExitAsObservable();
}
/// <summary>OnTriggerStay is called once per frame for every Collider other that is touching the trigger.</summary>
public static IObservable<Collider> OnTriggerStayAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Collider>();
return GetOrAddComponent<ObservableTriggerTrigger>(component.gameObject).OnTriggerStayAsObservable();
}
#endregion
#region ObservableUpdateTrigger
/// <summary>Update is called every frame, if the MonoBehaviour is enabled.</summary>
public static IObservable<Unit> UpdateAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableUpdateTrigger>(component.gameObject).UpdateAsObservable();
}
#endregion
#region ObservableVisibleTrigger
/// <summary>OnBecameInvisible is called when the renderer is no longer visible by any camera.</summary>
public static IObservable<Unit> OnBecameInvisibleAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableVisibleTrigger>(component.gameObject).OnBecameInvisibleAsObservable();
}
/// <summary>OnBecameVisible is called when the renderer became visible by any camera.</summary>
public static IObservable<Unit> OnBecameVisibleAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableVisibleTrigger>(component.gameObject).OnBecameVisibleAsObservable();
}
#endregion
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#region ObservableTransformChangedTrigger
/// <summary>Callback sent to the graphic before a Transform parent change occurs.</summary>
public static IObservable<Unit> OnBeforeTransformParentChangedAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableTransformChangedTrigger>(component.gameObject).OnBeforeTransformParentChangedAsObservable();
}
/// <summary>This function is called when the parent property of the transform of the GameObject has changed.</summary>
public static IObservable<Unit> OnTransformParentChangedAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableTransformChangedTrigger>(component.gameObject).OnTransformParentChangedAsObservable();
}
/// <summary>This function is called when the list of children of the transform of the GameObject has changed.</summary>
public static IObservable<Unit> OnTransformChildrenChangedAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableTransformChangedTrigger>(component.gameObject).OnTransformChildrenChangedAsObservable();
}
#endregion
#region ObservableCanvasGroupChangedTrigger
/// <summary>Callback that is sent if the canvas group is changed.</summary>
public static IObservable<Unit> OnCanvasGroupChangedAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableCanvasGroupChangedTrigger>(component.gameObject).OnCanvasGroupChangedAsObservable();
}
#endregion
#region ObservableRectTransformTrigger
/// <summary>Callback that is sent if an associated RectTransform has it's dimensions changed.</summary>
public static IObservable<Unit> OnRectTransformDimensionsChangeAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableRectTransformTrigger>(component.gameObject).OnRectTransformDimensionsChangeAsObservable();
}
/// <summary>Callback that is sent if an associated RectTransform is removed.</summary>
public static IObservable<Unit> OnRectTransformRemovedAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableRectTransformTrigger>(component.gameObject).OnRectTransformRemovedAsObservable();
}
#endregion
// uGUI
#region ObservableEventTrigger classes
public static IObservable<BaseEventData> OnDeselectAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<BaseEventData>();
return GetOrAddComponent<ObservableDeselectTrigger>(component.gameObject).OnDeselectAsObservable();
}
public static IObservable<AxisEventData> OnMoveAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<AxisEventData>();
return GetOrAddComponent<ObservableMoveTrigger>(component.gameObject).OnMoveAsObservable();
}
public static IObservable<PointerEventData> OnPointerDownAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservablePointerDownTrigger>(component.gameObject).OnPointerDownAsObservable();
}
public static IObservable<PointerEventData> OnPointerEnterAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservablePointerEnterTrigger>(component.gameObject).OnPointerEnterAsObservable();
}
public static IObservable<PointerEventData> OnPointerExitAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservablePointerExitTrigger>(component.gameObject).OnPointerExitAsObservable();
}
public static IObservable<PointerEventData> OnPointerUpAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservablePointerUpTrigger>(component.gameObject).OnPointerUpAsObservable();
}
public static IObservable<BaseEventData> OnSelectAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<BaseEventData>();
return GetOrAddComponent<ObservableSelectTrigger>(component.gameObject).OnSelectAsObservable();
}
public static IObservable<PointerEventData> OnPointerClickAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservablePointerClickTrigger>(component.gameObject).OnPointerClickAsObservable();
}
public static IObservable<BaseEventData> OnSubmitAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<BaseEventData>();
return GetOrAddComponent<ObservableSubmitTrigger>(component.gameObject).OnSubmitAsObservable();
}
public static IObservable<PointerEventData> OnDragAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservableDragTrigger>(component.gameObject).OnDragAsObservable();
}
public static IObservable<PointerEventData> OnBeginDragAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservableBeginDragTrigger>(component.gameObject).OnBeginDragAsObservable();
}
public static IObservable<PointerEventData> OnEndDragAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservableEndDragTrigger>(component.gameObject).OnEndDragAsObservable();
}
public static IObservable<PointerEventData> OnDropAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservableDropTrigger>(component.gameObject).OnDropAsObservable();
}
public static IObservable<BaseEventData> OnUpdateSelectedAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<BaseEventData>();
return GetOrAddComponent<ObservableUpdateSelectedTrigger>(component.gameObject).OnUpdateSelectedAsObservable();
}
public static IObservable<PointerEventData> OnInitializePotentialDragAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservableInitializePotentialDragTrigger>(component.gameObject).OnInitializePotentialDragAsObservable();
}
public static IObservable<BaseEventData> OnCancelAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<BaseEventData>();
return GetOrAddComponent<ObservableCancelTrigger>(component.gameObject).OnCancelAsObservable();
}
public static IObservable<PointerEventData> OnScrollAsObservable(this UIBehaviour component)
{
if (component == null || component.gameObject == null) return Observable.Empty<PointerEventData>();
return GetOrAddComponent<ObservableScrollTrigger>(component.gameObject).OnScrollAsObservable();
}
#endregion
#endif
#region ObservableParticleTrigger
/// <summary>OnParticleCollision is called when a particle hits a collider.</summary>
public static IObservable<GameObject> OnParticleCollisionAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<GameObject>();
return GetOrAddComponent<ObservableParticleTrigger>(component.gameObject).OnParticleCollisionAsObservable();
}
#if UNITY_5_4_OR_NEWER
/// <summary>OnParticleTrigger is called when any particles in a particle system meet the conditions in the trigger module.</summary>
public static IObservable<Unit> OnParticleTriggerAsObservable(this Component component)
{
if (component == null || component.gameObject == null) return Observable.Empty<Unit>();
return GetOrAddComponent<ObservableParticleTrigger>(component.gameObject).OnParticleTriggerAsObservable();
}
#endif
#endregion
}
} | 411 | 0.875039 | 1 | 0.875039 | game-dev | MEDIA | 0.927002 | game-dev | 0.920374 | 1 | 0.920374 |
ImLegiitXD/Dream-Advanced | 3,406 | dll/back/1.7.10/net/minecraft/block/BlockOre.java | package net.minecraft.block;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class BlockOre extends Block
{
private static final String __OBFID = "CL_00000282";
public BlockOre()
{
super(Material.rock);
this.setCreativeTab(CreativeTabs.tabBlock);
}
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return this == Blocks.coal_ore ? Items.coal : (this == Blocks.diamond_ore ? Items.diamond : (this == Blocks.lapis_ore ? Items.dye : (this == Blocks.emerald_ore ? Items.emerald : (this == Blocks.quartz_ore ? Items.quartz : Item.getItemFromBlock(this)))));
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(Random p_149745_1_)
{
return this == Blocks.lapis_ore ? 4 + p_149745_1_.nextInt(5) : 1;
}
/**
* Returns the usual quantity dropped by the block plus a bonus of 1 to 'i' (inclusive).
*/
public int quantityDroppedWithBonus(int p_149679_1_, Random p_149679_2_)
{
if (p_149679_1_ > 0 && Item.getItemFromBlock(this) != this.getItemDropped(0, p_149679_2_, p_149679_1_))
{
int var3 = p_149679_2_.nextInt(p_149679_1_ + 2) - 1;
if (var3 < 0)
{
var3 = 0;
}
return this.quantityDropped(p_149679_2_) * (var3 + 1);
}
else
{
return this.quantityDropped(p_149679_2_);
}
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.dropBlockAsItemWithChance(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
if (this.getItemDropped(p_149690_5_, p_149690_1_.rand, p_149690_7_) != Item.getItemFromBlock(this))
{
int var8 = 0;
if (this == Blocks.coal_ore)
{
var8 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 0, 2);
}
else if (this == Blocks.diamond_ore)
{
var8 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 3, 7);
}
else if (this == Blocks.emerald_ore)
{
var8 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 3, 7);
}
else if (this == Blocks.lapis_ore)
{
var8 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 2, 5);
}
else if (this == Blocks.quartz_ore)
{
var8 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 2, 5);
}
this.dropXpOnBlockBreak(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, var8);
}
}
/**
* Determines the damage on the item the block drops. Used in cloth and wood.
*/
public int damageDropped(int p_149692_1_)
{
return this == Blocks.lapis_ore ? 4 : 0;
}
}
| 411 | 0.669429 | 1 | 0.669429 | game-dev | MEDIA | 0.997494 | game-dev | 0.786162 | 1 | 0.786162 |
EphemeralSpace/ephemeral-space | 35,610 | Content.Shared/Containers/ItemSlot/ItemSlotsSystem.cs | using System.Diagnostics.CodeAnalysis;
using Content.Shared.ActionBlocker;
using Content.Shared.Administration.Logs;
using Content.Shared.Database;
using Content.Shared.Destructible;
using Content.Shared.Hands.Components;
using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction;
using Content.Shared.Interaction.Events;
using Content.Shared.Popups;
using Content.Shared.Verbs;
using Content.Shared.Whitelist;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Utility;
namespace Content.Shared.Containers.ItemSlots
{
/// <summary>
/// A class that handles interactions related to inserting/ejecting items into/from an item slot.
/// </summary>
/// <remarks>
/// Note when using popups on entities with many slots with InsertOnInteract, EjectOnInteract or EjectOnUse:
/// A single use will try to insert to/eject from every slot and generate a popup for each that fails.
/// </remarks>
public sealed partial class ItemSlotsSystem : EntitySystem
{
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
[Dependency] private readonly ActionBlockerSystem _actionBlockerSystem = default!;
[Dependency] private readonly SharedContainerSystem _containers = default!;
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedAudioSystem _audioSystem = default!;
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
public override void Initialize()
{
base.Initialize();
InitializeLock();
SubscribeLocalEvent<ItemSlotsComponent, MapInitEvent>(OnMapInit);
SubscribeLocalEvent<ItemSlotsComponent, ComponentInit>(Oninitialize);
SubscribeLocalEvent<ItemSlotsComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<ItemSlotsComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<ItemSlotsComponent, UseInHandEvent>(OnUseInHand);
SubscribeLocalEvent<ItemSlotsComponent, GetVerbsEvent<AlternativeVerb>>(AddAlternativeVerbs);
SubscribeLocalEvent<ItemSlotsComponent, GetVerbsEvent<InteractionVerb>>(AddInteractionVerbsVerbs);
SubscribeLocalEvent<ItemSlotsComponent, BreakageEventArgs>(OnBreak);
SubscribeLocalEvent<ItemSlotsComponent, DestructionEventArgs>(OnBreak);
SubscribeLocalEvent<ItemSlotsComponent, ComponentGetState>(GetItemSlotsState);
SubscribeLocalEvent<ItemSlotsComponent, ComponentHandleState>(HandleItemSlotsState);
SubscribeLocalEvent<ItemSlotsComponent, ItemSlotButtonPressedEvent>(HandleButtonPressed);
}
#region ComponentManagement
/// <summary>
/// Spawn in starting items for any item slots that should have one.
/// </summary>
private void OnMapInit(EntityUid uid, ItemSlotsComponent itemSlots, MapInitEvent args)
{
foreach (var slot in itemSlots.Slots.Values)
{
if (slot.HasItem || string.IsNullOrEmpty(slot.StartingItem))
continue;
var item = Spawn(slot.StartingItem, Transform(uid).Coordinates);
if (slot.ContainerSlot != null)
_containers.Insert(item, slot.ContainerSlot);
}
}
/// <summary>
/// Ensure item slots have containers.
/// </summary>
private void Oninitialize(EntityUid uid, ItemSlotsComponent itemSlots, ComponentInit args)
{
foreach (var (id, slot) in itemSlots.Slots)
{
slot.ContainerSlot = _containers.EnsureContainer<ContainerSlot>(uid, id);
}
}
/// <summary>
/// Given a new item slot, store it in the <see cref="ItemSlotsComponent"/> and ensure the slot has an item
/// container.
/// </summary>
public void AddItemSlot(EntityUid uid, string id, ItemSlot slot, ItemSlotsComponent? itemSlots = null)
{
itemSlots ??= EnsureComp<ItemSlotsComponent>(uid);
DebugTools.AssertOwner(uid, itemSlots);
if (itemSlots.Slots.TryGetValue(id, out var existing))
{
if (existing.Local)
Log.Error(
$"Duplicate item slot key. Entity: {Comp<MetaDataComponent>(uid).EntityName} ({uid}), key: {id}");
else
// server state takes priority
slot.CopyFrom(existing);
}
slot.ContainerSlot = _containers.EnsureContainer<ContainerSlot>(uid, id);
itemSlots.Slots[id] = slot;
Dirty(uid, itemSlots);
}
/// <summary>
/// Remove an item slot. This should generally be called whenever a component that added a slot is being
/// removed.
/// </summary>
public void RemoveItemSlot(EntityUid uid, ItemSlot slot, ItemSlotsComponent? itemSlots = null)
{
if (Terminating(uid) || slot.ContainerSlot == null)
return;
_containers.ShutdownContainer(slot.ContainerSlot);
// Don't log missing resolves. when an entity has all of its components removed, the ItemSlotsComponent may
// have been removed before some other component that added an item slot (and is now trying to remove it).
if (!Resolve(uid, ref itemSlots, logMissing: false))
return;
itemSlots.Slots.Remove(slot.ContainerSlot.ID);
if (itemSlots.Slots.Count == 0)
RemComp(uid, itemSlots);
else
Dirty(uid, itemSlots);
}
public bool TryGetSlot(EntityUid uid,
string slotId,
[NotNullWhen(true)] out ItemSlot? itemSlot,
ItemSlotsComponent? component = null)
{
itemSlot = null;
if (!Resolve(uid, ref component))
return false;
return component.Slots.TryGetValue(slotId, out itemSlot);
}
#endregion
#region Interactions
/// <summary>
/// Attempt to take an item from a slot, if any are set to EjectOnInteract.
/// </summary>
private void OnInteractHand(EntityUid uid, ItemSlotsComponent itemSlots, InteractHandEvent args)
{
if (args.Handled)
return;
foreach (var slot in itemSlots.Slots.Values)
{
if (!slot.EjectOnInteract || slot.Item == null || !CanEject(uid, args.User, slot, popup: args.User))
continue;
args.Handled = true;
TryEjectToHands(uid, slot, args.User, true);
break;
}
}
/// <summary>
/// Attempt to eject an item from the first valid item slot.
/// </summary>
private void OnUseInHand(EntityUid uid, ItemSlotsComponent itemSlots, UseInHandEvent args)
{
if (args.Handled)
return;
foreach (var slot in itemSlots.Slots.Values)
{
if (!slot.EjectOnUse || slot.Item == null || !CanEject(uid, args.User, slot, popup: args.User))
continue;
args.Handled = true;
TryEjectToHands(uid, slot, args.User, true);
break;
}
}
/// <summary>
/// Tries to insert a held item in any fitting item slot. If a valid slot already contains an item, it will
/// swap it out and place the old one in the user's hand.
/// </summary>
/// <remarks>
/// This only handles the event if the user has an applicable entity that can be inserted. This allows for
/// other interactions to still happen (e.g., open UI, or toggle-open), despite the user holding an item.
/// Maybe this is undesirable.
/// </remarks>
private void OnInteractUsing(EntityUid uid, ItemSlotsComponent itemSlots, InteractUsingEvent args)
{
if (args.Handled)
return;
if (!TryComp(args.User, out HandsComponent? hands))
return;
if (itemSlots.Slots.Count == 0)
return;
// If any slot can be inserted into don't show popup.
// If any whitelist passes, but slot is locked, then show locked.
// If whitelist fails all, show whitelist fail.
// valid, insertable slots (if any)
var slots = new List<ItemSlot>();
string? whitelistFailPopup = null;
string? lockedFailPopup = null;
foreach (var slot in itemSlots.Slots.Values)
{
if (!slot.InsertOnInteract)
continue;
if (CanInsert(uid, args.Used, args.User, slot, slot.Swap))
{
slots.Add(slot);
}
else
{
var allowed = CanInsertWhitelist(args.Used, slot);
if (lockedFailPopup == null && slot.LockedFailPopup != null && allowed && slot.Locked)
lockedFailPopup = slot.LockedFailPopup;
if (whitelistFailPopup == null && slot.WhitelistFailPopup != null)
whitelistFailPopup = slot.WhitelistFailPopup;
}
}
if (slots.Count == 0)
{
// it's a bit weird that the popupMessage is stored with the item slots themselves, but in practice
// the popup messages will just all be the same, so it's probably fine.
//
// doing a check to make sure that they're all the same or something is probably frivolous
if (lockedFailPopup != null)
_popupSystem.PopupClient(Loc.GetString(lockedFailPopup), uid, args.User);
else if (whitelistFailPopup != null)
_popupSystem.PopupClient(Loc.GetString(whitelistFailPopup), uid, args.User);
return;
}
// Drop the held item onto the floor. Return if the user cannot drop.
if (!_handsSystem.TryDrop(args.User, args.Used))
return;
slots.Sort(SortEmpty);
foreach (var slot in slots)
{
if (slot.Item != null)
_handsSystem.TryPickupAnyHand(args.User, slot.Item.Value, handsComp: hands);
Insert(uid, slot, args.Used, args.User, excludeUserAudio: true);
if (slot.InsertSuccessPopup.HasValue)
_popupSystem.PopupClient(Loc.GetString(slot.InsertSuccessPopup), uid, args.User);
args.Handled = true;
return;
}
}
#endregion
#region Insert
/// <summary>
/// Insert an item into a slot. This does not perform checks, so make sure to also use <see
/// cref="CanInsert"/> or just use <see cref="TryInsert"/> instead.
/// </summary>
/// <param name="excludeUserAudio">If true, will exclude the user when playing sound. Does nothing client-side.
/// Useful for predicted interactions</param>
private void Insert(EntityUid uid,
ItemSlot slot,
EntityUid item,
EntityUid? user,
bool excludeUserAudio = false)
{
bool? inserted = slot.ContainerSlot != null ? _containers.Insert(item, slot.ContainerSlot) : null;
// ContainerSlot automatically raises a directed EntInsertedIntoContainerMessage
// Logging
if (inserted != null && inserted.Value && user != null)
_adminLogger.Add(LogType.Action,
LogImpact.Low,
$"{ToPrettyString(user.Value)} inserted {ToPrettyString(item)} into {slot.ContainerSlot?.ID + " slot of "}{ToPrettyString(uid)}");
_audioSystem.PlayPredicted(slot.InsertSound, uid, excludeUserAudio ? user : null);
}
/// <summary>
/// Check whether a given item can be inserted into a slot. Unless otherwise specified, this will return
/// false if the slot is already filled.
/// </summary>
public bool CanInsert(EntityUid uid,
EntityUid usedUid,
EntityUid? user,
ItemSlot slot,
bool swap = false)
{
if (slot.ContainerSlot == null)
return false;
if (slot.HasItem && (!swap || swap && !CanEject(uid, user, slot)))
return false;
if (!CanInsertWhitelist(usedUid, slot))
return false;
if (slot.Locked)
return false;
var ev = new ItemSlotInsertAttemptEvent(uid, usedUid, user, slot);
RaiseLocalEvent(uid, ref ev);
RaiseLocalEvent(usedUid, ref ev);
if (ev.Cancelled)
{
return false;
}
return _containers.CanInsert(usedUid, slot.ContainerSlot, assumeEmpty: swap);
}
private bool CanInsertWhitelist(EntityUid usedUid, ItemSlot slot)
{
if (_whitelistSystem.IsWhitelistFail(slot.Whitelist, usedUid)
|| _whitelistSystem.IsBlacklistPass(slot.Blacklist, usedUid))
return false;
return true;
}
/// <summary>
/// Tries to insert item into a specific slot.
/// </summary>
/// <returns>False if failed to insert item</returns>
public bool TryInsert(EntityUid uid,
string id,
EntityUid item,
EntityUid? user,
ItemSlotsComponent? itemSlots = null,
bool excludeUserAudio = false)
{
if (!Resolve(uid, ref itemSlots))
return false;
if (!itemSlots.Slots.TryGetValue(id, out var slot))
return false;
return TryInsert(uid, slot, item, user, excludeUserAudio: excludeUserAudio);
}
/// <summary>
/// Tries to insert item into a specific slot.
/// </summary>
/// <returns>False if failed to insert item</returns>
public bool TryInsert(EntityUid uid,
ItemSlot slot,
EntityUid item,
EntityUid? user,
bool excludeUserAudio = false)
{
if (!CanInsert(uid, item, user, slot))
return false;
Insert(uid, slot, item, user, excludeUserAudio: excludeUserAudio);
return true;
}
/// <summary>
/// Tries to insert item into a specific slot from an entity's hand.
/// Does not check action blockers.
/// </summary>
/// <returns>False if failed to insert item</returns>
public bool TryInsertFromHand(EntityUid uid,
ItemSlot slot,
EntityUid user,
HandsComponent? hands = null,
bool excludeUserAudio = false)
{
if (!Resolve(user, ref hands, false))
return false;
if (!_handsSystem.TryGetActiveItem((user, hands), out var held))
return false;
if (!CanInsert(uid, held.Value, user, slot))
return false;
// hands.Drop(item) checks CanDrop action blocker
if (!_handsSystem.TryDrop(user, hands.ActiveHandId!))
return false;
Insert(uid, slot, held.Value, user, excludeUserAudio: excludeUserAudio);
return true;
}
/// <summary>
/// Tries to insert an item into any empty slot.
/// </summary>
/// <param name="ent">The entity that has the item slots.</param>
/// <param name="item">The item to be inserted.</param>
/// <param name="user">The entity performing the interaction.</param>
/// <param name="excludeUserAudio">
/// If true, will exclude the user when playing sound. Does nothing client-side.
/// Useful for predicted interactions
/// </param>
/// <returns>False if failed to insert item</returns>
public bool TryInsertEmpty(Entity<ItemSlotsComponent?> ent,
EntityUid item,
EntityUid? user,
bool excludeUserAudio = false)
{
if (!Resolve(ent, ref ent.Comp, false))
return false;
if (!TryGetAvailableSlot(ent,
item,
user,
out var itemSlot,
emptyOnly: true))
return false;
if (user != null && !_handsSystem.TryDrop(user.Value, item))
return false;
Insert(ent, itemSlot, item, user, excludeUserAudio: excludeUserAudio);
return true;
}
/// <summary>
/// Tries to get any slot that the <paramref name="item"/> can be inserted into.
/// </summary>
/// <param name="ent">Entity that <paramref name="item"/> is being inserted into.</param>
/// <param name="item">Entity being inserted into <paramref name="ent"/>.</param>
/// <param name="userEnt">Entity inserting <paramref name="item"/> into <paramref name="ent"/>.</param>
/// <param name="itemSlot">The ItemSlot on <paramref name="ent"/> to insert <paramref name="item"/> into.</param>
/// <param name="emptyOnly"> True only returns slots that are empty.
/// False returns any slot that is able to receive <paramref name="item"/>.</param>
/// <returns>True when a slot is found. Otherwise, false.</returns>
public bool TryGetAvailableSlot(Entity<ItemSlotsComponent?> ent,
EntityUid item,
Entity<HandsComponent?>? userEnt,
[NotNullWhen(true)] out ItemSlot? itemSlot,
bool emptyOnly = false)
{
itemSlot = null;
if (userEnt is { } user
&& Resolve(user, ref user.Comp)
&& _handsSystem.IsHolding(user, item))
{
if (!_handsSystem.CanDrop(user, item))
return false;
}
if (!Resolve(ent, ref ent.Comp, false))
return false;
var slots = new List<ItemSlot>();
foreach (var slot in ent.Comp.Slots.Values)
{
if (emptyOnly && slot.ContainerSlot?.ContainedEntity != null)
continue;
if (CanInsert(ent, item, userEnt, slot))
slots.Add(slot);
}
if (slots.Count == 0)
return false;
slots.Sort(SortEmpty);
itemSlot = slots[0];
return true;
}
private static int SortEmpty(ItemSlot a, ItemSlot b)
{
var aEnt = a.ContainerSlot?.ContainedEntity;
var bEnt = b.ContainerSlot?.ContainedEntity;
if (aEnt == null && bEnt == null)
return a.Priority.CompareTo(b.Priority);
if (aEnt == null)
return -1;
return 1;
}
#endregion
#region Eject
/// <summary>
/// Check whether an ejection from a given slot may happen.
/// </summary>
/// <remarks>
/// If a popup entity is given, this will generate a popup message if any are configured on the the item slot.
/// </remarks>
public bool CanEject(EntityUid uid, EntityUid? user, ItemSlot slot, EntityUid? popup = null)
{
if (slot.Locked)
{
if (popup.HasValue && slot.LockedFailPopup.HasValue)
_popupSystem.PopupClient(Loc.GetString(slot.LockedFailPopup), uid, popup.Value);
return false;
}
if (slot.ContainerSlot?.ContainedEntity is not { } item)
return false;
var ev = new ItemSlotEjectAttemptEvent(uid, item, user, slot);
RaiseLocalEvent(uid, ref ev);
RaiseLocalEvent(item, ref ev);
if (ev.Cancelled)
return false;
return _containers.CanRemove(item, slot.ContainerSlot);
}
/// <summary>
/// Eject an item from a slot. This does not perform checks (e.g., is the slot locked?), so you should
/// probably just use <see cref="TryEject"/> instead.
/// </summary>
/// <param name="excludeUserAudio">If true, will exclude the user when playing sound. Does nothing client-side.
/// Useful for predicted interactions</param>
private void Eject(EntityUid uid, ItemSlot slot, EntityUid item, EntityUid? user, bool excludeUserAudio = false)
{
bool? ejected = slot.ContainerSlot != null ? _containers.Remove(item, slot.ContainerSlot) : null;
// ContainerSlot automatically raises a directed EntRemovedFromContainerMessage
// Logging
if (ejected != null && ejected.Value && user != null)
_adminLogger.Add(LogType.Action,
LogImpact.Low,
$"{ToPrettyString(user.Value)} ejected {ToPrettyString(item)} from {slot.ContainerSlot?.ID + " slot of "}{ToPrettyString(uid)}");
_audioSystem.PlayPredicted(slot.EjectSound, uid, excludeUserAudio ? user : null);
}
/// <summary>
/// Try to eject an item from a slot.
/// </summary>
/// <returns>False if item slot is locked or has no item inserted</returns>
public bool TryEject(EntityUid uid,
ItemSlot slot,
EntityUid? user,
[NotNullWhen(true)] out EntityUid? item,
bool excludeUserAudio = false)
{
item = null;
// This handles logic with the slot itself
if (!CanEject(uid, user, slot))
return false;
item = slot.Item;
// This handles user logic
if (user != null && item != null && !_actionBlockerSystem.CanPickup(user.Value, item.Value))
return false;
Eject(uid, slot, item!.Value, user, excludeUserAudio);
return true;
}
/// <summary>
/// Try to eject item from a slot.
/// </summary>
/// <returns>False if the id is not valid, the item slot is locked, or it has no item inserted</returns>
public bool TryEject(EntityUid uid,
string id,
EntityUid? user,
[NotNullWhen(true)] out EntityUid? item,
ItemSlotsComponent? itemSlots = null,
bool excludeUserAudio = false)
{
item = null;
if (!Resolve(uid, ref itemSlots))
return false;
if (!itemSlots.Slots.TryGetValue(id, out var slot))
return false;
return TryEject(uid, slot, user, out item, excludeUserAudio);
}
/// <summary>
/// Try to eject item from a slot directly into a user's hands. If they have no hands, the item will still
/// be ejected onto the floor.
/// </summary>
/// <returns>
/// False if the id is not valid, the item slot is locked, or it has no item inserted. True otherwise, even
/// if the user has no hands.
/// </returns>
public bool TryEjectToHands(EntityUid uid, ItemSlot slot, EntityUid? user, bool excludeUserAudio = false)
{
if (!TryEject(uid, slot, user, out var item, excludeUserAudio))
return false;
if (user != null)
_handsSystem.PickupOrDrop(user.Value, item.Value);
return true;
}
#endregion
#region Verbs
private void AddAlternativeVerbs(EntityUid uid,
ItemSlotsComponent itemSlots,
GetVerbsEvent<AlternativeVerb> args)
{
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
{
return;
}
// Add the insert-item verbs
if (args.Using != null && _actionBlockerSystem.CanDrop(args.User))
{
var canInsertAny = false;
foreach (var slot in itemSlots.Slots.Values)
{
// Disable slot insert if InsertOnInteract is true
if (slot.InsertOnInteract || !CanInsert(uid, args.Using.Value, args.User, slot))
continue;
var verbSubject = slot.Name != string.Empty
? Loc.GetString(slot.Name)
: Name(args.Using.Value);
AlternativeVerb verb = new()
{
IconEntity = GetNetEntity(args.Using),
Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true)
};
if (slot.InsertVerbText != null)
{
verb.Text = Loc.GetString(slot.InsertVerbText);
verb.Icon = new SpriteSpecifier.Texture(
new("/Textures/Interface/VerbIcons/insert.svg.192dpi.png"));
}
else if (slot.EjectOnInteract)
{
// Inserting/ejecting is a primary interaction for this entity. Instead of using the insert
// category, we will use a single "Place <item>" verb.
verb.Text = Loc.GetString("place-item-verb-text", ("subject", verbSubject));
verb.Icon = new SpriteSpecifier.Texture(
new("/Textures/Interface/VerbIcons/drop.svg.192dpi.png"));
}
else
{
verb.Category = VerbCategory.Insert;
verb.Text = verbSubject;
}
verb.Priority = slot.Priority;
args.Verbs.Add(verb);
canInsertAny = true;
}
// If can insert then insert. Don't run eject verbs.
if (canInsertAny)
return;
}
// Add the eject-item verbs
foreach (var slot in itemSlots.Slots.Values)
{
if (slot.EjectOnInteract || slot.DisableEject)
// For this item slot, ejecting/inserting is a primary interaction. Instead of an eject category
// alt-click verb, there will be a "Take item" primary interaction verb.
continue;
if (!CanEject(uid, args.User, slot))
continue;
if (!_actionBlockerSystem.CanPickup(args.User, slot.Item!.Value))
continue;
var verbSubject = slot.Name != string.Empty
? Loc.GetString(slot.Name)
: Comp<MetaDataComponent>(slot.Item.Value).EntityName ?? string.Empty;
AlternativeVerb verb = new()
{
IconEntity = GetNetEntity(slot.Item),
Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true)
};
if (slot.EjectVerbText == null)
{
verb.Text = verbSubject;
verb.Category = VerbCategory.Eject;
}
else
{
verb.Text = Loc.GetString(slot.EjectVerbText);
}
verb.Priority = slot.Priority;
args.Verbs.Add(verb);
}
}
private void AddInteractionVerbsVerbs(EntityUid uid,
ItemSlotsComponent itemSlots,
GetVerbsEvent<InteractionVerb> args)
{
if (args.Hands == null || !args.CanAccess || !args.CanInteract)
return;
// If there are any slots that eject on left-click, add a "Take <item>" verb.
foreach (var slot in itemSlots.Slots.Values)
{
if (!slot.EjectOnInteract || !CanEject(uid, args.User, slot))
continue;
if (!_actionBlockerSystem.CanPickup(args.User, slot.Item!.Value))
continue;
var verbSubject = slot.Name != string.Empty
? Loc.GetString(slot.Name)
: Name(slot.Item!.Value);
InteractionVerb takeVerb = new()
{
IconEntity = GetNetEntity(slot.Item),
Act = () => TryEjectToHands(uid, slot, args.User, excludeUserAudio: true)
};
if (slot.EjectVerbText == null)
takeVerb.Text = Loc.GetString("take-item-verb-text", ("subject", verbSubject));
else
takeVerb.Text = Loc.GetString(slot.EjectVerbText);
takeVerb.Priority = slot.Priority;
args.Verbs.Add(takeVerb);
}
// Next, add the insert-item verbs
if (args.Using == null || !_actionBlockerSystem.CanDrop(args.User))
return;
foreach (var slot in itemSlots.Slots.Values)
{
if (!slot.InsertOnInteract || !CanInsert(uid, args.Using.Value, args.User, slot))
continue;
var verbSubject = slot.Name != string.Empty
? Loc.GetString(slot.Name)
: Name(args.Using.Value);
InteractionVerb insertVerb = new()
{
IconEntity = GetNetEntity(args.Using),
Act = () => Insert(uid, slot, args.Using.Value, args.User, excludeUserAudio: true)
};
if (slot.InsertVerbText != null)
{
insertVerb.Text = Loc.GetString(slot.InsertVerbText);
insertVerb.Icon =
new SpriteSpecifier.Texture(
new ResPath("/Textures/Interface/VerbIcons/insert.svg.192dpi.png"));
}
else if (slot.EjectOnInteract)
{
// Inserting/ejecting is a primary interaction for this entity. Instead of using the insert
// category, we will use a single "Place <item>" verb.
insertVerb.Text = Loc.GetString("place-item-verb-text", ("subject", verbSubject));
insertVerb.Icon =
new SpriteSpecifier.Texture(
new ResPath("/Textures/Interface/VerbIcons/drop.svg.192dpi.png"));
}
else
{
insertVerb.Category = VerbCategory.Insert;
insertVerb.Text = verbSubject;
}
insertVerb.Priority = slot.Priority;
args.Verbs.Add(insertVerb);
}
}
#endregion
#region BUIs
private void HandleButtonPressed(EntityUid uid, ItemSlotsComponent component, ItemSlotButtonPressedEvent args)
{
if (!component.Slots.TryGetValue(args.SlotId, out var slot))
return;
if (args.TryEject && slot.HasItem)
TryEjectToHands(uid, slot, args.Actor, true);
else if (args.TryInsert && !slot.HasItem)
TryInsertFromHand(uid, slot, args.Actor);
}
#endregion
/// <summary>
/// Eject items from (some) slots when the entity is destroyed.
/// </summary>
private void OnBreak(EntityUid uid, ItemSlotsComponent component, EntityEventArgs args)
{
foreach (var slot in component.Slots.Values)
{
if (slot.EjectOnBreak && slot.HasItem)
{
SetLock(uid, slot, false, component);
TryEject(uid, slot, null, out var _);
}
}
}
/// <summary>
/// Get the contents of some item slot.
/// </summary>
/// <returns>The item in the slot, or null if the slot is empty or the entity doesn't have an <see cref="ItemSlotsComponent"/>.</returns>
public EntityUid? GetItemOrNull(EntityUid uid, string id, ItemSlotsComponent? itemSlots = null)
{
if (!Resolve(uid, ref itemSlots, logMissing: false))
return null;
return itemSlots.Slots.GetValueOrDefault(id)?.Item;
}
/// <summary>
/// Lock an item slot. This stops items from being inserted into or ejected from this slot.
/// </summary>
public void SetLock(EntityUid uid, string id, bool locked, ItemSlotsComponent? itemSlots = null)
{
if (!Resolve(uid, ref itemSlots))
return;
if (!itemSlots.Slots.TryGetValue(id, out var slot))
return;
SetLock(uid, slot, locked, itemSlots);
}
/// <summary>
/// Lock an item slot. This stops items from being inserted into or ejected from this slot.
/// </summary>
public void SetLock(EntityUid uid, ItemSlot slot, bool locked, ItemSlotsComponent? itemSlots = null)
{
if (!Resolve(uid, ref itemSlots))
return;
slot.Locked = locked;
Dirty(uid, itemSlots);
}
/// <summary>
/// Update the locked state of the managed item slots.
/// </summary>
/// <remarks>
/// Note that the slot's ContainerSlot performs its own networking, so we don't need to send information
/// about the contained entity.
/// </remarks>
private void HandleItemSlotsState(EntityUid uid, ItemSlotsComponent component, ref ComponentHandleState args)
{
if (args.Current is not ItemSlotsComponentState state)
return;
foreach (var (key, slot) in component.Slots)
{
if (!state.Slots.ContainsKey(key))
RemoveItemSlot(uid, slot, component);
}
foreach (var (serverKey, serverSlot) in state.Slots)
{
if (component.Slots.TryGetValue(serverKey, out var itemSlot))
{
itemSlot.CopyFrom(serverSlot);
itemSlot.ContainerSlot = _containers.EnsureContainer<ContainerSlot>(uid, serverKey);
}
else
{
var slot = new ItemSlot(serverSlot);
slot.Local = false;
AddItemSlot(uid, serverKey, slot);
}
}
}
private void GetItemSlotsState(EntityUid uid, ItemSlotsComponent component, ref ComponentGetState args)
{
args.State = new ItemSlotsComponentState(component.Slots);
}
}
}
| 411 | 0.964667 | 1 | 0.964667 | game-dev | MEDIA | 0.944153 | game-dev | 0.964037 | 1 | 0.964037 |
mariumbacchus/Soulslike-Weaponry | 7,700 | src/main/java/net/soulsweaponry/items/scythe/SoulReaper.java | package net.soulsweaponry.items.scythe;
import net.minecraft.client.render.item.BuiltinModelItemRenderer;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ToolMaterial;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.Hand;
import net.minecraft.util.TypedActionResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.soulsweaponry.client.renderer.item.SoulReaperRenderer;
import net.soulsweaponry.config.ConfigConstructor;
import net.soulsweaponry.entity.mobs.Forlorn;
import net.soulsweaponry.entity.mobs.SoulReaperGhost;
import net.soulsweaponry.entity.mobs.Soulmass;
import net.soulsweaponry.entitydata.IEntityDataSaver;
import net.soulsweaponry.entitydata.SummonsData;
import net.soulsweaponry.items.ISummonAllies;
import net.soulsweaponry.items.SoulHarvestingItem;
import net.soulsweaponry.particles.ParticleEvents;
import net.soulsweaponry.particles.ParticleHandler;
import net.soulsweaponry.registry.EntityRegistry;
import net.soulsweaponry.registry.SoundRegistry;
import net.soulsweaponry.util.TooltipAbilities;
import software.bernie.geckolib.animatable.GeoItem;
import software.bernie.geckolib.animatable.client.RenderProvider;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.*;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.UUID;
import java.util.function.Consumer;
import java.util.function.Supplier;
public class SoulReaper extends SoulHarvestingItem implements GeoItem, ISummonAllies {
private final AnimatableInstanceCache factory = GeckoLibUtil.createInstanceCache(this);
private final Supplier<Object> renderProvider = GeoItem.makeRenderer(this);
public SoulReaper(ToolMaterial toolMaterial, Settings settings) {
super(toolMaterial, (int) ConfigConstructor.soul_reaper_damage, ConfigConstructor.soul_reaper_attack_speed, settings);
this.addTooltipAbility(TooltipAbilities.SOUL_RELEASE);
}
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity player, Hand hand) {
ItemStack stack = player.getStackInHand(hand);
if (this.isDisabled(stack)) {
this.notifyDisabled(player);
return TypedActionResult.fail(stack);
}
if (stack.hasNbt() && stack.getNbt().contains(KILLS)) {
int power = this.getSouls(stack);
if (player.isCreative()) power = player.getRandom().nextBetween(5, 50);
if (power >= 3 && !world.isClient && this.canSummonEntity((ServerWorld) world, player, this.getSummonsListId())) {
Vec3d vecBlocksAway = player.getRotationVector().multiply(3).add(player.getPos());
ParticleHandler.particleOutburstMap(world, 50, vecBlocksAway.getX(), vecBlocksAway.getY(), vecBlocksAway.getZ(), ParticleEvents.CONJURE_ENTITY_MAP, 1f);
world.playSound(null, player.getBlockPos(), SoundRegistry.NIGHTFALL_SPAWN_EVENT, SoundCategory.PLAYERS, 0.8f, 1f);
if (power < 10) {
SoulReaperGhost entity = new SoulReaperGhost(EntityRegistry.SOUL_REAPER_GHOST, world);
entity.setPos(vecBlocksAway.x, player.getY() + .1f, vecBlocksAway.z);
entity.setOwner(player);
world.spawnEntity(entity);
this.saveSummonUuid(player, entity.getUuid());
if (!player.isCreative()) this.addAmount(stack, -3);
} else if (player.isSneaking() || power < 30) {
Forlorn entity = new Forlorn(EntityRegistry.FORLORN, world);
entity.setPos(vecBlocksAway.x, player.getY() + .1f, vecBlocksAway.z);
entity.setOwner(player);
world.spawnEntity(entity);
this.saveSummonUuid(player, entity.getUuid());
if (!player.isCreative()) this.addAmount(stack, -10);
} else {
Soulmass entity = new Soulmass(EntityRegistry.SOULMASS, world);
entity.setPos(vecBlocksAway.x, player.getY() + .1f, vecBlocksAway.z);
entity.setOwner(player);
world.spawnEntity(entity);
this.saveSummonUuid(player, entity.getUuid());
if (!player.isCreative()) this.addAmount(stack, -30);
}
stack.damage(3, player, (p_220045_0_) -> p_220045_0_.sendToolBreakStatus(hand));
return TypedActionResult.success(stack, true);
}
}
return TypedActionResult.fail(stack);
}
private PlayState predicate(AnimationState<?> event){
//Figure out how to dynamically change the animation with ISyncable (problem now is that it can't override the prev. animation)
/*ClientPlayerEntity player;
if ((player = MinecraftClient.getInstance().player) != null) {
for (Hand hand : Hand.values()) {
ItemStack stack = player.getStackInHand(hand);
if (stack.isOf(WeaponRegistry.SOUL_REAPER)) {
int souls = this.getSouls(stack);
if (souls >= 10) {
if (souls >= 30) {
event.getController().setAnimation(new AnimationBuilder().addAnimation("high_souls", EDefaultLoopTypes.LOOP));
} else {
event.getController().setAnimation(new AnimationBuilder().addAnimation("mid_souls", EDefaultLoopTypes.LOOP));
}
return PlayState.CONTINUE;
}
}
}
}*/
event.getController().setAnimation(RawAnimation.begin().then("low_souls", Animation.LoopType.LOOP));
return PlayState.CONTINUE;
}
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
data.add(new AnimationController<>(this, "controller", 0, this::predicate));
}
@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return this.factory;
}
@Override
public void createRenderer(Consumer<Object> consumer) {
consumer.accept(new RenderProvider() {
private final SoulReaperRenderer renderer = new SoulReaperRenderer();
@Override
public BuiltinModelItemRenderer getCustomRenderer() {
return this.renderer;
}
});
}
@Override
public Supplier<Object> getRenderProvider() {
return this.renderProvider;
}
@Override
public int getMaxSummons() {
return (int) ConfigConstructor.soul_reaper_summoned_allies_cap;
}
@Override
public String getSummonsListId() {
return "SoulReaperSummons";
}
@Override
public void saveSummonUuid(LivingEntity user, UUID summonUuid) {
SummonsData.addSummonUUID((IEntityDataSaver) user, summonUuid, this.getSummonsListId());
}
@Override
public boolean isDisabled(ItemStack stack) {
return ConfigConstructor.disable_use_soul_reaper;
}
@Override
public boolean isFireproof() {
return ConfigConstructor.is_fireproof_soul_reaper;
}
@Override
public boolean canEnchantReduceCooldown(ItemStack stack) {
return false;
}
@Override
public String[] getReduceCooldownEnchantIds(ItemStack stack) {
return null;
}
} | 411 | 0.957671 | 1 | 0.957671 | game-dev | MEDIA | 0.96759 | game-dev | 0.970098 | 1 | 0.970098 |
DethRaid/SanityEngine | 29,386 | SanityEngine/extern/physx/include/physx/PxFiltering.h | //
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of NVIDIA CORPORATION nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_NX_FILTERING
#define PX_PHYSICS_NX_FILTERING
/** \addtogroup physics
@{
*/
#include "PxPhysXConfig.h"
#include "foundation/PxFlags.h"
#if !PX_DOXYGEN
namespace physx
{
#endif
class PxActor;
class PxShape;
static const PxU32 INVALID_FILTER_PAIR_INDEX = 0xffffffff;
/**
\brief Collection of flags describing the actions to take for a collision pair.
@see PxPairFlags PxSimulationFilterShader.filter() PxSimulationFilterCallback
*/
struct PxPairFlag
{
enum Enum
{
/**
\brief Process the contacts of this collision pair in the dynamics solver.
\note Only takes effect if the colliding actors are rigid bodies.
*/
eSOLVE_CONTACT = (1<<0),
/**
\brief Call contact modification callback for this collision pair
\note Only takes effect if the colliding actors are rigid bodies.
@see PxContactModifyCallback
*/
eMODIFY_CONTACTS = (1<<1),
/**
\brief Call contact report callback or trigger callback when this collision pair starts to be in contact.
If one of the two collision objects is a trigger shape (see #PxShapeFlag::eTRIGGER_SHAPE)
then the trigger callback will get called as soon as the other object enters the trigger volume.
If none of the two collision objects is a trigger shape then the contact report callback will get
called when the actors of this collision pair start to be in contact.
\note Only takes effect if the colliding actors are rigid bodies.
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger()
*/
eNOTIFY_TOUCH_FOUND = (1<<2),
/**
\brief Call contact report callback while this collision pair is in contact
If none of the two collision objects is a trigger shape then the contact report callback will get
called while the actors of this collision pair are in contact.
\note Triggers do not support this event. Persistent trigger contacts need to be tracked separately by observing eNOTIFY_TOUCH_FOUND/eNOTIFY_TOUCH_LOST events.
\note Only takes effect if the colliding actors are rigid bodies.
\note No report will get sent if the objects in contact are sleeping.
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
\note If this flag gets enabled while a pair is in touch already, there will be no eNOTIFY_TOUCH_PERSISTS events until the pair loses and regains touch.
@see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger()
*/
eNOTIFY_TOUCH_PERSISTS = (1<<3),
/**
\brief Call contact report callback or trigger callback when this collision pair stops to be in contact
If one of the two collision objects is a trigger shape (see #PxShapeFlag::eTRIGGER_SHAPE)
then the trigger callback will get called as soon as the other object leaves the trigger volume.
If none of the two collision objects is a trigger shape then the contact report callback will get
called when the actors of this collision pair stop to be in contact.
\note Only takes effect if the colliding actors are rigid bodies.
\note This event will also get triggered if one of the colliding objects gets deleted.
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger()
*/
eNOTIFY_TOUCH_LOST = (1<<4),
/**
\brief Call contact report callback when this collision pair is in contact during CCD passes.
If CCD with multiple passes is enabled, then a fast moving object might bounce on and off the same
object multiple times. Hence, the same pair might be in contact multiple times during a simulation step.
This flag will make sure that all the detected collision during CCD will get reported. For performance
reasons, the system can not always tell whether the contact pair lost touch in one of the previous CCD
passes and thus can also not always tell whether the contact is new or has persisted. eNOTIFY_TOUCH_CCD
just reports when the two collision objects were detected as being in contact during a CCD pass.
\note Only takes effect if the colliding actors are rigid bodies.
\note Trigger shapes are not supported.
\note Only takes effect if eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact() PxSimulationEventCallback.onTrigger()
*/
eNOTIFY_TOUCH_CCD = (1<<5),
/**
\brief Call contact report callback when the contact force between the actors of this collision pair exceeds one of the actor-defined force thresholds.
\note Only takes effect if the colliding actors are rigid bodies.
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact()
*/
eNOTIFY_THRESHOLD_FORCE_FOUND = (1<<6),
/**
\brief Call contact report callback when the contact force between the actors of this collision pair continues to exceed one of the actor-defined force thresholds.
\note Only takes effect if the colliding actors are rigid bodies.
\note If a pair gets re-filtered and this flag has previously been disabled, then the report will not get fired in the same frame even if the force threshold has been reached in the
previous one (unless #eNOTIFY_THRESHOLD_FORCE_FOUND has been set in the previous frame).
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact()
*/
eNOTIFY_THRESHOLD_FORCE_PERSISTS = (1<<7),
/**
\brief Call contact report callback when the contact force between the actors of this collision pair falls below one of the actor-defined force thresholds (includes the case where this collision pair stops being in contact).
\note Only takes effect if the colliding actors are rigid bodies.
\note If a pair gets re-filtered and this flag has previously been disabled, then the report will not get fired in the same frame even if the force threshold has been reached in the
previous one (unless #eNOTIFY_THRESHOLD_FORCE_FOUND or #eNOTIFY_THRESHOLD_FORCE_PERSISTS has been set in the previous frame).
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact()
*/
eNOTIFY_THRESHOLD_FORCE_LOST = (1<<8),
/**
\brief Provide contact points in contact reports for this collision pair.
\note Only takes effect if the colliding actors are rigid bodies and if used in combination with the flags eNOTIFY_TOUCH_... or eNOTIFY_THRESHOLD_FORCE_...
\note Only takes effect if eDETECT_DISCRETE_CONTACT or eDETECT_CCD_CONTACT is raised
@see PxSimulationEventCallback.onContact() PxContactPair PxContactPair.extractContacts()
*/
eNOTIFY_CONTACT_POINTS = (1<<9),
/**
\brief This flag is used to indicate whether this pair generates discrete collision detection contacts.
\note Contacts are only responded to if eSOLVE_CONTACT is enabled.
*/
eDETECT_DISCRETE_CONTACT = (1<<10),
/**
\brief This flag is used to indicate whether this pair generates CCD contacts.
\note The contacts will only be responded to if eSOLVE_CONTACT is enabled on this pair.
\note The scene must have PxSceneFlag::eENABLE_CCD enabled to use this feature.
\note Non-static bodies of the pair should have PxRigidBodyFlag::eENABLE_CCD specified for this feature to work correctly.
\note This flag is not supported with trigger shapes. However, CCD trigger events can be emulated using non-trigger shapes
and requesting eNOTIFY_TOUCH_FOUND and eNOTIFY_TOUCH_LOST and not raising eSOLVE_CONTACT on the pair.
@see PxRigidBodyFlag::eENABLE_CCD
@see PxSceneFlag::eENABLE_CCD
*/
eDETECT_CCD_CONTACT = (1<<11),
/**
\brief Provide pre solver velocities in contact reports for this collision pair.
If the collision pair has contact reports enabled, the velocities of the rigid bodies before contacts have been solved
will be provided in the contact report callback unless the pair lost touch in which case no data will be provided.
\note Usually it is not necessary to request these velocities as they will be available by querying the velocity from the provided
PxRigidActor object directly. However, it might be the case that the velocity of a rigid body gets set while the simulation is running
in which case the PxRigidActor would return this new velocity in the contact report callback and not the velocity the simulation used.
@see PxSimulationEventCallback.onContact(), PxContactPairVelocity, PxContactPairHeader.extraDataStream
*/
ePRE_SOLVER_VELOCITY = (1<<12),
/**
\brief Provide post solver velocities in contact reports for this collision pair.
If the collision pair has contact reports enabled, the velocities of the rigid bodies after contacts have been solved
will be provided in the contact report callback unless the pair lost touch in which case no data will be provided.
@see PxSimulationEventCallback.onContact(), PxContactPairVelocity, PxContactPairHeader.extraDataStream
*/
ePOST_SOLVER_VELOCITY = (1<<13),
/**
\brief Provide rigid body poses in contact reports for this collision pair.
If the collision pair has contact reports enabled, the rigid body poses at the contact event will be provided
in the contact report callback unless the pair lost touch in which case no data will be provided.
\note Usually it is not necessary to request these poses as they will be available by querying the pose from the provided
PxRigidActor object directly. However, it might be the case that the pose of a rigid body gets set while the simulation is running
in which case the PxRigidActor would return this new pose in the contact report callback and not the pose the simulation used.
Another use case is related to CCD with multiple passes enabled, A fast moving object might bounce on and off the same
object multiple times. This flag can be used to request the rigid body poses at the time of impact for each such collision event.
@see PxSimulationEventCallback.onContact(), PxContactPairPose, PxContactPairHeader.extraDataStream
*/
eCONTACT_EVENT_POSE = (1<<14),
eNEXT_FREE = (1<<15), //!< For internal use only.
/**
\brief Provided default flag to do simple contact processing for this collision pair.
*/
eCONTACT_DEFAULT = eSOLVE_CONTACT | eDETECT_DISCRETE_CONTACT,
/**
\brief Provided default flag to get commonly used trigger behavior for this collision pair.
*/
eTRIGGER_DEFAULT = eNOTIFY_TOUCH_FOUND | eNOTIFY_TOUCH_LOST | eDETECT_DISCRETE_CONTACT
};
};
/**
\brief Bitfield that contains a set of raised flags defined in PxPairFlag.
@see PxPairFlag
*/
typedef PxFlags<PxPairFlag::Enum, PxU16> PxPairFlags;
PX_FLAGS_OPERATORS(PxPairFlag::Enum, PxU16)
/**
\brief Collection of flags describing the filter actions to take for a collision pair.
@see PxFilterFlags PxSimulationFilterShader PxSimulationFilterCallback
*/
struct PxFilterFlag
{
enum Enum
{
/**
\brief Ignore the collision pair as long as the bounding volumes of the pair objects overlap.
Killed pairs will be ignored by the simulation and won't run through the filter again until one
of the following occurs:
\li The bounding volumes of the two objects overlap again (after being separated)
\li The user enforces a re-filtering (see #PxScene::resetFiltering())
@see PxScene::resetFiltering()
*/
eKILL = (1<<0),
/**
\brief Ignore the collision pair as long as the bounding volumes of the pair objects overlap or until filtering relevant data changes for one of the collision objects.
Suppressed pairs will be ignored by the simulation and won't make another filter request until one
of the following occurs:
\li Same conditions as for killed pairs (see #eKILL)
\li The filter data or the filter object attributes change for one of the collision objects
@see PxFilterData PxFilterObjectAttributes
*/
eSUPPRESS = (1<<1),
/**
\brief Invoke the filter callback (#PxSimulationFilterCallback::pairFound()) for this collision pair.
@see PxSimulationFilterCallback
*/
eCALLBACK = (1<<2),
/**
\brief Track this collision pair with the filter callback mechanism.
When the bounding volumes of the collision pair lose contact, the filter callback #PxSimulationFilterCallback::pairLost()
will be invoked. Furthermore, the filter status of the collision pair can be adjusted through #PxSimulationFilterCallback::statusChange()
once per frame (until a pairLost() notification occurs).
@see PxSimulationFilterCallback
*/
eNOTIFY = (1<<3) | eCALLBACK,
/**
\brief Provided default to get standard behavior:
The application configure the pair's collision properties once when bounding volume overlap is found and
doesn't get asked again about that pair until overlap status or filter properties changes, or re-filtering is requested.
No notification is provided when bounding volume overlap is lost
The pair will not be killed or suppressed, so collision detection will be processed
*/
eDEFAULT = 0
};
};
/**
\brief Bitfield that contains a set of raised flags defined in PxFilterFlag.
@see PxFilterFlag
*/
typedef PxFlags<PxFilterFlag::Enum, PxU16> PxFilterFlags;
PX_FLAGS_OPERATORS(PxFilterFlag::Enum, PxU16)
/**
\brief PxFilterData is user-definable data which gets passed into the collision filtering shader and/or callback.
@see PxShape.setSimulationFilterData() PxShape.getSimulationFilterData() PxSimulationFilterShader PxSimulationFilterCallback
*/
struct PxFilterData
{
//= ATTENTION! =====================================================================================
// Changing the data layout of this class breaks the binary serialization format. See comments for
// PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
// function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
// accordingly.
//==================================================================================================
PX_INLINE PxFilterData(const PxEMPTY)
{
}
/**
\brief Default constructor.
*/
PX_INLINE PxFilterData()
{
word0 = word1 = word2 = word3 = 0;
}
/**
\brief Copy constructor.
*/
PX_INLINE PxFilterData(const PxFilterData& fd) : word0(fd.word0), word1(fd.word1), word2(fd.word2), word3(fd.word3) {}
/**
\brief Constructor to set filter data initially.
*/
PX_INLINE PxFilterData(PxU32 w0, PxU32 w1, PxU32 w2, PxU32 w3) : word0(w0), word1(w1), word2(w2), word3(w3) {}
/**
\brief (re)sets the structure to the default.
*/
PX_INLINE void setToDefault()
{
*this = PxFilterData();
}
/**
\brief Assignment operator
*/
PX_INLINE void operator = (const PxFilterData& fd)
{
word0 = fd.word0;
word1 = fd.word1;
word2 = fd.word2;
word3 = fd.word3;
}
/**
\brief Comparison operator to allow use in Array.
*/
PX_INLINE bool operator == (const PxFilterData& a) const
{
return a.word0 == word0 && a.word1 == word1 && a.word2 == word2 && a.word3 == word3;
}
/**
\brief Comparison operator to allow use in Array.
*/
PX_INLINE bool operator != (const PxFilterData& a) const
{
return !(a == *this);
}
PxU32 word0;
PxU32 word1;
PxU32 word2;
PxU32 word3;
};
/**
\brief Identifies each type of filter object.
@see PxGetFilterObjectType()
*/
struct PxFilterObjectType
{
enum Enum
{
/**
\brief A static rigid body
@see PxRigidStatic
*/
eRIGID_STATIC,
/**
\brief A dynamic rigid body
@see PxRigidDynamic
*/
eRIGID_DYNAMIC,
/**
\brief An articulation
@see PxArticulation
*/
eARTICULATION,
//brief internal use only!
eMAX_TYPE_COUNT = 16,
//brief internal use only!
eUNDEFINED = eMAX_TYPE_COUNT-1
};
};
// For internal use only
struct PxFilterObjectFlag
{
enum Enum
{
eKINEMATIC = (1<<4),
eTRIGGER = (1<<5)
};
};
/**
\brief Structure which gets passed into the collision filtering shader and/or callback providing additional information on objects of a collision pair
@see PxSimulationFilterShader PxSimulationFilterCallback getActorType() PxFilterObjectIsKinematic() PxFilterObjectIsTrigger()
*/
typedef PxU32 PxFilterObjectAttributes;
/**
\brief Extract filter object type from the filter attributes of a collision pair object
\param[in] attr The filter attribute of a collision pair object
\return The type of the collision pair object.
@see PxFilterObjectType
*/
PX_INLINE PxFilterObjectType::Enum PxGetFilterObjectType(PxFilterObjectAttributes attr)
{
return PxFilterObjectType::Enum(attr & (PxFilterObjectType::eMAX_TYPE_COUNT-1));
}
/**
\brief Specifies whether the collision object belongs to a kinematic rigid body
\param[in] attr The filter attribute of a collision pair object
\return True if the object belongs to a kinematic rigid body, else false
@see PxRigidBodyFlag::eKINEMATIC
*/
PX_INLINE bool PxFilterObjectIsKinematic(PxFilterObjectAttributes attr)
{
return (attr & PxFilterObjectFlag::eKINEMATIC) != 0;
}
/**
\brief Specifies whether the collision object is a trigger shape
\param[in] attr The filter attribute of a collision pair object
\return True if the object is a trigger shape, else false
@see PxShapeFlag::eTRIGGER_SHAPE
*/
PX_INLINE bool PxFilterObjectIsTrigger(PxFilterObjectAttributes attr)
{
return (attr & PxFilterObjectFlag::eTRIGGER) != 0;
}
/**
\brief Filter shader to specify handling of collision pairs.
Collision filtering is a mechanism to specify how a pair of potentially colliding objects should be processed by the
simulation. A pair of objects is potentially colliding if the bounding volumes of the two objects overlap.
In short, a collision filter decides whether a collision pair should get processed, temporarily ignored or discarded.
If a collision pair should get processed, the filter can additionally specify how it should get processed, for instance,
whether contacts should get resolved, which callbacks should get invoked or which reports should be sent etc.
\note A default implementation of a filter shader is provided in the PhysX extensions library, see #PxDefaultSimulationFilterShader.
@see PxSceneDesc.filterShader PxSimulationFilterCallback
*/
/**
\brief Filter method to specify how a pair of potentially colliding objects should be processed.
Return the PxFilterFlag flags and set the PxPairFlag flags to define what the simulation should do with the given collision pair.
This methods gets called when:
\li The bounding volumes of two objects start to overlap.
\li The bounding volumes of two objects overlap and the filter data or filter attributes of one of the objects changed
\li A re-filtering was forced through resetFiltering() (see #PxScene::resetFiltering())
\li Filtering is requested in scene queries
\note Certain pairs of objects are always ignored and this method does not get called. This is the case for the
following pairs:
\li Pair of static rigid actors
\li A static rigid actor and a kinematic actor (unless one is a trigger or if explicitly enabled through PxPairFilteringMode::eKEEP)
\li Two kinematic actors (unless one is a trigger or if explicitly enabled through PxPairFilteringMode::eKEEP)
\li Two jointed rigid bodies and the joint was defined to disable collision
\li Two articulation links if connected through an articulation joint
\note This is a performance critical method and should be stateless. You should neither access external objects
from within this method nor should you call external methods that are not inlined. If you need a more complex
logic to filter a collision pair then use the filter callback mechanism for this pair (see #PxSimulationFilterCallback,
#PxFilterFlag::eCALLBACK, #PxFilterFlag::eNOTIFY).
\param[in] attributes0 The filter attribute of the first object
\param[in] filterData0 The custom filter data of the first object
\param[in] attributes1 The filter attribute of the second object
\param[in] filterData1 The custom filter data of the second object
\param[out] pairFlags Flags giving additional information on how an accepted pair should get processed
\param[in] constantBlock The constant global filter data (see #PxSceneDesc.filterShaderData)
\param[in] constantBlockSize Size of the global filter data (see #PxSceneDesc.filterShaderDataSize)
\return Filter flags defining whether the pair should be discarded, temporarily ignored, processed and whether the
filter callback should get invoked for this pair.
@see PxSimulationFilterCallback PxFilterData PxFilterObjectAttributes PxFilterFlag PxFilterFlags PxPairFlag PxPairFlags
*/
typedef PxFilterFlags (*PxSimulationFilterShader)
(PxFilterObjectAttributes attributes0, PxFilterData filterData0,
PxFilterObjectAttributes attributes1, PxFilterData filterData1,
PxPairFlags& pairFlags, const void* constantBlock, PxU32 constantBlockSize);
/**
\brief Filter callback to specify handling of collision pairs.
This class is provided to implement more complex and flexible collision pair filtering logic, for instance, taking
the state of the user application into account. Filter callbacks also give the user the opportunity to track collision
pairs and update their filter state.
You might want to check the documentation on #PxSimulationFilterShader as well since it includes more general information
on filtering.
\note SDK state should not be modified from within the callbacks. In particular objects should not
be created or destroyed. If state modification is needed then the changes should be stored to a buffer
and performed after the simulation step.
\note The callbacks may execute in user threads or simulation threads, possibly simultaneously. The corresponding objects
may have been deleted by the application earlier in the frame. It is the application's responsibility to prevent race conditions
arising from using the SDK API in the callback while an application thread is making write calls to the scene, and to ensure that
the callbacks are thread-safe. Return values which depend on when the callback is called during the frame will introduce nondeterminism
into the simulation.
@see PxSceneDesc.filterCallback PxSimulationFilterShader
*/
class PxSimulationFilterCallback
{
public:
/**
\brief Filter method to specify how a pair of potentially colliding objects should be processed.
This method gets called when the filter flags returned by the filter shader (see #PxSimulationFilterShader)
indicate that the filter callback should be invoked (#PxFilterFlag::eCALLBACK or #PxFilterFlag::eNOTIFY set).
Return the PxFilterFlag flags and set the PxPairFlag flags to define what the simulation should do with the given
collision pair.
\param[in] pairID Unique ID of the collision pair used to issue filter status changes for the pair (see #statusChange())
\param[in] attributes0 The filter attribute of the first object
\param[in] filterData0 The custom filter data of the first object
\param[in] a0 Actor pointer of the first object
\param[in] s0 Shape pointer of the first object (NULL if the object has no shapes)
\param[in] attributes1 The filter attribute of the second object
\param[in] filterData1 The custom filter data of the second object
\param[in] a1 Actor pointer of the second object
\param[in] s1 Shape pointer of the second object (NULL if the object has no shapes)
\param[in,out] pairFlags In: Pair flags returned by the filter shader. Out: Additional information on how an accepted pair should get processed
\return Filter flags defining whether the pair should be discarded, temporarily ignored or processed and whether the pair
should be tracked and send a report on pair deletion through the filter callback
@see PxSimulationFilterShader PxFilterData PxFilterObjectAttributes PxFilterFlag PxPairFlag
*/
virtual PxFilterFlags pairFound( PxU32 pairID,
PxFilterObjectAttributes attributes0, PxFilterData filterData0, const PxActor* a0, const PxShape* s0,
PxFilterObjectAttributes attributes1, PxFilterData filterData1, const PxActor* a1, const PxShape* s1,
PxPairFlags& pairFlags) = 0;
/**
\brief Callback to inform that a tracked collision pair is gone.
This method gets called when a collision pair disappears or gets re-filtered. Only applies to
collision pairs which have been marked as filter callback pairs (#PxFilterFlag::eNOTIFY set in #pairFound()).
\param[in] pairID Unique ID of the collision pair that disappeared
\param[in] attributes0 The filter attribute of the first object
\param[in] filterData0 The custom filter data of the first object
\param[in] attributes1 The filter attribute of the second object
\param[in] filterData1 The custom filter data of the second object
\param[in] objectRemoved True if the pair was lost because one of the objects got removed from the scene
@see pairFound() PxSimulationFilterShader PxFilterData PxFilterObjectAttributes
*/
virtual void pairLost( PxU32 pairID,
PxFilterObjectAttributes attributes0,
PxFilterData filterData0,
PxFilterObjectAttributes attributes1,
PxFilterData filterData1,
bool objectRemoved) = 0;
/**
\brief Callback to give the opportunity to change the filter state of a tracked collision pair.
This method gets called once per simulation step to let the application change the filter and pair
flags of a collision pair that has been reported in #pairFound() and requested callbacks by
setting #PxFilterFlag::eNOTIFY. To request a change of filter status, the target pair has to be
specified by its ID, the new filter and pair flags have to be provided and the method should return true.
\note If this method changes the filter status of a collision pair and the pair should keep being tracked
by the filter callbacks then #PxFilterFlag::eNOTIFY has to be set.
\note The application is responsible to ensure that this method does not get called for pairs that have been
reported as lost, see #pairLost().
\param[out] pairID ID of the collision pair for which the filter status should be changed
\param[out] pairFlags The new pairFlags to apply to the collision pair
\param[out] filterFlags The new filterFlags to apply to the collision pair
\return True if the changes should be applied. In this case the method will get called again. False if
no more status changes should be done in the current simulation step. In that case the provided flags will be discarded.
@see pairFound() pairLost() PxFilterFlag PxPairFlag
*/
virtual bool statusChange(PxU32& pairID, PxPairFlags& pairFlags, PxFilterFlags& filterFlags) = 0;
protected:
virtual ~PxSimulationFilterCallback() {}
};
struct PxPairFilteringMode
{
enum Enum
{
/**
Output pair from BP, potentially send to user callbacks, create regular interaction object.
Enable contact pair filtering between kinematic/static or kinematic/kinematic rigid bodies.
By default contacts between these are suppressed (see #PxFilterFlag::eSUPPRESS) and don't get reported to the filter mechanism.
Use this mode if these pairs should go through the filtering pipeline nonetheless.
\note This mode is not mutable, and must be set in PxSceneDesc at scene creation.
*/
eKEEP,
/**
Output pair from BP, create interaction marker. Can be later switched to regular interaction.
*/
eSUPPRESS,
/**
Don't output pair from BP. Cannot be later switched to regular interaction, needs "resetFiltering" call.
*/
eKILL,
/**
Default is eSUPPRESS for compatibility with previous PhysX versions.
*/
eDEFAULT = eSUPPRESS
};
};
#if !PX_DOXYGEN
} // namespace physx
#endif
/** @} */
#endif
| 411 | 0.925483 | 1 | 0.925483 | game-dev | MEDIA | 0.694514 | game-dev | 0.883028 | 1 | 0.883028 |
idsoftware/quake2 | 11,476 | ctf/m_move.c | /*
Copyright (C) 1997-2001 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// m_move.c -- monster movement
#include "g_local.h"
#define STEPSIZE 18
/*
=============
M_CheckBottom
Returns false if any part of the bottom of the entity is off an edge that
is not a staircase.
=============
*/
int c_yes, c_no;
qboolean M_CheckBottom (edict_t *ent)
{
vec3_t mins, maxs, start, stop;
trace_t trace;
int x, y;
float mid, bottom;
VectorAdd (ent->s.origin, ent->mins, mins);
VectorAdd (ent->s.origin, ent->maxs, maxs);
// if all of the points under the corners are solid world, don't bother
// with the tougher checks
// the corners must be within 16 of the midpoint
start[2] = mins[2] - 1;
for (x=0 ; x<=1 ; x++)
for (y=0 ; y<=1 ; y++)
{
start[0] = x ? maxs[0] : mins[0];
start[1] = y ? maxs[1] : mins[1];
if (gi.pointcontents (start) != CONTENTS_SOLID)
goto realcheck;
}
c_yes++;
return true; // we got out easy
realcheck:
c_no++;
//
// check it for real...
//
start[2] = mins[2];
// the midpoint must be within 16 of the bottom
start[0] = stop[0] = (mins[0] + maxs[0])*0.5;
start[1] = stop[1] = (mins[1] + maxs[1])*0.5;
stop[2] = start[2] - 2*STEPSIZE;
trace = gi.trace (start, vec3_origin, vec3_origin, stop, ent, MASK_MONSTERSOLID);
if (trace.fraction == 1.0)
return false;
mid = bottom = trace.endpos[2];
// the corners must be within 16 of the midpoint
for (x=0 ; x<=1 ; x++)
for (y=0 ; y<=1 ; y++)
{
start[0] = stop[0] = x ? maxs[0] : mins[0];
start[1] = stop[1] = y ? maxs[1] : mins[1];
trace = gi.trace (start, vec3_origin, vec3_origin, stop, ent, MASK_MONSTERSOLID);
if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
bottom = trace.endpos[2];
if (trace.fraction == 1.0 || mid - trace.endpos[2] > STEPSIZE)
return false;
}
c_yes++;
return true;
}
/*
=============
SV_movestep
Called by monster program code.
The move will be adjusted for slopes and stairs, but if the move isn't
possible, no move is done, false is returned, and
pr_global_struct->trace_normal is set to the normal of the blocking wall
=============
*/
//FIXME since we need to test end position contents here, can we avoid doing
//it again later in catagorize position?
qboolean SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
{
float dz;
vec3_t oldorg, neworg, end;
trace_t trace;
int i;
float stepsize;
vec3_t test;
int contents;
// try the move
VectorCopy (ent->s.origin, oldorg);
VectorAdd (ent->s.origin, move, neworg);
// flying monsters don't step up
if ( ent->flags & (FL_SWIM | FL_FLY) )
{
// try one move with vertical motion, then one without
for (i=0 ; i<2 ; i++)
{
VectorAdd (ent->s.origin, move, neworg);
if (i == 0 && ent->enemy)
{
if (!ent->goalentity)
ent->goalentity = ent->enemy;
dz = ent->s.origin[2] - ent->goalentity->s.origin[2];
if (ent->goalentity->client)
{
if (dz > 40)
neworg[2] -= 8;
if (!((ent->flags & FL_SWIM) && (ent->waterlevel < 2)))
if (dz < 30)
neworg[2] += 8;
}
else
{
if (dz > 8)
neworg[2] -= 8;
else if (dz > 0)
neworg[2] -= dz;
else if (dz < -8)
neworg[2] += 8;
else
neworg[2] += dz;
}
}
trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, neworg, ent, MASK_MONSTERSOLID);
// fly monsters don't enter water voluntarily
if (ent->flags & FL_FLY)
{
if (!ent->waterlevel)
{
test[0] = trace.endpos[0];
test[1] = trace.endpos[1];
test[2] = trace.endpos[2] + ent->mins[2] + 1;
contents = gi.pointcontents(test);
if (contents & MASK_WATER)
return false;
}
}
// swim monsters don't exit water voluntarily
if (ent->flags & FL_SWIM)
{
if (ent->waterlevel < 2)
{
test[0] = trace.endpos[0];
test[1] = trace.endpos[1];
test[2] = trace.endpos[2] + ent->mins[2] + 1;
contents = gi.pointcontents(test);
if (!(contents & MASK_WATER))
return false;
}
}
if (trace.fraction == 1)
{
VectorCopy (trace.endpos, ent->s.origin);
if (relink)
{
gi.linkentity (ent);
G_TouchTriggers (ent);
}
return true;
}
if (!ent->enemy)
break;
}
return false;
}
// push down from a step height above the wished position
if (!(ent->monsterinfo.aiflags & AI_NOSTEP))
stepsize = STEPSIZE;
else
stepsize = 1;
neworg[2] += stepsize;
VectorCopy (neworg, end);
end[2] -= stepsize*2;
trace = gi.trace (neworg, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID);
if (trace.allsolid)
return false;
if (trace.startsolid)
{
neworg[2] -= stepsize;
trace = gi.trace (neworg, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID);
if (trace.allsolid || trace.startsolid)
return false;
}
// don't go in to water
if (ent->waterlevel == 0)
{
test[0] = trace.endpos[0];
test[1] = trace.endpos[1];
test[2] = trace.endpos[2] + ent->mins[2] + 1;
contents = gi.pointcontents(test);
if (contents & MASK_WATER)
return false;
}
if (trace.fraction == 1)
{
// if monster had the ground pulled out, go ahead and fall
if ( ent->flags & FL_PARTIALGROUND )
{
VectorAdd (ent->s.origin, move, ent->s.origin);
if (relink)
{
gi.linkentity (ent);
G_TouchTriggers (ent);
}
ent->groundentity = NULL;
return true;
}
return false; // walked off an edge
}
// check point traces down for dangling corners
VectorCopy (trace.endpos, ent->s.origin);
if (!M_CheckBottom (ent))
{
if ( ent->flags & FL_PARTIALGROUND )
{ // entity had floor mostly pulled out from underneath it
// and is trying to correct
if (relink)
{
gi.linkentity (ent);
G_TouchTriggers (ent);
}
return true;
}
VectorCopy (oldorg, ent->s.origin);
return false;
}
if ( ent->flags & FL_PARTIALGROUND )
{
ent->flags &= ~FL_PARTIALGROUND;
}
ent->groundentity = trace.ent;
ent->groundentity_linkcount = trace.ent->linkcount;
// the move is ok
if (relink)
{
gi.linkentity (ent);
G_TouchTriggers (ent);
}
return true;
}
//============================================================================
/*
===============
M_ChangeYaw
===============
*/
void M_ChangeYaw (edict_t *ent)
{
float ideal;
float current;
float move;
float speed;
current = anglemod(ent->s.angles[YAW]);
ideal = ent->ideal_yaw;
if (current == ideal)
return;
move = ideal - current;
speed = ent->yaw_speed;
if (ideal > current)
{
if (move >= 180)
move = move - 360;
}
else
{
if (move <= -180)
move = move + 360;
}
if (move > 0)
{
if (move > speed)
move = speed;
}
else
{
if (move < -speed)
move = -speed;
}
ent->s.angles[YAW] = anglemod (current + move);
}
/*
======================
SV_StepDirection
Turns to the movement direction, and walks the current distance if
facing it.
======================
*/
qboolean SV_StepDirection (edict_t *ent, float yaw, float dist)
{
vec3_t move, oldorigin;
float delta;
ent->ideal_yaw = yaw;
M_ChangeYaw (ent);
yaw = yaw*M_PI*2 / 360;
move[0] = cos(yaw)*dist;
move[1] = sin(yaw)*dist;
move[2] = 0;
VectorCopy (ent->s.origin, oldorigin);
if (SV_movestep (ent, move, false))
{
delta = ent->s.angles[YAW] - ent->ideal_yaw;
if (delta > 45 && delta < 315)
{ // not turned far enough, so don't take the step
VectorCopy (oldorigin, ent->s.origin);
}
gi.linkentity (ent);
G_TouchTriggers (ent);
return true;
}
gi.linkentity (ent);
G_TouchTriggers (ent);
return false;
}
/*
======================
SV_FixCheckBottom
======================
*/
void SV_FixCheckBottom (edict_t *ent)
{
ent->flags |= FL_PARTIALGROUND;
}
/*
================
SV_NewChaseDir
================
*/
#define DI_NODIR -1
void SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
{
float deltax,deltay;
float d[3];
float tdir, olddir, turnaround;
//FIXME: how did we get here with no enemy
if (!enemy)
return;
olddir = anglemod( (int)(actor->ideal_yaw/45)*45 );
turnaround = anglemod(olddir - 180);
deltax = enemy->s.origin[0] - actor->s.origin[0];
deltay = enemy->s.origin[1] - actor->s.origin[1];
if (deltax>10)
d[1]= 0;
else if (deltax<-10)
d[1]= 180;
else
d[1]= DI_NODIR;
if (deltay<-10)
d[2]= 270;
else if (deltay>10)
d[2]= 90;
else
d[2]= DI_NODIR;
// try direct route
if (d[1] != DI_NODIR && d[2] != DI_NODIR)
{
if (d[1] == 0)
tdir = d[2] == 90 ? 45 : 315;
else
tdir = d[2] == 90 ? 135 : 215;
if (tdir != turnaround && SV_StepDirection(actor, tdir, dist))
return;
}
// try other directions
if ( ((rand()&3) & 1) || abs(deltay)>abs(deltax))
{
tdir=d[1];
d[1]=d[2];
d[2]=tdir;
}
if (d[1]!=DI_NODIR && d[1]!=turnaround
&& SV_StepDirection(actor, d[1], dist))
return;
if (d[2]!=DI_NODIR && d[2]!=turnaround
&& SV_StepDirection(actor, d[2], dist))
return;
/* there is no direct path to the player, so pick another direction */
if (olddir!=DI_NODIR && SV_StepDirection(actor, olddir, dist))
return;
if (rand()&1) /*randomly determine direction of search*/
{
for (tdir=0 ; tdir<=315 ; tdir += 45)
if (tdir!=turnaround && SV_StepDirection(actor, tdir, dist) )
return;
}
else
{
for (tdir=315 ; tdir >=0 ; tdir -= 45)
if (tdir!=turnaround && SV_StepDirection(actor, tdir, dist) )
return;
}
if (turnaround != DI_NODIR && SV_StepDirection(actor, turnaround, dist) )
return;
actor->ideal_yaw = olddir; // can't move
// if a bridge was pulled out from underneath a monster, it may not have
// a valid standing position at all
if (!M_CheckBottom (actor))
SV_FixCheckBottom (actor);
}
/*
======================
SV_CloseEnough
======================
*/
qboolean SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
{
int i;
for (i=0 ; i<3 ; i++)
{
if (goal->absmin[i] > ent->absmax[i] + dist)
return false;
if (goal->absmax[i] < ent->absmin[i] - dist)
return false;
}
return true;
}
/*
======================
M_MoveToGoal
======================
*/
void M_MoveToGoal (edict_t *ent, float dist)
{
edict_t *goal;
goal = ent->goalentity;
if (!ent->groundentity && !(ent->flags & (FL_FLY|FL_SWIM)))
return;
// if the next step hits the enemy, return immediately
if (ent->enemy && SV_CloseEnough (ent, ent->enemy, dist) )
return;
// bump around...
if ( (rand()&3)==1 || !SV_StepDirection (ent, ent->ideal_yaw, dist))
{
if (ent->inuse)
SV_NewChaseDir (ent, goal, dist);
}
}
/*
===============
M_walkmove
===============
*/
qboolean M_walkmove (edict_t *ent, float yaw, float dist)
{
vec3_t move;
if (!ent->groundentity && !(ent->flags & (FL_FLY|FL_SWIM)))
return false;
yaw = yaw*M_PI*2 / 360;
move[0] = cos(yaw)*dist;
move[1] = sin(yaw)*dist;
move[2] = 0;
return SV_movestep(ent, move, true);
}
| 411 | 0.890584 | 1 | 0.890584 | game-dev | MEDIA | 0.966593 | game-dev | 0.997293 | 1 | 0.997293 |
ocodo/.emacs.d | 8,151 | elpa/emms-20210911.2031/emms-player-simple.el | ;;; emms-player-simple.el --- A generic simple player. -*- lexical-binding: t; -*-
;; Copyright (C) 2003-2021 Free Software Foundation, Inc.
;; Authors: Ulrik Jensen <terryp@daimi.au.dk>
;; Jorgen Schäfer <forcer@forcix.cx>
;; Keywords: emms, mpg321, ogg123
;; This file is part of EMMS.
;; EMMS is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; EMMS is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with EMMS; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; This is a simple player interface - if you have an external player
;; that just expects the filename to play as an argument, this should
;; be able to use it. See the define-emms-simple-player lines at the
;; end of this file for examples.
;; Add the following to your `emms-player-list':
;; emms-player-mpg321
;; emms-player-ogg123
;;; Code:
;; Version control
(defvar emms-player-simple-version "0.2 $Revision: 1.26 $"
"Simple player for EMMS version string.")
;; $Id: emms-player-simple.el,v 1.26 2005/08/02 15:27:51 forcer Exp $
(require 'emms)
;; Customization
(defmacro define-emms-simple-player (name types regex command &rest args)
"Define a simple player with the use of `emms-define-player'.
NAME is used to contruct the name of the function like
emms-player-NAME. TYPES is a list of track types understood by
this player. REGEX must be a regexp that matches the filenames
the player can play. COMMAND specifies the command line argument
to call the player and ARGS are the command line arguments."
(let ((group (intern (concat "emms-player-" (symbol-name name))))
(command-name (intern (concat "emms-player-"
(symbol-name name)
"-command-name")))
(parameters (intern (concat "emms-player-"
(symbol-name name)
"-parameters")))
(player-name (intern (concat "emms-player-" (symbol-name name))))
(start (intern (concat "emms-player-" (symbol-name name) "-start")))
(stop (intern (concat "emms-player-" (symbol-name name) "-stop")))
(playablep (intern (concat "emms-player-" (symbol-name name) "-playable-p"))))
`(progn
(defgroup ,group nil
,(concat "EMMS player for " command ".")
:group 'emms-player
:prefix ,(concat "emms-player-" (symbol-name name) "-"))
(defcustom ,command-name ,command
,(concat "The command name of " command ".")
:type 'string)
(defcustom ,parameters ',args
,(concat "The arguments to `" (symbol-name command-name) "'.")
:type '(repeat string))
(defcustom ,player-name (emms-player #',start #',stop #',playablep)
,(concat "A player for EMMS.")
:type '(cons symbol alist))
(emms-player-set ,player-name 'regex ,regex)
(emms-player-set ,player-name 'pause 'emms-player-simple-pause)
(emms-player-set ,player-name 'resume 'emms-player-simple-resume)
(defun ,start (track)
"Start the player process."
(emms-player-simple-start (emms-track-name track)
,player-name
,command-name
,parameters))
(defun ,stop ()
"Stop the player process."
(emms-player-simple-stop))
(defun ,playablep (track)
"Return non-nil when we can play this track."
(and (executable-find ,command-name)
(memq (emms-track-type track) ,types)
(string-match (emms-player-get ,player-name 'regex)
(emms-track-name track)))))))
;; Global variables
(defvar emms-player-simple-process-name "emms-player-simple-process"
"The name of the simple player process")
(defun emms-player-simple-stop ()
"Stop the currently playing process, if indeed there is one"
(let ((process (get-process emms-player-simple-process-name)))
(when process
(kill-process process)
(delete-process process))))
;; Utility-functions
(defun emms-player-simple-start (filename player cmdname params)
"Starts a process playing FILENAME using the specified CMDNAME with
the specified PARAMS.
PLAYER is the name of the current player."
(let ((process (apply #'start-process
emms-player-simple-process-name
nil
cmdname
;; splice in params here
(append params (list filename)))))
;; add a sentinel for signaling termination
(set-process-sentinel process #'emms-player-simple-sentinel))
(emms-player-started player))
(defun emms-player-simple-sentinel (proc str)
"Sentinel for determining the end of process"
(ignore str)
(when (or (eq (process-status proc) 'exit)
(eq (process-status proc) 'signal))
(emms-player-stopped)))
(defun emms-player-simple-pause ()
"Pause the player by sending a SIGSTOP."
(signal-process (get-process emms-player-simple-process-name)
'SIGSTOP))
(defun emms-player-simple-resume ()
"Resume the player by sending a SIGCONT."
(signal-process (get-process emms-player-simple-process-name)
'SIGCONT))
(defun emms-player-simple-regexp (&rest extensions)
"Return a regexp matching all EXTENSIONS, case-insensitively."
(concat "\\.\\("
(mapconcat (lambda (extension)
(mapconcat (lambda (char)
(let ((u (upcase char))
(d (downcase char)))
(if (= u d)
(format "%c" char)
(format "[%c%c]" u d))))
extension
""))
extensions
"\\|")
"\\)\\'"))
(define-emms-simple-player mpg321 '(file url)
(emms-player-simple-regexp "mp3" "mp2")
"mpg321")
(define-emms-simple-player ogg123 '(file)
(emms-player-simple-regexp "ogg" "flac")
"ogg123")
(define-emms-simple-player speexdec '(file)
(emms-player-simple-regexp "spx")
"speexdec")
(define-emms-simple-player playsound '(file)
(emms-player-simple-regexp "wav")
"playsound")
(define-emms-simple-player mikmod '(file)
(emms-player-simple-regexp "669" "amf" "dsm" "far" "gdm" "it"
"imf" "mod" "med" "mtm" "okt" "s3m"
"stm" "stx" "ult" "apun" "xm" "mod")
"mikmod" "-q" "-p" "1" "-X")
(define-emms-simple-player timidity '(file)
(emms-player-simple-regexp "mid" "rmi" "rcp" "r36" "g18" "g36" "mfi")
"timidity")
(define-emms-simple-player fluidsynth '(file)
(emms-player-simple-regexp "mid")
"fluidsynth" "-aalsa" "-in" "/media/music/sf/FluidR3-GM.SF2")
(define-emms-simple-player alsaplayer '(file url)
(concat "\\`http[s]?://\\|"
(emms-player-simple-regexp "ogg" "mp3" "wav" "flac" "pls" "m3u"))
"alsaplayer" "--quiet" "--nosave" "\"--interface text\"")
(emms-player-set emms-player-alsaplayer
'pause
'emms-player-alsaplayer-pause)
;;; Pause is also resume for alsaplayer
(emms-player-set emms-player-alsaplayer
'resume
nil)
(emms-player-set emms-player-alsaplayer
'seek
'emms-player-alsaplayer-seek)
(defun emms-player-alsaplayer-pause ()
(call-process "alsaplayer" nil nil nil "--pause"))
(defun emms-player-alsaplayer-seek (sec)
(call-process "alsaplayer" nil nil nil "--relative" (format "%d" sec)))
(provide 'emms-player-simple)
;;; emms-player-simple.el ends here
| 411 | 0.911967 | 1 | 0.911967 | game-dev | MEDIA | 0.310964 | game-dev | 0.68997 | 1 | 0.68997 |
EnhancedNetwork/TownofHost-Enhanced | 12,573 | Roles/Neutral/Pirate.cs | using Hazel;
using InnerNet;
using System.Text.RegularExpressions;
using TOHE.Modules.ChatManager;
using TOHE.Roles.Core;
using TOHE.Roles.Double;
using UnityEngine;
using static TOHE.Options;
using static TOHE.Translator;
using static TOHE.Utils;
namespace TOHE.Roles.Neutral;
internal class Pirate : RoleBase
{
//===========================SETUP================================\\
public override CustomRoles Role => CustomRoles.Pirate;
private const int Id = 15000;
public static bool HasEnabled => CustomRoleManager.HasEnabled(CustomRoles.Pirate);
public override bool IsDesyncRole => true;
public override CustomRoles ThisRoleBase => CustomRoles.Impostor;
public override Custom_RoleType ThisRoleType => Custom_RoleType.NeutralChaos;
//==================================================================\\
private static OptionItem SuccessfulDuelsToWin;
private static OptionItem TryHideMsg;
private static OptionItem DuelCooldown;
private static readonly Dictionary<byte, bool> DuelDone = [];
private static byte PirateTarget;
private static int pirateChose, targetChose;
public static int NumWin = 0;
public override void SetupCustomOption()
{
Options.SetupSingleRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Pirate);
DuelCooldown = FloatOptionItem.Create(Id + 12, "DuelCooldown", new(0f, 180f, 2.5f), 22.5f, TabGroup.NeutralRoles, false).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Pirate])
.SetValueFormat(OptionFormat.Seconds);
TryHideMsg = BooleanOptionItem.Create(Id + 10, "PirateTryHideMsg", true, TabGroup.NeutralRoles, false).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Pirate])
.SetColor(Color.green);
SuccessfulDuelsToWin = IntegerOptionItem.Create(Id + 11, "SuccessfulDuelsToWin", new(1, 20, 1), 2, TabGroup.NeutralRoles, false).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Pirate])
.SetValueFormat(OptionFormat.Times);
}
public override void Init()
{
PirateTarget = byte.MaxValue;
DuelDone.Clear();
pirateChose = -1;
targetChose = -1;
NumWin = 0;
}
public override void Add(byte playerId)
{
DuelDone[playerId] = false;
}
public override void OnMeetingHudStart(PlayerControl pc)
{
if (!HasEnabled || PirateTarget == byte.MaxValue) return;
var tpc = GetPlayerById(PirateTarget);
if (!tpc.IsAlive()) return;
MeetingHudStartPatch.AddMsg(GetString("PirateMeetingMsg"), pc.PlayerId, ColorString(GetRoleColor(CustomRoles.Pirate), GetString("PirateTitle")));
MeetingHudStartPatch.AddMsg(GetString("PirateTargetMeetingMsg"), tpc.PlayerId, ColorString(GetRoleColor(CustomRoles.Pirate), GetString("PirateTitle")));
}
public override void SetKillCooldown(byte id) => Main.AllPlayerKillCooldown[id] = DuelCooldown.GetFloat();
public override bool CanUseKillButton(PlayerControl pc) => true;
public override string GetProgressText(byte playerId, bool comms)
=> ColorString(GetRoleColor(CustomRoles.Pirate).ShadeColor(0.25f), $"({NumWin}/{SuccessfulDuelsToWin.GetInt()})");
public void SendRPC(int operate, byte target = byte.MaxValue, int points = -1)
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SyncRoleSkill, SendOption.Reliable, -1);
writer.WriteNetObject(_Player);
writer.Write(operate);
writer.Write(target);
if (operate == 1)
{
writer.Write(points);
}
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
public override void ReceiveRPC(MessageReader reader, PlayerControl NaN)
{
int operate = reader.ReadInt32();
byte target = reader.ReadByte();
PirateTarget = target;
if (operate == 1)
{
int points = reader.ReadInt32();
NumWin = points;
}
}
public override bool OnCheckMurderAsKiller(PlayerControl killer, PlayerControl target)
{
if (target.Is(CustomRoles.NiceMini) && Mini.Age < 18)
{
killer.Notify(ColorString(GetRoleColor(CustomRoles.Gangster), GetString("CantDuel")));
return true;
}
if (target.Is(CustomRoles.Pestilence)) return true;
if (PirateTarget != byte.MaxValue)
{
killer.Notify(GetString("PirateTargetAlreadyChosen"));
return false;
}
Logger.Msg($"{killer.GetNameWithRole()} chose a target {target.GetNameWithRole()}", "Pirate");
PirateTarget = target.PlayerId;
SendRPC(operate: 0, target: target.PlayerId, points: -1);
DuelDone[PirateTarget] = false;
if (!Options.DisableShieldAnimations.GetBool()) killer.RpcGuardAndKill(killer);
else killer.SetKillCooldown();
return false;
}
public override void SetAbilityButtonText(HudManager hud, byte playerId)
{
hud.KillButton.OverrideText(GetString("PirateDuelButtonText"));
}
public override Sprite GetKillButtonSprite(PlayerControl player, bool shapeshifting) => CustomButton.Get("Challenge");
public override string GetMarkOthers(PlayerControl seer, PlayerControl target, bool isMeeting = false)
=> isMeeting && target.PlayerId == PirateTarget ? ColorString(GetRoleColor(CustomRoles.Pirate), " ⦿") : string.Empty;
public override void OnCheckForEndVoting(PlayerState.DeathReason deathReason, params byte[] exileIds)
{
if (_Player == null || PirateTarget == byte.MaxValue) return;
var pirateId = _state.PlayerId;
if (!DuelDone[pirateId]) return;
var pirateTarget = PirateTarget.GetPlayer();
if (DuelDone[PirateTarget])
{
if (targetChose == pirateChose)
{
NumWin++;
if (pirateTarget.IsAlive())
{
CheckForEndVotingPatch.TryAddAfterMeetingDeathPlayers(PlayerState.DeathReason.Pirate, PirateTarget);
pirateTarget.SetRealKiller(_Player);
}
}
}
else if (pirateTarget.IsAlive())
{
CheckForEndVotingPatch.TryAddAfterMeetingDeathPlayers(PlayerState.DeathReason.Pirate, PirateTarget);
pirateTarget.SetRealKiller(_Player);
}
}
public override void AfterMeetingTasks()
{
if (_Player == null) return;
var pirateId = _state.PlayerId;
if (NumWin >= SuccessfulDuelsToWin.GetInt())
{
NumWin = SuccessfulDuelsToWin.GetInt();
if (!CustomWinnerHolder.CheckForConvertedWinner(pirateId))
{
CustomWinnerHolder.ResetAndSetWinner(CustomWinner.Pirate);
CustomWinnerHolder.WinnerIds.Add(pirateId);
}
}
DuelDone.Clear();
PirateTarget = byte.MaxValue;
SendRPC(operate: 1, target: byte.MaxValue, points: NumWin);
foreach (byte playerId in Main.PlayerStates.Values.Where(x => x.MainRole == CustomRoles.Pirate).Select(x => x.PlayerId)) { DuelDone[playerId] = false; }
}
public override void OnMurderPlayerAsTarget(PlayerControl killer, PlayerControl target, bool inMeeting, bool isSuicide)
{
PirateTarget = byte.MaxValue;
SendRPC(operate: 1, target: byte.MaxValue, points: NumWin);
}
public static bool DuelCheckMsg(PlayerControl pc, string msg, bool isUI = false)
{
var originMsg = msg;
if (!AmongUsClient.Instance.AmHost) return false;
if (!GameStates.IsMeeting || pc == null || GameStates.IsExilling) return false;
if (!pc.Is(CustomRoles.Pirate) && PirateTarget != pc.PlayerId) return false;
msg = msg.ToLower().TrimStart().TrimEnd();
bool operate = false;
if (CheckCommond(ref msg, "duel")) operate = true;
else return false;
if (!pc.IsAlive())
{
pc.ShowInfoMessage(isUI, GetString("PirateDead"));
return true;
}
if (operate)
{
if (TryHideMsg.GetBool())
{
//if (Options.NewHideMsg.GetBool()) ChatManager.SendPreviousMessagesToAll();
//else TryHideMsgForDuel();
TryHideMsgForDuel();
ChatManager.SendPreviousMessagesToAll();
}
else if (pc.AmOwner) SendMessage(originMsg, 255, pc.GetRealName());
if (!MsgToPlayerAndRole(msg, out int rpsOption, out string error))
{
SendMessage(error, pc.PlayerId);
return true;
}
Logger.Info($"{pc.GetNameWithRole()} selected {rpsOption}", "Pirate");
if (DuelDone[pc.PlayerId])
{
_ = new LateTask(() =>
{
pc.ShowInfoMessage(isUI, GetString("DuelAlreadyDone"));
Logger.Msg("Duel attempted more than once", "Pirate");
}, 0.2f, "Pirate Duel Already Done");
return true;
}
else
{
if (pc.Is(CustomRoles.Pirate))
{
pirateChose = rpsOption;
}
else
{
targetChose = rpsOption;
}
_ = new LateTask(() =>
{
pc.ShowInfoMessage(isUI, string.Format(GetString("DuelDone"), rpsOption));
}, 0.2f, "Pirate Duel Done");
DuelDone[pc.PlayerId] = true;
return true;
}
}
return true;
}
private static bool MsgToPlayerAndRole(string msg, out int rpsOpt, out string error)
{
if (msg.StartsWith("/")) msg = msg.Replace("/", string.Empty);
Regex r = new("\\d+");
MatchCollection mc = r.Matches(msg);
string result = string.Empty;
for (int i = 0; i < mc.Count; i++)
{
result += mc[i];//匹配结果是完整的数字,此处可以不做拼接的
}
if (int.TryParse(result, out int num))
{
if (num < 0 || num > 2)
{
rpsOpt = -1;
error = GetString("DuelHelp");
return false;
}
else { rpsOpt = num; }
}
else
{
rpsOpt = -1;
error = GetString("DuelHelp");
return false;
}
error = string.Empty;
return true;
}
public static bool CheckCommond(ref string msg, string command)
{
var comList = command.Split('|');
for (int i = 0; i < comList.Length; i++)
{
//if (exact)
//{
// if (msg == "/" + comList[i]) return true;
//}
//else
//{
if (msg.StartsWith("/" + comList[i]))
{
msg = msg.Replace("/" + comList[i], string.Empty);
return true;
}
//}
}
return false;
}
public static void TryHideMsgForDuel()
{
ChatUpdatePatch.DoBlockChat = true;
if (ChatManager.quickChatSpamMode != QuickChatSpamMode.QuickChatSpam_Disabled)
{
ChatManager.SendQuickChatSpam();
ChatUpdatePatch.DoBlockChat = false;
return;
}
List<CustomRoles> roles = CustomRolesHelper.AllRoles.Where(x => x is not CustomRoles.NotAssigned).ToList();
var rd = IRandom.Instance;
string msg;
string[] command = ["duel", "rps"];
for (int i = 0; i < 20; i++)
{
msg = "/";
if (rd.Next(1, 100) < 20)
{
msg += "id";
}
else
{
msg += command[rd.Next(0, command.Length - 1)];
msg += " ";
msg += rd.Next(0, 3).ToString();
}
var player = Main.AllAlivePlayerControls.RandomElement();
DestroyableSingleton<HudManager>.Instance.Chat.AddChat(player, msg);
var writer = CustomRpcSender.Create("MessagesToSend", SendOption.None);
writer.StartMessage(-1);
writer.StartRpc(player.NetId, (byte)RpcCalls.SendChat)
.Write(msg)
.EndRpc();
writer.EndMessage();
writer.SendMessage();
}
ChatUpdatePatch.DoBlockChat = false;
}
}
| 411 | 0.890076 | 1 | 0.890076 | game-dev | MEDIA | 0.709426 | game-dev,networking | 0.832641 | 1 | 0.832641 |
odoo/wkhtmltopdf | 4,042 | qt/src/3rdparty/webkit/Source/WebCore/platform/ContextMenu.h | /*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ContextMenu_h
#define ContextMenu_h
#include <wtf/Noncopyable.h>
#include "ContextMenuItem.h"
#include "PlatformMenuDescription.h"
#include "PlatformString.h"
#if PLATFORM(MAC)
#include <wtf/RetainPtr.h>
#elif PLATFORM(QT)
#include <QMenu>
#endif
namespace WebCore {
class ContextMenuController;
class ContextMenu {
WTF_MAKE_NONCOPYABLE(ContextMenu); WTF_MAKE_FAST_ALLOCATED;
public:
ContextMenu();
ContextMenuItem* itemWithAction(unsigned);
#if USE(CROSS_PLATFORM_CONTEXT_MENUS)
#if PLATFORM(WIN)
typedef HMENU NativeMenu;
#elif PLATFORM(EFL)
typedef void* NativeMenu;
#endif
explicit ContextMenu(NativeMenu);
NativeMenu nativeMenu() const;
static NativeMenu createNativeMenuFromItems(const Vector<ContextMenuItem>&);
static void getContextMenuItems(NativeMenu, Vector<ContextMenuItem>&);
// FIXME: When more platforms switch over, this should return const ContextMenuItem*'s.
ContextMenuItem* itemAtIndex(unsigned index) { return &m_items[index]; }
void setItems(const Vector<ContextMenuItem>& items) { m_items = items; }
const Vector<ContextMenuItem>& items() const { return m_items; }
void appendItem(const ContextMenuItem& item) { m_items.append(item); }
#else
ContextMenu(const PlatformMenuDescription);
~ContextMenu();
void insertItem(unsigned position, ContextMenuItem&);
void appendItem(ContextMenuItem&);
ContextMenuItem* itemAtIndex(unsigned, const PlatformMenuDescription);
unsigned itemCount() const;
PlatformMenuDescription platformDescription() const;
void setPlatformDescription(PlatformMenuDescription);
PlatformMenuDescription releasePlatformDescription();
#if PLATFORM(WX)
static ContextMenuItem* itemWithId(int);
#endif
#endif // USE(CROSS_PLATFORM_CONTEXT_MENUS)
private:
#if USE(CROSS_PLATFORM_CONTEXT_MENUS)
Vector<ContextMenuItem> m_items;
#else
#if PLATFORM(MAC)
// Keep this in sync with the PlatformMenuDescription typedef
RetainPtr<NSMutableArray> m_platformDescription;
#elif PLATFORM(QT)
QList<ContextMenuItem> m_items;
#elif PLATFORM(CHROMIUM)
Vector<ContextMenuItem> m_items;
#else
PlatformMenuDescription m_platformDescription;
#if OS(WINCE)
unsigned m_itemCount;
#endif
#endif
#endif // USE(CROSS_PLATFORM_CONTEXT_MENUS)
};
#if !USE(CROSS_PLATFORM_CONTEXT_MENUS)
Vector<ContextMenuItem> contextMenuItemVector(PlatformMenuDescription);
PlatformMenuDescription platformMenuDescription(Vector<ContextMenuItem>&);
#endif
}
#endif // ContextMenu_h
| 411 | 0.846214 | 1 | 0.846214 | game-dev | MEDIA | 0.3604 | game-dev | 0.618961 | 1 | 0.618961 |
SpookyIluha/DDLC64-LibdragonVNE | 31,715 | src/engine/engine_logic.cpp | #include <libdragon.h>
#include <fstream>
#include <map>
#include "audioutils.h"
#include "engine_gamestatus.h"
#include "tortellini.hh"
#include "engine_library.h"
#include "engine_overlays.h"
#include "engine_eeprom.h"
#include "engine_gfx.h"
#include "engine_filesystem.h"
#include "engine_logic.h"
// current sequence data
sequencefile_t cursequence = sequencefile_t();
// global character data
std::map<std::string, character_t> characters;
// max number of characters in the game
int maxcharacters = 0;
// cg data
std::vector<std::string> cglist;
int scripts_cglist_getindex(const char* cgfn){
size_t index = 0; bool found = false;
while(!found && index < cglist.size()){
if(!strcmp(cglist[index].c_str(), cgfn)) found = true;
else index++;
} if(!found) return -1;
else return index;
}
void scripts_cglist_set_viewed_flag(const char* cgfn, bool value){
int index = scripts_cglist_getindex(cgfn);
if(index < 0) return;
uint64_t val = 1 << index;
if(value) gamestatus.state_persistent.cg_unlocked_bitfield |= val;
else gamestatus.state_persistent.cg_unlocked_bitfield &= ~val;
}
bool scripts_cglist_get_viewed_flag(int index){
uint64_t val = 1 << index;
return gamestatus.state_persistent.cg_unlocked_bitfield & val;
}
std::string& scripts_cglist_get_filename_at(int index){
return cglist[index];
}
size_t scripts_cglist_get_count(){
return cglist.size();
}
int scripts_cglist_glob_handler(const char *fn, dir_t *dir, void *data){
std::string name = std::string(fn);
name = name.substr(name.find_last_of("/\\") + 1);
size_t lastindex = name.find_last_of(".");
std::string rawname = name.substr(0, lastindex);
for(const std::string& n : cglist) if(!strcmp(n.c_str(), rawname.c_str())) return DIR_WALK_CONTINUE;
cglist.push_back(rawname);
if(gamestatus.state.scripts.debug) debugf("found cg: %s\n", rawname.c_str());
return DIR_WALK_CONTINUE;
}
/// @brief Load a single .ini character data file in a global array of characters as a part of a glob process
/// @param fn Filename to load
/// @param dir directory of the file (not used)
/// @param data not used
/// @return continue the glob function
int scripts_characters_glob_handler(const char *fn, dir_t *dir, void *data) {
debugf("found character: %s\n", fn);
tortellini::ini ini;
std::ifstream in(fn);
in >> ini;
std::string shortname = ini["Character"]["shortname"] | "unknown";
std::string shortname2 = ini["Character"]["shortname2"] | "unknown";
if(characters.count(shortname)) {
debugf("character is duplicate: %s, skipping\n", shortname.c_str());
return DIR_WALK_CONTINUE;
}
character_t chr = character_t();
strcpy(chr.imagesfolder, ((ini["Data"]["images"] | "unknown")).c_str());
strcpy(chr.name, ((ini["Character"]["name"] | "No Name")).c_str());
strcpy(chr.shortname, shortname.c_str());
strcpy(chr.shortname2, shortname2.c_str());
chr.entityindex = maxcharacters;
// iterate over all composite section
tortellini::ini::section composites = ini["Composite"];
// for each entry parse a list of image files into an array of strings
for(auto& pair : composites._mapref){
std::vector<std::string> imgs = std::vector<std::string>();
std::istringstream iss = std::istringstream(pair.second);
std::string s;
while(getline( iss, s, ' ' )) {
s.erase(remove( s.begin(), s.end(), '\"' ),s.end());
imgs.push_back(s);
}
chr.composites[pair.first] = imgs;
}
characters[shortname] = chr;
maxcharacters++;
return DIR_WALK_CONTINUE;
}
/// @brief Load all .ini files for all the characters described in the game into a global array (rom://scripts/characters/*.ini)
void scripts_characters_load(){
characters.clear();
maxcharacters = 0;
dir_glob("*.ini", (filesystem_getfolder(DIR_SCRIPT_LANG, true, false) + "characters/").c_str(), scripts_characters_glob_handler, NULL);
dir_glob("*.ini", (filesystem_getfolder(DIR_SCRIPT_LANG, true, true) + "characters/").c_str(), scripts_characters_glob_handler, NULL);
dir_glob("*.ini", (filesystem_getfolder(DIR_SCRIPT_LANG, false, false) + "characters/").c_str(), scripts_characters_glob_handler, NULL);
dir_glob("*.ini", (filesystem_getfolder(DIR_SCRIPT_LANG, false, true) + "characters/").c_str(), scripts_characters_glob_handler, NULL);
}
void scripts_cglist_load(){
cglist.clear();
dir_glob("*.sprite", filesystem_getfolder(DIR_CG, true, false).c_str(), scripts_cglist_glob_handler, NULL);
dir_glob("*.sprite", filesystem_getfolder(DIR_CG, true, true).c_str(), scripts_cglist_glob_handler, NULL);
dir_glob("*.sprite", filesystem_getfolder(DIR_CG, false, false).c_str(), scripts_cglist_glob_handler, NULL);
dir_glob("*.sprite", filesystem_getfolder(DIR_CG, true, true).c_str(), scripts_cglist_glob_handler, NULL);
}
/// @brief Load a default .ini configuration file with all the info on the game's structure (rom://scripts/config.ini)
void scripts_config_load(){
tortellini::ini ini;
// (optional) Read INI in from a file.
// Default construction and subsequent assignment is just fine, too.
std::ifstream in(filesystem_getfn(DIR_SCRIPT_LANG, "config.ini").c_str());
in >> ini;
strcpy(gamestatus.data.imagesfolder, ((ini["Data"]["images"] | "unknown")).c_str());
strcpy(gamestatus.data.bgfolder, ((ini["Data"]["backgrounds"] | "unknown")).c_str());
strcpy(gamestatus.data.cgfolder, ((ini["Data"]["cgbackgrounds"] | "unknown")).c_str());
strcpy(gamestatus.data.fontfolder, ((ini["Data"]["fonts"] | "unknown")).c_str());
strcpy(gamestatus.data.bgmfolder, ((ini["Data"]["music"] | "unknown")).c_str());
strcpy(gamestatus.data.sfxfolder, ((ini["Data"]["sounds"] | "unknown")).c_str());
strcpy(gamestatus.data.startupscript, (ini["Defaults"]["startupscript"] | "unknown").c_str());
strcpy(gamestatus.data.startuplabel, ((ini["Defaults"]["startuplabel"] | "[Main]")).c_str());
strcpy(gamestatus.data.defaults.selectsound, (ini["Defaults"]["selectsound"] | "select").c_str());
strcpy(gamestatus.data.defaults.a_button_image, ((ini["Defaults"]["a_button_image"] | "unknown_a_button")).c_str());
strcpy(gamestatus.data.defaults.b_button_image, (ini["Defaults"]["b_button_image"] | "unknown_b_button").c_str());
strcpy(gamestatus.data.defaults.start_button_image, ((ini["Defaults"]["start_button_image"] | "unknown_start_button")).c_str());
strcpy(gamestatus.data.defaults.textbox_image, (ini["Defaults"]["textbox_image"] | "unknown_textbox_img").c_str());
strcpy(gamestatus.data.defaults.namebox_image, ((ini["Defaults"]["namebox_image"] | "unknown_namebox_img")).c_str());
strcpy(gamestatus.data.defaults.overlay_frame, ((ini["Defaults"]["overlay_frame"] | "unknown_frame_img")).c_str());
strcpy(gamestatus.data.defaults.button_idle, (ini["Defaults"]["button_idle"] | "unknown_buttonidle_img").c_str());
strcpy(gamestatus.data.defaults.button_select, ((ini["Defaults"]["button_select"] | "unknown_buttonselect_img")).c_str());
gamestatus.state.scripts.debug = ini["Scripts"]["debug"] | false;
gamestatus.fonts.mainfont = ini["Fonts"]["mainfont"] | 1;
gamestatus.fonts.mainfontstyle = ini["Fonts"]["mainfontstyle"] | 0;
gamestatus.fonts.mainfontselected = ini["Fonts"]["mainfontselected"] | 0;
gamestatus.fonts.titlefont = ini["Fonts"]["titlefont"] | 1;
gamestatus.fonts.titlefontstyle = ini["Fonts"]["titlefontstyle"] | 0;
if(gamestatus.fonts.fontcount){
for(int i = 1; i <= gamestatus.fonts.fontcount; i++){
rdpq_text_unregister_font(i);
if(gamestatus.fonts.fonts[i - 1]) {rdpq_font_free(gamestatus.fonts.fonts[i - 1]), gamestatus.fonts.fonts[i - 1] = NULL;}
}
}
{
int fontid = 1;
char keyfont[128]; char keyfontcolor[128]; char keyfontcoloroutline[128];
std::string font;
do{
sprintf(keyfont, "font%i", fontid);
font = ini["Fonts"][keyfont] | "";
if(!font.empty()){
std::string fontfn = filesystem_getfn(DIR_FONT, (font).c_str());
debugf("Font %i: %s\n", fontid,fontfn.c_str() );
gamestatus.fonts.fonts[fontid - 1] = rdpq_font_load(fontfn.c_str());
rdpq_text_register_font(fontid, gamestatus.fonts.fonts[fontid - 1]);
gamestatus.fonts.fontcount = fontid;
int styleid = 0;
uint32_t color1 = 0x000000FE; uint32_t color2 = 0xFEFEFEFE;
do{
sprintf(keyfontcolor, "font%i_color%itext", fontid, styleid);
sprintf(keyfontcoloroutline, "font%i_color%ioutline", fontid, styleid);
color1 = ini["Fonts"][keyfontcolor] | 0xFAFAFAFE;
color2 = ini["Fonts"][keyfontcoloroutline] | 0xFEFEFEFE;
debugf("Font %i Style %i: %08lx %08lx\n", fontid, styleid, color1, color2);
rdpq_fontstyle_t style; style.color = color_from_packed32(color1); style.outline_color = color_from_packed32(color2);
rdpq_font_style(gamestatus.fonts.fonts[fontid - 1], styleid, &style);
styleid++;
} while (color1 != 0xFAFAFAFE);
}
fontid++;
} while (!font.empty() && fontid < MAX_FONTS);
}
in.close();
}
/// @brief Load a text sequence file .script, overriding the current sequence instance
/// @param fn Filename to load
void scripts_sequence_load(const char *fn){
rspq_wait();
// clear the current sequence
for(auto& [name, block] : cursequence){
for(auto& action : block){
action.functionname.clear();
action.parameters.clear();
action.parameters.clear();
}
block.clear();
}
cursequence.clear();
debugf("loading sequence script: %s\n", fn);
std::ifstream infile(fn);
std::string line = std::string();
actionblock_t curblock = actionblock_t();
std::string curblockname = std::string();
// read and parse the file line by line
while (std::getline(infile, line))
{
std::stringstream ss(line);
std::vector<std::string> words = std::vector<std::string>();
std::string word = std::string();
action_t action = action_t();
// convert a line into token array (with quoted strings)
while (ss >> std::quoted(word)) {
words.push_back(word);
}
// parse the tokens
std::string front; if(words.size() > 0) front = words.front();
if(front.front() != '#') // comment line parse
switch(words.size()){
case 0: break;
case 1: {
// this there's only one word in a line, its either a label name, or a short way to "say" narrative
bool islabel = (front.front() == '[');
if(islabel){
// if its a label, add a new action block and set it as a new destination
if(!curblockname.empty()){
cursequence[curblockname] = curblock;
curblock = actionblock_t();
curblockname = front;
} else { curblockname = front; }
} else {
// else just write is as a say function with one argument
action.functionname = "say";
action.parameters.push_back(front);
curblock.push_back(action);
}
break;
}
default: {
// if this is a short way to say something, aka it starts with a shortname of a character, then set the function as "say"
if(characters.count(front)){
action.functionname = "say";
} else { // else its just a function call with parameters
action.functionname = front;
words.erase(words.begin());
}
action.parameters = words;
curblock.push_back(action);
break;
}
}
if(curblock.size()){
curblock.back().parameters_cstr.clear();
for(std::string& cstr : curblock.back().parameters) curblock.back().parameters_cstr.push_back(cstr.c_str());
}
}
cursequence[curblockname] = curblock;
std::string fnstr = std::string(fn);
fnstr = fnstr.substr(fnstr.find_last_of("/\\") + 1);
fnstr = fnstr.substr(0, fnstr.find_last_of("."));
strcpy(gamestatus.state.seq.currentfile, fnstr.c_str());
// debug info printf
if(gamestatus.state.scripts.debug){
debugf("sequence script load complete: %s, blocks found %i\n\n", fn, cursequence.size());
for(const auto &[name, block] : cursequence){
debugf("Block: %s\n", name.c_str());
int i = 0;
for(const auto &action : block){
debugf("Action %i: %s, parms: ", i, action.functionname.c_str());
for(const auto &parm : action.parameters) debugf("| %s |", parm.c_str());
debugf("\n");
i++;
}
}
}
}
void scripts_sequence_setlabel(const char *label){
if(label != gamestatus.state.seq.currentlabel)
strcpy(gamestatus.state.seq.currentlabel, label);
gamestatus.state.seq.curline = 0;
gamestatus.state.seq.lastresult = SEQ_CONTINUE_LINEJMP;
}
void scripts_sequence_line(uint32_t line){
gamestatus.state.seq.curline = line;
gamestatus.state.seq.lastresult = SEQ_CONTINUE_LINEJMP;
}
void scripts_sequence_load_and_setlabel(const char *fn, const char *label, uint32_t line){
std::string fname = std::string(fn); fname += ".script";
std::string fnamefull = filesystem_getfn(DIR_SCRIPT_LANG, fname.c_str() );
scripts_sequence_setlabel(label);
scripts_sequence_line(line);
scripts_sequence_load(fnamefull.c_str());
}
typedef class{
public:
sprite_t* background = NULL;
sprite_t* namebox = NULL;
sprite_t* textbox = NULL;
sprite_t* button_a = NULL;
rspq_block_t* backgroundblock = NULL;
rspq_block_t* charactersblock = NULL;
char curbackground[LONGSTR_LENGTH] = {0};
struct{
sprite_t* entsprite = {0};
surface_t entspritesurf = {0};
char expressionfn[SHORTSTR_LENGTH] = {0};
bool active = false;
} ents[MAX_CHARACTERS_LIMIT];
int entsactive = 0;
struct{
int textcurlen = 0, textlen = 0;
long long frame = 0;
int curline = 0;
const char* ptr = NULL;
} dialogue;
uint32_t seqline;
} runtime_t;
runtime_t RUNT = runtime_t();
void engine_newgame(){
// load all the game and sequence data and start the sequence
engine_gameruntfree();
seqlibrary_library_load();
scripts_characters_load();
scripts_cglist_load();
scripts_sequence_load_and_setlabel(gamestatus.data.startupscript, gamestatus.data.startuplabel, 0);
engine_loop();
}
void engine_continuegame(){
engine_gameruntfree();
debugf("music %s\n", gamestatus.state.audio.bgmusic_name);
if(gamestatus.state.audio.bgmusic_name[0]) bgm_play(gamestatus.state.audio.bgmusic_name, gamestatus.state.audio.loopingmusic, 0);
else bgm_stop(0);
// load all the game and sequence data and start the sequence
seqlibrary_library_load();
scripts_characters_load();
scripts_cglist_load();
scripts_sequence_load_and_setlabel(gamestatus.state.seq.currentfile, gamestatus.state.seq.currentlabel, gamestatus.state.seq.curline);
gamestatus.state.seq.lastresult = SEQ_CONTINUE_LINEJMP;
engine_loop();
}
surface_t scripts_composite_image(const char* basefolder, const std::vector<std::string>& imagesfn){
if(gamestatus.state.scripts.debug){
debugf("Composite vector (size %u): ", imagesfn.size());
debugf("| %s |", imagesfn[0].c_str());}
char fn[512] = {0}; sprintf(fn, "%s/%s", basefolder, imagesfn[0].c_str());
sprite_t* input = sprite_load(filesystem_getfn(DIR_IMAGE, fn).c_str()); assertf(input, "Image couldn't load %s", fn);
assertf(input->width && input->height, "Image has no dimentions %s", fn);
surface_t output = surface_alloc(FMT_RGBA16, input->width, input->height);
rdpq_attach(&output, NULL);
rdpq_clear(RGBA32(0,0,0,0));
rdpq_set_mode_copy(true);
rdpq_sprite_blit(input, 0,0, NULL);
for(uint32_t i = 1; i < imagesfn.size(); i++){
rspq_wait();
sprite_free(input); input = NULL;
sprintf(fn, "%s/%s", basefolder, imagesfn[i].c_str());
if(gamestatus.state.scripts.debug) debugf("| %s |", imagesfn[i].c_str());
input = sprite_load(filesystem_getfn(DIR_IMAGE, fn).c_str());
rdpq_sprite_blit(input, 0,0, NULL);
} if(gamestatus.state.scripts.debug)debugf("\n");
rdpq_detach();
rspq_wait();
sprite_free(input);
return output;
}
character_t* scripts_find_character(const std::string& charname){
character_t* chr = NULL;
for(auto& ch : characters) if (!strcmp(ch.second.shortname2, charname.c_str())) chr = &ch.second;
if(!chr) {if(characters.count(charname)) chr = &characters[charname];}
assertf(chr, "Character not found %s", charname.c_str());
return chr;
}
void game_background_transition(){
float t = 1;
while(t > 0 && RUNT.background){
audioutils_mixer_update();
rdpq_attach(display_get(), NULL);
rdpq_set_mode_standard();
rdpq_mode_combiner(RDPQ_COMBINER_TEX_FLAT);
rdpq_mode_dithering(DITHER_SQUARE_INVSQUARE);
rdpq_set_prim_color(RGBA32((uint8_t)(t*250.0),(uint8_t)(t*250.0),(uint8_t)(t*250.0), 255));
if(RUNT.backgroundblock) rspq_block_run(RUNT.backgroundblock);
else rdpq_sprite_blit(RUNT.background, 0,0, NULL);
rdpq_detach_show();
t -= display_get_delta_time();
}
rspq_wait();
if(RUNT.backgroundblock) {rspq_block_free(RUNT.backgroundblock); RUNT.backgroundblock = NULL;}
if(RUNT.background) {sprite_free(RUNT.background); RUNT.background = NULL;}
if(gamestatus.state.game.backgroundfn[0] != 0){
char fn[512]; sprintf(fn , "%s.sprite", gamestatus.state.game.backgroundfn);
RUNT.background = sprite_load(filesystem_getfn(DIR_ROOT, fn).c_str());
}
t = 0;
while(t < 1){
audioutils_mixer_update();
rdpq_attach(display_get(), NULL);
rdpq_set_mode_standard();
rdpq_mode_combiner(RDPQ_COMBINER_TEX_FLAT);
rdpq_mode_dithering(DITHER_SQUARE_INVSQUARE);
rdpq_set_prim_color(RGBA32((uint8_t)(t*250.0),(uint8_t)(t*250.0),(uint8_t)(t*250.0), 255));
if(!RUNT.backgroundblock){
rspq_block_begin();
if(RUNT.background) rdpq_sprite_blit(RUNT.background, 0,0, NULL);
else rdpq_clear(RGBA32(0,0,0,0));
RUNT.backgroundblock = rspq_block_end();
} rspq_block_run(RUNT.backgroundblock);
rdpq_detach_show();
t += display_get_delta_time();
}
}
// reload data, backgrounds, characters as necessary per game state
void resolve_dirty_flag(){
rspq_wait();
if(RUNT.charactersblock) {rspq_block_free(RUNT.charactersblock); RUNT.charactersblock = NULL;}
// background
if(strcmp(RUNT.curbackground, gamestatus.state.game.backgroundfn)){
game_background_transition();
strcpy(RUNT.curbackground, gamestatus.state.game.backgroundfn);
}
// dialogue
if(gamestatus.state.game.dialogue.line != RUNT.dialogue.curline){
RUNT.dialogue.textcurlen = 0;
RUNT.dialogue.frame = 0;
RUNT.dialogue.curline = gamestatus.state.game.dialogue.line;
RUNT.dialogue.ptr = (cursequence[gamestatus.state.seq.currentlabel])
[RUNT.dialogue.curline].parameters[gamestatus.state.game.dialogue.lineidx].c_str();
char dial[1024]; sprintf(dial, RUNT.dialogue.ptr, gamestatus.state.game.playername);
RUNT.dialogue.textlen = strlen(dial);
}
RUNT.entsactive = 0; // characters
if(RUNT.charactersblock) {rspq_block_free(RUNT.charactersblock); RUNT.charactersblock = NULL;}
for(auto& character : characters){
int i = character.second.entityindex;
RUNT.ents[i].active = gamestatus.state.game.entities[i].active;
rspq_wait();
if(RUNT.ents[i].active) RUNT.entsactive++;
else {
if(RUNT.ents[i].entsprite) {sprite_free(RUNT.ents[i].entsprite); RUNT.ents[i].entsprite = NULL;}
if(RUNT.ents[i].entspritesurf.buffer) {surface_free(&RUNT.ents[i].entspritesurf); RUNT.ents[i].entspritesurf.buffer = NULL; memset(&RUNT.ents[i].entspritesurf, 0, sizeof(surface_t));}
}
if(strcmp(RUNT.ents[i].expressionfn, gamestatus.state.game.entities[i].expressionfn)){
strcpy(RUNT.ents[i].expressionfn, gamestatus.state.game.entities[i].expressionfn);
rspq_wait();
if(RUNT.ents[i].entsprite) {sprite_free(RUNT.ents[i].entsprite); RUNT.ents[i].entsprite = NULL;}
if(RUNT.ents[i].entspritesurf.buffer) {surface_free(&RUNT.ents[i].entspritesurf); RUNT.ents[i].entspritesurf.buffer = NULL; memset(&RUNT.ents[i].entspritesurf, 0, sizeof(surface_t));}
// if there's a composite image for the expression then composite it, else check if there's a direct file there and load it, otherwise error
if(RUNT.ents[i].expressionfn[0] != 0){
if(character.second.composites.count(RUNT.ents[i].expressionfn))
RUNT.ents[i].entspritesurf = scripts_composite_image(character.second.imagesfolder, character.second.composites[gamestatus.state.game.entities[i].expressionfn]);
else{
char fn[512]; sprintf(fn, "%s/%s", character.second.imagesfolder, RUNT.ents[i].expressionfn);
FILE *f = fopen(filesystem_getfn(DIR_IMAGE, fn).c_str(), "rb");
if(f){
fclose(f);
RUNT.ents[i].entsprite = sprite_load(filesystem_getfn(DIR_IMAGE, fn).c_str());
} else{
if(gamestatus.state.scripts.debug)
debugf("No composite rule with this name found %s for character %s\n", RUNT.ents[i].expressionfn, character.second.name);
}
}
}
}
}
gamestatus.state.game.dirtyflag = false;
}
void game_update(){
if(RUNT.dialogue.textcurlen < RUNT.dialogue.textlen) {
RUNT.dialogue.textcurlen++;
}
RUNT.dialogue.frame++;
joypad_poll();
audioutils_mixer_update();
// dialogue handling
joypad_buttons_t pressed = joypad_get_buttons_pressed(JOYPAD_PORT_1);
joypad_buttons_t held = joypad_get_buttons_held(JOYPAD_PORT_1);
if(!gamestatus.state.game.overlay_active){
if(RUNT.dialogue.textcurlen >= RUNT.dialogue.textlen && (gamestatus.state.game.dialogue.autoskip || pressed.a)){
gamestatus.state.seq.lastresult = SEQ_CONTINUE;
} else if (RUNT.dialogue.frame > 3 && pressed.a) RUNT.dialogue.textcurlen = RUNT.dialogue.textlen;
if (pressed.c_up && held.b) gamestatus.state.scripts.debug = !gamestatus.state.scripts.debug;
if (held.z || held.l || held.r) RUNT.dialogue.textcurlen = RUNT.dialogue.textlen;
if (RUNT.dialogue.frame > 3 && (held.z || held.l || held.r)) gamestatus.state.seq.lastresult = SEQ_CONTINUE;
}
if(pressed.start) engine_game_pause_menu();
overlays_update();
}
void game_render(){
rdpq_attach(display_get(), NULL);
rdpq_set_mode_copy(true);
if(!RUNT.backgroundblock){
rspq_block_begin();
if(RUNT.background) rdpq_sprite_blit(RUNT.background, 0,0, NULL);
else rdpq_clear(RGBA32(0,0,0,0));
RUNT.backgroundblock = rspq_block_end();
} rspq_block_run(RUNT.backgroundblock);
if(!RUNT.charactersblock){
rspq_block_begin();
rdpq_set_mode_copy(true);
if(RUNT.entsactive > 0){
int width = RUNT.textbox->width;
int start = display_get_width() / 2 - width / 2;
int incr = width / (RUNT.entsactive + 1);
start += incr;
for(int i = 0; i < MAX_CHARACTERS_LIMIT; i++){
if(RUNT.ents[i].active) {
if(RUNT.ents[i].entsprite){
rdpq_sprite_blit_anchor(RUNT.ents[i].entsprite, ALIGN_CENTER, VALIGN_BOTTOM, start, display_get_height() - RUNT.textbox->height, NULL);
}
else if(RUNT.ents[i].entspritesurf.buffer) {
rdpq_tex_blit_anchor(&RUNT.ents[i].entspritesurf, ALIGN_CENTER, VALIGN_BOTTOM, start, display_get_height() - RUNT.textbox->height, NULL);
}
start += incr;
}
}
}
if(RUNT.dialogue.ptr && RUNT.textbox) {
rdpq_sprite_blit_anchor(RUNT.textbox, ALIGN_CENTER, VALIGN_BOTTOM, display_get_width() / 2, display_get_height(), NULL);
}
RUNT.charactersblock = rspq_block_end();
} rspq_block_run(RUNT.charactersblock);
overlays_draw();
if(RUNT.dialogue.ptr && RUNT.textbox){
rdpq_textparms_t textparms = {0};
textparms.width = RUNT.textbox->width - 30;
textparms.height = RUNT.textbox->height - 30;
textparms.align = ALIGN_LEFT; textparms.valign = VALIGN_TOP;
textparms.wrap = WRAP_WORD;
//textparms.preserve_overlap = true; // could be bad for performance
textparms.max_chars = RUNT.dialogue.textcurlen;
textparms.style_id = gamestatus.fonts.mainfontstyle;
rdpq_textparms_t textparms_title = {0}; textparms_title.style_id = gamestatus.fonts.titlefontstyle;
if(strlen(gamestatus.state.game.dialogue.name)){
rdpq_sprite_blit_anchor(RUNT.namebox, ALIGN_LEFT, VALIGN_BOTTOM, display_get_width() / 2 - (RUNT.textbox->width / 2) + 15, display_get_height() - RUNT.textbox->height, NULL);
rdpq_text_printf(&textparms_title, gamestatus.fonts.titlefont, display_get_width() / 2 - (RUNT.textbox->width / 2) + 25, display_get_height() - RUNT.textbox->height - 5, "%s", !strcmp(gamestatus.state.game.dialogue.name, "player")? gamestatus.state.game.playername : gamestatus.state.game.dialogue.name);
}
rdpq_text_printf(&textparms, gamestatus.fonts.mainfont, display_get_width() / 2 - (RUNT.textbox->width / 2) + 15, display_get_height() - RUNT.textbox->height + 15, RUNT.dialogue.ptr, gamestatus.state.game.playername);
if(RUNT.dialogue.textcurlen >= RUNT.dialogue.textlen && RUNT.button_a && !gamestatus.state.game.overlay_active){
rdpq_set_mode_standard();
rdpq_mode_blender(RDPQ_BLENDER_MULTIPLY);
rdpq_sprite_blit_anchor(RUNT.button_a, ALIGN_RIGHT, VALIGN_BOTTOM, display_get_width() / 2 + (RUNT.textbox->width / 2), display_get_height(), NULL);
}
}
if(gamestatus.state.scripts.debug){
heap_stats_t stats;
sys_get_heap_stats(&stats);
rdpq_text_printf(NULL, gamestatus.fonts.mainfont, 30 , 30, "FPS: %.2f\nMEM: %i total, %i used\nscript %s, label %s, line %lu", display_get_fps(),
stats.total, stats.used,
gamestatus.state.seq.currentfile, gamestatus.state.seq.currentlabel, gamestatus.state.seq.curline);
}
rdpq_detach_show();
}
void engine_loop(){
RUNT = runtime_t();
if(!RUNT.textbox) RUNT.textbox = sprite_load(filesystem_getfn(DIR_IMAGE, gamestatus.data.defaults.textbox_image).c_str());
if(!RUNT.namebox) RUNT.namebox = sprite_load(filesystem_getfn(DIR_IMAGE, gamestatus.data.defaults.namebox_image).c_str());
if(!RUNT.button_a) RUNT.button_a = sprite_load(filesystem_getfn(DIR_IMAGE, gamestatus.data.defaults.a_button_image).c_str());
RUNT.seqline = gamestatus.state.seq.curline;
while(true){
// update game state based on the seqeunce
while(gamestatus.state.seq.lastresult == SEQ_CONTINUE || gamestatus.state.seq.lastresult == SEQ_CONTINUE_LINEJMP || gamestatus.state.seq.lastresult == SEQ_FROM_SAVE){
if(gamestatus.state.seq.lastresult == SEQ_CONTINUE_LINEJMP)
RUNT.seqline = gamestatus.state.seq.curline;
else gamestatus.state.seq.curline = RUNT.seqline;
assertf(RUNT.seqline < (cursequence[gamestatus.state.seq.currentlabel]).size(), "sequence %s, label %s, reached the end of label without jump action, pc is %lu size is %u\nPlease reset your system.",
gamestatus.state.seq.currentfile, gamestatus.state.seq.currentlabel, RUNT.seqline, (cursequence[gamestatus.state.seq.currentlabel]).size());
action_t* action = &(cursequence[gamestatus.state.seq.currentlabel])[RUNT.seqline];
assertf(seqlibraryfuncs.count(action->functionname) > 0, "sequence %s, label %s, action %lu: invalid action %s not found",
gamestatus.state.seq.currentfile, gamestatus.state.seq.currentlabel, gamestatus.state.seq.curline + 1, action->functionname.c_str());
if(gamestatus.state.scripts.debug) {
debugf("Action %lu: %s parms:", RUNT.seqline, action->functionname.c_str());
for(const auto& str : action->parameters){
debugf("| %s |", str.c_str());
} debugf("\n");
}
// sequence function call
gamestatus.state.seq.lastresult = seqlibraryfuncs[action->functionname](action->parameters);
if(gamestatus.state.seq.lastresult != SEQ_CONTINUE_LINEJMP)
RUNT.seqline++;
}
// we've collected all the persistent state changes for the current line, now it needs for player's input
// (like pressing next on dialogue, or making a choice)
while(!(gamestatus.state.seq.lastresult == SEQ_CONTINUE || gamestatus.state.seq.lastresult == SEQ_CONTINUE_LINEJMP)){
if(gamestatus.state.game.dirtyflag)
resolve_dirty_flag();
game_update();
game_render();
if(gamestatus.state.seq.lastresult == SEQ_RETURN_TO_MENU){engine_gameruntfree(); return;}
}
}
}
void engine_gameruntfree(){
// clear sequence data
cursequence.clear();
characters.clear();
cglist.clear();
maxcharacters = 0;
RUNT.seqline = 0;
if(RUNT.background) {sprite_free(RUNT.background); } RUNT.background = NULL;
if(RUNT.namebox) {sprite_free(RUNT.namebox); } RUNT.namebox = NULL;
if(RUNT.textbox) {sprite_free(RUNT.textbox); } RUNT.textbox = NULL;
if(RUNT.button_a) {sprite_free(RUNT.button_a); } RUNT.button_a = NULL;
if(RUNT.backgroundblock) {rspq_block_free(RUNT.backgroundblock); } RUNT.backgroundblock = NULL;
if(RUNT.charactersblock) {rspq_block_free(RUNT.charactersblock); } RUNT.charactersblock = NULL;
RUNT.curbackground[0] = 0;
for(int i = 0; i < MAX_CHARACTERS_LIMIT; i++){
if(RUNT.ents[i].entsprite) {sprite_free(RUNT.ents[i].entsprite); } RUNT.ents[i].entsprite = NULL;
if(RUNT.ents[i].entspritesurf.buffer) {surface_free(&RUNT.ents[i].entspritesurf); memset(&RUNT.ents[i].entspritesurf, 0, sizeof(RUNT.ents[i].entspritesurf));}
RUNT.ents[i].expressionfn[0] = 0;
RUNT.ents[i].active = false;
}
RUNT.dialogue.textcurlen = 0;
RUNT.dialogue.textlen = 0;
RUNT.dialogue.curline = 0;
RUNT.dialogue.frame = 0;
RUNT.dialogue.ptr = NULL;
} | 411 | 0.910721 | 1 | 0.910721 | game-dev | MEDIA | 0.689015 | game-dev | 0.924137 | 1 | 0.924137 |
kripken/intensityengine | 18,284 | src/thirdparty/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h | /*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef QUANTIZED_BVH_H
#define QUANTIZED_BVH_H
class btSerializer;
//#define DEBUG_CHECK_DEQUANTIZATION 1
#ifdef DEBUG_CHECK_DEQUANTIZATION
#ifdef __SPU__
#define printf spu_printf
#endif //__SPU__
#include <stdio.h>
#include <stdlib.h>
#endif //DEBUG_CHECK_DEQUANTIZATION
#include "LinearMath/btVector3.h"
#include "LinearMath/btAlignedAllocator.h"
#ifdef BT_USE_DOUBLE_PRECISION
#define btQuantizedBvhData btQuantizedBvhDoubleData
#define btOptimizedBvhNodeData btOptimizedBvhNodeDoubleData
#define btQuantizedBvhDataName "btQuantizedBvhDoubleData"
#else
#define btQuantizedBvhData btQuantizedBvhFloatData
#define btOptimizedBvhNodeData btOptimizedBvhNodeFloatData
#define btQuantizedBvhDataName "btQuantizedBvhFloatData"
#endif
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vclrf__m128.asp
//Note: currently we have 16 bytes per quantized node
#define MAX_SUBTREE_SIZE_IN_BYTES 2048
// 10 gives the potential for 1024 parts, with at most 2^21 (2097152) (minus one
// actually) triangles each (since the sign bit is reserved
#define MAX_NUM_PARTS_IN_BITS 10
///btQuantizedBvhNode is a compressed aabb node, 16 bytes.
///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range).
ATTRIBUTE_ALIGNED16 (struct) btQuantizedBvhNode
{
BT_DECLARE_ALIGNED_ALLOCATOR();
//12 bytes
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
//4 bytes
int m_escapeIndexOrTriangleIndex;
bool isLeafNode() const
{
//skipindex is negative (internal node), triangleindex >=0 (leafnode)
return (m_escapeIndexOrTriangleIndex >= 0);
}
int getEscapeIndex() const
{
btAssert(!isLeafNode());
return -m_escapeIndexOrTriangleIndex;
}
int getTriangleIndex() const
{
btAssert(isLeafNode());
// Get only the lower bits where the triangle index is stored
return (m_escapeIndexOrTriangleIndex&~((~0)<<(31-MAX_NUM_PARTS_IN_BITS)));
}
int getPartId() const
{
btAssert(isLeafNode());
// Get only the highest bits where the part index is stored
return (m_escapeIndexOrTriangleIndex>>(31-MAX_NUM_PARTS_IN_BITS));
}
}
;
/// btOptimizedBvhNode contains both internal and leaf node information.
/// Total node size is 44 bytes / node. You can use the compressed version of 16 bytes.
ATTRIBUTE_ALIGNED16 (struct) btOptimizedBvhNode
{
BT_DECLARE_ALIGNED_ALLOCATOR();
//32 bytes
btVector3 m_aabbMinOrg;
btVector3 m_aabbMaxOrg;
//4
int m_escapeIndex;
//8
//for child nodes
int m_subPart;
int m_triangleIndex;
int m_padding[5];//bad, due to alignment
};
///btBvhSubtreeInfo provides info to gather a subtree of limited size
ATTRIBUTE_ALIGNED16(class) btBvhSubtreeInfo
{
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
//12 bytes
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
//4 bytes, points to the root of the subtree
int m_rootNodeIndex;
//4 bytes
int m_subtreeSize;
int m_padding[3];
btBvhSubtreeInfo()
{
//memset(&m_padding[0], 0, sizeof(m_padding));
}
void setAabbFromQuantizeNode(const btQuantizedBvhNode& quantizedNode)
{
m_quantizedAabbMin[0] = quantizedNode.m_quantizedAabbMin[0];
m_quantizedAabbMin[1] = quantizedNode.m_quantizedAabbMin[1];
m_quantizedAabbMin[2] = quantizedNode.m_quantizedAabbMin[2];
m_quantizedAabbMax[0] = quantizedNode.m_quantizedAabbMax[0];
m_quantizedAabbMax[1] = quantizedNode.m_quantizedAabbMax[1];
m_quantizedAabbMax[2] = quantizedNode.m_quantizedAabbMax[2];
}
}
;
class btNodeOverlapCallback
{
public:
virtual ~btNodeOverlapCallback() {};
virtual void processNode(int subPart, int triangleIndex) = 0;
};
#include "LinearMath/btAlignedAllocator.h"
#include "LinearMath/btAlignedObjectArray.h"
///for code readability:
typedef btAlignedObjectArray<btOptimizedBvhNode> NodeArray;
typedef btAlignedObjectArray<btQuantizedBvhNode> QuantizedNodeArray;
typedef btAlignedObjectArray<btBvhSubtreeInfo> BvhSubtreeInfoArray;
///The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU.
///It is used by the btBvhTriangleMeshShape as midphase, and by the btMultiSapBroadphase.
///It is recommended to use quantization for better performance and lower memory requirements.
ATTRIBUTE_ALIGNED16(class) btQuantizedBvh
{
public:
enum btTraversalMode
{
TRAVERSAL_STACKLESS = 0,
TRAVERSAL_STACKLESS_CACHE_FRIENDLY,
TRAVERSAL_RECURSIVE
};
protected:
btVector3 m_bvhAabbMin;
btVector3 m_bvhAabbMax;
btVector3 m_bvhQuantization;
int m_bulletVersion; //for serialization versioning. It could also be used to detect endianess.
int m_curNodeIndex;
//quantization data
bool m_useQuantization;
NodeArray m_leafNodes;
NodeArray m_contiguousNodes;
QuantizedNodeArray m_quantizedLeafNodes;
QuantizedNodeArray m_quantizedContiguousNodes;
btTraversalMode m_traversalMode;
BvhSubtreeInfoArray m_SubtreeHeaders;
//This is only used for serialization so we don't have to add serialization directly to btAlignedObjectArray
mutable int m_subtreeHeaderCount;
///two versions, one for quantized and normal nodes. This allows code-reuse while maintaining readability (no template/macro!)
///this might be refactored into a virtual, it is usually not calculated at run-time
void setInternalNodeAabbMin(int nodeIndex, const btVector3& aabbMin)
{
if (m_useQuantization)
{
quantize(&m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[0] ,aabbMin,0);
} else
{
m_contiguousNodes[nodeIndex].m_aabbMinOrg = aabbMin;
}
}
void setInternalNodeAabbMax(int nodeIndex,const btVector3& aabbMax)
{
if (m_useQuantization)
{
quantize(&m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[0],aabbMax,1);
} else
{
m_contiguousNodes[nodeIndex].m_aabbMaxOrg = aabbMax;
}
}
btVector3 getAabbMin(int nodeIndex) const
{
if (m_useQuantization)
{
return unQuantize(&m_quantizedLeafNodes[nodeIndex].m_quantizedAabbMin[0]);
}
//non-quantized
return m_leafNodes[nodeIndex].m_aabbMinOrg;
}
btVector3 getAabbMax(int nodeIndex) const
{
if (m_useQuantization)
{
return unQuantize(&m_quantizedLeafNodes[nodeIndex].m_quantizedAabbMax[0]);
}
//non-quantized
return m_leafNodes[nodeIndex].m_aabbMaxOrg;
}
void setInternalNodeEscapeIndex(int nodeIndex, int escapeIndex)
{
if (m_useQuantization)
{
m_quantizedContiguousNodes[nodeIndex].m_escapeIndexOrTriangleIndex = -escapeIndex;
}
else
{
m_contiguousNodes[nodeIndex].m_escapeIndex = escapeIndex;
}
}
void mergeInternalNodeAabb(int nodeIndex,const btVector3& newAabbMin,const btVector3& newAabbMax)
{
if (m_useQuantization)
{
unsigned short int quantizedAabbMin[3];
unsigned short int quantizedAabbMax[3];
quantize(quantizedAabbMin,newAabbMin,0);
quantize(quantizedAabbMax,newAabbMax,1);
for (int i=0;i<3;i++)
{
if (m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[i] > quantizedAabbMin[i])
m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMin[i] = quantizedAabbMin[i];
if (m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[i] < quantizedAabbMax[i])
m_quantizedContiguousNodes[nodeIndex].m_quantizedAabbMax[i] = quantizedAabbMax[i];
}
} else
{
//non-quantized
m_contiguousNodes[nodeIndex].m_aabbMinOrg.setMin(newAabbMin);
m_contiguousNodes[nodeIndex].m_aabbMaxOrg.setMax(newAabbMax);
}
}
void swapLeafNodes(int firstIndex,int secondIndex);
void assignInternalNodeFromLeafNode(int internalNode,int leafNodeIndex);
protected:
void buildTree (int startIndex,int endIndex);
int calcSplittingAxis(int startIndex,int endIndex);
int sortAndCalcSplittingIndex(int startIndex,int endIndex,int splitAxis);
void walkStacklessTree(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
void walkStacklessQuantizedTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const;
void walkStacklessQuantizedTree(btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax,int startNodeIndex,int endNodeIndex) const;
void walkStacklessTreeAgainstRay(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin, const btVector3& aabbMax, int startNodeIndex,int endNodeIndex) const;
///tree traversal designed for small-memory processors like PS3 SPU
void walkStacklessQuantizedTreeCacheFriendly(btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax) const;
///use the 16-byte stackless 'skipindex' node tree to do a recursive traversal
void walkRecursiveQuantizedTreeAgainstQueryAabb(const btQuantizedBvhNode* currentNode,btNodeOverlapCallback* nodeCallback,unsigned short int* quantizedQueryAabbMin,unsigned short int* quantizedQueryAabbMax) const;
///use the 16-byte stackless 'skipindex' node tree to do a recursive traversal
void walkRecursiveQuantizedTreeAgainstQuantizedTree(const btQuantizedBvhNode* treeNodeA,const btQuantizedBvhNode* treeNodeB,btNodeOverlapCallback* nodeCallback) const;
void updateSubtreeHeaders(int leftChildNodexIndex,int rightChildNodexIndex);
public:
BT_DECLARE_ALIGNED_ALLOCATOR();
btQuantizedBvh();
virtual ~btQuantizedBvh();
///***************************************** expert/internal use only *************************
void setQuantizationValues(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax,btScalar quantizationMargin=btScalar(1.0));
QuantizedNodeArray& getLeafNodeArray() { return m_quantizedLeafNodes; }
///buildInternal is expert use only: assumes that setQuantizationValues and LeafNodeArray are initialized
void buildInternal();
///***************************************** expert/internal use only *************************
void reportAabbOverlappingNodex(btNodeOverlapCallback* nodeCallback,const btVector3& aabbMin,const btVector3& aabbMax) const;
void reportRayOverlappingNodex (btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget) const;
void reportBoxCastOverlappingNodex(btNodeOverlapCallback* nodeCallback, const btVector3& raySource, const btVector3& rayTarget, const btVector3& aabbMin,const btVector3& aabbMax) const;
SIMD_FORCE_INLINE void quantize(unsigned short* out, const btVector3& point,int isMax) const
{
btAssert(m_useQuantization);
btAssert(point.getX() <= m_bvhAabbMax.getX());
btAssert(point.getY() <= m_bvhAabbMax.getY());
btAssert(point.getZ() <= m_bvhAabbMax.getZ());
btAssert(point.getX() >= m_bvhAabbMin.getX());
btAssert(point.getY() >= m_bvhAabbMin.getY());
btAssert(point.getZ() >= m_bvhAabbMin.getZ());
btVector3 v = (point - m_bvhAabbMin) * m_bvhQuantization;
///Make sure rounding is done in a way that unQuantize(quantizeWithClamp(...)) is conservative
///end-points always set the first bit, so that they are sorted properly (so that neighbouring AABBs overlap properly)
///@todo: double-check this
if (isMax)
{
out[0] = (unsigned short) (((unsigned short)(v.getX()+btScalar(1.)) | 1));
out[1] = (unsigned short) (((unsigned short)(v.getY()+btScalar(1.)) | 1));
out[2] = (unsigned short) (((unsigned short)(v.getZ()+btScalar(1.)) | 1));
} else
{
out[0] = (unsigned short) (((unsigned short)(v.getX()) & 0xfffe));
out[1] = (unsigned short) (((unsigned short)(v.getY()) & 0xfffe));
out[2] = (unsigned short) (((unsigned short)(v.getZ()) & 0xfffe));
}
#ifdef DEBUG_CHECK_DEQUANTIZATION
btVector3 newPoint = unQuantize(out);
if (isMax)
{
if (newPoint.getX() < point.getX())
{
printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n",newPoint.getX()-point.getX(), newPoint.getX(),point.getX());
}
if (newPoint.getY() < point.getY())
{
printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n",newPoint.getY()-point.getY(), newPoint.getY(),point.getY());
}
if (newPoint.getZ() < point.getZ())
{
printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n",newPoint.getZ()-point.getZ(), newPoint.getZ(),point.getZ());
}
} else
{
if (newPoint.getX() > point.getX())
{
printf("unconservative X, diffX = %f, oldX=%f,newX=%f\n",newPoint.getX()-point.getX(), newPoint.getX(),point.getX());
}
if (newPoint.getY() > point.getY())
{
printf("unconservative Y, diffY = %f, oldY=%f,newY=%f\n",newPoint.getY()-point.getY(), newPoint.getY(),point.getY());
}
if (newPoint.getZ() > point.getZ())
{
printf("unconservative Z, diffZ = %f, oldZ=%f,newZ=%f\n",newPoint.getZ()-point.getZ(), newPoint.getZ(),point.getZ());
}
}
#endif //DEBUG_CHECK_DEQUANTIZATION
}
SIMD_FORCE_INLINE void quantizeWithClamp(unsigned short* out, const btVector3& point2,int isMax) const
{
btAssert(m_useQuantization);
btVector3 clampedPoint(point2);
clampedPoint.setMax(m_bvhAabbMin);
clampedPoint.setMin(m_bvhAabbMax);
quantize(out,clampedPoint,isMax);
}
SIMD_FORCE_INLINE btVector3 unQuantize(const unsigned short* vecIn) const
{
btVector3 vecOut;
vecOut.setValue(
(btScalar)(vecIn[0]) / (m_bvhQuantization.getX()),
(btScalar)(vecIn[1]) / (m_bvhQuantization.getY()),
(btScalar)(vecIn[2]) / (m_bvhQuantization.getZ()));
vecOut += m_bvhAabbMin;
return vecOut;
}
///setTraversalMode let's you choose between stackless, recursive or stackless cache friendly tree traversal. Note this is only implemented for quantized trees.
void setTraversalMode(btTraversalMode traversalMode)
{
m_traversalMode = traversalMode;
}
SIMD_FORCE_INLINE QuantizedNodeArray& getQuantizedNodeArray()
{
return m_quantizedContiguousNodes;
}
SIMD_FORCE_INLINE BvhSubtreeInfoArray& getSubtreeInfoArray()
{
return m_SubtreeHeaders;
}
////////////////////////////////////////////////////////////////////
/////Calculate space needed to store BVH for serialization
unsigned calculateSerializeBufferSize() const;
/// Data buffer MUST be 16 byte aligned
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const;
///deSerializeInPlace loads and initializes a BVH from a buffer in memory 'in place'
static btQuantizedBvh *deSerializeInPlace(void *i_alignedDataBuffer, unsigned int i_dataBufferSize, bool i_swapEndian);
static unsigned int getAlignmentSerializationPadding();
//////////////////////////////////////////////////////////////////////
virtual int calculateSerializeBufferSizeNew() const;
///fills the dataBuffer and returns the struct name (and 0 on failure)
virtual const char* serialize(void* dataBuffer, btSerializer* serializer) const;
virtual void deSerializeFloat(struct btQuantizedBvhFloatData& quantizedBvhFloatData);
virtual void deSerializeDouble(struct btQuantizedBvhDoubleData& quantizedBvhDoubleData);
////////////////////////////////////////////////////////////////////
SIMD_FORCE_INLINE bool isQuantized()
{
return m_useQuantization;
}
private:
// Special "copy" constructor that allows for in-place deserialization
// Prevents btVector3's default constructor from being called, but doesn't inialize much else
// ownsMemory should most likely be false if deserializing, and if you are not, don't call this (it also changes the function signature, which we need)
btQuantizedBvh(btQuantizedBvh &other, bool ownsMemory);
}
;
struct btBvhSubtreeInfoData
{
int m_rootNodeIndex;
int m_subtreeSize;
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
};
struct btOptimizedBvhNodeFloatData
{
btVector3FloatData m_aabbMinOrg;
btVector3FloatData m_aabbMaxOrg;
int m_escapeIndex;
int m_subPart;
int m_triangleIndex;
};
struct btOptimizedBvhNodeDoubleData
{
btVector3DoubleData m_aabbMinOrg;
btVector3DoubleData m_aabbMaxOrg;
int m_escapeIndex;
int m_subPart;
int m_triangleIndex;
};
struct btQuantizedBvhNodeData
{
int m_escapeIndexOrTriangleIndex;
unsigned short int m_quantizedAabbMin[3];
unsigned short int m_quantizedAabbMax[3];
};
struct btQuantizedBvhFloatData
{
btVector3FloatData m_bvhAabbMin;
btVector3FloatData m_bvhAabbMax;
btVector3FloatData m_bvhQuantization;
int m_curNodeIndex;
int m_useQuantization;
int m_numContiguousLeafNodes;
int m_numQuantizedContiguousNodes;
btOptimizedBvhNodeFloatData *m_contiguousNodesPtr;
btQuantizedBvhNodeData *m_quantizedContiguousNodesPtr;
int m_traversalMode;
int m_numSubtreeHeaders;
btBvhSubtreeInfoData *m_subTreeInfoPtr;
};
struct btQuantizedBvhDoubleData
{
btVector3DoubleData m_bvhAabbMin;
btVector3DoubleData m_bvhAabbMax;
btVector3DoubleData m_bvhQuantization;
int m_curNodeIndex;
int m_useQuantization;
int m_numContiguousLeafNodes;
int m_numQuantizedContiguousNodes;
btOptimizedBvhNodeDoubleData *m_contiguousNodesPtr;
btQuantizedBvhNodeData *m_quantizedContiguousNodesPtr;
int m_traversalMode;
int m_numSubtreeHeaders;
btBvhSubtreeInfoData *m_subTreeInfoPtr;
};
SIMD_FORCE_INLINE int btQuantizedBvh::calculateSerializeBufferSizeNew() const
{
return sizeof(btQuantizedBvhData);
}
#endif //QUANTIZED_BVH_H
| 411 | 0.97326 | 1 | 0.97326 | game-dev | MEDIA | 0.82267 | game-dev | 0.957549 | 1 | 0.957549 |
project-topaz/topaz | 4,126 | scripts/zones/Bastok_Mines/npcs/Abd-al-Raziq.lua | -----------------------------------
-- Area: Bastok Mines
-- NPC: Abd-al-Raziq
-- Type: Alchemy Guild Master
-- !pos 126.768 1.017 -0.234 234
-----------------------------------
local ID = require("scripts/zones/Bastok_Mines/IDs")
require("scripts/globals/crafting")
require("scripts/globals/missions")
require("scripts/globals/status")
-----------------------------------
function onTrade(player, npc, trade)
local signed = trade:getItem():getSignature() == player:getName() and 1 or 0
local newRank = tradeTestItem(player, npc, trade, tpz.skill.ALCHEMY)
if
newRank > 9 and
player:getCharVar("AlchemyExpertQuest") == 1 and
player:hasKeyItem(tpz.keyItem.WAY_OF_THE_ALCHEMIST)
then
if signed ~=0 then
player:setSkillRank(tpz.skill.ALCHEMY, newRank)
player:startEvent(121, 0, 0, 0, 0, newRank, 1)
player:setCharVar("AlchemyExpertQuest",0)
player:setLocalVar("AlchemyTraded",1)
else
player:startEvent(121, 0, 0, 0, 0, newRank, 0)
end
elseif newRank ~= 0 and newRank <=9 then
player:setSkillRank(tpz.skill.ALCHEMY, newRank)
player:startEvent(121, 0, 0, 0, 0, newRank)
player:setLocalVar("AlchemyTraded",1)
end
end
function onTrigger(player, npc)
local craftSkill = player:getSkillLevel(tpz.skill.ALCHEMY)
local testItem = getTestItem(player, npc, tpz.skill.ALCHEMY)
local guildMember = isGuildMember(player, 1)
local rankCap = getCraftSkillCap(player, tpz.skill.ALCHEMY)
local expertQuestStatus = 0
local Rank = player:getSkillRank(tpz.skill.ALCHEMY)
local realSkill = (craftSkill - Rank) / 32
local canRankUp = rankCap - realSkill -- used to make sure rank up isn't overridden by ASA mission
if (guildMember == 1) then guildMember = 150995375; end
if player:getCharVar("AlchemyExpertQuest") == 1 then
if player:hasKeyItem(tpz.keyItem.WAY_OF_THE_ALCHEMIST) then
expertQuestStatus = 550
else
expertQuestStatus = 600
end
end
if (player:getCurrentMission(ASA) == tpz.mission.id.asa.THAT_WHICH_CURDLES_BLOOD and guildMember == 150995375 and canRankUp >= 3) then
local item = 0
local asaStatus = player:getCharVar("ASA_Status")
-- TODO: Other Enfeebling Kits
if (asaStatus == 0) then
item = 2779
else
printf("Error: Unknown ASA Status Encountered <%u>", asaStatus)
end
-- The Parameters are Item IDs for the Recipe
player:startEvent(590, item, 2774, 929, 4103, 2777, 4103)
elseif expertQuestStatus == 550 then
--[[
Feeding the proper parameter currently hangs the client in cutscene. This may
possibly be due to an unimplemented packet or function (display recipe?) Work
around to present dialog to player to let them know the trade is ready to be
received by triggering with lower rank up parameters.
--]]
player:showText(npc, 7237)
player:showText(npc, 7239)
player:startEvent(120, testItem, realSkill, 44, guildMember, 0, 0, 0, 0)
else
player:startEvent(120, testItem, realSkill, rankCap, guildMember, expertQuestStatus, 0, 0, 0)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
local guildMember = isGuildMember(player, 1)
if (csid == 120 and option == 2) then
if guildMember == 1 then
player:setCharVar("AlchemyExpertQuest",1)
end
elseif (csid == 120 and option == 1) then
local crystal = 4101 -- water crystal
if (player:getFreeSlotsCount() == 0) then
player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED, crystal)
else
player:addItem(crystal)
player:messageSpecial(ID.text.ITEM_OBTAINED, crystal)
signupGuild(player, guild.alchemy)
end
else
if player:getLocalVar("AlchemyTraded") == 1 then
player:tradeComplete()
player:setLocalVar("AlchemyTraded",0)
end
end
end
| 411 | 0.938764 | 1 | 0.938764 | game-dev | MEDIA | 0.927483 | game-dev | 0.89337 | 1 | 0.89337 |
jasonmzx/cppkart | 20,403 | src/game/scenes/GameScene.cpp | #include "GameScene.hpp"
#include <chrono>
//#define BT_USE_DOUBLE_PRECISION 1
Logger* GameScene::logger = Logger::getInstance();
GameScene* GameScene::instance = nullptr;
GameScene::GameScene(int WIN_W, int WIN_H, SDL_Window* window) {
WIN_WIDTH = WIN_W;
WIN_HEIGHT = WIN_H;
this->SDL_window = window;
instance = this;
gContactAddedCallback = bulletCollisionCallback;
// Rendering
camera = std::make_shared<Camera>(WIN_WIDTH, WIN_HEIGHT, glm::vec3(0.0f, 10.0f, 2.0f));
renderer = GameGLRenderer::getInstance(WIN_WIDTH, WIN_HEIGHT, camera.get()); // Init Renderer
// IO
gameInput = std::make_shared<GameInput>();
//* =================== Load Sound Effects =================== *//
// Init SDL_mixer
if (Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 2048) < 0) {
logger->log(Logger::ERROR, "SDL_mixer could not initialize! SDL_mixer Error: " + std::string(Mix_GetError()));
}
crashSound = Mix_LoadWAV("../src/ressources/sounds/zapsplat_car_crash_01.mp3");
if (crashSound == nullptr) {
logger->log(Logger::ERROR, "Failed to load sound effect! SDL_mixer Error: " + std::string(Mix_GetError()));
}
}
bool GameScene::bulletCollisionCallback(btManifoldPoint& cp,
const btCollisionObjectWrapper* colObj0, int partId0, int index0, const btCollisionObjectWrapper* colObj1, int partId1, int index1)
{
//std::cout << "Collision Detected!" << std::endl;
// Get the two colliding objects
btCollisionObject* obj0 = (btCollisionObject*)colObj0->getCollisionObject();
btCollisionObject* obj1 = (btCollisionObject*)colObj1->getCollisionObject();
// Retrieve user pointers and cast them back to int
int userPtr0 = reinterpret_cast<intptr_t>(obj0->getUserPointer());
int userPtr1 = reinterpret_cast<intptr_t>(obj1->getUserPointer());
// Retreive applied impulse
float impulse = cp.getAppliedImpulse();
if( impulse > 0.1f) {
std::cout << "Collision Detected between objects with user pointers: "
<< userPtr0 << " and " << userPtr1 << " | IMPULSE: " << impulse << std::endl;
}
if( impulse > 5000.0f && GameScene::instance) {
Mix_PlayChannel(-1, GameScene::instance->crashSound, 0);
}
return false;
}
void GameScene::updateImGui() {
// --- Speed Plot ----
static float speed_values[90] = { 0 };
static int speed_offset = 0; // Index of the current value
// --- Inferencing Time Plot ----
static float ECS_INFR_values[90] = { 0 };
static int ECS_INFR_offset = 0;
//FPS Time Plot
static float FPS_values[90] = { 0 };
static int FPS_offset = 0;
static double refresh_time = 0.0;
if (ImGui::Begin("Game Controls")) {
if (ImGui::BeginTabBar("Tabs")) {
if (ImGui::BeginTabItem("DEBUG TOOLS")) { // Debug Tools Tab
ImGui::Text("Vehicle Speed: %.2f", vSpeed);
ImGui::Spacing();
if(ImGui::GetTime() > refresh_time) {
speed_values[speed_offset] = vSpeed;
speed_offset = (speed_offset + 1) % IM_ARRAYSIZE(speed_values); // offset modulo array size, to wrap around
}
ImGui::PlotLines("", speed_values, IM_ARRAYSIZE(speed_values), speed_offset, NULL, 0.0f, 100.0f, ImVec2(0, 80));
ImGui::Spacing();
if (ImGui::Button("Reset Vehicle")) {
ecManager->resetPlayerVehicle();
}
if (ImGui::Button("Toggle Bullet Debug Draw")) {
isBulletDebugDraw = !isBulletDebugDraw;
ecManager->toggleAICylinders();
}
if (ImGui::Button("Activate AI Control")) {
ecManager->toggleAIVehicleControl();
}
if (ImGui::Button("Spawn Barrier")) {
glm::vec3 player_pos = ecManager->getLastPlayerPos();
player_pos.y += 10.0f;
makeBarrier(player_pos.x, player_pos.y, player_pos.z);
}
if (ImGui::Button("RENDER :: View GGX Normals")) {
ecManager->toggleNormalsShader();
}
// This is the X,Y,Z Location of the vehicle
ImGui::Text("%s", ecManager->debugStateSTR().c_str());
// Input fields for x, y, z coordinates
static float cam_tp_x = 0.0f, cam_tp_y = 0.0f, cam_tp_z = 0.0f;
ImGui::InputFloat("X", &cam_tp_x);
ImGui::InputFloat("Y", &cam_tp_y);
ImGui::InputFloat("Z", &cam_tp_z);
if (ImGui::Button("Teleport Camera")) {
printf("Teleporting Camera to: %f, %f, %f\n", cam_tp_x, cam_tp_y, cam_tp_z);
glm::vec3 teleport_to = glm::vec3(cam_tp_x, cam_tp_y, cam_tp_z);
camera->setCameraPosition(teleport_to);
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("PERFORMANCE")) { // Performance Tab
// Create a simple line plot
if (ImGui::GetTime() > refresh_time) {
ECS_INFR_values[ECS_INFR_offset] = ecInferenceTimeMS;
ECS_INFR_offset = (ECS_INFR_offset + 1) % IM_ARRAYSIZE(ECS_INFR_values); // offset modulo array size, to wrap around
FPS_values[FPS_offset] = ImGui::GetIO().Framerate;
FPS_offset = (FPS_offset + 1) % IM_ARRAYSIZE(FPS_values); // offset modulo array size, to wrap around
refresh_time = ImGui::GetTime() + 1.0f / 60.0f;
}
float framerate = ImGui::GetIO().Framerate;
char formatted_inference_STR[50];
char formatted_fps_STR[50];
sprintf(formatted_fps_STR, "FPS: %.1f", framerate);
sprintf(formatted_inference_STR, "ECS (ms): %.2f", ecInferenceTimeMS);
ImGui::PlotLines(formatted_inference_STR, ECS_INFR_values, IM_ARRAYSIZE(ECS_INFR_values), ECS_INFR_offset, NULL, 0.0f, 100.0f, ImVec2(0, 80));
ImGui::PlotLines(formatted_fps_STR, FPS_values, IM_ARRAYSIZE(FPS_values), FPS_offset, NULL, 0.0f, 100.0f, ImVec2(0, 80));
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
ImGui::End();
}
}
void GameScene::tickScene() { //* Main Game Loop Function (Scene Tick)
update(1.0f / 60.0f);
render();
}
void GameScene::update(float dt) {
//TODO: Accumulate deltaTime and pass it to physicsWorld->dynamicsWorld->stepSimulation
//world->physicsWorld->dynamicsWorld->stepSimulation(deltaTimeWithTimeScale, 2, deltaTime);
physicsWorld->dynamicsWorld->stepSimulation(1.0f / 60.0f, 4, 1/240.0f);
}
glm::vec3 GameScene::BulletRaycast() {
glm::vec3 rayStart, rayEnd;
camera->GenerateRay(rayStart, rayEnd, 1000.0f);
btCollisionWorld::ClosestRayResultCallback rayCallback(btVector3(rayStart.x, rayStart.y, rayStart.z), btVector3(rayEnd.x, rayEnd.y, rayEnd.z));
rayCallback.m_collisionFilterGroup = COLLISION_GROUP_ALL | COLLISION_GROUP_CHUNKS;
physicsWorld->dynamicsWorld->rayTest(btVector3(rayStart.x, rayStart.y, rayStart.z), btVector3(rayEnd.x, rayEnd.y, rayEnd.z), rayCallback);
if(rayCallback.hasHit()) {
std::cout << "Ray hit at: " << rayCallback.m_hitPointWorld.getX() << " " << rayCallback.m_hitPointWorld.getY() << " " << rayCallback.m_hitPointWorld.getZ() << std::endl;
return glm::vec3(rayCallback.m_hitPointWorld.getX(), rayCallback.m_hitPointWorld.getY(), rayCallback.m_hitPointWorld.getZ());
}
return glm::vec3(0.0f, 0.0f, 0.0f);
}
void GameScene::makeBarrier(float x, float y, float z) {
std::shared_ptr<Entity> roadBarrierEntity = std::make_shared<Entity>();
auto roadBarrierComponent = std::make_shared<MovableObjectComponent>("../assets/road_barrier_01/road_barrier_01.obj",
"../assets/road_barrier_01/road_barrier_01_tex2.jpg",
std::vector<int>{0}, false, false, 1.0f, 0.5f);
// roadBarrierComponent->phyMesh->meshRigidBody->setCollisionFlags(roadBarrierComponent->phyMesh->meshRigidBody->getCollisionFlags() | btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK);
// physicsWorld->dynamicsWorld->addRigidBody(roadBarrierComponent->phyMesh->meshRigidBody, COLLISION_GROUP_ALL, COLLISION_GROUP_ALL);
roadBarrierComponent->SetRenderScale(10.0f);
roadBarrierEntity->addComponent(roadBarrierComponent);
entities.push_back(roadBarrierEntity);
roadBarrierComponent->SetPosition(x, y, z);
}
void GameScene::render() {
procGameInputs();
// Render game objects
renderer->RenderPrep();
auto start = std::chrono::high_resolution_clock::now();
vSpeed = 0.0f;
ecManager->componentSpecificPass(entities, gameInput); // ECS Component Specifics Pass
ecManager->tick(entities); // ECS System Tick (All Components)
ecManager->debugSetPlayerVehicleVelocity(vSpeed);
auto end = std::chrono::high_resolution_clock::now();
ecInferenceTimeMS = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
if(isBulletDebugDraw) {
renderer->DebugRender();
}
// do multiple near/far plane passes
// 1- 100, 100- 10000 etc play arround
camera->Matrix(45.0f, 1.0f, 4000.0f, renderer->mainShader, "camMatrix"); //! IMPORTANT
}
void GameScene::procGameInputs() {
const Uint8 *KB_InputState = SDL_GetKeyboardState(NULL);
GameInput* gameInputPtr = gameInput.get();
gameInputPtr->keyboardUpdateInput(KB_InputState);
// Some Direct Key Actions
if(KB_InputState[SDL_SCANCODE_ESCAPE]) { // Free the mouse
trackMouse = !trackMouse;
}
if(KB_InputState[SDL_SCANCODE_F1]) { // Toggle Vehicle Camera
followPlayerVehicle = !followPlayerVehicle;
ecManager->setFreeCameraMode(followPlayerVehicle);
}
if (trackMouse)
{ // Let the Mouse handle the camera or not
// Handles mouse inputs
int mouseX, mouseY;
Uint32 mouseButtons = SDL_GetMouseState(&mouseX, &mouseY);
// If mouse left button is pressed
if (mouseButtons & SDL_BUTTON(SDL_BUTTON_LEFT))
{
printf("Mouse Left Button Pressed\n");
glm::vec3 rayHit = BulletRaycast();
gameInputPtr->setDebugRaycastXYZ(rayHit.x, rayHit.y, rayHit.z);
//makeBarrier();
} else {
gameInputPtr->setDebugRaycastXYZ(0.0f, 0.0f, 0.0f);
}
if (firstClick)
{
// Center the mouse cursor
SDL_WarpMouseInWindow(SDL_window, WIN_WIDTH / 2, WIN_HEIGHT / 2);
firstClick = false;
SDL_ShowCursor(SDL_DISABLE); // Hide the mouse cursor
}
else
{
// SDL doesn't directly give us the previous position of the cursor,
// so we compute the motion based on the current position and centering the cursor.
int mouzDeltaX = mouseX - WIN_WIDTH / 2;
int mouzDeltaY = mouseY - WIN_HEIGHT / 2;
camera->Inputs();
camera->ProcessMouseLook(mouzDeltaX, mouzDeltaY);
SDL_WarpMouseInWindow(SDL_window, WIN_WIDTH / 2, WIN_HEIGHT / 2);
}
}
// Joystick input handling
if (gGameController != nullptr) {
SDL_JoystickUpdate(); // Update joystick state
// Left joystick
int leftX = SDL_JoystickGetAxis(gGameController, 0); // X axis
int leftY = SDL_JoystickGetAxis(gGameController, 1); // Y axis
// LT and RT triggers
int lt = SDL_JoystickGetAxis(gGameController, 2); // LT axis (Left Trigger)
int rt = SDL_JoystickGetAxis(gGameController, 5); // RT axis (Right Trigger)
gameInputPtr->xboxControllerUpdateInput(leftX, leftY, lt, rt);
// Right joystick
int rightX = SDL_JoystickGetAxis(gGameController, 3); // X axis
int rightY = SDL_JoystickGetAxis(gGameController, 4); // Y axis
// printf("Left Joystick - X: %d, Y: %d\n", leftX, leftY);
// printf("Right Joystick - X: %d, Y: %d\n", rightX, rightY);
// printf("Left Trigger (LT): %d\n", lt);
// printf("Right Trigger (RT): %d\n", rt);
// Print button states
for (int i = 0; i < SDL_JoystickNumButtons(gGameController); i++) {
if (SDL_JoystickGetButton(gGameController, i) == SDL_PRESSED) {
printf("Button %d pressed\n", i);
if(i == 4){ // LB
printf("BOING");
camera->setFrontLook(true);
} else {
camera->setFrontLook(false);
}
}
}
}
}
void GameScene::load_HighRoadHills_Map(std::shared_ptr<Entity> terrainEntity) {
float terrainEntityScale = 15.0f;
auto terrainRenderComponent = std::make_shared<RenderComponent>("../src/ressources/DE_MAP0/MAPOI.obj",
"../src/ressources/DE_Map1/Map01_Albedo.png",
std::vector<int>{0}, true, false);
// auto terrainRenderComponent = std::make_shared<RenderComponent>("../assets/square_island/Square_island.obj",
// "../assets/square_island/Map_Base_Color.jpg",
// 0, true, false);
terrainRenderComponent->SetRenderScale(terrainEntityScale);
auto terrainRoadRenderComponent = std::make_shared<RenderComponent>("../src/ressources/DE_MAP0/MAPOI.obj",
"../src/ressources/DE_MAP0/BIG_ROAD_TEX.jpg",
std::vector<int>{2}, true, false);
terrainRoadRenderComponent->SetRenderScale(terrainEntityScale);
auto terrainBottomRoadRenderComponent = std::make_shared<RenderComponent>("../src/ressources/DE_MAP0/MAPOI.obj",
"../src/ressources/DE_MAP0/STONE_WALL_04.jpg",
std::vector<int>{3}, false, false);
terrainBottomRoadRenderComponent->SetRenderScale(terrainEntityScale);
auto terrainChunks_physics_Component = std::make_shared<TerrainChunksComponent>("../src/ressources/DE_MAP0/chunks", terrainEntityScale);
ecManager->setTerrainChunks(terrainChunks_physics_Component);
// Add Render Components:
terrainEntity->addComponent(terrainRenderComponent);
terrainEntity->addComponent(terrainRoadRenderComponent);
terrainEntity->addComponent(terrainBottomRoadRenderComponent);
// Add Physics Component:
terrainEntity->addComponent(terrainChunks_physics_Component);
}
void GameScene::load_SquareIsland_Map(std::shared_ptr<Entity> terrainEntity) {
float terrainEntityScale = 260.0f;
auto aiSplineComponent = std::make_shared<AISplineComponent>(terrainEntityScale);
auto terrainRenderComponent = std::make_shared<RenderComponent>("../assets/square_island/Square_island.obj",
"../assets/square_island/Map_Base_Color.jpg",
std::vector<int>{0}, true, false);
terrainRenderComponent->SetRenderScale(terrainEntityScale);
auto terrainRoadRenderComponent = std::make_shared<RenderComponent>("../assets/square_island/Square_island.obj",
"../assets/square_island/High_Way_Tex.jpg",
std::vector<int>{2}, true, false);
terrainRoadRenderComponent->SetRenderScale(terrainEntityScale);
auto terrainChunks_physics_Component = std::make_shared<TerrainChunksComponent>("../assets/square_island/chunks", terrainEntityScale);
ecManager->setTerrainChunks(terrainChunks_physics_Component);
// Render Components:
terrainEntity->addComponent(terrainRenderComponent);
terrainEntity->addComponent(terrainRoadRenderComponent);
terrainEntity->addComponent(aiSplineComponent);
ecManager->setAISpline(aiSplineComponent);
// Physics Component:
terrainEntity->addComponent(terrainChunks_physics_Component);
}
void GameScene::init() {
// * =================== Joystick Input =================== * //
const int JOYSTICK_DEAD_ZONE = 4000;
const uint8_t* state = SDL_GetKeyboardState(nullptr);
gGameController = nullptr;
//Check for joysticks
if( SDL_NumJoysticks() < 1 )
{
printf( "Warning: No joysticks connected!\n" );
}
else
{
//Load joystick
gGameController = SDL_JoystickOpen( 0 );
if( gGameController == nullptr )
{
printf( "Warning: Unable4000 to open game controller! SDL Error: %s\n", SDL_GetError() );
}
//Load second joystick on xbox 360 controller
printf(
"JOYSTICK CONNECTION :-)\n"
);
}
// ECS Init
ecManager->setCamera(camera);
// Init reference to physics singleton
physicsWorld = PhysicsWorldSingleton::getInstance();
//* ----------------- Terrain Entity Definition ----------------- *//
// std::shared_ptr<Entity> terrainEntity = std::make_shared<Entity>();
// load_HighRoadHills_Map(terrainEntity);
// entities.push_back(terrainEntity);
std::shared_ptr<Entity> terrainEntity2 = std::make_shared<Entity>();
load_SquareIsland_Map(terrainEntity2);
entities.push_back(terrainEntity2);
//* ----------------- Vehicle Entity Definition ----------------- *//
std::shared_ptr<Entity> playerVehicleEntity = std::make_shared<Entity>();
auto playerVehicleComponent = std::make_shared<VehicleControlComponent>(-2670.0f, 415.0f, 3752.0f);
auto aiVehicleComponent = std::make_shared<AIVehicleComponent>();
ecManager->setPlayerVehicle(playerVehicleComponent);
ecManager->setAIVehicle(aiVehicleComponent);
playerVehicleEntity->addComponent(playerVehicleComponent);
playerVehicleEntity->addComponent(aiVehicleComponent);
// auto playerVehicleRenderComponent = std::make_shared<VehicleRenderComponent>("../src/ressources/volga/volga.obj", "../src/ressources/first_car_wheel.obj",
// "../src/ressources/volga/volga.png",
// 0, true);
auto playerVehicleRenderComponent = std::make_shared<VehicleRenderComponent>("../assets/dale_aristocrat_vehicle/source/Dale Aristocrat PS1.gltf", "../assets/dale_aristocrat_vehicle/source/Dale Aristocrat PS1.gltf",
"../assets/dale_aristocrat_vehicle/textures/DaleAristocrat_PS1_Colored.png",
std::vector<int>{1,2}, true);
playerVehicleRenderComponent->SetRenderScale(10.0f);
playerVehicleEntity->addComponent(playerVehicleRenderComponent);
entities.push_back(playerVehicleEntity);
//this->makeBarrier();
auto skyboxEntity = std::make_shared<Entity>();
auto skyboxRenderComponent = std::make_shared<RenderComponent>("../assets/alien_moon_skybox/source/scene.gltf",
"../assets/alien_moon_skybox/textures/Skybox_baseColor.png",
std::vector<int>{0}, false, false);
skyboxRenderComponent->SetRenderScale(130.0f);
//skyboxEntity->addComponent(skyboxRenderComponent);
//entities.push_back(skyboxEntity);
ecManager->setSkybox(skyboxRenderComponent);
logger->log(Logger::INFO,"GameScene Loaded in " + std::to_string(entities.size()) + " entities");
auto cylinderEntity = std::make_shared<Entity>();
auto cylinderRenderComponent = std::make_shared<RenderCylinderComponent>();
cylinderEntity->addComponent(cylinderRenderComponent);
entities.push_back(cylinderEntity);
}
void GameScene::initECS(std::shared_ptr<SceneManager> sceneManager) {
ecManager = std::make_unique<ECManager>();
}
void GameScene::updateScreenSize(int w, int h) {
WIN_WIDTH = w;
WIN_HEIGHT = h;
camera->UpdateScreenSize(w, h);
renderer->UpdateScreenSize(w, h);
} | 411 | 0.908817 | 1 | 0.908817 | game-dev | MEDIA | 0.700568 | game-dev,graphics-rendering | 0.956895 | 1 | 0.956895 |
EmptyBottleInc/DFU-Tanguy-Multiplayer | 4,575 | Assets/Scripts/Game/MagicAndEffects/Effects/Enchanting/RepairsObjects.cs | // Project: Daggerfall Unity
// Copyright: Copyright (C) 2009-2022 Daggerfall Workshop
// Web Site: http://www.dfworkshop.net
// License: MIT License (http://www.opensource.org/licenses/mit-license.php)
// Source Code: https://github.com/Interkarma/daggerfall-unity
// Original Author: Gavin Clayton (interkarma@dfworkshop.net)
// Contributors:
//
// Notes:
//
using DaggerfallConnect.FallExe;
using DaggerfallWorkshop.Game.Entity;
using DaggerfallWorkshop.Game.Items;
namespace DaggerfallWorkshop.Game.MagicAndEffects.MagicEffects
{
/// <summary>
/// Repairs equipped items.
/// </summary>
public class RepairsObjects : BaseEntityEffect
{
public static readonly string EffectKey = EnchantmentTypes.RepairsObjects.ToString();
const int conditionPerRounds = 4;
const int conditionAmount = 1;
const int enchantCost = 900;
public override void SetProperties()
{
properties.Key = EffectKey;
properties.ShowSpellIcon = false;
properties.AllowedCraftingStations = MagicCraftingStations.ItemMaker;
properties.ItemMakerFlags = ItemMakerFlags.AllowMultiplePrimaryInstances;
properties.EnchantmentPayloadFlags = EnchantmentPayloadFlags.Held;
}
public override string GroupName => TextManager.Instance.GetLocalizedText(EffectKey);
public override EnchantmentSettings[] GetEnchantmentSettings()
{
EnchantmentSettings[] enchantments = new EnchantmentSettings[1];
enchantments[0] = new EnchantmentSettings()
{
Version = 1,
EffectKey = EffectKey,
ClassicType = EnchantmentTypes.RepairsObjects,
ClassicParam = -1,
PrimaryDisplayName = GroupName,
EnchantCost = enchantCost,
};
return enchantments;
}
#region Payloads
/// <summary>
/// Testing classic yields the following results:
/// - Only equipped items will receive repairs, items just stored in inventory are not repaired.
/// - Repair will happen whether player is resting or just standing around while game time passes.
/// - Repair does not happen when player is fast travelling (possibly game balance reasons?).
/// The following assumptions have been made from observation:
/// - Items are repaired 1 hit point every 4 minutes. Takes around 8-9 hours for a Dwarven Dagger to go from "battered" to "new" in classic and DFU with this timing.
/// - Uncertain if not repairing during travel is intended or not - it doesn't seem to make sense for a passive enchantment that works all other times.
/// - Not doing anything around this right now so that repair ticks work consistently with other passive enchantment effects.
/// - Assuming only a single item is repaired per tick. Priority is based on equip order enumeration.
/// </summary>
public override void MagicRound()
{
base.MagicRound();
// Get peered entity gameobject
DaggerfallEntityBehaviour entityBehaviour = GetPeeredEntityBehaviour(manager);
if (!entityBehaviour)
return;
// Only works on player entity
if (entityBehaviour.EntityType != EntityTypes.Player)
return;
// This special only triggers once every conditionPerRounds
if (GameManager.Instance.EntityEffectBroker.MagicRoundsSinceStartup % conditionPerRounds != 0)
return;
// Improve condition of a single item not at max condition
for (int i = 0; i < GameManager.Instance.PlayerEntity.Items.Count; i++)
{
DaggerfallUnityItem item = GameManager.Instance.PlayerEntity.Items.GetItem(i);
if (item != null && item.currentCondition < item.maxCondition)
{
// Do not repair magic items unless settings allow it
if (item.IsEnchanted && !DaggerfallUnity.Settings.AllowMagicRepairs)
continue;
// Improve condition of item and exit
item.currentCondition += conditionAmount;
//UnityEngine.Debug.LogFormat("Improved condition of item {0} by {1} points", item.LongName, conditionAmount);
return;
}
}
}
#endregion
}
} | 411 | 0.970006 | 1 | 0.970006 | game-dev | MEDIA | 0.93954 | game-dev | 0.962092 | 1 | 0.962092 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.