示例#1
0
 /// <summary>
 /// 表示させるアイテムを更新します
 /// </summary>
 public void updateItem()
 {
     detachContents();
     foreach (IItem item in inventory.getItems())
     {
         GameObject    nodeObject = Instantiate(tradeItemNodePrefab);
         TradeItemNode node       = nodeObject.GetComponent <TradeItemNode>();
         node.setGoods(item, TradeHelper.getSellValue(item, player, (Merchant)trader), this);
         nodeObject.transform.SetParent(content.transform);
     }
 }
示例#2
0
        /// <summary>
        /// 初期設定を行います
        /// </summary>
        /// <param name="player">取引に参加するPC</param>
        /// <param name="trader">取引に参加するフレンドリキャラクター</param>
        public void setState(Player player, IFriendly trader)
        {
            this.player    = player;
            this.trader    = trader;
            this.inventory = player.getInventory();

            headerText.text = player.getName();

            tradeItemNodePrefab = (GameObject)Resources.Load("Prefabs/TradeItemNode");

            foreach (IItem item in inventory.getItems())
            {
                GameObject    nodeObject = Instantiate(tradeItemNodePrefab);
                TradeItemNode node       = nodeObject.GetComponent <TradeItemNode>();
                node.setGoods(item, TradeHelper.getSellValue(item, player, (Merchant)trader), this);
                nodeObject.transform.SetParent(content.transform);
            }
        }
示例#3
0
        /// <summary>
        /// 初期設定を行います
        /// </summary>
        /// <param name="goods">商品のリスト</param>
        /// <param name="player">取引に参加するプレイヤー</param>
        /// <param name="trader">取引に参加するIFriendlyキャラクター</param>
        /// <param name="window">親となるメッセージウィンドウ</param>
        public void setState(List <IItem> goods, Player player, IFriendly trader, MassageWindow window)
        {
            tradeItemNodePrefab = (GameObject)Resources.Load("Prefabs/TradeItemNode");
            this.goods          = goods;
            foreach (IItem item in goods)
            {
                TradeItemNode node = Instantiate(tradeItemNodePrefab).GetComponent <TradeItemNode>();
                node.setGoods(item, TradeHelper.getBuyValue(item, player, (Merchant)trader), this);
                node.transform.SetParent(content.transform);
            }
            this.player = player;
            this.trader = (Merchant)trader;
            this.window = window;

            headerText.text = trader.getName();

            sellWindow = transform.root.GetComponent <TradeView>().getSellWindow();
            sellWindow.setState(player, trader);
            sellWindow.transform.SetParent(transform.root);
        }