//===================================== // update //===================================== public void updateDraw(bool first) { night1.SetActive(false); night2.SetActive(false); var myp = GameFactory.getGame().getMyPlayer(); if (myp.state == game.db.PLAYER_STATE.NONE) { night1.SetActive(true); } else if (myp.state == game.db.PLAYER_STATE.NIGHT_VOTE) { night2.SetActive(true); night_chara.clear(); night_chara.add("投票しない", -1); foreach (var p in GameFactory.getGame().shareData.players.players) { if (p.fdead) { continue; } night_chara.add("" + p.name, p.id); } night_chara.updateDraw(first); } }
private void updateMidnight1(bool first) { { var myp = GameFactory.getGame().getMyPlayer(); mid1_item.clear(); mid1_item.add("使用しない", -1); for (int i = 0; i < myp.items.Length; i++) { if (myp.getItem(i) == game.db.ITEM.NONE) continue; mid1_item.add("" + myp.getItemStr(i), i); } mid1_item.updateDraw(first); } { mid1_chara.clear(); foreach (var p in GameFactory.getGame().shareData.players.players) { if ( p.id == GameFactory.getGame().localData.myPlayer) continue; mid1_chara.add(""+p.name , p.id); } mid1_chara.updateDraw(first); } }
//-------------------------------------------------- // draw //-------------------------------------------------- public void updateDraw(bool first) { noon1.SetActive(false); noon2.SetActive(false); noon3.SetActive(false); noon4.SetActive(false); var myp = GameFactory.getGame().getMyPlayer(); if (myp.state == game.db.PLAYER_STATE.NOON_END) { //終了 } else if (myp.state == game.db.PLAYER_STATE.NONE) { // 選択画面 noon1.SetActive(true); noon1_chara.clear(); foreach (var p in GameFactory.getGame().shareData.players.players) { if (p.id == GameFactory.getGame().localData.myPlayer) { continue; } if (p.state == game.db.PLAYER_STATE.NOON_END) { continue; } noon1_chara.add("" + p.name, p.id); } noon1_chara.updateDraw(first); } else if (myp.state == game.db.PLAYER_STATE.NOON_WAIT_ACK) { //待ち noon2.SetActive(true); } else if (myp.state == game.db.PLAYER_STATE.NOON_REQUEST_RETURN) { //返答 noon3.SetActive(true); var opp_id = GameFactory.getGame().getMyPlayer().net_opp; var opp = GameFactory.getGame().shareData.players.getPlayer(opp_id); GameObject.Find("Canvas/Noon/Noon3/opp_text").GetComponent <Text>().text = opp.name + "から交換要望がありました"; } else if (myp.state == game.db.PLAYER_STATE.NOON_ITEM) { //アイテム選択 noon4.SetActive(true); noon4_item.clear(); for (int i = 0; i < myp.items.Length; i++) { if (myp.getItem(i) == game.db.ITEM.MURDERE_KNIFE) { continue; } if (myp.getItem(i) == game.db.ITEM.NONE) { continue; } noon4_item.add("" + myp.getItemStr(i), i); } noon4_item.updateDraw(first); } }
public void setMyItemList(MyDropdown drop, int item_index, Player opp, bool first, int id1, int id2, int id3, int id4) { var myp = GameFactory.getGame().getMyPlayer(); var myitem = myp.getItem(item_index); drop.clear(); //狂気の殺人包丁ならそれしか選択できない if (myitem == ITEM.MURDERE_KNIFE) { var id = myp.id * 10 + item_index; drop.add(Player.getStr(myitem) + "(" + id + ")", id); return; } // 敵と味方から選択可能 // 自分で既に選択済みなのは除外 List <int> kouho = new List <int>(); for (int i = 0; i < 4; i++) { kouho.Add(myp.id * 10 + i); } for (int i = 0; i < 4; i++) { kouho.Add(opp.id * 10 + i); } for (int i = 0; i < 4; i++) { //狂気の殺人包丁は除外 if (myp.getItem(i) == ITEM.MURDERE_KNIFE) { kouho.Remove(myp.id * 10 + i); continue; } //他で選択されているのは除外 if (first) { // 最初は自分以外のindexを除外 if (item_index != i) { kouho.Remove(myp.id * 10 + i); continue; } } } if (!first) { if (item_index == 0) { kouho.Remove(id2); kouho.Remove(id3); kouho.Remove(id4); } else if (item_index == 1) { kouho.Remove(id1); kouho.Remove(id3); kouho.Remove(id4); } else if (item_index == 2) { kouho.Remove(id1); kouho.Remove(id2); kouho.Remove(id4); } else if (item_index == 3) { kouho.Remove(id1); kouho.Remove(id2); kouho.Remove(id3); } } foreach (var no in kouho) { int id = no / 10; int item = no % 10; var p = GameFactory.getGame().shareData.players.getPlayer(id); string s = p.getItemStr(item); if (s == "") { s = "なし"; } drop.add(s + "(" + no + ")", no); } //選択 if (first) { //最初は選択を自分のindex通り drop.select(myp.id * 10 + item_index); } else { if (item_index == 0) { drop.select(id1); } else if (item_index == 1) { drop.select(id2); } else if (item_index == 2) { drop.select(id3); } else if (item_index == 3) { drop.select(id4); } } }