Skip to content

Instantly share code, notes, and snippets.

View maxmonax's full-sized avatar
🏠
Working from home

Max maxmonax

🏠
Working from home
View GitHub Profile
@maxmonax
maxmonax / YaGamesApi.ts
Last active October 10, 2023 13:52
Yandex Games API wrapper
import { LogMng } from "@/utils/LogMng";
export class YaGamesApi {
private static instance: YaGamesApi = null;
private _ysdk: any;
private constructor() { }
static getInstance(): YaGamesApi {
@maxmonax
maxmonax / GameLeftMenu.vue
Last active August 9, 2023 13:10
Toggle Vue Component
<template>
<div class="GameLeftMenu">
<ToggleSwitch v-model:isAuto="isAutoState" />
<div v-if="isAutoState">
<div class="MenuContentGreen">
auto
</div>
</div>
<div v-else>
var io;
var socket;
module.exports.initGame = function(aIO, aSocket) {
console.log('initGame...');
io = aIO;
socket = aSocket;
if (!io) {
export function applyHueShader(
aTexture: THREE.MeshStandardMaterial,
aHueDataObject: any
) {
aTexture.onBeforeCompile = shader => {
shader.uniforms.hueShift = aHueDataObject.hueShift;
let main = "void main(";
let out = "gl_FragColor = vec4( outgoingLight, diffuseColor.a );";
import * as THREE from 'three';
import { ThreeLoader } from '../loaders/ThreeLoader';
import { Params } from '../data/Params';
import { LogMng } from '../utils/LogMng';
import { MyMath } from '../utils/MyMath';
import * as ShipData from '../data/ShipData';
import { Config } from '../data/Config';
type SlotPosData = {
pos: THREE.Vector3,
private testBuildMega(cx: number, cy: number, b_id: number) {
let worldPos = GameMath.indexPosToWorldPos(cx, cy);
this.scrollCameraTo(worldPos.x, worldPos.y, true);
Params.game2d.time.events.add(5000, () => {
// build huge first
let data = {};
data = {
x: cx,
y: cy,
@maxmonax
maxmonax / CanvasMng.ts
Last active August 25, 2019 17:55
Canvas Mng for the coloring game
module PhaserGame.Client {
export const IMG_W_MIN = 760;
export const IMG_W_MAX = 760 * 1.4;
export const IMG_H = 760;
const IMG_DATA = [
{ img_bg: 'heart_bg', img: 'heart' },
{ img_bg: 'rocket_bg', img: 'rocket' },
{ img_bg: 'star_bg', img: 'star' },
@maxmonax
maxmonax / LoadMng.ts
Last active November 13, 2018 21:52
Phaser post loader
namespace LoadMng {
export class SceneLoader {
private static _instance: SceneLoader;
private game: Phaser.Game;
isSelectLoaded = false;
isGameLoaded = false;
isFinalLoaded = false;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;