本文整理汇总了C#中Party类的典型用法代码示例。如果您正苦于以下问题:C# Party类的具体用法?C# Party怎么用?C# Party使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Party类属于命名空间,在下文中一共展示了Party类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PurchasePrice
public ProductPurchasePrice PurchasePrice(Party supplier, DateTime orderDate, Product product = null, Part part = null)
{
ProductPurchasePrice purchasePrice = null;
foreach (SupplierOffering supplierOffering in supplier.SupplierOfferingsWhereSupplier)
{
if ((supplierOffering.ExistProduct && supplierOffering.Product.Equals(product)) ||
(supplierOffering.ExistPart && supplierOffering.Part.Equals(part)))
{
if (supplierOffering.FromDate <= orderDate && (!supplierOffering.ExistThroughDate || supplierOffering.ThroughDate >= orderDate))
{
foreach (ProductPurchasePrice productPurchasePrice in supplierOffering.ProductPurchasePrices)
{
if (productPurchasePrice.FromDate <= orderDate && (!productPurchasePrice.ExistThroughDate || productPurchasePrice.ThroughDate >= orderDate))
{
purchasePrice = productPurchasePrice;
break;
}
}
}
}
if (purchasePrice != null)
{
break;
}
}
return purchasePrice;
}
示例2: CreateParty
public Party CreateParty(string userId, string title, string description, double longitude, double latidude,
string locationAddress, DateTime startTime, DateTime creationTime)
{
var party = new Party()
{
UserId = userId,
Title = title,
Description = description,
Longitude = longitude,
Latitude = latidude,
LocationAddress = locationAddress,
StartTime = startTime,
CreationTime = creationTime
};
var user = this.users
.All()
.Where(u => u.Id == userId)
.FirstOrDefault();
this.parties.Add(party);
party.Members.Add(user);
user.Parties.Add(party);
this.users.SaveChanges();
return party;
}
示例3: Overworld
public Overworld(Party playerParty, Area area)
{
if (playerParty == null)
throw new Exception("Party playerParty cannot be null");
PlayerParty = playerParty;
Area = area;
EnemyParties = new List<Party>();
states = new Stack<OverworldState>();
states.Push(new OverworldStates.Menu(this));
stateChanged = true;
Map = new Map(100, 100, 5, 5);
PlayerParty.PrimaryPartyMember.StartOverworld(new Vector2(200.0f));
addEntity(PlayerParty.PrimaryPartyMember.OverworldEntity);
camera = new Camera(Game1.ScreenSize);
camera.Target = playerParty.PrimaryPartyMember.OverworldEntity;
//populateWithScenery();
//populateWithEnemies();
playerInvincibilityTimer = 0.0f;
}
示例4: OnEnable
void OnEnable () {
if (CurrentParty == null)
{
CurrentParty = new Party(PhotonNetwork.player);
}
nonGmPlayers = new PhotonPlayer[9];
GmPlayers = new PhotonPlayer[11];
ConnectedPlayers = PhotonNetwork.playerList;
int counter = 0;
int gmcounter = 0;
foreach (GameObject _object in PlayerButtons)
{
_object.SetActive(false);
}
foreach (GameObject _object in PartyButtons)
{
_object.SetActive(false);
}
foreach (PhotonPlayer _player in ConnectedPlayers)
{
if (_player.name != "" && _player.name != PhotonNetwork.player.name)
{
nonGmPlayers[counter] = _player;
PlayerButtons[counter].SetActive(true);
PlayerButtons[counter].GetComponentInChildren<Text>().text = _player.name;
counter++;
}
else if (_player.name != PhotonNetwork.player.name && !_player.isMasterClient)
{
GmPlayers[gmcounter] = _player;
gmcounter++;
}
}
updateCurrentPartyUi();
}
示例5: CreateBook
public static void CreateBook(string parent, string bookName, string strategy, string portfolio)
{
try
{
var exist = Env.Current.StaticData.GetPartyByCode(bookName);
if (exist != null)
{
throw new Exception(String.Format("Book {0} already exists!", bookName));
}
else
{
var entity = Env.Current.StaticData.GetPartyByCode(parent);
if (entity == null)
{
throw new Exception("Cannot find entity" + entity);
}
var newStrategy = new Party { Code = bookName, Name = bookName, ParentId = entity.Id, Role = Party.Book, Description = "Legacy strategy" };
newStrategy.SetProperty("Portfolio", portfolio);
newStrategy.SetProperty("Strategy", strategy);
Env.Current.StaticData.SaveParty(newStrategy);
ScriptBase.Logger.InfoFormat("Created book {0} in pfolio {1}.", bookName, portfolio);
}
}
catch (Exception ex)
{
ScriptBase.Logger.Error(ex);
}
}
示例6: BattleInfo
public BattleInfo(BattleType battleType, Party party1, Party party2)
{
_BattleType = battleType;
_ParticipatingParties = new List<Party>();
_ParticipatingParties.Add(party1);
_ParticipatingParties.Add(party2);
}
示例7: Add
public Party Add(Party item)
{
if (item == null)
throw new ArgumentNullException("Party is null");
using (Context con = new Context())
{
foreach (var ing in item.Menus)
{
if (con.Menu.FirstOrDefault(x => x.Id == ing.Id) == null)
throw new ArgumentException("You need to add the menu to the database first: " + ing.Name);
if (!con.Menu.FirstOrDefault(x => x.Id == ing.Id).Equals(ing))
throw new ArgumentException("You need to update the menu first: " + ing.Name);
}
if (con.Address.FirstOrDefault(x => x.Id == item.Address.Id) == null)
throw new ArgumentException("You need to add the address to the database first: " + item.Address.StreetAddress);
if (!con.Address.FirstOrDefault(x => x.Id == item.Address.Id).Equals(item.Address))
throw new ArgumentException("You need to update the address first: " + item.Address.StreetAddress);
if (con.Customer.FirstOrDefault(x => x.Id == item.Customer.Id) == null)
throw new ArgumentException("You need to add the customer to the database first: " + item.Customer.FirstName);
if (!con.Customer.FirstOrDefault(x => x.Id == item.Customer.Id).Equals(item.Customer))
throw new ArgumentException("You need to update the customer first: " + item.Customer.FirstName);
}
using (Context con = new Context())
{
item.Menus.ForEach(x => con.Menu.Find(x.Id));
con.Address.Attach(item.Address);
con.Customer.Attach(item.Customer);
item = con.Party.Add(item);
con.SaveChanges();
}
return item;
}
示例8: EncounterIntro
public EncounterIntro(Overworld overworld, Party enemyParty)
: base(overworld)
{
if (enemyParty == null)
throw new Exception("Party enemyParty cannot be null");
this.enemyParty = enemyParty;
}
示例9: recieveCurrentParty
void recieveCurrentParty(PhotonPlayer[] _players, bool _open)
{
List<PhotonPlayer> _players2 = new List<PhotonPlayer>();
foreach (PhotonPlayer _p in _players) { _players2.Add(_p); }
Party _party = new Party(_players2, _open);
GameObject.FindGameObjectWithTag("MenuController").GetComponentInChildren<SocialScreen>().recieveCurrentParty(_party);
}
示例10: run
public static void run()
{
string answer;
bool success = false;
Party p1 = new Party(true),
p2 = new Party();
do
{
if (success)
{
heal(p1);
}
else
{
p1 = initPlayerParty();
}
success = fight(p1, p2);
Console.WriteLine("\nGo another round? (y/n)");
answer = Console.ReadLine().ToLower();
Console.WriteLine();
} while (answer.Equals("y"));
Console.Write("Until the next time!");
Text.userRead();
}
示例11: AddToParty
public static void AddToParty(FighterData fighter, Party party)
{
// TODO: party capacity get.
if ((party.currentCost + fighter.cost) < GameData.instance.playerData.partyCapacity) {
party.Add (fighter);
}
}
示例12: HandlePartyInvitationDungeonRequest
public static void HandlePartyInvitationDungeonRequest(PartyInvitationDungeonRequestMessage message, WorldClient client)
{
WorldClient target = WorldServer.Instance.GetOnlineClient(message.name);
Party p;
if (client.Character.PartyMember == null)
{
WorldServer.Instance.Parties.OrderBy(x => x.Id);
int partyId = 0;
if (WorldServer.Instance.Parties.Count > 0)
{
partyId = WorldServer.Instance.Parties.Last().Id + 1;
}
else
{
partyId = 1;
}
p = new Party(partyId, client.Character.Id, "");
}
else
{
p = WorldServer.Instance.Parties.Find(x => x.Id == client.Character.PartyMember.Party.Id);
}
if (p == null)
return;
p.SetName(DungeonsIdRecord.DungeonsId.Find(x => x.Id == message.dungeonId).Name, client);
p.CreateInvitation(client, target, PartyTypeEnum.PARTY_TYPE_DUNGEON, message.dungeonId);
if (p.Members.Count == 0)
{
p.BossCharacterId = client.Character.Id;
p.NewMember(client);
}
}
示例13: AddAccountability
public void AddAccountability(Party parent,Party child)
{
Guard.Against<ArgumentNullException>(_partyHierarchyRepository == null, "建構式需指定repository");
PartyHierarchy partyHierarchy =
new PartyHierarchy()
{
Level = 1,
ParentPartyId = parent.Id,
ChildPartyId = child.Id,
PartyHierarchyType = PartyHierarchyType.Accountable
};
_partyHierarchyRepository.SaveOrUpdate(partyHierarchy);
IList<PartyHierarchy> allParents = _partyHierarchyRepository.
Query(q => q.ChildPartyId == parent.Id && q.PartyHierarchyType == PartyHierarchyType.Accountable);
foreach(var up in allParents)
{
PartyHierarchy hierarchy =
new PartyHierarchy()
{
Level = up.Level + 1,
ParentPartyId = up.ParentPartyId,
ChildPartyId = child.Id,
PartyHierarchyType = up.PartyHierarchyType
};
_partyHierarchyRepository.SaveOrUpdate(hierarchy);
}
}
示例14: AbilityModifier
public override double AbilityModifier(Party.DataEquipmentInformation weapon, Party.DataEquipmentInformation armor, Party.DataEquipmentInformation accessory, Ability ability)
{
if (ability.IsJumpAttack())
{
return 1.25;
}
return 1.0;
}
示例15: Encounter
public Encounter(Overworld overworld, Party enemyParty)
: base(overworld)
{
this.enemyParty = enemyParty;
// In here instead of Start() to stop flicker when the state is rendered before Start() is called. The EncounterRenderer doesn't rely on the state of Encounter anyway
OverworldStateRenderer = new EncounterRenderer(this);
}