Inheritance: MonoBehaviour
コード例 #1
0
 internal static void Init(ClientMain game)
 {
     if (MeshRefs.Count > 0)
     {
         ClearOldEntries(game, -1);
     }
 }
コード例 #2
0
        private static string GenMeshId(ClientMain game, ItemStack stack)
        {
            string result = BuildMeshId(game, stack);

            stack.TempAttributes.SetString("meshId", result);
            return(result);
        }
コード例 #3
0
 public DefaultMode(ClientMain game, CamPath path) : base(game, path)
 {
     if (path?.Target?.GetType() == typeof(CamTargetSelf))
     {
         path.Target = null;
     }
 }
コード例 #4
0
        public ScreenSpaceReflections(VolumetricShadingMod mod)
        {
            _mod = mod;

            _game     = mod.CApi.GetClient();
            _platform = _game.GetClientPlatformWindows();

            RegisterInjectorProperties();

            mod.CApi.Event.ReloadShader += ReloadShaders;
            mod.Events.PreFinalRender   += OnSetFinalUniforms;
            mod.ShaderPatcher.OnReload  += RegeneratePatches;

            _enabled            = ModSettings.ScreenSpaceReflectionsEnabled;
            _rainEnabled        = ModSettings.SSRRainReflectionsEnabled;
            _refractionsEnabled = ModSettings.SSRRefractionsEnabled;
            _causticsEnabled    = ModSettings.SSRCausticsEnabled;

            mod.CApi.Settings.AddWatcher <bool>("volumetricshading_screenSpaceReflections", OnEnabledChanged);
            mod.CApi.Settings.AddWatcher <bool>("volumetricshading_SSRRainReflections", OnRainReflectionsChanged);
            mod.CApi.Settings.AddWatcher <bool>("volumetricshading_SSRRefractions", OnRefractionsChanged);
            mod.CApi.Settings.AddWatcher <bool>("volumetricshading_SSRCaustics", OnCausticsChanged);

            mod.CApi.Event.RegisterRenderer(this, EnumRenderStage.Opaque, "ssrWorldSpace");
            mod.CApi.Event.RegisterRenderer(this, EnumRenderStage.AfterOIT, "ssrOut");

            _textureIdsField =
                typeof(ChunkRenderer).GetField("textureIds", BindingFlags.Instance | BindingFlags.NonPublic);

            mod.Events.RebuildFramebuffers += SetupFramebuffers;
            SetupFramebuffers(_platform.FrameBuffers);
        }
コード例 #5
0
 public PreviewRenderer(ICoreClientAPI api, RecipeSelectionHandler selection)
 {
     API       = api;
     Selection = selection;
     Game      = (ClientMain)API.GetType().GetField("game", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(API);
     API.Event.RegisterRenderer(this, EnumRenderStage.Opaque);
 }
コード例 #6
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Client received main. </summary>
        ///
        /// <remarks>   Brayden, 15/09/2018. </remarks>
        ///
        /// <param name="senderMain">   The sender main. </param>
        /// <param name="dataMain">     The data main. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        void client_ReceivedMain(ClientMain senderMain, byte[] dataMain)
        {
            Invoke((MethodInvoker) delegate
            {
                if (txtAnswer.Text == Encoding.Default.GetString(dataMain))
                {
                    MessageBox.Show("Answer Is Correct!", "Correct!");
                    btnSend.Enabled = true;
                }
                else if (txtAnswer.Text != Encoding.Default.GetString(dataMain))
                {
                    int num;
                    bool answer = int.TryParse(txtAnswer.Text, out num);
                    nodeList.AddNode(new Node(num));
                    LinkList();
                    MessageBox.Show("Incorrect Answer!", "Incorrect!");
                }
            });
            values = new NodeProperties2(Convert.ToInt32(txtFirstNumber.Text), Convert.ToInt32(txtSecondNumber.Text), comboBoxOperator.Text, Convert.ToInt32(txtAnswer.Text));
            BinaryTree();
            btnSend.Enabled       = true;
            txtFirstNumber.Text   = "";
            comboBoxOperator.Text = "";
            txtSecondNumber.Text  = "";
            txtAnswer.Text        = "";
        }
コード例 #7
0
ファイル: FrameBuffers.cs プロジェクト: Novocain1/ShadersMod
        public static int LoadTextureArray(this ClientMain game, AssetLocation[] locations, int width, int height)
        {
            var Platform = game.GetField <ClientPlatformWindows>("Platform");

            BitmapRef[] bmps = new BitmapRef[locations.Length];

            for (int i = 0; i < locations.Length; i++)
            {
                var name = locations[i].WithPathPrefixOnce("textures/");

                byte[] assetData = Platform.AssetManager.TryGet(name)?.Data;

                if (assetData == null)
                {
                    return(0);
                }

                bmps[i] = Platform.BitmapCreateFromPng(assetData, assetData.Length);
            }

            int id = Platform.LoadTextureArray(bmps, width, height);

            for (int i = 0; i < bmps.Length; i++)
            {
                bmps[i].Dispose();
            }

            return(id);
        }
コード例 #8
0
        internal static MeshRef GetMesh(ClientMain game, ItemStack stack)
        {
            string meshId = GetMeshId(game, stack);

            System.Console.WriteLine("Getting mesh for '{0}'", meshId);

            return(MeshRefs.ContainsKey(meshId) ? MeshRefs[meshId].Value : GenerateMesh(game, meshId, stack));
        }
コード例 #9
0
 public CamMode(ClientMain game, CamPath path)
 {
     _path     = path;
     Default   = new DefaultMode(game, path);
     LastPitch = path.Nodes[0].Pitch;
     LastYaw   = path.Nodes[0].Yaw;
     Game      = game;
     Api       = (ICoreClientAPI)game.Api;
 }
コード例 #10
0
        public ChunkCuller(ClientMain game)
        {
            this.game = game;
            chunksize = game.WorldMap.ChunkSize;

            ClientSettings.Inst.AddWatcher <int>("viewDistance", GenShellVectors);
            GenShellVectors(ClientSettings.ViewDistance);

            ClientSettings.Inst.AddWatcher <bool>("occlusionculling", occlusioncullingModeChanged);
        }
コード例 #11
0
 public override void Dispose(ClientMain game)
 {
     base.Dispose(game);
     foreach (var val in WaypointElements)
     {
         val.TryClose();
         val.Dispose();
     }
     WaypointElements.Clear();
 }
コード例 #12
0
ファイル: Login.cs プロジェクト: DanielGomes14/DB-Project
        private void login(object sender, EventArgs e)
        {
            if (Program.verifySGBDConnection())
            {
                String     Email    = LoginEmailBox.Text;
                String     Password = LoginPasswordBox.Text;
                SqlCommand cm       = new SqlCommand("Project.pd_Login");
                cm.CommandType = CommandType.StoredProcedure;
                cm.Parameters.Add(new SqlParameter("@Loginemail", SqlDbType.VarChar));
                cm.Parameters.Add(new SqlParameter("@password", SqlDbType.VarChar));
                cm.Parameters.Add(new SqlParameter("@response", SqlDbType.VarChar, 1));
                cm.Parameters["@LoginEmail"].Value   = Email;
                cm.Parameters["@password"].Value     = Password;
                cm.Parameters["@response"].Direction = ParameterDirection.Output;
                cm.Connection = Program.cn;
                cm.ExecuteNonQuery();

                if ("" + cm.Parameters["@response"].Value == "1")
                {
                    //check admin

                    SqlCommand comand = new SqlCommand("select Project.udf_isadmin ('" + Email + "')", Program.cn);
                    int        value  = (int)comand.ExecuteScalar();
                    Console.WriteLine(value);
                    if (value > 0)
                    {
                        Program.currentUser = value;
                        this.Hide();
                        AdminMain admin = new AdminMain();
                        admin.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        SqlCommand cmd    = new SqlCommand("select Project.udf_isclient ('" + Email + "')", Program.cn);
                        int        value2 = (int)cmd.ExecuteScalar();
                        Console.WriteLine(Email);
                        Console.WriteLine("Login:"******"current_user " + Program.currentUser);
                }
                else
                {
                    MessageBox.Show("Incorrent Login");
                }
                Program.cn.Close();
            }
        }
コード例 #13
0
 public override void Dispose(ClientMain game)
 {
     base.Dispose(game);
     for (int i = 0; i < TextTasks.Count;)
     {
         if (TextTasks.TryDequeue(out var a))
         {
             i++;
         }
     }
 }
コード例 #14
0
    void Start()
    {
        client = new ClientMain(PlayerPrefs.GetString("serverPort"));

        id = PlayerPrefs.GetString("userId");
        gameObject.name = id;

        movement = GetComponent <Movement>();
        movement.OnBeforeFlip += beforeFlip;
        movement.OnAfterFlip  += afterFlip;
    }
 public ClientMainViewModel()
 {
     ClientDetails           = new ClientMain();
     AddressDetails          = new ClientAddresses();
     BankDetails             = new ClientBankDetails();
     DepositryDetails        = new ClientDepositoryDetails();
     EquityBrokerDetails     = new ClientEquityBrokerDetails();
     PersonalDetails         = new ClientPersonal();
     SecondaryContactDetails = new ClientSecondaryContact();
     MappingDetails          = new ClientMapping();
 }
コード例 #16
0
 public override void Apply()
 {
     for (int i = 0; i < ClientMain.Entities.Count; i++)
     {
         if (ClientMain.Entities[i].ID == id)
         {
             ClientMain.RemoveEntity(ClientMain.Entities[i]);
             return;
         }
     }
     SysConsole.Output(OutputType.WARNING, "Tried to despawn nonexistent entity with ID " + id);
 }
コード例 #17
0
        public override void Apply()
        {
            Chunk chunk = ClientMain.GetChunk(loc);

            chunk.FromBytes(chunkdetail);
            chunk.UpdateVBO();
            for (int i = 0; i < Normals.Length; i++)
            {
                ClientMain.GetChunk(loc + Normals[i]).UpdateVBO();
            }
            ChunkReceived = true;
        }
コード例 #18
0
        internal static int ClearOldEntries(ClientMain game, long maxAge)
        {
            ClientPlatformAbstract platform = game.GetType().GetField("Platform", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(game) as ClientPlatformAbstract;
            var invalidEntries = MeshRefs.Where(pair => !pair.Value.IsValid(maxAge));

            foreach (var entry in invalidEntries)
            {
                platform.DeleteMesh(entry.Value.Value);
                MeshRefs.Remove(entry.Key);
            }
            return(invalidEntries.Count());
        }
コード例 #19
0
        public static ChunkRenderer GetChunkRenderer(this ClientMain client)
        {
            var renderer = (ChunkRenderer)typeof(ClientMain)
                           .GetField("chunkRenderer", BindingFlags.Instance | BindingFlags.NonPublic)
                           ?.GetValue(client);

            if (renderer == null)
            {
                throw new Exception("Could not fetch chunk renderer!");
            }

            return(renderer);
        }
コード例 #20
0
 public override void Dispose(ClientMain game)
 {
     if (game != null)
     {
         base.Dispose(game);
     }
     foreach (var val in WaypointElements)
     {
         val?.TryClose();
         val?.Dispose();
     }
     WaypointElements?.Clear();
 }
コード例 #21
0
        public static ClientPlatformAbstract GetClientPlatformAbstract(this ClientMain client)
        {
            var platform = (ClientPlatformAbstract)typeof(ClientMain)
                           .GetField("Platform", BindingFlags.Instance | BindingFlags.NonPublic)
                           ?.GetValue(client);

            if (platform == null)
            {
                throw new Exception("Could not fetch platform via reflection!");
            }

            return(platform);
        }
コード例 #22
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Listener socket accepted. </summary>
        ///
        /// <remarks>   Brayden, 15/09/2018. </remarks>
        ///
        /// <param name="f">    A Socket to process. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        void listener_SocketAccepted(System.Net.Sockets.Socket f)
        {
            ClientMain client = new ClientMain(f);

            client.Received     += new ClientMain.ClientReceivedHandlerMain(client_ReceivedMain);
            client.Disconnected += Client_Disconnected;

            Invoke((MethodInvoker) delegate
            {
                ListViewItem i = new ListViewItem();
                i.Text         = client.EndPoint.ToString();
                i.Tag          = client;
            });
        }
コード例 #23
0
ファイル: NewEntityPacketIn.cs プロジェクト: shuidong/Voxalia
        public override void Apply()
        {
            ServerEntity ent = new ServerEntity();

            ent.Scale      = scale;
            ent.Position   = pos;
            ent.Direction  = dir;
            ent.ID         = uid;
            ent.EntTexture = Texture.GetTexture(texture);
            ent.EntModel   = Model.GetModel(model);
            ent.Color      = ServerEntity.IntToColor(color);
            SysConsole.Output(OutputType.INFO, "Spawn: " + ent.Position + ", " + ent.Direction + ", " + ent.Scale + ", "
                              + ent.ID + ", " + ent.EntModel + ", " + ent.EntTexture + ", " + ent.Color);
            ClientMain.SpawnEntity(ent);
        }
 public ClientMain GetData(long ID)
 {
     try
     {
         DataSet        data  = new DataSet();
         SqlParameter[] param = new SqlParameter[1];
         param[0] = new SqlParameter("@ID", ID);
         data     = new ADODataFunction().ExecuteDataset(Constants.Procedures.GetClientMainByID, param, CommandType.StoredProcedure);
         ClientMain datas = data.Tables[0].AsEnumerable().Select(a => new ClientMain
         {
             ID = a.Field <long>("ID")
             ,
             FamilyID = !string.IsNullOrEmpty(Convert.ToString(a.Field <long>("FamilyID"))) ? a.Field <long>("FamilyID") : 0
             ,
             DOB = !string.IsNullOrEmpty(a.Field <string>("DOB")) ? a.Field <string>("DOB") : ""
             ,
             FirstName = !string.IsNullOrEmpty(a.Field <string>("FirstName")) ? a.Field <string>("FirstName") : ""
             ,
             Gender = !string.IsNullOrEmpty(Convert.ToString(a.Field <int>("Gender"))) ? a.Field <int>("Gender") : 0
             ,
             IntroducerID = !string.IsNullOrEmpty(Convert.ToString(a.Field <long>("IntroducerID"))) ? a.Field <long>("IntroducerID") : 0
             ,
             MiddleName = !string.IsNullOrEmpty(a.Field <string>("MiddleName")) ? a.Field <string>("MiddleName") : ""
             ,
             LastName = !string.IsNullOrEmpty(a.Field <string>("LastName")) ? a.Field <string>("LastName") : ""
             ,
             OccupationID = !string.IsNullOrEmpty(Convert.ToString(a.Field <int>("OccupationID"))) ? a.Field <int>("OccupationID") : 0
             ,
             PAN = !string.IsNullOrEmpty(a.Field <string>("PAN")) ? a.Field <string>("PAN") : ""
             ,
             Title = !string.IsNullOrEmpty(Convert.ToString(a.Field <int>("Title"))) ? a.Field <int>("Title") : 0
             ,
             MobileNumber = !string.IsNullOrEmpty(Convert.ToString(a.Field <long>("MobileNo"))) ? a.Field <long>("MobileNo") : 0
             ,
             EmailId = !string.IsNullOrEmpty(a.Field <string>("EmailId")) ? a.Field <string>("EmailId") : ""
             ,
             ShortName = !string.IsNullOrEmpty(a.Field <string>("ShortName")) ? a.Field <string>("ShortName") : ""
             ,
             IsActive = a.Field <bool>("IsActive")
         }).FirstOrDefault();
         return(datas);
         //return _context.clientMains.Where(e=>e.ID ==ID).FirstOrDefault();
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #25
0
        /// <summary>
        /// Central program entry point.
        /// Decides whether to lauch the server or the client.
        /// </summary>
        /// <param name="args">The command line arguments</param>
        static void Main(string[] args)
        {
            ConsoleHandle = Process.GetCurrentProcess().MainWindowHandle;
            SysConsole.Init();
            LaunchFlags    = new List <char>();
            LaunchSettings = new List <KeyValuePair <string, string> >();
            bool in_setting = false;

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].StartsWith("--") && args[i].Length > 2)
                {
                    in_setting = true;
                    Console.WriteLine("Found setting " + args[i].Substring(2));
                    LaunchSettings.Add(new KeyValuePair <string, string>(args[i].Substring(2), ""));
                }
                else if (args[i].StartsWith("-") && args[i].Length > 1)
                {
                    for (int x = 1; x < args[i].Length; x++)
                    {
                        Console.WriteLine("Found flag " + args[i][x]);
                        LaunchFlags.Add(args[i][x]);
                    }
                    in_setting = false;
                }
                else if (in_setting)
                {
                    KeyValuePair <string, string> kvp = LaunchSettings[LaunchSettings.Count - 1];
                    LaunchSettings.RemoveAt(LaunchSettings.Count - 1);
                    Console.WriteLine("Found setting argument, " + kvp.Key + " is now " + kvp.Value + (kvp.Value.Length > 0 ? " " : "") + args[i]);
                    LaunchSettings.Add(new KeyValuePair <string, string>(kvp.Key, kvp.Value + (kvp.Value.Length > 0 ? " ": "") + args[i]));
                }
            }
#if CLIENT
            if (args.Length > 0 && args[0] == "server")
            {
                ServerMain.Init();
            }
            else
            {
                ClientMain.Init();
            }
#else
            ServerMain.Init();
#endif
        }
コード例 #26
0
        public VolumetricLighting(VolumetricShadingMod mod)
        {
            _mod  = mod;
            _game = _mod.CApi.GetClient();

            _dropShadowIntensityField = typeof(AmbientManager)
                                        .GetField("DropShadowIntensity", BindingFlags.NonPublic | BindingFlags.Instance);

            _enabled = ClientSettings.GodRayQuality > 0;

            _mod.CApi.Settings.AddWatcher <int>("shadowMapQuality", OnShadowMapChanged);
            _mod.CApi.Settings.AddWatcher <int>("godRays", OnGodRaysChanged);

            _mod.Events.PreGodraysRender += OnSetGodrayUniforms;
            _mod.Events.PostUseShader    += OnPostUseShader;

            RegisterPatches();
        }
コード例 #27
0
 public FloatyWaypointManagement(ClientMain game, WaypointUtils utils) : base(game)
 {
     capi       = game.Api as ICoreClientAPI;
     this.utils = utils;
     capi.Input.RegisterHotKey("editfloatywaypoint", "Edit Floaty Waypoint", GlKeys.R, HotkeyType.GUIOrOtherControls);
     capi.Input.SetHotKeyHandler("editfloatywaypoint", (k) =>
     {
         foreach (var val in WaypointElements)
         {
             if (val.isAligned)
             {
                 val.OpenEditDialog();
                 return(true);
             }
         }
         return(false);
     });
     Update();
 }
コード例 #28
0
        private static string BuildMeshId(ClientMain game, ItemStack stack)
        {
            string       result = stack.Item.Code.ToString().Replace(':', '.');
            IModularItem item   = stack.Item as IModularItem;

            if (item != null)
            {
                var slots = ModularItemHelper.GetSlots(stack, game);

                foreach (var slot in slots)
                {
                    if (slot.Value != null)
                    {
                        result = result + "." + BuildMeshId(game, slot.Value);
                    }
                }
            }
            return(result);
        }
 public ClientMain GetInvestorDetail(long ID)
 {
     try
     {
         DataSet        data  = new DataSet();
         SqlParameter[] param = new SqlParameter[1];
         param[0] = new SqlParameter("@ID", ID);
         data     = new ADODataFunction().ExecuteDataset(Constants.Procedures.GetInvestorDetail, param, CommandType.StoredProcedure);
         ClientMain model = data.Tables[0].AsEnumerable().Select(a => new ClientMain
         {
             ClientName = a.Field <string>("Name")
             ,
             PAN = a.Field <string>("PAN")
         }).FirstOrDefault();
         return(model);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #30
0
        public SystemCamStudio(ClientMain game) : base(game)
        {
            _game = game;
            _capi = (ICoreClientAPI)game.Api;

            InitModel();
            _platform = game.GetField <ClientPlatformAbstract>("Platform");

            _capi.UnregisterCommand("cam");
            _capi.RegisterCommand("cam", "Cinematic Camera Studio", "", CmdCam);

            var eventManager = game.GetField <ClientEventManager>("eventManager");

            eventManager.CallMethod("RegisterRenderer", new DummyRenderer {
                action = OnRenderFrame3D
            },
                                    EnumRenderStage.Opaque, "cinecam", 0.7f);
            eventManager.CallMethod("RegisterRenderer", new DummyRenderer {
                action = OnFinalizeFrame
            },
                                    EnumRenderStage.Done, "cinecam-done", 0.98f);
        }