Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Hanabi_NS;
- using Sio;
- using static Sio.Basic;
- using Gui;
- using DxLibDLL;
- //ToDo SIZEに下駄を履かせる
- namespace Tamaya_NameSpace
- {
- //ToDo火輪クラスが消えてないかも。//やったかも
- public static class Tamaya
- {
- public static int CancelDraw()
- {
- //uchiageCancel.DrawBox(1, null, modoruColor);
- uchiageCanselHide.DrawHideBox();
- int result=uchiageCanselHide.InputCheck();
- LibDX.Font.Set(40);
- LibDX.DrawStringKage(uchiageCanselHide, "戻る", ScColor.WHITE, ScColor.BLACK, 0, uchiageCanselHide.GetHeight() / 2);
- //Console.WriteLine("uchicanselHide{0}", uchiageCanselHide.x);
- LibDX.Font.SetToInitialized();
- return result;
- }
- static void JunbanDrawOresen(int arg)
- {
- if (arg<MODE_EDIT_SPEED || MODE_EDIT_SUISIN<arg) { return; }
- editBoxIndexList.Remove(arg);
- editBoxIndexList.Add(arg);
- }
- static void SetSakuseiTo0()//ポインタをあてただけなので各種パラメータはコピーされない
- {//パラメータを渡すのが面倒なので、変更された値は逐次反映させるようにするか
- UchiageHanabi buf = new();
- buf.hanabi = SAKUSEIchu;
- hanabiWindow._hanabiDispBoxes[0].SetHanabi(buf);
- }
- public static int Mode = MODE_ADD; //リストにするほど複雑ではない。かも
- //リストでやっておけばよかった
- public static int preMode = 0;
- public const int MODE_ADD = 9;//0 色追加
- public const int MODE_EDIT_UWAGAKI = 1;
- public const int MODE_CURRENT_CLEAR = 2;
- public const int MODE_IREKAE = 3;
- public const int CONVET_TO_EDITBOX_INDEX_SUBST = 4;
- public const int MODE_EDIT_SPEED = 4;//1 速度変更
- public const int MODE_EDIT_SOMITU = 5;//2 粗密変更
- public const int MODE_EDIT_SIZE = 6;
- public const int MODE_EDIT_SUISIN = 7;//4 指定インデックスからやりなおし
- public const int MODE_EDIT_NIZI = 8; //れいんぼー カラーセットボックスを2つつかうが、回転速度はどうしよう
- //public const int MODE_EDIT_TEMPCOLOR = 5;//3 色を一時保管 長押しで火輪を追加するのでいらないかも
- public const int UCHIAGE_BOTTOM_LIMIT = 200;
- private static SunaDokei circleAdd = new(180);
- static uint modoruColor = DX.GetColor(200, 200, 200);
- static int editsX1=500;
- static int editsX2=editsX1+600;
- public const int MODE_ZENKESI = 888888;//すべて消す。ボタンIDは0
- public const int MODE_UCHIAGE = 999999;//9 打ち上げ
- //public static Sio.Lib.FlipFlop modeFlipFlop = new();
- public static List<UchiageHanabi> zaiko;
- static int zaikoIndex = 0;
- static Hanabi_NS.Hanabi swapBuf=new();
- public static HanabiWindow hanabiWindow;
- static HanabiDispBox curDispBox;
- public static Gui.ButtonsBox zaikoDrawAtUchiageBox;
- public static Sio.Basic.FlipFlop zaikoIndexFlipFlop=new();
- static int nextIndex;
- public static int sakuseiIndex;
- public static List<UchiageHanabi> running;
- public static Hanabi_NS.Hanabi SAKUSEIchu;
- public static Gui.Box uchiageCancel;
- private static Gui.HideBox uchiageCanselHide;
- public static Gui.ColorSetBox colorsetbox;
- public static Gui.Window editBox;
- static Sio.Basic.FlipFlop zaikoIndexFp=new();
- public static Gui.Box uchiageJunbi;
- public static Gui.Box zaikoheTuika;
- public static Gui.Box zaikoheTuikaClearNasi;
- static ListBool oresenEdit;
- static List<int> editBoxIndexList = new();
- public static uint uwagakiColor = 0;
- public static Gui.Oresen speedOresen;
- public static uint speedColor = DX.GetColor(30,30,255);
- public static Gui.Oresen sizeOresen;
- public static uint sizeColor = DX.GetColor(255,30,30);
- public static Gui.Oresen somituOresen;
- public static uint somituColor = DX.GetColor(30, 255, 30);
- public static Gui.Oresen suisinOresen;
- public static uint suisinColor = DX.GetColor(30, 255, 255);
- public static uint zenkesiColor = DX.GetColor(200, 50, 150);
- public static List<Gui.Oresen> oresenList;
- public static PosXY bufAddPos;
- public static PosXY lenPos;
- private static MizuDokeiXY moveX;
- private static MizuDokeiXY moveY;
- private static MizuDokeiXY moveXY_ToZero;
- private static MizuDokeiXY moveRevX;
- private static MizuDokeiXY indexLast_moveDownY;
- private static MizuDokeiXY index1_MovYDown;//zaiko[1]用
- private static int clickedBMIndex = 0;
- private static int LEN_A_BOX;//= 55;//レイアウト変更時に注意。 座標代入時に決める。
- private static int sideLen = 3;
- private static Gui.ButtonsBox modeSwitchButtons;
- static string uchiageJunbiStr = "打ち上げへ";
- static string zaikoheTuikaStr = "在庫へ追加";
- static string zaikoheTuikaClearNachiStr = "コピーを残して追加";
- //private static Gui.ButtonVar curHanabiDrawArea;
- public static List<ButtonElemental> testKonzai;
- //_____________________メンバ変数__END__________________________
- public class UchiageHanabi
- {
- public Hanabi_NS.Hanabi hanabi;
- public Oodama oodama;
- public bool drawBool;
- public int pastTime;
- public int pastTimeBorder = 300;
- public UchiageHanabi()
- {
- hanabi = new Hanabi_NS.Hanabi();
- oodama = new Oodama();
- drawBool = false;
- }
- public void SetDrawOn()
- {
- drawBool = true;
- }
- public void Refresh()
- {
- if ((oodama.posF - oodama.targetPosF).LengthSquared() < 10)
- {
- hanabi.Refresh();
- hanabi.DDDDDoooooon();
- pastTime++;
- }
- else
- {
- oodama.Refresh();
- //if (Sio.Dbg.PerSecondRunBool(5))
- }
- }
- public void Draw()
- {
- if ((oodama.posF - oodama.targetPosF).LengthSquared() < 100)
- {
- hanabi.DrawHanabi();
- }
- else
- {
- oodama.DrawOodama();
- }
- }
- public UchiageHanabi(Hanabi_NS.Hanabi arg)
- {
- hanabi = arg;
- oodama = new();
- }
- public UchiageHanabi GetCopy()
- {
- UchiageHanabi result= new();
- result.hanabi.SetKarinList(this.hanabi.GetKarinList());
- result.oodama = new();
- return result;
- }
- }
- public static void Tamaya_Init()
- {
- Mode = MODE_ADD;
- sakuseiIndex = 0;
- oresenList = new();
- zaiko = new();
- running = new();
- colorsetbox = new(0, 0, 400, Glo.WIN_Y*9/10);
- SAKUSEIchu = new();
- //uchiageCancel = new(Glo.WIN_X * 15 / 16, Glo.WIN_Y / 16, Glo.WIN_X, Glo.WIN_Y);
- uchiageCancel = new(0, 0, Glo.WIN_X / 16, Glo.WIN_Y);
- uchiageCanselHide=new();
- uchiageCanselHide.SetInputCheckBox(uchiageCancel);
- uchiageCanselHide.SetHidePosition(new BoxMaterial(-Glo.WIN_X / 16, 0,0,Glo.WIN_Y));
- uchiageCanselHide.HideBox_Init();
- uchiageCanselHide.SetColor(ScColor.WHITE);
- uchiageJunbi = new(Glo.WIN_X * 15 / 16, 0, Glo.WIN_X, Glo.WIN_Y / 3);
- zaikoheTuika = new(Glo.WIN_X * 15 / 16, Glo.WIN_Y / 3, Glo.WIN_X, Glo.WIN_Y*2/3);
- zaikoheTuikaClearNasi = new(zaikoheTuika);
- zaikoheTuikaClearNasi.Slide(0, Glo.WIN_Y / 3);
- editsX1 = 500;
- editsX2 = editsX1+600;
- editBox = new();
- editBox.SetLimitBox();
- editBox.WindowReady(editsX1, 500, editsX2, Glo.WIN_Y-16);
- editBox.SetDispBackColor(ScColor.WHITE);
- //_________________動くボタンテスト___________________
- hanabiWindow = new();
- hanabiWindow = HanaDispWindowJunbi.GetHanabiDispWindow(editsX1,300,editsX2,500);
- curDispBox = new();
- curDispBox = hanabiWindow._hanabiDispBoxes[0];
- hanabiWindow.SetPreZeroToZero();
- UchiageHanabi bufCurUH = new();
- bufCurUH.hanabi = SAKUSEIchu;
- curDispBox.SetHanabi(bufCurUH);
- //
- zaikoDrawAtUchiageBox = new(0,Glo.WIN_Y-50,Glo.WIN_X,Glo.WIN_Y+100);
- zaikoIndexFlipFlop = new(0);
- //zaikoDrawAtUchiageBox.NewMovableBox();
- var uchiageZaikoButtons = Gui.ButtonVar.GeneButtonList_test(16, 1, 50, 50, 5, 0, Glo.WIN_X/2+85,0);
- uchiageZaikoButtons[0].SetAllPositions(uchiageZaikoButtons[1]);
- uchiageZaikoButtons[0].Slide(new PosXY(0, -55));
- zaikoDrawAtUchiageBox.SetButtonsList(uchiageZaikoButtons);
- zaikoDrawAtUchiageBox.Refresh();
- // やっておかないとButton入力の一回目を無視するので
- moveX = new(uchiageZaikoButtons[2].x - uchiageZaikoButtons[1].x, 0, 9, 10);
- moveX.SetZero();
- moveY = new(0, uchiageZaikoButtons[1].y - uchiageZaikoButtons[0].y, 9, 10);
- moveY.SetZero();
- moveRevX= new(uchiageZaikoButtons[1].x - uchiageZaikoButtons[2].x, 0, 9, 10);
- moveRevX.SetZero();
- index1_MovYDown = new(0, uchiageZaikoButtons[0].y - uchiageZaikoButtons[1].y, 9, 10);
- index1_MovYDown.SetZero();
- moveXY_ToZero = new(0,0,9,10);
- indexLast_moveDownY = new(0, -55, 99, 100);
- LEN_A_BOX = uchiageZaikoButtons[2].x - uchiageZaikoButtons[1].x;
- Sio.Basic.KakkOut("LEN_A_BOX", LEN_A_BOX);
- testKonzai = new();
- var list_1bit = ButtonOnOff.GeneOnOffButtonList(10, 2, 50, 50, 5, 5, 0, 0);
- testKonzai.AddRange(list_1bit);
- var list_but_toK = ButtonVar.GeneButtonList(10, 2, 50, 50, 5, 5, 0, 200);
- testKonzai.AddRange(list_but_toK);
- for(int i=0; i< testKonzai.Count; i++)
- {
- for(int j=0; j<4; j++)
- {
- testKonzai[i].SetColorsAll(LibDX.RandomLightColor.GetColor(),
- LibDX.RandomLightColor.GetColor(),
- LibDX.RandomLightColor.GetColor(),
- LibDX.RandomLightColor.GetColor()
- );
- }
- }
- modeSwitchButtons = new(editsX1,0,editsX2,400);
- modeSwitchButtons.SetIndex(MODE_ADD);
- modeSwitchButtons.SetResetIndex(MODE_ADD);
- //var buttons = new List<Gui.Button>();
- var buttons = Gui.ButtonVar.GeneButtonList(4, 4, 120, 50, 10, 10);
- for (int i=0; i<buttons.Count; i++)
- {
- buttons[i].SetBaseColor(ScColor.GRAY);
- buttons[i].SetMouseOnColor(ScColor.WHITE);
- }
- buttons[0].SetColor(uwagakiColor);
- buttons[0].SetClickedColor(uwagakiColor);
- buttons[0].SetBaseColor(DX.GetColor(30, 30, 100));
- buttons[0].SetString("全て破棄");
- buttons[MODE_EDIT_UWAGAKI].SetColor(uwagakiColor);
- buttons[MODE_EDIT_UWAGAKI].SetClickedColor(uwagakiColor);
- buttons[MODE_EDIT_UWAGAKI].SetBaseColor(DX.GetColor(100,100,100));
- buttons[MODE_EDIT_UWAGAKI].SetString("やりなおす");
- buttons[MODE_CURRENT_CLEAR].SetWakuColor(ScColor.YORUcolor);
- buttons[MODE_CURRENT_CLEAR].SetClickedColor(ScColor.YORUcolor);
- buttons[MODE_CURRENT_CLEAR].SetBaseColor(DX.GetColor(30, 30,150 ));
- buttons[MODE_CURRENT_CLEAR].SetString("破棄");
- buttons[MODE_IREKAE].SetWakuColor(DX.GetColor(100,100,150));
- buttons[MODE_IREKAE].SetClickedColor(DX.GetColor(100, 100, 150));
- buttons[MODE_IREKAE].SetBaseColor(DX.GetColor(50, 50, 100));
- buttons[MODE_IREKAE].SetString("入れ替え");
- /*
- buttons[MODE_].SetWakuColor();
- buttons[MODE_].SetClickedColor();
- buttons[MODE_].SetBaseColor(DX.GetColor(30, 30, 150));
- buttons[MODE_].SetString("");
- */
- buttons[MODE_EDIT_SPEED].SetWakuColor(speedColor);
- buttons[MODE_EDIT_SPEED].SetClickedColor(speedColor);
- //buttons[MODE_EDIT_].SetBaseColor(DX.GetColor(, , ));
- buttons[MODE_EDIT_SPEED].SetBaseColor(DX.GetColor(80, 80, 100));
- buttons[MODE_EDIT_SPEED].SetString("スピード");
- buttons[MODE_EDIT_SIZE].SetWakuColor(sizeColor);
- buttons[MODE_EDIT_SIZE].SetClickedColor(sizeColor);
- buttons[MODE_EDIT_SIZE].SetBaseColor(DX.GetColor(100, 80, 80));
- buttons[MODE_EDIT_SIZE].SetString("サイズ");
- buttons[MODE_EDIT_SOMITU ].SetWakuColor(somituColor);
- buttons[MODE_EDIT_SOMITU ].SetClickedColor(somituColor);
- buttons[MODE_EDIT_SOMITU].SetBaseColor(DX.GetColor(90,120 , 100));
- buttons[MODE_EDIT_SOMITU ].SetString("密度");
- buttons[MODE_EDIT_SUISIN].SetWakuColor(suisinColor);
- buttons[MODE_EDIT_SUISIN].SetClickedColor(suisinColor);
- buttons[MODE_EDIT_SUISIN].SetBaseColor(DX.GetColor(50, 100, 100));
- buttons[MODE_EDIT_SUISIN].SetString("推進力");
- modeSwitchButtons.SetButtonsList(buttons);
- modeSwitchButtons.SetMode(ButtonsBox.MODE_ONLY);
- oresenEdit = new(4, false);
- bufAddPos = new();
- lenPos = new(editBox);
- lenPos.AddXY(0, Gui.Window.barHeight);
- lenPos.SetVecTo(editBox.GetDrawArea().pos2);
- lenPos.WriteInfoXY("lenPos,as描画領域の大きさ");
- sizeOresen = new Gui.Oresen(editBox.GetDrawArea());
- sizeOresen.SetValueRange(0, 6, sideLen);//
- sizeOresen.SetColors(int.MaxValue, sizeColor);
- sizeOresen.SetValuesAll(3f);
- sizeOresen.SetStartValue(3f);
- //ValueInitialize.SetOresenValues(sizeOresen, 20, 15, 10, 50);
- //Oresen生成(座標)、パラメーター
- speedOresen = new(editBox.GetDrawArea());
- speedOresen.SetValueRange(10, 50, sideLen);
- speedOresen.SetStartValue(20);
- //speedOresen.ResetValuesAll();
- //speedOresen.SetValuesToWave();
- speedOresen.SetColors(int.MaxValue, speedColor);
- ValueInitialize.SetOresenValues(speedOresen, 30, 1, 20, 60);
- somituOresen = new(editBox.GetDrawArea());
- somituOresen.SetValueRange(10, 150, sideLen);
- somituOresen.SetStartValue(70);
- //somituOresen.ResetValuesAll();
- somituOresen.SetColors(int.MaxValue, somituColor);
- ValueInitialize.SetOresenValues(somituOresen, 60, -1, 15, 65);
- suisinOresen = new(editBox.GetDrawArea());
- suisinOresen.SetValueRange(0f, 1.0f-Hibana.airDecMulti, sideLen);
- //suisinOresen.SetValueRange(0f, (1f), sideLen);
- suisinOresen.SetStartValue(0.11f);
- //suisinOresen.ResetValuesAll();
- suisinOresen.SetColors(int.MaxValue, suisinColor);
- ValueInitialize.SetOresenValues(suisinOresen, 30, -1, 10, 60);
- oresenList.Add(speedOresen);
- oresenList.Add(somituOresen);
- oresenList.Add(sizeOresen);
- oresenList.Add(suisinOresen);
- editBoxIndexList.Add(MODE_EDIT_SPEED);
- editBoxIndexList.Add(MODE_EDIT_SOMITU);
- editBoxIndexList.Add(MODE_EDIT_SIZE);
- editBoxIndexList.Add(MODE_EDIT_SUISIN);
- editBoxIndexList.Add(0);//dummy
- Sio.Basic.WriteListInt("At Init() editBoxIndexList", editBoxIndexList);
- //speedOresen.SetAllPositions(editBox.drawArea);
- /*speedOresen = new(0,editBox.pos2.y, editBox.pos2.x, editBox.drawArea.pos2.y);
- speedOresen.SetPosXY(0, editBox.pos2.y-editBox.y);
- speedOresen.pos2.SetPosXY(lenPos);*/
- Sio.Basic.WriteStringList(speedOresen.InfoBox("spOresen"));
- //Console.ReadLine();
- }
- public static UchiageHanabi GetCopy(int argidx)
- {
- UchiageHanabi result = new();
- if (zaiko[argidx] == null) { Sio.Dbg.AddLog("zaikoインデックスエラー"); }
- var buf = zaiko[argidx];
- result.oodama = new Oodama();
- result.hanabi.SetKarinList(buf.hanabi.GetKarinList());
- return result;
- }
- public static void SetAllParaEditBox()
- {
- /*
- SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SPEED, speedOresen.GetValuesAll());
- SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SOMITU, somituOresen.GetValuesAll());
- SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SIZE, sizeOresen.GetValuesAll());
- SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SUISIN, suisinOresen.GetValuesAll());
- */
- speedOresen.SetValues(SAKUSEIchu.GetParas(Hanabi_NS.Hanabi.SPEED));
- somituOresen.SetValues(SAKUSEIchu.GetParas(Hanabi_NS.Hanabi.SOMITU));
- sizeOresen.SetValues(SAKUSEIchu.GetParas(Hanabi_NS.Hanabi.SIZE));
- suisinOresen.SetValues(SAKUSEIchu.GetParas(Hanabi_NS.Hanabi.SUISIN));
- }
- //public static void IziruJunbi()//在庫へ追加準備の直後に...ってそれなら一緒に入れたほうがいいか
- public static void SetAllParasUchiageHanabi(UchiageHanabi arg=null)
- {
- if (arg == null)
- {
- SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SPEED, speedOresen.GetValuesAll());
- SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SOMITU, somituOresen.GetValuesAll());
- SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SIZE, sizeOresen.GetValuesAll());
- SAKUSEIchu.SetParas(Hanabi_NS.Hanabi.SUISIN, suisinOresen.GetValuesAll());
- }
- else
- {
- arg.hanabi.SetParas(Hanabi_NS.Hanabi.SPEED, speedOresen.GetValuesAll());
- arg.hanabi.SetParas(Hanabi_NS.Hanabi.SOMITU, somituOresen.GetValuesAll());
- arg.hanabi.SetParas(Hanabi_NS.Hanabi.SIZE, sizeOresen.GetValuesAll());
- arg.hanabi.SetParas(Hanabi_NS.Hanabi.SUISIN, suisinOresen.GetValuesAll());
- Console.WriteLine("arg!=null in");
- }
- }
- public static void SetIndex(int arg)
- {
- if (zaiko.Count == 0) { return; }
- nextIndex = arg;
- if (zaiko.Count <= nextIndex) { Sio.Dbg.AddLog("IndexOver AutoAdjust"); }
- nextIndex += zaiko.Count;
- nextIndex %= zaiko.Count;
- }
- public static void IndexInc()
- {
- nextIndex++;
- nextIndex %= zaiko.Count;
- }
- public static void SetAllParas(Hanabi arg)
- {
- arg.SetParas(Hanabi_NS.Hanabi.SPEED, speedOresen.GetValuesAll());
- arg.SetParas(Hanabi_NS.Hanabi.SOMITU, somituOresen.GetValuesAll());
- arg.SetParas(Hanabi_NS.Hanabi.SIZE, sizeOresen.GetValuesAll());
- arg.SetParas(Hanabi_NS.Hanabi.SUISIN, suisinOresen.GetValuesAll());
- }
- public static void Refresh()
- {
- foreach (UchiageHanabi u in running)
- {
- u.Refresh();
- /*if (Sio.Dbg.PerSecondRunBool())
- {
- //Sio.Lib.WriteStringList(u.hanabi.InfoHanabi());
- }*/
- }
- for (int i = running.Count - 1; 0 < i; i--)
- {
- if (running[i].pastTimeBorder < running[i].pastTime)
- {
- // running.RemoveAt(i);
- }
- }
- }
- public static void Zenkeshi()
- {
- foreach(UchiageHanabi u in running)
- {
- foreach(Karin k in u.hanabi.tamagome)
- {
- k.hibanas.Clear();
- }
- u.hanabi.tamagome.Clear();
- }
- running.Clear();
- }
- public static void DrawUchiagetaHanabi()
- {
- foreach (UchiageHanabi u in running)
- {
- u.Draw();
- }
- }
- public static void Run()
- {
- //Mode = -1;
- int bufMode=zaikoIndexFp.Run(Mode);
- circleAdd.Run();
- //Lib.KakkOut("bufmode","FpFpvar", bufMode,zaikoIndexFp.GetMem());
- if (bufMode != 0)
- {
- JunbanDrawOresen(Mode);
- Sio.Basic.WriteListInt("editBoxIndexList",editBoxIndexList);
- circleAdd.TimerReset();
- }
- Sio.Dbg.AddInfo("作成idx[" + sakuseiIndex+"]");
- if(SAKUSEIchu.tamagome.Count <= sakuseiIndex && SAKUSEIchu.GetKarinCount()!=0)
- {
- sakuseiIndex = SAKUSEIchu.tamagome.Count;
- }
- //bufAddPos.AddXY(0, Gui.MovableBox.barHeight);
- if (Mode != MODE_UCHIAGE)
- {
- modeSwitchButtons.DrawBox();
- modeSwitchButtons.InputCheck();
- modeSwitchButtons.Refresh();
- foreach (Oresen o in oresenList)
- {
- o.Refresh();
- }
- Mode = modeSwitchButtons.GetLastOnButtonIndex();
- if (Mode == 0) { Mode = MODE_ZENKESI; }
- zaikoheTuika.DrawBox(1, null, ScColor.HIRUcolor);
- zaikoheTuika.DrawStringInBox(zaikoheTuikaStr);
- uchiageJunbi.DrawBox(1, null, ScColor.ORANGE);
- uchiageJunbi.DrawStringInBox(uchiageJunbiStr);
- zaikoheTuikaClearNasi.DrawBox(1, null, ScColor.CYAN);
- colorsetbox.DrawColorSetBox();
- //DispPreview.DrawZaiko(zaikoWindow, zaiko);
- //DispPreview.KaraHaTumeru(zaikoWindow, zaiko);
- //hanabiWindow.Refresh();
- hanabiWindow.InputCheckHW();
- hanabiWindow.Refresh();
- hanabiWindow.DrawHanabiWindow();
- //hanabiWindow.DrawID();
- SetAllParasUchiageHanabi();
- //SetSakuseiTo0();
- if (hanabiWindow.Get_ZeroChanged())
- {
- hanabiWindow.Set_ZeroChanged(false);
- SAKUSEIchu = hanabiWindow._hanabiDispBoxes[0].uh.hanabi;
- int idx = hanabiWindow.Get_PreZeroIndex();
- Console.WriteLine("ZeroChangedCheck; 元0のインデックス[{0}]",idx);
- SetAllParasUchiageHanabi(hanabiWindow._hanabiDispBoxes[idx].uh);//
- //SetAllParas(hanabiWindow.uhlist[idx].uh.hanabi);
- if (0 != SAKUSEIchu.GetKarinCount())
- {
- SetAllParaEditBox();
- sakuseiIndex =Sio.Basic.GetMin(sakuseiIndex, hanabiWindow._hanabiDispBoxes[0].uh.hanabi.GetKarinCount());
- }
- }
- SetAllParasUchiageHanabi();
- bufAddPos.SetPosXY(editBox);
- editBox.DrawWindow();
- DispPreview.DrawGradation(editBox, SAKUSEIchu,sideLen);
- Disp.DrawHanabiInBoxAsSideBar(editBox, editBox.GetDrawArea(), SAKUSEIchu, sideLen);
- // 二度手間になってるけど、仕様が決まってなかったらしょうがない
- var bufDrawArea = editBox.GetDrawAreaAbs();
- int dx = bufDrawArea.x + sakuseiIndex * sideLen;
- DX.DrawLine(dx, bufDrawArea.y, dx, bufDrawArea.pos2.y, ScColor.GENZAN, 5);
- DX.DrawLine(dx, bufDrawArea.y, dx, bufDrawArea.pos2.y, ScColor.WHITE, 3);
- //editBox.WriteInfoMova();
- //editBox.WriteInfoMova();
- editBox.InputCheckWindow();
- colorsetbox.InputCheckWindow();//レイアウト決まって動かさないようにするときはコメントアウト
- colorsetbox.InputCheckColorSetBox();
- if (colorsetbox.InBoxClicked())
- {
- var k = new Karin();
- k.SetColor(colorsetbox.GetColor());
- k.blendVal = colorsetbox.GetBlendVar();
- if ( SAKUSEIchu.tamagome.Count <= sakuseiIndex)
- {
- SAKUSEIchu.AddKarinToTamagome(k);
- }
- else
- {
- SAKUSEIchu.UwagakiKarin(sakuseiIndex, k);
- sakuseiIndex++;
- }
- }
- if (Input.Defined.Kettei()&& 2<SAKUSEIchu.GetKarinCount())
- {
- if (zaikoheTuika.InBoxMouse() || zaikoheTuikaClearNasi.InBoxMouse())
- {
- var buf = new UchiageHanabi();
- buf.hanabi.SetKarinList(SAKUSEIchu.GetKarinList());
- buf.oodama = new();
- var bufspeed = speedOresen.GetValuesAll();
- var bufsomitu = somituOresen.GetValuesAll();
- var bufsize = sizeOresen.GetValuesAll();
- var bufsuisin = suisinOresen.GetValuesAll();
- for (int i = 0; i < buf.hanabi.GetKarinCount(); i++)
- {
- buf.hanabi.tamagome[i].SetSpeed(bufspeed[i]);
- buf.hanabi.tamagome[i].somitu = (int)bufsomitu[i];
- buf.hanabi.tamagome[i].size = (int)bufsize[i];
- buf.hanabi.tamagome[i].suisin = bufsuisin[i];
- //Console.WriteLine("buf推進"+bufsuisin[i]);
- //
- }
- curDispBox=hanabiWindow.Add(buf);
- hanabiWindow.Set_ZeroChanged(false);
- if (!zaikoheTuikaClearNasi.InBoxMouse())
- {
- Console.WriteLine("作成中色素クリア");
- SAKUSEIchu.tamagome.Clear();
- //SetSakuseiTo0();
- }
- else
- {
- Console.WriteLine("色素をコピーして再セット");
- var buf2 = buf.GetCopy();
- curDispBox.SetHanabi(buf2);
- SetAllParaEditBox();
- }
- SAKUSEIchu = curDispBox.uh.hanabi;
- SetIndex(0);
- //花火を追加ここまで
- }
- }
- if (uchiageJunbi.InBoxMouse())
- {
- if (Input.Defined.Kettei())
- {
- preMode = Mode;//定数にしたほうがいいか、変数でもいいのかどっちが後で見た時わかりやすいかわからんけど、
- //やっぱModeのほうがよさげ。
- Mode = MODE_UCHIAGE;
- SetAllParasUchiageHanabi();
- return;
- }
- }
- //editBox.DrawMovableBox();
- editBox.InputCheckWindow();
- for (int i = 0; i < editBoxIndexList.Count; i++)
- {
- if (editBoxIndexList[i] != 0)
- {
- oresenList[editBoxIndexList[i] - 4].DrawBox(bufAddPos, 0);
- if (i == editBoxIndexList.Count - 1)
- {
- bool nakanuki = true;
- int bufAdd = circleAdd.GetTime();
- LibDX.Blend.On(150);
- bufAdd = Wave(6, bufAdd/50+10, 1);
- oresenList[editBoxIndexList[i] - 4].DrawBox(bufAddPos, bufAdd);
- LibDX.Blend.Off();
- oresenList[editBoxIndexList[i] - 4].DrawBox(bufAddPos, 0, nakanuki);
- }
- }
- }
- /*speedOresen.DrawBox(bufAddPos);
- sizeOresen.DrawBox(bufAddPos);
- somituOresen.DrawBox(bufAddPos);
- suisinOresen.DrawBox(bufAddPos);*/
- /*if (Input.Defined.PushingNumber() != -1)
- {
- Mode = Input.Defined.PushingNumber();
- return;
- }*/
- }//エディットモード 基礎部分ここまで
- if (Mode == MODE_EDIT_SPEED)
- {
- //editBox.DrawMovableBox();
- //editBox.InputCheckMovableBox();
- //SetAllPositionInDrawArea(speedOresen);
- //speedOresen.DrawBox(1,bufAddPos);
- //speedOresen.WriteInfoXY();
- speedOresen.InputCheck(bufAddPos);
- }
- if (Mode == MODE_EDIT_SIZE)
- {
- //SetAllPositionInDrawArea(speedOresen);
- //speedOresen.DrawBox(1,bufAddPos);
- //speedOresen.WriteInfoXY();
- sizeOresen.InputCheck(bufAddPos);
- }
- if (Mode== MODE_EDIT_SOMITU)
- {
- somituOresen.InputCheck(bufAddPos);
- }
- if (Mode == MODE_EDIT_SUISIN)
- {
- suisinOresen.InputCheck(bufAddPos);
- }
- if (Mode == MODE_EDIT_UWAGAKI)
- {
- YesNoBox.Draw(editBox.GetDrawAreaAbs(),uwagakiColor);
- int resultbuf = YesNoBox.InputCheck(editBox.GetDrawAreaAbs());
- if (resultbuf != 0)
- {
- if (resultbuf == 1)
- {
- sakuseiIndex = (Sio.Input.mouseX - editBox.GetX()) / sideLen;
- sakuseiIndex = GetMin(sakuseiIndex, SAKUSEIchu.tamagome.Count - 1);
- sakuseiIndex = GetMax(0, sakuseiIndex);
- }
- modeSwitchButtons.Reset();
- modeSwitchButtons.SetIndex(MODE_ADD);
- Mode = MODE_ADD;
- }
- preMode = Mode;
- }
- if (Mode == MODE_CURRENT_CLEAR)
- {
- YesNoBox.Draw(editBox.GetDrawAreaAbs(),ScColor.RED);
- //Disp.DrawHanabiInBoxAsSideBar(editBox, editBox.GetDrawArea(), SAKUSEIchu, sideLen);
- //int resultbuf = YesNoBox.InputCheck(editBox.GetDrawAreaAbs());
- int resultbuf = YesNoBox.InputCheck(editBox.GetDrawAreaAbs());
- if (resultbuf != 0)
- {
- if (resultbuf == 1)
- {
- sakuseiIndex = 0;
- SAKUSEIchu.tamagome.Clear();
- }
- modeSwitchButtons.Reset();
- modeSwitchButtons.SetIndex(MODE_ADD);
- Mode = MODE_ADD;
- }
- preMode = Mode;
- }
- if (Mode == MODE_ZENKESI)
- {
- YesNoBox.Draw(hanabiWindow.GetDrawAreaAbs(), ScColor.RED);
- //Disp.DrawHanabiInBoxAsSideBar(editBox, editBox.GetDrawArea(), SAKUSEIchu, sideLen);
- //int resultbuf = YesNoBox.InputCheck(editBox.GetDrawAreaAbs());
- int resultbuf = YesNoBox.InputCheck(hanabiWindow.GetDrawAreaAbs());
- if (resultbuf != 0)
- {
- if (resultbuf == 1)
- {
- sakuseiIndex = 0;
- zaiko.Clear();
- hanabiWindow.Zenkeshi();
- nextIndex = 0;
- }
- modeSwitchButtons.Reset();
- modeSwitchButtons.SetIndex(MODE_ADD);
- Mode = MODE_ADD;
- }
- preMode = Mode;
- }
- /*
- if (Mode == MODE_IREKAE)
- {
- zaikoWindow.InputCheck();
- YesNoBox.Draw(zaikoWindow.GetDrawAreaAbs(), ScColor.RED);
- int resultbuf= YesNoBox.InputCheck(zaikoWindow.GetDrawAreaAbs());
- if (resultbuf != 0)
- {
- if (resultbuf == 1)
- {
- if (zaikoWindow.GetLastOnButtonIndex() < zaiko.Count)
- {
- Irekae(zaikoWindow.GetLastOnButtonIndex());
- }
- }
- if (resultbuf == -1)
- {
- }
- modeSwitchButtons.Reset();
- modeSwitchButtons.SetIndex(MODE_ADD);//ここをちょっといじると順番かえるのに使える。かも
- }
- }*/
- if (Mode == MODE_UCHIAGE)
- {
- if (Mode != preMode)
- {
- zaiko = hanabiWindow.SortedList();
- //SetAllParasUchiageHanabi(zaiko[0]);
- SetAllParasUchiageHanabi();
- SetIndex(0);
- KakkOut("打ち上げ準備に入った瞬間", "前のモード", Mode, preMode);
- //Console.WriteLine("同一判定" + (zaiko[0].hanabi == SAKUSEIchu).ToString());
- //SetAllParasUchiageHanabi();
- //ここでYXソートしたIDリストを渡して整列
- }
- if (zaiko.Count <= 0)
- {
- LibDX.Font.Set(30);
- DX.DrawBox(200, 100, 600, 160, ScColor.GRAY,DX.TRUE);
- LibDX.DrawStringKage(200, 100, "在庫なし", ScColor.WHITE);
- LibDX.DrawStringKage(200, 130, "←戻って作成しましょう", ScColor.WHITE);
- CancelDraw();
- //uchiageCanselHide.
- uchiageCanselHide.Refresh();//紛らわしいが retrunの前なので我慢
- LibDX.Font.SetToInitialized();
- if (Input.Defined.Kettei()) { Mode = preMode; }
- return;
- //Mode = MODE_ADD;
- }
- moveX.Run();
- moveY.Run();
- moveRevX.Run();
- moveXY_ToZero.Run();
- index1_MovYDown.Run();
- indexLast_moveDownY.Run();
- //lastMovY_Down.Run();
- if (Glo.dbgDispFlag)
- {
- zaikoDrawAtUchiageBox.DrawBoxFutoWakuUchi();
- zaikoDrawAtUchiageBox.DrawBox();
- }
- //
- //zaikoDrawAtUchiageBox.DrawBoxFutoWakuUchi();
- //zaikoDrawAtUchiageBox.DrawBox();
- //
- if (Mode == preMode)
- {
- JuuryokuSeigyo.InputCheck();
- JuuryokuSeigyo.Draw();
- }
- int bufIndex = nextIndex%zaiko.Count;//先頭インデックス。どうせ0だけど、ほかでも使いそうなので一応
- for(int i=0; i<zaiko.Count && i < zaikoDrawAtUchiageBox.GetCount() ; i++)
- {
- var b=zaikoDrawAtUchiageBox.GetButtonPosition(i);//マテリアルだけ使う
- if (i == 0) {
- b.Slide(moveY.GetMem());
- b.Slide(moveXY_ToZero.GetMem());
- //b.Slide(moveRevY.GetMem());
- }
- if (i == 1)
- {
- b.Slide(index1_MovYDown.GetMem());
- b.Slide(moveX.GetMem());
- }
- if(1<i && i!=zaiko.Count-1){
- b.Slide(moveX.GetMem());
- if (i <= clickedBMIndex)
- {
- b.Slide(moveRevX.GetMem());
- }
- }
- if (i == zaiko.Count - 1)
- {
- b.Slide(indexLast_moveDownY.GetMem());
- }
- /*if(i==zaiko.Count-1)
- {
- b.Slide(lastMovY_Down.GetMem());
- }*/
- //マテリアルだけだと打ち上げ中にインデックスを変えられないから
- //専用関数書くか、ボタン機能をそのまま使うか
- Disp.DrawHanabiInboxAsAnime(zaiko[bufIndex].hanabi, b, null);
- bufIndex++;
- bufIndex %= zaiko.Count;
- }
- if (Glo.dbgDispFlag)
- {
- DX.DrawLine(0, Glo.WIN_Y - UCHIAGE_BOTTOM_LIMIT, Glo.WIN_X, Glo.WIN_Y - UCHIAGE_BOTTOM_LIMIT,
- DX.GetColor(255, 255, 0), 5);
- }
- CancelDraw();
- if (uchiageCancel.InBoxMouse())
- {
- if (Input.Defined.Kettei())
- {
- //preMode=
- Mode = MODE_ADD;
- Zenkeshi();
- return;
- }
- }
- if (Sio.Input.Defined.Kettei() && !JuuryokuSeigyo.GetValueBoxPosition().InBoxMouse())
- {
- if (Sio.Input.mouseY < Glo.WIN_Y - UCHIAGE_BOTTOM_LIMIT)
- {
- moveX.AddStart();
- moveY.ResetMem();
- indexLast_moveDownY.ResetMem();
- //var uchiage = new UchiageHanabi();
- //var uchiage = GetCopy();
- var uchiage = GetCopy(0);
- //IndexInc();
- uchiage.SetDrawOn();//使ってないかも
- uchiage.oodama.Uchiage();
- uchiage.hanabi.SetOrigin(uchiage.oodama.targetPosF);
- running.Add(uchiage);
- zaiko.Add(zaiko[0]);
- zaiko.RemoveAt(0);
- Console.WriteLine("zaiko count{0} currentIndex{1},runningCount{2}", zaiko.Count, nextIndex, running.Count);
- }
- if(Glo.WIN_Y - UCHIAGE_BOTTOM_LIMIT < Sio.Input.mouseY)
- {
- zaikoDrawAtUchiageBox.InputCheck();
- // Refreshで消えるのでここで取得
- bool bufPushed = zaikoDrawAtUchiageBox.GetButtonPushed();
- zaikoDrawAtUchiageBox.Refresh();
- int bufButtonIndex = zaikoDrawAtUchiageBox.GetLastOnButtonIndex();
- if (0 != bufButtonIndex && bufPushed)
- {
- if (bufButtonIndex < zaiko.Count)
- {
- Console.WriteLine("bufButtonIndex [{0}] , NextIndex[{1}]", bufButtonIndex,nextIndex);
- //var swapbuf = zaiko[0];
- //bufButtonIndex
- clickedBMIndex = bufButtonIndex;
- bufButtonIndex = (bufButtonIndex +zaiko.Count())% zaiko.Count;
- Console.WriteLine("bufButtonIndexConverted [{0}]", bufButtonIndex);
- zaiko.Insert(nextIndex, zaiko[bufButtonIndex]);
- zaiko.RemoveAt((bufButtonIndex + 1)%zaiko.Count);
- moveXY_ToZero.SetStart((clickedBMIndex-1)*LEN_A_BOX, LEN_A_BOX);
- moveXY_ToZero.ResetMem();
- moveRevX.AddStart();
- index1_MovYDown.ResetMem();
- moveY.ResetMem();
- //lastMovY_Down.ResetMem();
- }
- }
- if (!bufPushed)
- {
- moveX.AddStart();
- moveY.ResetMem();
- //var uchiage = new UchiageHanabi();
- //var uchiage = GetCopy();
- var uchiage = GetCopy(0);
- //IndexInc();
- uchiage.SetDrawOn();//使ってないかも
- uchiage.oodama.Uchiage();
- uchiage.hanabi.SetOrigin(uchiage.oodama.targetPosF);
- running.Add(uchiage);
- zaiko.Add(zaiko[0]);
- zaiko.RemoveAt(0);
- Console.WriteLine("zaiko count{0} currentIndex{1},runningCount{2}", zaiko.Count, nextIndex, running.Count);
- }
- }
- }
- Tamaya.Refresh();
- Tamaya.DrawUchiagetaHanabi();
- preMode = Mode;
- }
- uchiageCanselHide.Refresh();
- return;
- }//____________Run___End_____________
- public static void SetAllPositionInDrawArea(Gui.Box arg)
- {
- arg.SetPosXY(bufAddPos);
- arg.pos2.SetPosXY(bufAddPos);
- arg.pos2.AddXY(lenPos);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment