最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

[C#]當屏幕檢測到白色啟動原神,黑色啟動星穹鐵道的抽象項目

2023-08-16 23:37 作者:瘋狂的戰(zhàn)斗雞plus  | 我要投稿


首先:這玩意兒就是純純的整活,一個小時就完成了,大家就當看個樂呵


靈感來自于基于【白屏檢測】的 原神啟動器

以及其評論

就是這位老哥

于是就用C#做了這么一個玩意兒

界面先隨便看著吧

使用方法也是十分的簡單,只要輸入原神和星鐵的exe地址之后當檢測到全屏的白色或者黑色就會啟動對應的游戲十分簡單粗暴

接下來是代碼:


public Form1()

? ? ? ? {

? ? ? ? ? ? InitializeComponent();

? ? ? ? }

? ? ? ? bool isshowW =false;

? ? ? ? bool isshowB = false;

? ? ? ? private void Timer_Tick(object sender, EventArgs e)

? ? ? ? {

? ? ? ? ? ? Rectangle rectangle = Screen.PrimaryScreen.Bounds;

? ? ? ? ? ? Bitmap bitmap = new Bitmap(rectangle.Width, rectangle.Height, PixelFormat.Format32bppArgb);

? ? ? ? ? ? Graphics g = Graphics.FromImage(bitmap);

? ? ? ? ? ? g.CopyFromScreen(rectangle.Left, rectangle.Top, 0, 0, bitmap.Size);


? ? ? ? ? ? int totalPixels = bitmap.Width * bitmap.Height;

? ? ? ? ? ? int rSum = 0, gSum = 0, bSum = 0;


? ? ? ? ? ? BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);

? ? ? ? ? ? IntPtr ptr = bitmapData.Scan0;


? ? ? ? ? ? int bytes = Math.Abs(bitmapData.Stride) * bitmap.Height;

? ? ? ? ? ? byte[] rgbValues = new byte[bytes];


? ? ? ? ? ? Marshal.Copy(ptr, rgbValues, 0, bytes);


? ? ? ? ? ? for (int i = 0; i < bytes; i += 4)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? byte b = rgbValues[i];

? ? ? ? ? ? ? ? byte gs = rgbValues[i + 1];

? ? ? ? ? ? ? ? byte r = rgbValues[i + 2];


? ? ? ? ? ? ? ? rSum += r;

? ? ? ? ? ? ? ? gSum += gs;

? ? ? ? ? ? ? ? bSum += b;

? ? ? ? ? ? }


? ? ? ? ? ? bitmap.UnlockBits(bitmapData);

? ? ? ? ? ? bitmap.Dispose();

? ? ? ? ? ? g.Dispose();


? ? ? ? ? ? int avgR = rSum / totalPixels;

? ? ? ? ? ? int avgG = gSum / totalPixels;

? ? ? ? ? ? int avgB = bSum / totalPixels;


? ? ? ? ? ? bool isScreenWhite = IsColorCloseToWhite(avgR, avgG, avgB);

? ? ? ? ? ? bool isScreenBlack = IsColorCloseToBlack(avgR, avgG, avgB);


? ? ? ? ? ? if (isScreenWhite)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? // 屏幕全白,執(zhí)行相應操作

? ? ? ? ? ? ? ? if(isshowW == false)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? Process.Start(textBox1.Text);

? ? ? ? ? ? ? ? ? ? isshowW = true;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? else if (!isScreenWhite)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? isshowW = false;

? ? ? ? ? ? }

? ? ? ? ? ? if (isScreenBlack)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? if (isshowB == false)

? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? Process.Start(textBox2.Text);

? ? ? ? ? ? ? ? ? ? isshowB = true;

? ? ? ? ? ? ? ? }

? ? ? ? ? ? }

? ? ? ? ? ? else if (!isScreenBlack)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? isshowB = false;

? ? ? ? ? ? }

? ? ? ? }


? ? ? ? private bool IsColorCloseToWhite(int r, int g, int b)

? ? ? ? {

? ? ? ? ? ? // 定義一個閾值,判斷顏色是否接近白色

? ? ? ? ? ? int threshold = 250;

? ? ? ? ? ? return r >= threshold && g >= threshold && b >= threshold;

? ? ? ? }

? ? ? ? private bool IsColorCloseToBlack(int r, int g, int b)

? ? ? ? {

? ? ? ? ? ? // 定義一個閾值,判斷顏色是否接近白色

? ? ? ? ? ? int threshold = 15;

? ? ? ? ? ? return r <= threshold && g <= threshold && b <= threshold;

? ? ? ? }

? ? ? ? bool isqidong =false;

? ? ? ? private void button1_Click(object sender, EventArgs e)

? ? ? ? {

? ? ? ? ? ? Timer timer = new Timer();

? ? ? ? ? ? timer.Tick += Timer_Tick;

? ? ? ? ? ? if (!isqidong)

? ? ? ? ? ? {

? ? ? ? ? ? ? ? timer.Start();

? ? ? ? ? ? ? ? button1.Text = "停止";

? ? ? ? ? ? ? ? isqidong = true;

? ? ? ? ? ? }

? ? ? ? ? ? else

? ? ? ? ? ? {

? ? ? ? ? ? ? ? timer.Stop();

? ? ? ? ? ? ? ? button1.Text = "啟動";

? ? ? ? ? ? ? ? isqidong = false;

? ? ? ? ? ? }

? ? ? ? ? ??

? ? ? ? }

? ? }

(放心絕對綠色無污染)
下載地址:

鏈接:https://pan.baidu.com/s/1ghSbFrOEZ0-_RlVf1uxegQ?pwd=f9rk?

提取碼:f9rk

順便預告一下下一個視頻

炒冷飯


[C#]當屏幕檢測到白色啟動原神,黑色啟動星穹鐵道的抽象項目的評論 (共 條)

分享到微博請遵守國家法律
海盐县| 濮阳县| 扶风县| 浑源县| 毕节市| 金门县| 武义县| 大宁县| 长武县| 九龙坡区| 延津县| 桐城市| 唐海县| 潞西市| 织金县| 石门县| 宝应县| 咸阳市| 越西县| 瑞昌市| 威信县| 肇庆市| 嵩明县| 余姚市| 玉门市| 神农架林区| 仙桃市| 天镇县| 宁陵县| 达尔| 从化市| 黄骅市| 封丘县| 承德市| 鹤壁市| 安远县| 会东县| 长子县| 北流市| 祁连县| 黄骅市|