SioDxLibDotNet

Untitled

Sep 24th, 2023
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 43.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Hanabi_NS;
  7. using Sio;
  8. using static Sio.Basic;
  9. using Gui;
  10. using DxLibDLL;
  11. //ToDo SIZEに下駄を履かせる
  12.  
  13. namespace Tamaya_NameSpace
  14. {
  15. //ToDo火輪クラスが消えてないかも。//やったかも
  16. public static class Tamaya
  17. {
  18. public static int CancelDraw()
  19. {
  20. //uchiageCancel.DrawBox(1, null, modoruColor);
  21. uchiageCanselHide.DrawHideBox();
  22. int result=uchiageCanselHide.InputCheck();
  23. LibDX.Font.Set(40);
  24. LibDX.DrawStringKage(uchiageCanselHide, "戻る", ScColor.WHITE, ScColor.BLACK, 0, uchiageCanselHide.GetHeight() / 2);
  25. //Console.WriteLine("uchicanselHide{0}", uchiageCanselHide.x);
  26. LibDX.Font.SetToInitialized();
  27. return result;
  28. }
  29.  
  30. static void JunbanDrawOresen(int arg)
  31. {
  32. if (arg<MODE_EDIT_SPEED || MODE_EDIT_SUISIN<arg) { return; }
  33. editBoxIndexList.Remove(arg);
  34. editBoxIndexList.Add(arg);
  35. }
  36. static void SetSakuseiTo0()//ポインタをあてただけなので各種パラメータはコピーされない
  37. {//パラメータを渡すのが面倒なので、変更された値は逐次反映させるようにするか
  38. UchiageHanabi buf = new();
  39. buf.hanabi = SAKUSEIchu;
  40. hanabiWindow._hanabiDispBoxes[0].SetHanabi(buf);
  41. }
  42.  
  43. public static int Mode = MODE_ADD; //リストにするほど複雑ではない。かも
  44. //リストでやっておけばよかった
  45.  
  46. public static int preMode = 0;
  47. public const int MODE_ADD = 9;//0 色追加
  48. public const int MODE_EDIT_UWAGAKI = 1;
  49. public const int MODE_CURRENT_CLEAR = 2;
  50. public const int MODE_IREKAE = 3;
  51. public const int CONVET_TO_EDITBOX_INDEX_SUBST = 4;
  52. public const int MODE_EDIT_SPEED = 4;//1 速度変更
  53. public const int MODE_EDIT_SOMITU = 5;//2 粗密変更
  54. public const int MODE_EDIT_SIZE = 6;
  55. public const int MODE_EDIT_SUISIN = 7;//4 指定インデックスからやりなおし
  56. public const int MODE_EDIT_NIZI = 8; //れいんぼー カラーセットボックスを2つつかうが、回転速度はどうしよう
  57. //public const int MODE_EDIT_TEMPCOLOR = 5;//3 色を一時保管 長押しで火輪を追加するのでいらないかも
  58.  
  59. public const int UCHIAGE_BOTTOM_LIMIT = 200;
  60. private static SunaDokei circleAdd = new(180);
  61. static uint modoruColor = DX.GetColor(200, 200, 200);
  62. static int editsX1=500;
  63. static int editsX2=editsX1+600;
  64. public const int MODE_ZENKESI = 888888;//すべて消す。ボタンIDは0
  65. public const int MODE_UCHIAGE = 999999;//9 打ち上げ
  66. //public static Sio.Lib.FlipFlop modeFlipFlop = new();
  67. public static List<UchiageHanabi> zaiko;
  68. static int zaikoIndex = 0;
  69. static Hanabi_NS.Hanabi swapBuf=new();
  70. public static HanabiWindow hanabiWindow;
  71. static HanabiDispBox curDispBox;
  72. public static Gui.ButtonsBox zaikoDrawAtUchiageBox;
  73. public static Sio.Basic.FlipFlop zaikoIndexFlipFlop=new();
  74. static int nextIndex;
  75. public static int sakuseiIndex;
  76. public static List<UchiageHanabi> running;
  77. public static Hanabi_NS.Hanabi SAKUSEIchu;
  78. public static Gui.Box uchiageCancel;
  79. private static Gui.HideBox uchiageCanselHide;
  80. public static Gui.ColorSetBox colorsetbox;
  81. public static Gui.Window editBox;
  82. static Sio.Basic.FlipFlop zaikoIndexFp=new();
  83. public static Gui.Box uchiageJunbi;
  84. public static Gui.Box zaikoheTuika;
  85. public static Gui.Box zaikoheTuikaClearNasi;
  86. static ListBool oresenEdit;
  87. static List<int> editBoxIndexList = new();
  88.  
  89. public static uint uwagakiColor = 0;
  90.  
  91. public static Gui.Oresen speedOresen;
  92. public static uint speedColor = DX.GetColor(30,30,255);
  93. public static Gui.Oresen sizeOresen;
  94. public static uint sizeColor = DX.GetColor(255,30,30);
  95. public static Gui.Oresen somituOresen;
  96. public static uint somituColor = DX.GetColor(30, 255, 30);
  97. public static Gui.Oresen suisinOresen;
  98. public static uint suisinColor = DX.GetColor(30, 255, 255);
  99.  
  100. public static uint zenkesiColor = DX.GetColor(200, 50, 150);
  101.  
  102. public static List<Gui.Oresen> oresenList;
  103. public static PosXY bufAddPos;
  104. public static PosXY lenPos;
  105. private static MizuDokeiXY moveX;
  106. private static MizuDokeiXY moveY;
  107. private static MizuDokeiXY moveXY_ToZero;
  108. private static MizuDokeiXY moveRevX;
  109. private static MizuDokeiXY indexLast_moveDownY;
  110. private static MizuDokeiXY index1_MovYDown;//zaiko[1]用
  111. private static int clickedBMIndex = 0;
  112. private static int LEN_A_BOX;//= 55;//レイアウト変更時に注意。 座標代入時に決める。
  113. private static int sideLen = 3;
  114. private static Gui.ButtonsBox modeSwitchButtons;
  115. static string uchiageJunbiStr = "打ち上げへ";
  116. static string zaikoheTuikaStr = "在庫へ追加";
  117. static string zaikoheTuikaClearNachiStr = "コピーを残して追加";
  118. //private static Gui.ButtonVar curHanabiDrawArea;
  119. public static List<ButtonElemental> testKonzai;
  120.  
  121.  
  122.  
  123. //_____________________メンバ変数__END__________________________
  124. public class UchiageHanabi
  125. {
  126. public Hanabi_NS.Hanabi hanabi;
  127. public Oodama oodama;
  128. public bool drawBool;
  129. public int pastTime;
  130. public int pastTimeBorder = 300;
  131.  
  132. public UchiageHanabi()
  133. {
  134. hanabi = new Hanabi_NS.Hanabi();
  135. oodama = new Oodama();
  136. drawBool = false;
  137. }
  138. public void SetDrawOn()
  139. {
  140. drawBool = true;
  141. }
  142. public void Refresh()
  143. {
  144. if ((oodama.posF - oodama.targetPosF).LengthSquared() < 10)
  145. {
  146. hanabi.Refresh();
  147. hanabi.DDDDDoooooon();
  148. pastTime++;
  149. }
  150. else
  151. {
  152. oodama.Refresh();
  153. //if (Sio.Dbg.PerSecondRunBool(5))
  154. }
  155. }
  156.  
  157.  
  158. public void Draw()
  159. {
  160. if ((oodama.posF - oodama.targetPosF).LengthSquared() < 100)
  161. {
  162. hanabi.DrawHanabi();
  163. }
  164. else
  165. {
  166. oodama.DrawOodama();
  167. }
  168. }
  169.  
  170. public UchiageHanabi(Hanabi_NS.Hanabi arg)
  171. {
  172. hanabi = arg;
  173. oodama = new();
  174. }
  175. public UchiageHanabi GetCopy()
  176. {
  177. UchiageHanabi result= new();
  178. result.hanabi.SetKarinList(this.hanabi.GetKarinList());
  179. result.oodama = new();
  180. return result;
  181. }
  182. }
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190. public static void Tamaya_Init()
  191. {
  192. Mode = MODE_ADD;
  193. sakuseiIndex = 0;
  194. oresenList = new();
  195. zaiko = new();
  196. running = new();
  197. colorsetbox = new(0, 0, 400, Glo.WIN_Y*9/10);
  198. SAKUSEIchu = new();
  199. //uchiageCancel = new(Glo.WIN_X * 15 / 16, Glo.WIN_Y / 16, Glo.WIN_X, Glo.WIN_Y);
  200. uchiageCancel = new(0, 0, Glo.WIN_X / 16, Glo.WIN_Y);
  201. uchiageCanselHide=new();
  202. uchiageCanselHide.SetInputCheckBox(uchiageCancel);
  203. uchiageCanselHide.SetHidePosition(new BoxMaterial(-Glo.WIN_X / 16, 0,0,Glo.WIN_Y));
  204.  
  205. uchiageCanselHide.HideBox_Init();
  206. uchiageCanselHide.SetColor(ScColor.WHITE);
  207. uchiageJunbi = new(Glo.WIN_X * 15 / 16, 0, Glo.WIN_X, Glo.WIN_Y / 3);
  208.  
  209. zaikoheTuika = new(Glo.WIN_X * 15 / 16, Glo.WIN_Y / 3, Glo.WIN_X, Glo.WIN_Y*2/3);
  210. zaikoheTuikaClearNasi = new(zaikoheTuika);
  211. zaikoheTuikaClearNasi.Slide(0, Glo.WIN_Y / 3);
  212. editsX1 = 500;
  213. editsX2 = editsX1+600;
  214.  
  215. editBox = new();
  216. editBox.SetLimitBox();
  217. editBox.WindowReady(editsX1, 500, editsX2, Glo.WIN_Y-16);
  218. editBox.SetDispBackColor(ScColor.WHITE);
  219.  
  220.  
  221.  
  222. //_________________動くボタンテスト___________________
  223.  
  224. hanabiWindow = new();
  225. hanabiWindow = HanaDispWindowJunbi.GetHanabiDispWindow(editsX1,300,editsX2,500);
  226. curDispBox = new();
  227. curDispBox = hanabiWindow._hanabiDispBoxes[0];
  228. hanabiWindow.SetPreZeroToZero();
  229. UchiageHanabi bufCurUH = new();
  230. bufCurUH.hanabi = SAKUSEIchu;
  231. curDispBox.SetHanabi(bufCurUH);
  232.  
  233.  
  234.  
  235.  
  236. //
  237.  
  238.  
  239. zaikoDrawAtUchiageBox = new(0,Glo.WIN_Y-50,Glo.WIN_X,Glo.WIN_Y+100);
  240. zaikoIndexFlipFlop = new(0);
  241. //zaikoDrawAtUchiageBox.NewMovableBox();
  242. var uchiageZaikoButtons = Gui.ButtonVar.GeneButtonList_test(16, 1, 50, 50, 5, 0, Glo.WIN_X/2+85,0);
  243. uchiageZaikoButtons[0].SetAllPositions(uchiageZaikoButtons[1]);
  244. uchiageZaikoButtons[0].Slide(new PosXY(0, -55));
  245. zaikoDrawAtUchiageBox.SetButtonsList(uchiageZaikoButtons);
  246. zaikoDrawAtUchiageBox.Refresh();
  247. // やっておかないとButton入力の一回目を無視するので
  248.  
  249. moveX = new(uchiageZaikoButtons[2].x - uchiageZaikoButtons[1].x, 0, 9, 10);
  250. moveX.SetZero();
  251. moveY = new(0, uchiageZaikoButtons[1].y - uchiageZaikoButtons[0].y, 9, 10);
  252. moveY.SetZero();
  253. moveRevX= new(uchiageZaikoButtons[1].x - uchiageZaikoButtons[2].x, 0, 9, 10);
  254. moveRevX.SetZero();
  255. index1_MovYDown = new(0, uchiageZaikoButtons[0].y - uchiageZaikoButtons[1].y, 9, 10);
  256. index1_MovYDown.SetZero();
  257. moveXY_ToZero = new(0,0,9,10);
  258. indexLast_moveDownY = new(0, -55, 99, 100);
  259. LEN_A_BOX = uchiageZaikoButtons[2].x - uchiageZaikoButtons[1].x;
  260. Sio.Basic.KakkOut("LEN_A_BOX", LEN_A_BOX);
  261.  
  262. testKonzai = new();
  263. var list_1bit = ButtonOnOff.GeneOnOffButtonList(10, 2, 50, 50, 5, 5, 0, 0);
  264. testKonzai.AddRange(list_1bit);
  265. var list_but_toK = ButtonVar.GeneButtonList(10, 2, 50, 50, 5, 5, 0, 200);
  266. testKonzai.AddRange(list_but_toK);
  267. for(int i=0; i< testKonzai.Count; i++)
  268. {
  269. for(int j=0; j<4; j++)
  270. {
  271. testKonzai[i].SetColorsAll(LibDX.RandomLightColor.GetColor(),
  272. LibDX.RandomLightColor.GetColor(),
  273. LibDX.RandomLightColor.GetColor(),
  274. LibDX.RandomLightColor.GetColor()
  275. );
  276. }
  277. }
  278.  
  279.  
  280.  
  281. modeSwitchButtons = new(editsX1,0,editsX2,400);
  282. modeSwitchButtons.SetIndex(MODE_ADD);
  283. modeSwitchButtons.SetResetIndex(MODE_ADD);
  284. //var buttons = new List<Gui.Button>();
  285. var buttons = Gui.ButtonVar.GeneButtonList(4, 4, 120, 50, 10, 10);
  286. for (int i=0; i<buttons.Count; i++)
  287. {
  288. buttons[i].SetBaseColor(ScColor.GRAY);
  289. buttons[i].SetMouseOnColor(ScColor.WHITE);
  290. }
  291. buttons[0].SetColor(uwagakiColor);
  292. buttons[0].SetClickedColor(uwagakiColor);
  293. buttons[0].SetBaseColor(DX.GetColor(30, 30, 100));
  294. buttons[0].SetString("全て破棄");
  295.  
  296.  
  297.  
  298. buttons[MODE_EDIT_UWAGAKI].SetColor(uwagakiColor);
  299. buttons[MODE_EDIT_UWAGAKI].SetClickedColor(uwagakiColor);
  300. buttons[MODE_EDIT_UWAGAKI].SetBaseColor(DX.GetColor(100,100,100));
  301. buttons[MODE_EDIT_UWAGAKI].SetString("やりなおす");
  302.  
  303. buttons[MODE_CURRENT_CLEAR].SetWakuColor(ScColor.YORUcolor);
  304. buttons[MODE_CURRENT_CLEAR].SetClickedColor(ScColor.YORUcolor);
  305. buttons[MODE_CURRENT_CLEAR].SetBaseColor(DX.GetColor(30, 30,150 ));
  306. buttons[MODE_CURRENT_CLEAR].SetString("破棄");
  307.  
  308. buttons[MODE_IREKAE].SetWakuColor(DX.GetColor(100,100,150));
  309. buttons[MODE_IREKAE].SetClickedColor(DX.GetColor(100, 100, 150));
  310. buttons[MODE_IREKAE].SetBaseColor(DX.GetColor(50, 50, 100));
  311. buttons[MODE_IREKAE].SetString("入れ替え");
  312.  
  313.  
  314.  
  315. /*
  316. buttons[MODE_].SetWakuColor();
  317. buttons[MODE_].SetClickedColor();
  318. buttons[MODE_].SetBaseColor(DX.GetColor(30, 30, 150));
  319. buttons[MODE_].SetString("");
  320. */
  321.  
  322.  
  323.  
  324. buttons[MODE_EDIT_SPEED].SetWakuColor(speedColor);
  325. buttons[MODE_EDIT_SPEED].SetClickedColor(speedColor);
  326. //buttons[MODE_EDIT_].SetBaseColor(DX.GetColor(, , ));
  327. buttons[MODE_EDIT_SPEED].SetBaseColor(DX.GetColor(80, 80, 100));
  328. buttons[MODE_EDIT_SPEED].SetString("スピード");
  329.  
  330. buttons[MODE_EDIT_SIZE].SetWakuColor(sizeColor);
  331. buttons[MODE_EDIT_SIZE].SetClickedColor(sizeColor);
  332. buttons[MODE_EDIT_SIZE].SetBaseColor(DX.GetColor(100, 80, 80));
  333. buttons[MODE_EDIT_SIZE].SetString("サイズ");
  334.  
  335.  
  336. buttons[MODE_EDIT_SOMITU ].SetWakuColor(somituColor);
  337. buttons[MODE_EDIT_SOMITU ].SetClickedColor(somituColor);
  338. buttons[MODE_EDIT_SOMITU].SetBaseColor(DX.GetColor(90,120 , 100));
  339. buttons[MODE_EDIT_SOMITU ].SetString("密度");
  340.  
  341. buttons[MODE_EDIT_SUISIN].SetWakuColor(suisinColor);
  342. buttons[MODE_EDIT_SUISIN].SetClickedColor(suisinColor);
  343. buttons[MODE_EDIT_SUISIN].SetBaseColor(DX.GetColor(50, 100, 100));
  344. buttons[MODE_EDIT_SUISIN].SetString("推進力");
  345.  
  346. modeSwitchButtons.SetButtonsList(buttons);
  347. modeSwitchButtons.SetMode(ButtonsBox.MODE_ONLY);
  348.  
  349. oresenEdit = new(4, false);
  350.  
  351. bufAddPos = new();
  352. lenPos = new(editBox);
  353. lenPos.AddXY(0, Gui.Window.barHeight);
  354. lenPos.SetVecTo(editBox.GetDrawArea().pos2);
  355. lenPos.WriteInfoXY("lenPos,as描画領域の大きさ");
  356. sizeOresen = new Gui.Oresen(editBox.GetDrawArea());
  357. sizeOresen.SetValueRange(0, 6, sideLen);//
  358. sizeOresen.SetColors(int.MaxValue, sizeColor);
  359. sizeOresen.SetValuesAll(3f);
  360. sizeOresen.SetStartValue(3f);
  361. //ValueInitialize.SetOresenValues(sizeOresen, 20, 15, 10, 50);
  362.  
  363. //Oresen生成(座標)、パラメーター
  364. speedOresen = new(editBox.GetDrawArea());
  365. speedOresen.SetValueRange(10, 50, sideLen);
  366. speedOresen.SetStartValue(20);
  367. //speedOresen.ResetValuesAll();
  368. //speedOresen.SetValuesToWave();
  369. speedOresen.SetColors(int.MaxValue, speedColor);
  370. ValueInitialize.SetOresenValues(speedOresen, 30, 1, 20, 60);
  371.  
  372. somituOresen = new(editBox.GetDrawArea());
  373. somituOresen.SetValueRange(10, 150, sideLen);
  374. somituOresen.SetStartValue(70);
  375. //somituOresen.ResetValuesAll();
  376. somituOresen.SetColors(int.MaxValue, somituColor);
  377. ValueInitialize.SetOresenValues(somituOresen, 60, -1, 15, 65);
  378. suisinOresen = new(editBox.GetDrawArea());
  379. suisinOresen.SetValueRange(0f, 1.0f-Hibana.airDecMulti, sideLen);
  380. //suisinOresen.SetValueRange(0f, (1f), sideLen);
  381. suisinOresen.SetStartValue(0.11f);
  382. //suisinOresen.ResetValuesAll();
  383. suisinOresen.SetColors(int.MaxValue, suisinColor);
  384. ValueInitialize.SetOresenValues(suisinOresen, 30, -1, 10, 60);
  385.  
  386. oresenList.Add(speedOresen);
  387. oresenList.Add(somituOresen);
  388. oresenList.Add(sizeOresen);
  389. oresenList.Add(suisinOresen);
  390. editBoxIndexList.Add(MODE_EDIT_SPEED);
  391. editBoxIndexList.Add(MODE_EDIT_SOMITU);
  392. editBoxIndexList.Add(MODE_EDIT_SIZE);
  393. editBoxIndexList.Add(MODE_EDIT_SUISIN);
  394. editBoxIndexList.Add(0);//dummy
  395.  
  396. Sio.Basic.WriteListInt("At Init() editBoxIndexList", editBoxIndexList);
  397.  
  398.  
  399. //speedOresen.SetAllPositions(editBox.drawArea);
  400.  
  401. /*speedOresen = new(0,editBox.pos2.y, editBox.pos2.x, editBox.drawArea.pos2.y);
  402. speedOresen.SetPosXY(0, editBox.pos2.y-editBox.y);
  403. speedOresen.pos2.SetPosXY(lenPos);*/
  404.  
  405. Sio.Basic.WriteStringList(speedOresen.InfoBox("spOresen"));
  406.  
  407.  
  408.  
  409. //Console.ReadLine();
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417. }
  418.  
  419.  
  420.  
  421.  
  422. public static UchiageHanabi GetCopy(int argidx)
  423. {
  424. UchiageHanabi result = new();
  425. if (zaiko[argidx] == null) { Sio.Dbg.AddLog("zaikoインデックスエラー"); }
  426. var buf = zaiko[argidx];
  427. result.oodama = new Oodama();
  428. result.hanabi.SetKarinList(buf.hanabi.GetKarinList());
  429. return result;
  430. }
  431.  
  432. public static void SetAllParaEditBox()
  433. {
  434. /*
  435. SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SPEED, speedOresen.GetValuesAll());
  436. SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SOMITU, somituOresen.GetValuesAll());
  437. SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SIZE, sizeOresen.GetValuesAll());
  438. SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SUISIN, suisinOresen.GetValuesAll());
  439. */
  440. speedOresen.SetValues(SAKUSEIchu.GetParas(Hanabi_NS.Hanabi.SPEED));
  441. somituOresen.SetValues(SAKUSEIchu.GetParas(Hanabi_NS.Hanabi.SOMITU));
  442. sizeOresen.SetValues(SAKUSEIchu.GetParas(Hanabi_NS.Hanabi.SIZE));
  443. suisinOresen.SetValues(SAKUSEIchu.GetParas(Hanabi_NS.Hanabi.SUISIN));
  444.  
  445.  
  446.  
  447. }
  448. //public static void IziruJunbi()//在庫へ追加準備の直後に...ってそれなら一緒に入れたほうがいいか
  449. public static void SetAllParasUchiageHanabi(UchiageHanabi arg=null)
  450. {
  451. if (arg == null)
  452. {
  453. SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SPEED, speedOresen.GetValuesAll());
  454. SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SOMITU, somituOresen.GetValuesAll());
  455. SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SIZE, sizeOresen.GetValuesAll());
  456. SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SUISIN, suisinOresen.GetValuesAll());
  457. }
  458. else
  459. {
  460. arg.hanabi.SetParas(Hanabi_NS.Hanabi.SPEED, speedOresen.GetValuesAll());
  461. arg.hanabi.SetParas(Hanabi_NS.Hanabi.SOMITU, somituOresen.GetValuesAll());
  462. arg.hanabi.SetParas(Hanabi_NS.Hanabi.SIZE, sizeOresen.GetValuesAll());
  463. arg.hanabi.SetParas(Hanabi_NS.Hanabi.SUISIN, suisinOresen.GetValuesAll());
  464. Console.WriteLine("arg!=null in");
  465. }
  466. }
  467.  
  468.  
  469. public static void SetIndex(int arg)
  470. {
  471. if (zaiko.Count == 0) { return; }
  472. nextIndex = arg;
  473. if (zaiko.Count <= nextIndex) { Sio.Dbg.AddLog("IndexOver AutoAdjust"); }
  474. nextIndex += zaiko.Count;
  475. nextIndex %= zaiko.Count;
  476. }
  477. public static void IndexInc()
  478. {
  479. nextIndex++;
  480. nextIndex %= zaiko.Count;
  481. }
  482.  
  483. public static void SetAllParas(Hanabi arg)
  484. {
  485. arg.SetParas(Hanabi_NS.Hanabi.SPEED, speedOresen.GetValuesAll());
  486. arg.SetParas(Hanabi_NS.Hanabi.SOMITU, somituOresen.GetValuesAll());
  487. arg.SetParas(Hanabi_NS.Hanabi.SIZE, sizeOresen.GetValuesAll());
  488. arg.SetParas(Hanabi_NS.Hanabi.SUISIN, suisinOresen.GetValuesAll());
  489. }
  490.  
  491.  
  492. public static void Refresh()
  493. {
  494.  
  495. foreach (UchiageHanabi u in running)
  496. {
  497. u.Refresh();
  498. /*if (Sio.Dbg.PerSecondRunBool())
  499. {
  500. //Sio.Lib.WriteStringList(u.hanabi.InfoHanabi());
  501. }*/
  502. }
  503. for (int i = running.Count - 1; 0 < i; i--)
  504. {
  505. if (running[i].pastTimeBorder < running[i].pastTime)
  506. {
  507. // running.RemoveAt(i);
  508. }
  509. }
  510. }
  511.  
  512. public static void Zenkeshi()
  513. {
  514. foreach(UchiageHanabi u in running)
  515. {
  516. foreach(Karin k in u.hanabi.tamagome)
  517. {
  518. k.hibanas.Clear();
  519. }
  520. u.hanabi.tamagome.Clear();
  521. }
  522. running.Clear();
  523. }
  524. public static void DrawUchiagetaHanabi()
  525. {
  526. foreach (UchiageHanabi u in running)
  527. {
  528. u.Draw();
  529. }
  530. }
  531.  
  532.  
  533.  
  534.  
  535. public static void Run()
  536. {
  537.  
  538. //Mode = -1;
  539. int bufMode=zaikoIndexFp.Run(Mode);
  540. circleAdd.Run();
  541. //Lib.KakkOut("bufmode","FpFpvar", bufMode,zaikoIndexFp.GetMem());
  542. if (bufMode != 0)
  543. {
  544. JunbanDrawOresen(Mode);
  545. Sio.Basic.WriteListInt("editBoxIndexList",editBoxIndexList);
  546. circleAdd.TimerReset();
  547. }
  548.  
  549. Sio.Dbg.AddInfo("作成idx[" + sakuseiIndex+"]");
  550. if(SAKUSEIchu.tamagome.Count <= sakuseiIndex && SAKUSEIchu.GetKarinCount()!=0)
  551. {
  552. sakuseiIndex = SAKUSEIchu.tamagome.Count;
  553. }
  554. //bufAddPos.AddXY(0, Gui.MovableBox.barHeight);
  555. if (Mode != MODE_UCHIAGE)
  556. {
  557. modeSwitchButtons.DrawBox();
  558. modeSwitchButtons.InputCheck();
  559. modeSwitchButtons.Refresh();
  560. foreach (Oresen o in oresenList)
  561. {
  562. o.Refresh();
  563. }
  564.  
  565. Mode = modeSwitchButtons.GetLastOnButtonIndex();
  566. if (Mode == 0) { Mode = MODE_ZENKESI; }
  567. zaikoheTuika.DrawBox(1, null, ScColor.HIRUcolor);
  568. zaikoheTuika.DrawStringInBox(zaikoheTuikaStr);
  569. uchiageJunbi.DrawBox(1, null, ScColor.ORANGE);
  570. uchiageJunbi.DrawStringInBox(uchiageJunbiStr);
  571. zaikoheTuikaClearNasi.DrawBox(1, null, ScColor.CYAN);
  572. colorsetbox.DrawColorSetBox();
  573.  
  574. //DispPreview.DrawZaiko(zaikoWindow, zaiko);
  575. //DispPreview.KaraHaTumeru(zaikoWindow, zaiko);
  576. //hanabiWindow.Refresh();
  577. hanabiWindow.InputCheckHW();
  578. hanabiWindow.Refresh();
  579. hanabiWindow.DrawHanabiWindow();
  580. //hanabiWindow.DrawID();
  581. SetAllParasUchiageHanabi();
  582.  
  583. //SetSakuseiTo0();
  584. if (hanabiWindow.Get_ZeroChanged())
  585. {
  586. hanabiWindow.Set_ZeroChanged(false);
  587.  
  588. SAKUSEIchu = hanabiWindow._hanabiDispBoxes[0].uh.hanabi;
  589. int idx = hanabiWindow.Get_PreZeroIndex();
  590. Console.WriteLine("ZeroChangedCheck; 元0のインデックス[{0}]",idx);
  591. SetAllParasUchiageHanabi(hanabiWindow._hanabiDispBoxes[idx].uh);//
  592. //SetAllParas(hanabiWindow.uhlist[idx].uh.hanabi);
  593.  
  594. if (0 != SAKUSEIchu.GetKarinCount())
  595. {
  596. SetAllParaEditBox();
  597. sakuseiIndex =Sio.Basic.GetMin(sakuseiIndex, hanabiWindow._hanabiDispBoxes[0].uh.hanabi.GetKarinCount());
  598. }
  599. }
  600.  
  601.  
  602.  
  603.  
  604.  
  605. SetAllParasUchiageHanabi();
  606. bufAddPos.SetPosXY(editBox);
  607. editBox.DrawWindow();
  608. DispPreview.DrawGradation(editBox, SAKUSEIchu,sideLen);
  609. Disp.DrawHanabiInBoxAsSideBar(editBox, editBox.GetDrawArea(), SAKUSEIchu, sideLen);
  610. // 二度手間になってるけど、仕様が決まってなかったらしょうがない
  611. var bufDrawArea = editBox.GetDrawAreaAbs();
  612. int dx = bufDrawArea.x + sakuseiIndex * sideLen;
  613. DX.DrawLine(dx, bufDrawArea.y, dx, bufDrawArea.pos2.y, ScColor.GENZAN, 5);
  614. DX.DrawLine(dx, bufDrawArea.y, dx, bufDrawArea.pos2.y, ScColor.WHITE, 3);
  615.  
  616. //editBox.WriteInfoMova();
  617. //editBox.WriteInfoMova();
  618. editBox.InputCheckWindow();
  619.  
  620. colorsetbox.InputCheckWindow();//レイアウト決まって動かさないようにするときはコメントアウト
  621. colorsetbox.InputCheckColorSetBox();
  622.  
  623. if (colorsetbox.InBoxClicked())
  624. {
  625. var k = new Karin();
  626. k.SetColor(colorsetbox.GetColor());
  627. k.blendVal = colorsetbox.GetBlendVar();
  628. if ( SAKUSEIchu.tamagome.Count <= sakuseiIndex)
  629. {
  630. SAKUSEIchu.AddKarinToTamagome(k);
  631. }
  632. else
  633. {
  634. SAKUSEIchu.UwagakiKarin(sakuseiIndex, k);
  635. sakuseiIndex++;
  636. }
  637. }
  638.  
  639. if (Input.Defined.Kettei()&& 2<SAKUSEIchu.GetKarinCount())
  640. {
  641. if (zaikoheTuika.InBoxMouse() || zaikoheTuikaClearNasi.InBoxMouse())
  642. {
  643. var buf = new UchiageHanabi();
  644. buf.hanabi.SetKarinList(SAKUSEIchu.GetKarinList());
  645. buf.oodama = new();
  646. var bufspeed = speedOresen.GetValuesAll();
  647. var bufsomitu = somituOresen.GetValuesAll();
  648. var bufsize = sizeOresen.GetValuesAll();
  649. var bufsuisin = suisinOresen.GetValuesAll();
  650. for (int i = 0; i < buf.hanabi.GetKarinCount(); i++)
  651. {
  652. buf.hanabi.tamagome[i].SetSpeed(bufspeed[i]);
  653. buf.hanabi.tamagome[i].somitu = (int)bufsomitu[i];
  654. buf.hanabi.tamagome[i].size = (int)bufsize[i];
  655. buf.hanabi.tamagome[i].suisin = bufsuisin[i];
  656. //Console.WriteLine("buf推進"+bufsuisin[i]);
  657. //
  658. }
  659. curDispBox=hanabiWindow.Add(buf);
  660. hanabiWindow.Set_ZeroChanged(false);
  661. if (!zaikoheTuikaClearNasi.InBoxMouse())
  662. {
  663. Console.WriteLine("作成中色素クリア");
  664. SAKUSEIchu.tamagome.Clear();
  665. //SetSakuseiTo0();
  666. }
  667. else
  668. {
  669. Console.WriteLine("色素をコピーして再セット");
  670. var buf2 = buf.GetCopy();
  671. curDispBox.SetHanabi(buf2);
  672. SetAllParaEditBox();
  673. }
  674. SAKUSEIchu = curDispBox.uh.hanabi;
  675. SetIndex(0);
  676. //花火を追加ここまで
  677. }
  678. }
  679. if (uchiageJunbi.InBoxMouse())
  680. {
  681. if (Input.Defined.Kettei())
  682. {
  683. preMode = Mode;//定数にしたほうがいいか、変数でもいいのかどっちが後で見た時わかりやすいかわからんけど、
  684. //やっぱModeのほうがよさげ。
  685. Mode = MODE_UCHIAGE;
  686. SetAllParasUchiageHanabi();
  687. return;
  688. }
  689. }
  690.  
  691.  
  692. //editBox.DrawMovableBox();
  693. editBox.InputCheckWindow();
  694. for (int i = 0; i < editBoxIndexList.Count; i++)
  695. {
  696. if (editBoxIndexList[i] != 0)
  697. {
  698.  
  699. oresenList[editBoxIndexList[i] - 4].DrawBox(bufAddPos, 0);
  700.  
  701. if (i == editBoxIndexList.Count - 1)
  702. {
  703. bool nakanuki = true;
  704. int bufAdd = circleAdd.GetTime();
  705. LibDX.Blend.On(150);
  706. bufAdd = Wave(6, bufAdd/50+10, 1);
  707. oresenList[editBoxIndexList[i] - 4].DrawBox(bufAddPos, bufAdd);
  708. LibDX.Blend.Off();
  709. oresenList[editBoxIndexList[i] - 4].DrawBox(bufAddPos, 0, nakanuki);
  710. }
  711. }
  712. }
  713.  
  714.  
  715.  
  716. /*speedOresen.DrawBox(bufAddPos);
  717. sizeOresen.DrawBox(bufAddPos);
  718. somituOresen.DrawBox(bufAddPos);
  719. suisinOresen.DrawBox(bufAddPos);*/
  720.  
  721.  
  722. /*if (Input.Defined.PushingNumber() != -1)
  723. {
  724.  
  725. Mode = Input.Defined.PushingNumber();
  726. return;
  727. }*/
  728. }//エディットモード 基礎部分ここまで
  729.  
  730.  
  731.  
  732.  
  733. if (Mode == MODE_EDIT_SPEED)
  734. {
  735.  
  736. //editBox.DrawMovableBox();
  737. //editBox.InputCheckMovableBox();
  738. //SetAllPositionInDrawArea(speedOresen);
  739. //speedOresen.DrawBox(1,bufAddPos);
  740.  
  741.  
  742. //speedOresen.WriteInfoXY();
  743. speedOresen.InputCheck(bufAddPos);
  744. }
  745. if (Mode == MODE_EDIT_SIZE)
  746. {
  747. //SetAllPositionInDrawArea(speedOresen);
  748. //speedOresen.DrawBox(1,bufAddPos);
  749.  
  750. //speedOresen.WriteInfoXY();
  751. sizeOresen.InputCheck(bufAddPos);
  752.  
  753. }
  754. if (Mode== MODE_EDIT_SOMITU)
  755. {
  756. somituOresen.InputCheck(bufAddPos);
  757. }
  758. if (Mode == MODE_EDIT_SUISIN)
  759. {
  760. suisinOresen.InputCheck(bufAddPos);
  761. }
  762. if (Mode == MODE_EDIT_UWAGAKI)
  763. {
  764. YesNoBox.Draw(editBox.GetDrawAreaAbs(),uwagakiColor);
  765. int resultbuf = YesNoBox.InputCheck(editBox.GetDrawAreaAbs());
  766. if (resultbuf != 0)
  767. {
  768. if (resultbuf == 1)
  769. {
  770. sakuseiIndex = (Sio.Input.mouseX - editBox.GetX()) / sideLen;
  771. sakuseiIndex = GetMin(sakuseiIndex, SAKUSEIchu.tamagome.Count - 1);
  772. sakuseiIndex = GetMax(0, sakuseiIndex);
  773. }
  774. modeSwitchButtons.Reset();
  775. modeSwitchButtons.SetIndex(MODE_ADD);
  776. Mode = MODE_ADD;
  777. }
  778. preMode = Mode;
  779. }
  780. if (Mode == MODE_CURRENT_CLEAR)
  781. {
  782.  
  783. YesNoBox.Draw(editBox.GetDrawAreaAbs(),ScColor.RED);
  784. //Disp.DrawHanabiInBoxAsSideBar(editBox, editBox.GetDrawArea(), SAKUSEIchu, sideLen);
  785. //int resultbuf = YesNoBox.InputCheck(editBox.GetDrawAreaAbs());
  786. int resultbuf = YesNoBox.InputCheck(editBox.GetDrawAreaAbs());
  787. if (resultbuf != 0)
  788. {
  789. if (resultbuf == 1)
  790. {
  791. sakuseiIndex = 0;
  792. SAKUSEIchu.tamagome.Clear();
  793. }
  794. modeSwitchButtons.Reset();
  795. modeSwitchButtons.SetIndex(MODE_ADD);
  796. Mode = MODE_ADD;
  797. }
  798. preMode = Mode;
  799. }
  800.  
  801. if (Mode == MODE_ZENKESI)
  802. {
  803.  
  804. YesNoBox.Draw(hanabiWindow.GetDrawAreaAbs(), ScColor.RED);
  805. //Disp.DrawHanabiInBoxAsSideBar(editBox, editBox.GetDrawArea(), SAKUSEIchu, sideLen);
  806. //int resultbuf = YesNoBox.InputCheck(editBox.GetDrawAreaAbs());
  807. int resultbuf = YesNoBox.InputCheck(hanabiWindow.GetDrawAreaAbs());
  808. if (resultbuf != 0)
  809. {
  810. if (resultbuf == 1)
  811. {
  812. sakuseiIndex = 0;
  813. zaiko.Clear();
  814. hanabiWindow.Zenkeshi();
  815. nextIndex = 0;
  816. }
  817. modeSwitchButtons.Reset();
  818. modeSwitchButtons.SetIndex(MODE_ADD);
  819. Mode = MODE_ADD;
  820. }
  821. preMode = Mode;
  822. }
  823. /*
  824. if (Mode == MODE_IREKAE)
  825. {
  826. zaikoWindow.InputCheck();
  827. YesNoBox.Draw(zaikoWindow.GetDrawAreaAbs(), ScColor.RED);
  828. int resultbuf= YesNoBox.InputCheck(zaikoWindow.GetDrawAreaAbs());
  829. if (resultbuf != 0)
  830. {
  831. if (resultbuf == 1)
  832. {
  833. if (zaikoWindow.GetLastOnButtonIndex() < zaiko.Count)
  834. {
  835. Irekae(zaikoWindow.GetLastOnButtonIndex());
  836. }
  837. }
  838. if (resultbuf == -1)
  839. {
  840.  
  841. }
  842. modeSwitchButtons.Reset();
  843. modeSwitchButtons.SetIndex(MODE_ADD);//ここをちょっといじると順番かえるのに使える。かも
  844. }
  845.  
  846. }*/
  847.  
  848.  
  849. if (Mode == MODE_UCHIAGE)
  850. {
  851. if (Mode != preMode)
  852. {
  853. zaiko = hanabiWindow.SortedList();
  854. //SetAllParasUchiageHanabi(zaiko[0]);
  855. SetAllParasUchiageHanabi();
  856. SetIndex(0);
  857. KakkOut("打ち上げ準備に入った瞬間", "前のモード", Mode, preMode);
  858. //Console.WriteLine("同一判定" + (zaiko[0].hanabi == SAKUSEIchu).ToString());
  859. //SetAllParasUchiageHanabi();
  860.  
  861. //ここでYXソートしたIDリストを渡して整列
  862. }
  863. if (zaiko.Count <= 0)
  864. {
  865. LibDX.Font.Set(30);
  866. DX.DrawBox(200, 100, 600, 160, ScColor.GRAY,DX.TRUE);
  867. LibDX.DrawStringKage(200, 100, "在庫なし", ScColor.WHITE);
  868. LibDX.DrawStringKage(200, 130, "←戻って作成しましょう", ScColor.WHITE);
  869.  
  870. CancelDraw();
  871. //uchiageCanselHide.
  872. uchiageCanselHide.Refresh();//紛らわしいが retrunの前なので我慢
  873. LibDX.Font.SetToInitialized();
  874. if (Input.Defined.Kettei()) { Mode = preMode; }
  875. return;
  876. //Mode = MODE_ADD;
  877. }
  878. moveX.Run();
  879. moveY.Run();
  880. moveRevX.Run();
  881. moveXY_ToZero.Run();
  882. index1_MovYDown.Run();
  883. indexLast_moveDownY.Run();
  884. //lastMovY_Down.Run();
  885.  
  886. if (Glo.dbgDispFlag)
  887. {
  888. zaikoDrawAtUchiageBox.DrawBoxFutoWakuUchi();
  889. zaikoDrawAtUchiageBox.DrawBox();
  890. }
  891. //
  892. //zaikoDrawAtUchiageBox.DrawBoxFutoWakuUchi();
  893. //zaikoDrawAtUchiageBox.DrawBox();
  894. //
  895. if (Mode == preMode)
  896. {
  897. JuuryokuSeigyo.InputCheck();
  898. JuuryokuSeigyo.Draw();
  899. }
  900.  
  901. int bufIndex = nextIndex%zaiko.Count;//先頭インデックス。どうせ0だけど、ほかでも使いそうなので一応
  902. for(int i=0; i<zaiko.Count && i < zaikoDrawAtUchiageBox.GetCount() ; i++)
  903. {
  904.  
  905. var b=zaikoDrawAtUchiageBox.GetButtonPosition(i);//マテリアルだけ使う
  906. if (i == 0) {
  907. b.Slide(moveY.GetMem());
  908. b.Slide(moveXY_ToZero.GetMem());
  909. //b.Slide(moveRevY.GetMem());
  910. }
  911. if (i == 1)
  912. {
  913. b.Slide(index1_MovYDown.GetMem());
  914. b.Slide(moveX.GetMem());
  915. }
  916. if(1<i && i!=zaiko.Count-1){
  917. b.Slide(moveX.GetMem());
  918. if (i <= clickedBMIndex)
  919. {
  920. b.Slide(moveRevX.GetMem());
  921. }
  922. }
  923. if (i == zaiko.Count - 1)
  924. {
  925. b.Slide(indexLast_moveDownY.GetMem());
  926. }
  927. /*if(i==zaiko.Count-1)
  928. {
  929. b.Slide(lastMovY_Down.GetMem());
  930. }*/
  931. //マテリアルだけだと打ち上げ中にインデックスを変えられないから
  932. //専用関数書くか、ボタン機能をそのまま使うか
  933. Disp.DrawHanabiInboxAsAnime(zaiko[bufIndex].hanabi, b, null);
  934. bufIndex++;
  935. bufIndex %= zaiko.Count;
  936. }
  937. if (Glo.dbgDispFlag)
  938. {
  939. DX.DrawLine(0, Glo.WIN_Y - UCHIAGE_BOTTOM_LIMIT, Glo.WIN_X, Glo.WIN_Y - UCHIAGE_BOTTOM_LIMIT,
  940. DX.GetColor(255, 255, 0), 5);
  941. }
  942.  
  943. CancelDraw();
  944. if (uchiageCancel.InBoxMouse())
  945. {
  946.  
  947.  
  948. if (Input.Defined.Kettei())
  949. {
  950. //preMode=
  951. Mode = MODE_ADD;
  952. Zenkeshi();
  953. return;
  954. }
  955. }
  956.  
  957. if (Sio.Input.Defined.Kettei() && !JuuryokuSeigyo.GetValueBoxPosition().InBoxMouse())
  958. {
  959. if (Sio.Input.mouseY < Glo.WIN_Y - UCHIAGE_BOTTOM_LIMIT)
  960. {
  961.  
  962. moveX.AddStart();
  963. moveY.ResetMem();
  964. indexLast_moveDownY.ResetMem();
  965. //var uchiage = new UchiageHanabi();
  966. //var uchiage = GetCopy();
  967. var uchiage = GetCopy(0);
  968. //IndexInc();
  969. uchiage.SetDrawOn();//使ってないかも
  970. uchiage.oodama.Uchiage();
  971. uchiage.hanabi.SetOrigin(uchiage.oodama.targetPosF);
  972. running.Add(uchiage);
  973.  
  974. zaiko.Add(zaiko[0]);
  975. zaiko.RemoveAt(0);
  976. Console.WriteLine("zaiko count{0} currentIndex{1},runningCount{2}", zaiko.Count, nextIndex, running.Count);
  977. }
  978. if(Glo.WIN_Y - UCHIAGE_BOTTOM_LIMIT < Sio.Input.mouseY)
  979. {
  980.  
  981. zaikoDrawAtUchiageBox.InputCheck();
  982.  
  983. // Refreshで消えるのでここで取得
  984. bool bufPushed = zaikoDrawAtUchiageBox.GetButtonPushed();
  985. zaikoDrawAtUchiageBox.Refresh();
  986.  
  987.  
  988. int bufButtonIndex = zaikoDrawAtUchiageBox.GetLastOnButtonIndex();
  989. if (0 != bufButtonIndex && bufPushed)
  990. {
  991. if (bufButtonIndex < zaiko.Count)
  992. {
  993. Console.WriteLine("bufButtonIndex [{0}] , NextIndex[{1}]", bufButtonIndex,nextIndex);
  994. //var swapbuf = zaiko[0];
  995. //bufButtonIndex
  996. clickedBMIndex = bufButtonIndex;
  997. bufButtonIndex = (bufButtonIndex +zaiko.Count())% zaiko.Count;
  998.  
  999. Console.WriteLine("bufButtonIndexConverted [{0}]", bufButtonIndex);
  1000. zaiko.Insert(nextIndex, zaiko[bufButtonIndex]);
  1001.  
  1002. zaiko.RemoveAt((bufButtonIndex + 1)%zaiko.Count);
  1003. moveXY_ToZero.SetStart((clickedBMIndex-1)*LEN_A_BOX, LEN_A_BOX);
  1004. moveXY_ToZero.ResetMem();
  1005. moveRevX.AddStart();
  1006. index1_MovYDown.ResetMem();
  1007. moveY.ResetMem();
  1008. //lastMovY_Down.ResetMem();
  1009. }
  1010. }
  1011. if (!bufPushed)
  1012. {
  1013. moveX.AddStart();
  1014. moveY.ResetMem();
  1015. //var uchiage = new UchiageHanabi();
  1016. //var uchiage = GetCopy();
  1017. var uchiage = GetCopy(0);
  1018. //IndexInc();
  1019. uchiage.SetDrawOn();//使ってないかも
  1020. uchiage.oodama.Uchiage();
  1021. uchiage.hanabi.SetOrigin(uchiage.oodama.targetPosF);
  1022. running.Add(uchiage);
  1023.  
  1024. zaiko.Add(zaiko[0]);
  1025. zaiko.RemoveAt(0);
  1026. Console.WriteLine("zaiko count{0} currentIndex{1},runningCount{2}", zaiko.Count, nextIndex, running.Count);
  1027. }
  1028.  
  1029.  
  1030. }
  1031.  
  1032. }
  1033.  
  1034. Tamaya.Refresh();
  1035. Tamaya.DrawUchiagetaHanabi();
  1036.  
  1037. preMode = Mode;
  1038. }
  1039. uchiageCanselHide.Refresh();
  1040. return;
  1041. }//____________Run___End_____________
  1042. public static void SetAllPositionInDrawArea(Gui.Box arg)
  1043. {
  1044. arg.SetPosXY(bufAddPos);
  1045. arg.pos2.SetPosXY(bufAddPos);
  1046. arg.pos2.AddXY(lenPos);
  1047. }
  1048. }
  1049.  
  1050. }
  1051.  
Advertisement
Add Comment
Please, Sign In to add comment