text stringlengths 13 6.01M |
|---|
using System.Linq;
using System.Text;
using Vintagestory.API.Client;
using Vintagestory.API.Common;
using Vintagestory.API.Config;
using Vintagestory.GameContent;
namespace OreCrystals
{
class CrystalPlanter: Block
{
public override void OnCreatedByCrafting(ItemSlot[] allInputslots, ItemSlot outputSlot, GridRecipe byRecipe)
{
ItemSlot oreSlot = null, planterSlot = null;
foreach(ItemSlot slot in allInputslots)
{
if(!slot.Empty)
{
if (slot.Itemstack.Collectible is BlockOre)
oreSlot = slot;
else if (slot.Itemstack.Collectible is BlockPlantContainer)
planterSlot = slot;
}
}
if(oreSlot != null && planterSlot != null)
{
Block block = api.World.GetBlock(new AssetLocation("orecrystals", "crystal_planter-" + oreSlot.Itemstack.Collectible.LastCodePart(1) + "-" + oreSlot.Itemstack.Collectible.LastCodePart(0) + "-" + planterSlot.Itemstack.Collectible.LastCodePart()));
ItemStack outStack = new ItemStack(block);
outputSlot.Itemstack = outStack;
}
base.OnCreatedByCrafting(allInputslots, outputSlot, byRecipe);
}
public override void GetHeldItemInfo(ItemSlot inSlot, StringBuilder dsc, IWorldAccessor world, bool withDebugInfo)
{
base.GetHeldItemInfo(inSlot, dsc, world, withDebugInfo);
//string description = Lang.Get("orecrystals:blockhelp-crystal-planter-desc");
//dsc.Append(description);
}
/*
public override RichTextComponentBase[] GetHandbookInfo(ItemSlot inSlot, ICoreClientAPI capi, ItemStack[] allStacks, ActionConsumable<string> openDetailPageFor)
{
RichTextComponentBase[] oldText = base.GetHandbookInfo(inSlot, capi, allStacks, openDetailPageFor);
RichTextComponentBase[] derp = new RichTextComponentBase[1] { new RichTextComponent(capi, Lang.Get("orecrystals:blockhelp-crystal-planter-desc"), CairoFont.WhiteSmallText()) };
oldText[1] = new RichTextComponent(capi, Lang.Get("orecrystals:blockhelp-crystal-planter-title"), CairoFont.WhiteSmallishText());
return oldText.Concat(derp).ToArray();
}
*/
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Windows.Media.Imaging;
namespace ET.Interface
{
//模块头元数据 延迟加载时只读取模块头
[MetadataAttribute]
[AttributeUsage(AttributeTargets.Class)]
public class ModuleHeaderAttribute : Attribute
{
//模块主键
public String ModuleKey { get; set; }
//模块显示名称
public String ModuleShowName { get; set; }
//模块等级 排序使用
public Int32 ILevel { get; set; }
//是否只支持单个文件
public bool IsOnlyOneFile { get; set; }
public BitmapImage ModuleIcon { get; set; }
public BitmapImage FileIcon { get; set; }
}
}
|
using JeopardySimulator.Ui.ViewModels;
using Xunit;
namespace JeopardySimulator.Tests
{
public class CommandResultTests
{
[Fact]
public void TestActivateWhenDisabledThenDonotActivate()
{
//Assign
CommandResultViewModel viewModel = new CommandResultViewModel("aa", false, true);
//Act
viewModel.Activate(100);
//Assert
Assert.True(!viewModel.IsActivated);
}
[Fact]
public void TestAddScoreCommandWhenExecutedThenScoreAdded()
{
//Assign
CommandResultViewModel viewModel = new CommandResultViewModel("aa");
int prevScore = viewModel.Score;
const int cost = 999;
//Act
viewModel.AddScoreCommand.Execute(cost);
//Assert
Assert.True(viewModel.Score == prevScore + cost);
}
[Fact]
public void TestSubstractScoreCommandWhenExecutedThenScoreSubstractedOrNil()
{
//Assign
CommandResultViewModel viewModel = new CommandResultViewModel("aa");
int prevScore = viewModel.Score;
const int cost = 999;
//Act
viewModel.SubstractScoreCommand.Execute(cost);
//Assert
Assert.True(viewModel.Score == prevScore - cost);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ChessZu : ChessEntity
{
public override void ShowChessPath()
{
base.ShowChessPath();
int index_x = (int)chessObj.chess_index_x;
int index_z = (int)chessObj.chess_index_z;
// 自己的卒
if (chessObj.chess_owner_player == 1)
{
if(index_z < 9)
{
SetIndexPath(index_x, index_z + 1);
}
if (index_z >= 5)
{
SetIndexPath(index_x - 1, index_z);
SetIndexPath(index_x + 1, index_z);
}
}
else
{
if (index_z > 0)
{
SetIndexPath(index_x, index_z - 1);
}
if (index_z <= 4)
{
SetIndexPath(index_x - 1, index_z);
SetIndexPath(index_x + 1, index_z);
}
}
}
public override ChessType GetChessType()
{
return ChessType.ChessTypeZu;
}
}
|
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
namespace ILoggerSamples
{
[TestClass]
public class ILoggerTests
{
#region Fields
private Mock<ILogger<LogTest>> _loggerMock;
private LogTest _logTest;
#endregion
#region Setup
[TestInitialize]
public void Setup()
{
_loggerMock = new Mock<ILogger<LogTest>>();
_logTest = new LogTest(_loggerMock.Object);
}
#endregion
#region Tests
[TestMethod]
public void TestLogInformation()
{
_logTest.Process();
_loggerMock.Verify(l => l.Log(
LogLevel.Information,
It.IsAny<EventId>(),
It.IsAny<It.IsAnyType>(),
It.IsAny<Exception>(),
(Func<It.IsAnyType, Exception, string>)It.IsAny<object>()), Times.Exactly(1));
}
[TestMethod]
public void TestLogError()
{
var recordId = new Guid("0b88ae00-7889-414a-aa26-18f206470001");
_logTest.ProcessWithException(recordId);
_loggerMock.Verify
(
l => l.Log
(
//Check the severity level
LogLevel.Error,
//This may or may not be relevant to your scenario
It.IsAny<EventId>(),
//This is the magical Moq code that exposes internal log processing from the extension methods
It.Is<It.IsAnyType>((state, t) =>
//This confirms that the correct log message was sent to the logger. {OriginalFormat} should match the value passed to the logger
//Note: messages should be retrieved from a service that will probably store the strings in a resource file
CheckValue(state, LogTest.ErrorMessage, "{OriginalFormat}") &&
//This confirms that an argument with a key of "recordId" was sent with the correct value
//In Application Insights, this will turn up in Custom Dimensions
CheckValue(state, recordId, nameof(recordId))
),
//Confirm the exception type
It.IsAny<NotImplementedException>(),
//Accept any valid Func here. The Func is specified by the extension methods
(Func<It.IsAnyType, Exception, string>)It.IsAny<object>()),
//Make sure the message was logged the correct number of times
Times.Exactly(1)
);
}
[TestMethod]
public void TestConsoleLoggingWithBeginScope()
{
var hostBuilder = Host.CreateDefaultBuilder().
ConfigureLogging((builderContext, loggingBuilder) =>
{
loggingBuilder.AddConsole((options) =>
{
//This displays arguments from the scope
options.IncludeScopes = true;
});
});
var host = hostBuilder.Build();
var logger = host.Services.GetRequiredService<ILogger<LogTest>>();
//This specifies that every time a log message is logged, the correlation id will be logged as part of it
using (logger.BeginScope("Correlation ID: {correlationID}", 123))
{
logger.LogInformation("Test");
logger.LogInformation("Test2");
}
}
[TestMethod]
public void TestConsoleLoggingCategory()
{
var hostBuilder = Host.CreateDefaultBuilder().
ConfigureLogging((builderContext, loggingBuilder) =>
{
loggingBuilder.AddConsole((options) =>
{
//This displays arguments from the scope
options.IncludeScopes = true;
});
});
var host = hostBuilder.Build();
var loggers = host.Services.GetRequiredService<ILoggerFactory>();
var logger = loggers.CreateLogger("Category1");
logger.LogInformation("Test");
}
#endregion
#region Private Methods
/// <summary>
/// Checks that a given key exists in the given collection, and that the value matches
/// </summary>
private static bool CheckValue(object state, object expectedValue, string key)
{
var keyValuePairList = (IReadOnlyList<KeyValuePair<string, object>>)state;
var actualValue = keyValuePairList.First(kvp => string.Compare(kvp.Key, key, StringComparison.Ordinal) == 0).Value;
return expectedValue.Equals(actualValue);
}
#endregion
}
}
|
using System;
using System.Collections.Generic;
using System.Security.Claims;
using JourniAPI.Models;
using JourniAPI.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using MongoDB.Bson;
namespace JourniAPI.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class PlacesController : ControllerBase
{
private readonly PlaceService _placeService;
public PlacesController(PlaceService placeService)
{
_placeService = placeService;
}
[Authorize]
[HttpGet]
public ActionResult<List<string>> GetAllPlaces()
{
string id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
return _placeService.GetAllPlaces(id);
}
[Authorize]
[HttpPost("{place.PlaceId}")]
public ActionResult<Day> AddPlace(string tripId, Place place)
{
ObjectId _id = ObjectId.Parse(tripId);
string id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
return _placeService.AddPlace(id, _id, place);
}
[Authorize]
[HttpDelete("{placeId}")]
public ActionResult<Day> RemovePlace(string placeId)
{
string id = User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
return _placeService.RemovePlace(id, placeId);
}
}
}
|
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
namespace ClipModels
{
public class CreditsTraf : TrafficList
{
//public int ID { get; set; }
CategoryDBContext db = new CategoryDBContext();
public int CreditsRoleId { get; set; }
[DisplayName("Credits Name")]
public string CreditsName { get; set; }
[DisplayName("Contact Details")]
public string CreditsContactsDetails { get; set; }
[NotMapped]
public string CreditsRoleIdStr
{
get
{
CreditsRole tmp = db.CreditsRoles.Find(CreditsRoleId);
if (tmp != null)
return tmp.Name;
else
return "";
}
}
//public virtual TrafficClip TrafficClip { get; set; }
//public int TrafficClipId { get; set; }
}
}
|
using System.Collections.Generic;
using SharpArch.Domain.DomainModel;
namespace Profiling2.Domain.Prf.Sources
{
/// <summary>
/// This entity represents an organisation or section within the peacekeeping mission which may have contributed
/// sources to the database. The attribute 'SourcePathPrefix' represents the share drive path where this entity's
/// files may have been imported from.
///
/// User accounts may also be linked to this entity. Together, these attributes, when saved in the Lucene index,
/// grant access to sources. For example a file from the human rights office (JHRO) may be accessible by a user
/// who is a member of JHRO.
/// </summary>
public class SourceOwningEntity : Entity
{
public virtual string Name { get; set; }
public virtual string SourcePathPrefix { get; set; }
public virtual IList<AdminUser> AdminUsers { get; set; }
public virtual IList<Source> Sources { get; set; }
public SourceOwningEntity()
{
this.AdminUsers = new List<AdminUser>();
this.Sources = new List<Source>();
}
}
}
|
using System;
namespace JakePerry.Reflection
{
[Flags]
public enum MemberFlags
{
None = 0,
Field = 1 << 0,
Property = 1 << 1,
Method = 1 << 2
}
}
|
using HBPonto.Database.Entities;
using Microsoft.EntityFrameworkCore;
using static HBPonto.Database.Maps.UserMap;
namespace HBPonto.Database.Contexts
{
public class UserContext: DbContext
{
public UserContext(DbContextOptions<UserContext> options) : base(options) { }
public virtual DbSet<User> Users { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(UserMapFactory.CreateInstance());
}
}
}
|
using Gdk;
using System.Collections.Generic;
using test1.Draw.Object;
using test1.Common;
namespace test1.Draw.Canvas
{
public class DefaultCanvas : ICanvas
{
Window _drawWindow;
readonly List<ObjectBase> _drawObjects;
public DefaultCanvas(Window window)
{
_drawObjects = new List<ObjectBase>();
_drawWindow = window;
}
public Window DrawWindow
{
get => _drawWindow;
set => _drawWindow = value;
}
public List<ObjectBase> DrawObjects => _drawObjects;
public void AddDrawObject(ObjectBase drawObject)
{
_drawObjects.Add(drawObject);
}
public void RemoveDrawObject(ObjectBase drawObject)
{
_drawObjects.Remove(drawObject);
}
public void Update()
{
DrawWindow.Clear();
Draw();
}
public void Draw()
{
foreach (ObjectBase drawObject in _drawObjects)
{
drawObject.Draw(DrawWindow);
}
}
}
}
|
using System;
using Framework.Core.Common;
namespace Tests.Data.Van.Input
{
internal class CutTurfData
{
static Random ran = new Random();
public string Activistcode = "Constituency: Charter School Parnt(Public)";
public int Point1x = 500; //249;
public int Point1y = 400;
public int Point2x = ran.Next(0, 400) - 200;
public int Point2y = ran.Next(0, 400) - 200;
public int Point3x = ran.Next(0, 400) - 200;
public int Point3y = ran.Next(0, 400) - 200;
public int Point4x = ran.Next(0, 400) - 200;
public int Point4y = ran.Next(0, 400) - 200;
public int Point5x = ran.Next(0, 400) - 200;
public int Point5y = ran.Next(0, 400) - 200;
public int dragpoint1x = ran.Next(0, 400)-200;//300;
public int dragpoint1y = ran.Next(0, 400) - 200;//100;
public int cutnumber = 6;
public int movenumber = 3;
public int editmovenumber = 1;
public string numberofautomaticcut = "3";
public string FolderName = "yuan";
public String Name = FakeData.RandomLetterString(5);//"aa";
}
} |
using UnityEngine;
using UnityEngine.UI;
using SimpleJSON;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class Game : MonoBehaviour {
[Header("Droprate")]
public int[] ItemRate;
public string[] ItemQuantity;
public string[] ItemType;
public string[] ItemName;
public string[] ItemFileName;
public int weightTotal;
public int MonsterLevel1,MonsterEXP1,MonsterGrade1,MonsterLevel2,MonsterEXP2,MonsterGrade2,MonsterLevel3,MonsterEXP3,MonsterGrade3,attacking,mapexpsimpan;
public float monstercurrentexp1,tempmonsterexp1,monstercurrentexp2,tempmonsterexp2,monstercurrentexp3,tempmonsterexp3,PlayerHPCurrent,PlayerHPMax,EnemiesHPCurrent,EnemiesHPMax;
public float Targetnextlevel1, Targetnextlevel2, Targetnextlevel3;
public int GetCritical;
public int Strike_Ele=0;
public string playerhantuid1,playerhantuid2,playerhantuid3,PlayerID,StageChoose;
public GameObject bintang1, bintang2, bintang3, bintang4, bintang5,validationError;
// public bool replay;
public Image[] Rewards, DropRewardsImage;
bool pressed=true;
lifeless lf;
public float times = 60;
bool critical=false;
public bool tanding=false;
public bool level1 = false;
bool data_belum_ada = true;
bool panggil_url = false;
bool repeat = true;
bool ulang=false;
bool auto = false;
bool Ab = false;
bool Bb = false;
public GameObject waiting,CameraEnd,CameraEndA,EndOptionButton,ClaimUI,sh1,sh2,sh3,sh1a,sh2a,sh3a,bukuBB,trouble1, hasilburu;
public LayerMask everything, monster;
public GameObject[] EndOption;
public TextMesh damageA, damageB;
public float damage,damage2;
public bool levelingmate;
public WWWForm formkirimreward;
public GameObject[] urutan1;
public GameObject[] urutan2;
public GameObject[] urutan3;
public GameObject Aobject, Bobject, karaA, karaB;
private Animation karaBanimation,model11a,model21a,model12a,model22a,model13a,model23a;
private SkinnedMeshRenderer karaBskin,karaBbukuskin;
public GameObject canvas1,canvas2,canvas3,canvas4,canvas5,canvas6;
public GameObject Monster1GO, Monster2GO, Monster3GO,hantuchoose1, hantuchoose2, hantuchoose3,hantugo1,hantugo2,hantugo3,hantugom1,hantugom2,hantugom3;
public Transform m1, m2, m3;
public GameObject effect;
public string[] suit1;
public string[] suit2;
public string[] suit3;
public float[] health1;
public float[] health2;
public float[] health3;
public GameObject[] healthBar1;
public GameObject[] healthBar2;
public GameObject[] healthBar3;
public GameObject scrollBar,vs,speedOption;
public string[] equipmentreward;
public string[] itemsreward;
public Sprite Charge;
public Sprite Block;
public Sprite Focus;
public Image icon1;
public Image icon2;
public Image icon3;
public float timer = 3f;
public bool timeUps = false;
bool multitime=false;
int nilai;
public GameObject plihan1;
public GameObject plihan2;
public GameObject plihan3;
public GameObject[] pilihanInputSuit;
private List<string> alpha = new List<string>{"0","1","2"};
public GameObject getReady;
public bool getReadyStatus = false;
public Sprite aIcon;
public Sprite bIcon;
public AudioClip[] Sfx;
public AudioSource hitYa;
// int pos1_car1_int = 0;
// int pos1_car2_int = 0;
// int pos1_car3_int = 0;
//
// int pos2_car1_int = 0;
// int pos2_car2_int = 0;
// int pos2_car3_int = 0;
public GameObject healthA1, healthA2, healthA3,healthB1, healthB2, healthB3, firstTimerGame, CB, PlayerHP, EnemiesHP;
public Text User1, debug,ClaimText,EXPValueText, joustingnameA,joustingnameB, joustingnameA1, joustingnameB1, joustingnameA2, joustingnameB2;
public Text User2;
public Vector3 joustingpostition;
GameObject model1_1;
GameObject model2_1;
GameObject model1_2;
GameObject model2_2;
GameObject model1_3;
GameObject model2_3;
GameObject effect1_1;
GameObject effect2_1;
GameObject effect1_2;
GameObject effect2_2;
GameObject effect1_3;
GameObject effect2_3;
public ParticleSystem A;
public ParticleSystem B;
public ParticleSystem Charge_A;
public ParticleSystem Charge_B;
public ParticleSystem Seri_A;
public ParticleSystem Seri_Adef;
public ParticleSystem Seri_B;
public ParticleSystem Seri_Bdef;
public GameObject Nyala;
bool presentDone;
[Header("Diperlukan Untuk SELAIN JOUSTING")]
public GameObject cameraA;
public GameObject cameraB;
public GameObject hospital, school, warehouse,oldhouse,bridge,graveyard,ArenaDuel,ArenaDuelAR;
//Tambah New Variabel untuk JOUSTING
[Header("Diperlukan Untuk JOUSTING")]
public GameObject envi;
public GameObject CameraAR,CameraAR2;
public GameObject CameraTarget, FightingTarget;
public GameObject hospitalAR;
public GameObject h1cubea, h2cubea, h3cubea, h1cubeb, h2cubeb, h3cubeb;
private bool ApakahCameraA = false;
public Text dg;
void Awake()
{
SetReward();
SetLocation();
}
void SetLocation()
{
var lokasi = PlayerPrefs.GetString (Link.LOKASI);
if (lokasi == "Warehouse")
{
warehouse.SetActive (true);
}
else if (lokasi == "School")
{
school.SetActive (true);
}
else if (lokasi == "Hospital")
{
hospital.SetActive (true);
}
else if (lokasi == "Bridge")
{
bridge.SetActive (true);
}
else if (lokasi == "Graveyard")
{
graveyard.SetActive (true);
}
else if (lokasi == "Old House")
{
oldhouse.SetActive (true);
}
else if (lokasi == "ArenaDuel")
{
ArenaDuel.SetActive (true);
}
else if (lokasi == "ArenaDuelAR")
{
ArenaDuelAR.SetActive(true);
}
}
public void nextornot()
{
int stage = int.Parse(PlayerPrefs.GetString(Link.StageChoose));
EndOption[2].SetActive (false);
if(stage==5||stage==11||stage==17||stage==23||stage==29||stage==35)
{
EndOption[4].transform.position = EndOption[3].transform.position;
EndOption[3].SetActive (false);
}
}
public void Dialogue(bool start)
{
int stage = int.Parse(PlayerPrefs.GetString(Link.Stage));
int stageChoose = int.Parse(PlayerPrefs.GetString(Link.StageChoose));
print("Gaben {0}"+ stageChoose);
if(!PlayerPrefs.HasKey("StageDialogueEnd"+stage.ToString()))
{
PlayerPrefs.SetString("StageDialogueEnd"+stage.ToString(),"False");
}
if(!PlayerPrefs.HasKey("StageDialogueStart"+stage.ToString()))
{
PlayerPrefs.SetString("StageDialogueStart"+stage.ToString(),"False");
}
bool test = bool.Parse(PlayerPrefs.GetString("StageDialogueEnd"+stage.ToString()));
bool cek = bool.Parse(PlayerPrefs.GetString("StageDialogueStart"+stage.ToString()));
switch(stage)
{
case 6:
if(!test&&!start)
{
PlayerPrefs.SetString("StageDialogueEnd"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("OldHouseEnd");
}
else if(!cek&&start&&stageChoose==6)
{
print("here0");
PlayerPrefs.SetString("StageDialogueStart"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("SchoolStart");
}
break;
case 12:
if(!test&&!start)
{
PlayerPrefs.SetString("StageDialogueEnd"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("SchoolEnd");
}
else if(!cek&&start&&stageChoose==12)
{
PlayerPrefs.SetString("StageDialogueStart"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("HospitalStart");
}
break;
case 18:
if(!test&&!start)
{
PlayerPrefs.SetString("StageDialogueEnd"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("HospitalEnd");
}
else if(!cek&&start&&stageChoose==18)
{
PlayerPrefs.SetString("StageDialogueStart"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("BridgeStart");
}
break;
case 24:
if(!test&&!start)
{
PlayerPrefs.SetString("StageDialogueEnd"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("BridgeEnd");
}
else if(!cek&&start&&stageChoose==24)
{
PlayerPrefs.SetString("StageDialogueStart"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("GraveyardStart");
}
break;
case 30:
if(!test&&!start)
{
PlayerPrefs.SetString("StageDialogueEnd"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("GraveyardEnd");
}
else if(!cek&&start&&stageChoose==30)
{
PlayerPrefs.SetString("StageDialogueStart"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("WarehouseStart");
}
break;
case 36:
if(!test&&!start)
{
PlayerPrefs.SetString("StageDialogueEnd"+stage.ToString(),"True");
SceneManagerHelper.LoadTutorial("WarehouseEnd");
}
break;
}
}
private void TutorBuru()
{
hantugom1.transform.localPosition = new Vector3 (0,0.011f,-.523f);
sh1a.transform.localPosition=new Vector3 (0,-0.033f,-.523f);
Nyala.transform.Find ("HolyEffect2 (3)").gameObject.SetActive (false);
Nyala.transform.Find ("HolyEffect2 (5)").gameObject.SetActive (false);
PlayerPrefs.SetString (Link.POS_1_CHAR_2_FILE, "");
PlayerPrefs.SetString (Link.POS_1_CHAR_3_FILE, "");
}
private void playoneshot(int whichSound)
{
hitYa.PlayOneShot(Sfx[whichSound]);
}
IEnumerator Played(){
string url = Link.url + "statusberburu";
formkirimreward.AddField ("MY_ID", PlayerID);
formkirimreward.AddField ("ID_Bermain", PlayerPrefs.GetString ("ID_bermain"));
WWW www = new WWW(url,formkirimreward);
yield return www;
if (www.error == null) {
}
Debug.Log (www.text);
}
IEnumerator Stage()
{
string url = Link.url + "Stage";
WWWForm form = new WWWForm();
form.AddField("MY_ID", PlayerID);
form.AddField("STAGE", StageChoose);
WWW www = new WWW(url, form);
yield return www;
if (www.error == null)
{
var jsonString = JSON.Parse(www.text);
int kode = int.Parse(jsonString["code"]);
if (kode == 1)
{
PlayerPrefs.SetString(Link.Stage, jsonString["data"]["Stage"]);
// PlayerPrefs.SetString(Link.Replay, "TRUE");
}
else
{
Debug.Log("BackSound Jangkrink");
}
}
Debug.Log(www.text);
}
private void NotGetCriticalAttack()
{
//cameraA.SetActive (true);
cameraB.SetActive (true);
cameraB.GetComponent<Camera> ().cullingMask = -139265;
cameraB.transform.Find ("PlaneP").gameObject.SetActive (false);
cameraA.transform.Find ("PlaneP").gameObject.SetActive (false);
karaBbukuskin.enabled = false;
karaA.transform.Find ("book001").GetComponent<SkinnedMeshRenderer> ().enabled = false;
karaA.GetComponent<SkinnedMeshRenderer> ().enabled = false;
karaBskin.enabled = false;
//pilihanInputSuit [9].SetActive (true);
//pilihanInputSuit [9].transform.FindChild ("VS").GetComponent<Animator> ().PlayInFixedTime ("versus animation", 0, 0);
if (PlayerPrefs.GetString ("Urutan1m") == "Hantu1A") {
hidegameobject(hantugom3,hantugom2);
hantugom1.transform.localPosition = new Vector3 (0, 0.011f, -.523f);
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Fire") {
// cameraA.transform.FindChild ("Plane").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Water") {
// cameraA.transform.FindChild ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Wind") {
// cameraA.transform.FindChild ("Plane3").gameObject.SetActive (true);
}
}
if (PlayerPrefs.GetString ("Urutan1m") == "Hantu2A") {
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Fire") {
// cameraA.transform.FindChild ("Plane").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Water") {
// cameraA.transform.FindChild ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Wind") {
// cameraA.transform.FindChild ("Plane3").gameObject.SetActive (true);
}
hidegameobject(hantugom1,hantugom3);
hantugom2.transform.localPosition = new Vector3 (0, 0.011f, -.523f);
}
if (PlayerPrefs.GetString ("Urutan1m") == "Hantu3A") {
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Fire") {
// cameraA.transform.FindChild ("Plane").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Water") {
// cameraA.transform.FindChild ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Wind") {
// cameraA.transform.FindChild ("Plane3").gameObject.SetActive (true);
}
hidegameobject(hantugom1,hantugom2);
hantugom3.transform.localPosition = new Vector3 (0, 0.011f, -.523f);
}
if (PlayerPrefs.GetString ("Urutan1") == "Hantu1B") {
hantugo1.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
// hantugo1.SetActive (true);
// if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Fire") {
// cameraB.transform.FindChild ("Plane").gameObject.SetActive (true);
// }
// if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Water") {
// cameraB.transform.FindChild ("Plane2").gameObject.SetActive (true);
// }
// if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Wind") {
// cameraB.transform.FindChild ("Plane3").gameObject.SetActive (true);
// }
Debug.Log (PlayerPrefs.GetString ("Suit1"));
if (PlayerPrefs.GetString ("Suit1") != "Kosong") {
hidegameobject(hantugo3,hantugo2);
}
// hantugo2.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
// hantugo3.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
//
} else if (PlayerPrefs.GetString ("Urutan1") == "Hantu2B") {
hantugo2.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Fire") {
// cameraB.transform.FindChild ("Plane").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Water") {
// cameraB.transform.FindChild ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Wind") {
// cameraB.transform.FindChild ("Plane3").gameObject.SetActive (true);
}
// hantugo1.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
if (PlayerPrefs.GetString ("Suit1") != "Kosong") {
//hantugo1.SetActive (false);
hidegameobject(hantugo1,hantugo3);
}
// hantugo3.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
} else if (PlayerPrefs.GetString ("Urutan1") == "Hantu3B") {
hantugo3.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Fire") {
// cameraB.transform.FindChild ("Plane").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Water") {
// cameraB.transform.FindChild ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Wind") {
// cameraB.transform.FindChild ("Plane3").gameObject.SetActive (true);
}
// hantugo1.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
//
// hantugo2.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
if (PlayerPrefs.GetString ("Suit1") != "Kosong") {
hidegameobject(hantugo1,hantugo2);
}
}
//}
if (PlayerPrefs.GetInt ("pos") == 1) {
cameraA.SetActive (true);
}
else {
cameraB.SetActive (true);
}
cameraB.transform.position = new Vector3 (8.75f, 9.98f, 12.7f);
cameraB.transform.rotation = Quaternion.Euler (0, 295.4f, 0);
scrollBar.SetActive (false);
speedOption.SetActive (false);
pilihanInputSuit [0].SetActive (false);
pilihanInputSuit [1].SetActive (false);
pilihanInputSuit [2].SetActive (false);
//single player
if(level1){
effect1_1.SetActive (false);
effect2_1.SetActive (false);
effect1_2.SetActive (false);
effect2_2.SetActive (false);
effect1_3.SetActive (false);
effect2_3.SetActive (false);
}
}
private void GetCriticalAttack()
{
cameraA.SetActive (true);
cameraB.SetActive (true);
cameraB.GetComponent<Camera> ().cullingMask = -139265;
cameraB.transform.Find ("PlaneP").gameObject.SetActive (false);
cameraA.transform.Find ("PlaneP").gameObject.SetActive (false);
karaBbukuskin.enabled = false;
karaA.transform.Find ("book001").GetComponent<SkinnedMeshRenderer> ().enabled = false;
karaA.GetComponent<SkinnedMeshRenderer> ().enabled = false;
karaBskin.enabled = false;
pilihanInputSuit [9].SetActive (true);
pilihanInputSuit [9].transform.Find ("VS").GetComponent<Animator> ().PlayInFixedTime ("versus animation", 0, 0);
if (PlayerPrefs.GetString ("Urutan1m") == "Hantu1A") {
hidegameobject(hantugom3,hantugom2);
hantugom1.transform.localPosition = new Vector3 (0, 0.011f, -.523f);
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Fire") {
cameraA.transform.Find ("Plane").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Water") {
cameraA.transform.Find ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Wind") {
cameraA.transform.Find ("Plane3").gameObject.SetActive (true);
}
}
if (PlayerPrefs.GetString ("Urutan1m") == "Hantu2A") {
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Fire") {
cameraA.transform.Find ("Plane").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Water") {
cameraA.transform.Find ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Wind") {
cameraA.transform.Find ("Plane3").gameObject.SetActive (true);
}
hidegameobject(hantugom1,hantugom3);
hantugom2.transform.localPosition = new Vector3 (0, 0.011f, -.523f);
}
if (PlayerPrefs.GetString ("Urutan1m") == "Hantu3A") {
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Fire") {
cameraA.transform.Find ("Plane").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Water") {
cameraA.transform.Find ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [0].GetComponent<PlayAnimation> ().element == "Wind") {
cameraA.transform.Find ("Plane3").gameObject.SetActive (true);
}
hidegameobject(hantugom1,hantugom2);
hantugom3.transform.localPosition = new Vector3 (0, 0.011f, -.523f);
}
if (PlayerPrefs.GetString ("Urutan1") == "Hantu1B") {
hantugo1.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
// hantugo1.SetActive (true);
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Fire") {
cameraB.transform.Find ("Plane").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Water") {
cameraB.transform.Find ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Wind") {
cameraB.transform.Find ("Plane3").gameObject.SetActive (true);
}
Debug.Log (PlayerPrefs.GetString ("Suit1"));
if (PlayerPrefs.GetString ("Suit1") != "Kosong") {
hidegameobject(hantugo3,hantugo2);
}
// hantugo2.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
// hantugo3.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
//
} else if (PlayerPrefs.GetString ("Urutan1") == "Hantu2B") {
hantugo2.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Fire") {
cameraB.transform.Find ("Plane").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Water") {
cameraB.transform.Find ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Wind") {
cameraB.transform.Find ("Plane3").gameObject.SetActive (true);
}
// hantugo1.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
if (PlayerPrefs.GetString ("Suit1") != "Kosong") {
hidegameobject(hantugo1,hantugo3);
}
// hantugo3.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
} else if (PlayerPrefs.GetString ("Urutan1") == "Hantu3B") {
hantugo3.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Fire") {
cameraB.transform.Find ("Plane").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Water") {
cameraB.transform.Find ("Plane2").gameObject.SetActive (true);
}
if (urutan1 [1].GetComponent<PlayAnimation> ().element == "Wind") {
cameraB.transform.Find ("Plane3").gameObject.SetActive (true);
}
// hantugo1.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
//
// hantugo2.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
if (PlayerPrefs.GetString ("Suit1") != "Kosong") {
hidegameobject(hantugo1,hantugo2);
}
}
//}
if (suit1 [1] == "Charge") {
hantuchoose1.SetActive (true);
hantuchoose1.GetComponent<Animator>().Play("GuntingtestB", -1,0f);
}
if (suit1 [1] == "Focus") {
hantuchoose2.SetActive (true);
hantuchoose2.GetComponent<Animator>().Play("GuntingtestB", -1, 0f);
}
if (suit1 [1] == "Block") {
hantuchoose3.SetActive (true);
hantuchoose3.GetComponent<Animator>().Play("GuntingtestB", -1, 0f);
}
if (suit1 [0] == "Charge") {
pilihanInputSuit[6].SetActive (true);
pilihanInputSuit[6].GetComponent<Animator>().Play("Gunting2", -1, 0f);
}
if (suit1 [0] == "Focus") {
pilihanInputSuit[7].SetActive (true);
pilihanInputSuit[7].GetComponent<Animator>().Play("Gunting2", -1, 0f);
}
if (suit1 [0] == "Block") {
pilihanInputSuit[8].SetActive (true);
pilihanInputSuit[8].GetComponent<Animator>().Play("Gunting2", -1, 0f);
}
if (PlayerPrefs.GetInt ("pos") == 1) {
cameraA.SetActive (true);
}
else {
cameraB.SetActive (true);
}
cameraA.GetComponent<Animator> ().SetBool ("idling", true);
cameraB.GetComponent<Animator> ().SetBool ("idling", true);
cameraB.transform.position = new Vector3 (8.75f, 9.98f, 12.7f);
cameraB.transform.rotation = Quaternion.Euler (0, 295.4f, 0);
scrollBar.SetActive (false);
speedOption.SetActive (false);
pilihanInputSuit [0].SetActive (false);
pilihanInputSuit [1].SetActive (false);
pilihanInputSuit [2].SetActive (false);
//single player
if(level1){
effect1_1.SetActive (false);
effect2_1.SetActive (false);
effect1_2.SetActive (false);
effect2_2.SetActive (false);
effect1_3.SetActive (false);
effect2_3.SetActive (false);
}
}
void sebelumwar(int getCritical){
if (PlayerPrefs.GetString(Link.SEARCH_BATTLE) == "JOUSTING") {
CameraAR2.SetActive(false);
joustingpostition = envi.transform.position;
envi.transform.SetParent(FightingTarget.transform);
envi.transform.localPosition = new Vector3(0, -0.001098633f, -6.103516e-05f);
envi.transform.localRotation = Quaternion.Euler(0, 0, 0);
}
print(getCritical);
if(getCritical<=1f)
{
GetCriticalAttack();
}
else
{
if (critical && attacking>=3 && PlayerPrefs.GetString(Link.JENIS) == "SINGLE")
{
GetCriticalAttack();
}
else
{
NotGetCriticalAttack();
}
}
}
void sebelumwar2(){
if (PlayerPrefs.GetString(Link.SEARCH_BATTLE) == "JOUSTING") {
CameraAR2.SetActive(true);
envi.transform.SetParent(CameraTarget.transform);
envi.transform.localPosition = new Vector3(0, -0.001098633f, -6.103516e-05f);
envi.transform.localRotation = Quaternion.Euler(0, 0, 0);
// envi.transform.position = joustingpostition;
}
if (PlayerPrefs.GetInt ("speedscale") == 1) {
Time.timeScale = .6f;
}
pilihanInputSuit [9].SetActive (false);
if (PlayerPrefs.GetInt ("pos") == 1) {
cameraA.GetComponent<Animator> ().Play("New State");
cameraB.SetActive(false);
}
else {
cameraB.GetComponent<Animator> ().Play("New State");
cameraA.SetActive(false);
}
hantuchoose1.SetActive (false);
hantuchoose2.SetActive (false);
hantuchoose3.SetActive (false);
pilihanInputSuit [6].SetActive (false);
pilihanInputSuit [7].SetActive (false);
pilihanInputSuit [8].SetActive (false);
cameraB.GetComponent<Animator> ().SetBool ("Fighting", true);
cameraA.GetComponent<Animator> ().SetBool ("Fighting", true);
// hantugo1.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
// hantugo2.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
// hantugo3.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
pilihanInputSuit [0].SetActive (false);
pilihanInputSuit [1].SetActive (false);
pilihanInputSuit [2].SetActive (false);
cameraB.transform.Find ("Plane").gameObject.SetActive (false);
cameraB.transform.Find ("Plane2").gameObject.SetActive (false);
cameraB.transform.Find ("Plane3").gameObject.SetActive (false);
cameraA.transform.Find ("Plane").gameObject.SetActive (false);
cameraA.transform.Find ("Plane2").gameObject.SetActive (false);
cameraA.transform.Find ("Plane3").gameObject.SetActive (false);
// hantuchoose1.SetActive (false);
// hantuchoose2.SetActive (false);
// hantuchoose3.SetActive (false);
//Time.timeScale = 1f;
cameraB.transform.position = new Vector3 (35, 9, 7);
cameraB.transform.rotation = Quaternion.Euler (0, -100.8f, 0);
}
void Start () {
//PlayerPrefs.SetString ("PLAY_TUTORIAL","TRUE");
winner3.transform.Find("KartuHantu").GetComponent<Image>().overrideSprite=Resources.Load<Sprite>("icon_charLama/" + PlayerPrefs.GetString (Link.POS_1_CHAR_1_FILE));
// PlayerPrefs.SetString(Link.Replay, "true");
StageChoose = PlayerPrefs.GetString(Link.StageChoose);
PlayerPrefs.SetString ("hantumusuh", "kosong");
PlayerID = PlayerPrefs.GetString (Link.ID);
mapexpsimpan = PlayerPrefs.GetInt ("MAPSEXP");
Debug.Log (PlayerPrefs.GetInt ("MAPSEXP"));
lf = GetComponent<lifeless> ();
karaBbukuskin=karaB.transform.Find ("book001").GetComponent<SkinnedMeshRenderer> ();
bukuBB=karaB.transform.Find ("book001").gameObject;
karaBskin=karaB.GetComponent<SkinnedMeshRenderer> ();
karaBanimation=karaB.GetComponent<Animation> ();
PlayerPrefs.DeleteKey ("win");
Debug.Log( PlayerPrefs.HasKey("win"));
PlayerPrefs.SetString ("Critical", "n");
attacking = 0;
//PlayerPrefs.DeleteAll ();
//PlayerPrefs.SetString("PLAY_TUTORIAL","TRUE");
if(PlayerPrefs.GetString ("berburu")=="ya")
{
PlayerPrefs.SetInt ("speedscale", 1);
karaA.SetActive (false);
karaBanimation.PlayQueued ("run", QueueMode.PlayNow);
karaBanimation.PlayQueued ("idlegame", QueueMode.CompleteOthers);
//PlayerPrefs.SetString (Link.POS_1_CHAR_1_FILE, "MukaraBta_Fire");
TutorBuru();
//var hantuburuname = PlayerPrefs.GetString(Link.POS_1_CHAR_1_FILE);
//if (hantuburuname.Contains('_'))
//{
// int index = hantuburuname.IndexOf('_');
// string result = hantuburuname.Substring(0, index);
// hasilburu.transform.FindChild("backname").FindChild("Namegreen").FindChild("Name").GetComponent<Text>().text = result;
//}
}
// PlayerPrefs.SetString (Link.POS_1_CHAR_1_FILE, "MukaraBta_Fire");
// PlayerPrefs.SetString (Link.POS_1_CHAR_2_FILE, "Kunti_fire");
// PlayerPrefs.SetString (Link.POS_1_CHAR_3_FILE, "Genderuwo_Fire");
//else
PlayerPrefs.SetString("1player","selesai");
PlayerPrefs.SetString("2player","selesai");
PlayerPrefs.SetString("3player","selesai");
PlayerPrefs.SetString("musuh1","selesai");
PlayerPrefs.SetString("musuh2","selesai");
PlayerPrefs.SetString("musuh3","selesai");
//untuk testing
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE" && PlayerPrefs.GetString ("berburu") != "ya") {
Dialogue(true);
// replay = bool.TryParse(PlayerPrefs.GetString(Link.Replay),out replay);
PlayerPrefs.SetInt ("speedscale", 1);
karaA.SetActive (false);
karaB.SetActive (true);
//karaB.transform.FindChild ("Buku").GetComponent<SkinnedMeshRenderer> ().updateWhenOffscreen = false;
karaBanimation.PlayQueued ("run", QueueMode.PlayNow);
karaBanimation.PlayQueued ("idlegame", QueueMode.CompleteOthers);
//test
// PlayerPrefs.SetString (Link.POS_1_CHAR_1_ATTACK, "500");//401 //483 //1248
// PlayerPrefs.SetString (Link.POS_1_CHAR_1_DEFENSE, "100");
// PlayerPrefs.SetString (Link.POS_1_CHAR_1_HP, "500");
//
//
// PlayerPrefs.SetString (Link.POS_1_CHAR_2_ATTACK, "500");// 322 300 1734
// PlayerPrefs.SetString (Link.POS_1_CHAR_2_DEFENSE, "100");
// PlayerPrefs.SetString (Link.POS_1_CHAR_2_HP, "500");
//
// PlayerPrefs.SetString (Link.POS_1_CHAR_3_ATTACK, "500");//552 450 1044
// PlayerPrefs.SetString (Link.POS_1_CHAR_3_DEFENSE, "100");
// PlayerPrefs.SetString (Link.POS_1_CHAR_3_HP, "500");
} else {
karaA.SetActive (false);
//karaB.transform.FindChild ("Buku").GetComponent<SkinnedMeshRenderer> ().updateWhenOffscreen = false;
karaBanimation.PlayQueued ("run", QueueMode.PlayNow);
karaBanimation.PlayQueued ("idlegame", QueueMode.CompleteOthers);
}
//
//
//
//
// PlayerPrefs.SetString (Link.POS_1_CHAR_1_ELEMENT, "Water");
// PlayerPrefs.SetString (Link.POS_1_CHAR_2_ELEMENT, "Fire");
// PlayerPrefs.SetString (Link.POS_1_CHAR_3_ELEMENT, "Wind");
hantuchoose1.SetActive (false);
hantuchoose2.SetActive (false);
hantuchoose3.SetActive (false);
PlayerPrefs.SetString ("Suit1", "Kosong");
PlayerPrefs.SetString ("Urutan1","Kosong");
PlayerPrefs.SetString ("Urutan1m", "Kosong");
CB.SetActive(false);
#if UNITY_EDITOR
CB.SetActive(true);
#endif
Debug.Log (PlayerPrefs.GetString ("PLAY_TUTORIAL"));
//PlayerPrefs.SetString (Link.SEARCH_BATTLE, "JOUSTING");
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
TutorBuru();
//firstTimerGame.gameObject.SetActive (true);
SceneManagerHelper.LoadTutorial("Game_1");
//Time.timeScale = 0;
}
else
{
firstTimerGame.gameObject.SetActive (false);
}
formkirimreward= new WWWForm ();
presentDone = false;
//debug.text = PlayerPrefs.GetInt ("pos").ToString ();
EndOption[5].SetActive (false);
Debug.Log (PlayerPrefs.GetString (Link.POS_1_CHAR_1_ATTACK));
Debug.Log ("posnow"+PlayerPrefs.GetInt ("pos"));
damageA.gameObject.SetActive (false);
damageB.gameObject.SetActive (false);
PlayerPrefs.SetInt ("Jumlah",0);
PlayerPrefs.SetString ("Main", "tidak");
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE")
{
if(PlayerPrefs.GetString (Link.SEARCH_BATTLE)== "ONLINE")
{
PlayerPrefs.SetString (Link.ArenaGetPoint, "50");
monsterInfo ();
SceneManagerHelper.LoadMusic("Game 1Multi");
EndOption[0].SetActive (true);
EndOption[2].SetActive (false);
EndOption[4].SetActive (false);
EndOption[3].SetActive (false);
speedOption.SetActive (false);
}
else
{
SceneManagerHelper.LoadMusic("Normal");
monsterInfo ();
EndOption[3].SetActive (true);
EndOption[4].SetActive (true);
EndOption[0].SetActive (false);
speedOption.SetActive (true);
}
}
else {
SceneManagerHelper.LoadMusic("Game 1Multi");
EndOption[0].SetActive (true);
EndOption[2].SetActive (false);
EndOption[4].SetActive (false);
EndOption[3].SetActive (false);
speedOption.SetActive (false);
// perlu di cek
//urutan1[1].transform.Find("Canvas2").gameObject.SetActive(false);
//urutan2[1].transform.Find("Canvas2").gameObject.SetActive(false);
//urutan3[1].transform.Find("Canvas2").gameObject.SetActive(false);
}
if (PlayerPrefs.GetInt ("pos") == 1) {
cameraA.SetActive (true);
ApakahCameraA = true;
}
else
{
Debug.Log ("single player");
cameraB.SetActive (true);
ApakahCameraA = false;
}
//TAMBAHAN DISINI
if (PlayerPrefs.GetString (Link.SEARCH_BATTLE) == "SINGLE" && PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
PlayerPrefs.SetString (Link.USER_1, "Enemy");
PlayerPrefs.SetString (Link.USER_2, PlayerPrefs.GetString (Link.USER_NAME));
} else {
//BIARKAN NAMA DARI MASING MASING PEMAIN.
}
if (PlayerPrefs.GetString (Link.SEARCH_BATTLE) == "JOUSTING") {
ArenaDuelAR.transform.Find("Object041").gameObject.SetActive(false);
ArenaDuelAR.SetActive(true);
this.gameObject.transform.SetParent (CameraTarget.transform);
speedOption.SetActive (false);
EndOption[0].SetActive (true);
EndOption[2].SetActive (false);
EndOption[4].SetActive (false);
CameraAR.SetActive (true);
//hospitalAR.SetActive (true);
envi.transform.SetParent (CameraTarget.transform);
// cameraA.transform.SetParent(CameraTarget.transform);
// cameraB.transform.SetParent(CameraTarget.transform);
}
if (PlayerPrefs.GetString (Link.SEARCH_BATTLE) == "REAL_TIME") {
ArenaDuel.SetActive (true);
}
Destroy (GameObject.Find("SoundBG"));
urutan1 = new GameObject[2];
urutan2 = new GameObject[2];
urutan3 = new GameObject[2];
urutan1 [0] = GameObject.Find ("Hantu1A");
urutan1 [1] = GameObject.Find ("Hantu1B");
urutan2 [0] = GameObject.Find ("Hantu2A");
urutan2 [1] = GameObject.Find ("Hantu2B");
urutan3 [0] = GameObject.Find ("Hantu3A");
urutan3 [1] = GameObject.Find ("Hantu3B");
Debug.Log ("Info Hantu POS 1 : ");
Debug.Log ("GRADE : " + PlayerPrefs.GetString(Link.POS_1_CHAR_1_GRADE));
Debug.Log ("LEVEL : " + PlayerPrefs.GetString(Link.POS_1_CHAR_1_LEVEL));
Debug.Log ("ATTACK : " + PlayerPrefs.GetString(Link.POS_1_CHAR_1_ATTACK));
Debug.Log ("DEFENSE : " + PlayerPrefs.GetString(Link.POS_1_CHAR_1_DEFENSE));
Debug.Log ("HP : " + PlayerPrefs.GetString(Link.POS_1_CHAR_1_HP));
Debug.Log ("Info Hantu POS 2 : ");
Debug.Log ("GRADE : " + PlayerPrefs.GetString(Link.POS_2_CHAR_1_GRADE));
Debug.Log ("LEVEL : " + PlayerPrefs.GetString(Link.POS_2_CHAR_1_LEVEL));
Debug.Log ("ATTACK : " + PlayerPrefs.GetString(Link.POS_2_CHAR_1_ATTACK));
Debug.Log ("DEFENSE : " + PlayerPrefs.GetString(Link.POS_2_CHAR_1_DEFENSE));
Debug.Log ("HP : " + PlayerPrefs.GetString(Link.POS_2_CHAR_1_HP));
//PlayerPrefs.SetString ("berburu", "tidak");
if (PlayerPrefs.GetString ("berburu") == "ya") {
healthA2.SetActive (false);
healthA3.SetActive (false);
model1_1 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_1_CHAR_1_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model1_1.transform.SetParent (urutan1 [0].transform);
model1_1.transform.localPosition = urutan1 [0].transform.Find ("COPY_POSITION").transform.localPosition;
model1_1.transform.localScale = urutan1 [0].transform.Find ("COPY_POSITION").transform.localScale;
model1_1.transform.localEulerAngles = urutan1 [0].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model1_1.name = "Genderuwo_Fire";
model1_1.transform.SetParent (urutan1 [0].transform.Find ("COPY_POSITION"));
effect1_1 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_1_CHAR_1_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect1_1.transform.SetParent (urutan1 [0].transform);
effect1_1.transform.localPosition = urutan1 [0].transform.Find ("COPY_POSITIONE").transform.localPosition;
effect1_1.transform.localScale = new Vector3(.26f,.26f,.26f);
effect1_1.transform.localEulerAngles = urutan1 [0].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect1_1.transform.SetParent (urutan1 [0].transform.Find ("COPY_POSITIONE"));
effect1_1.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_ATTACK));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_DEFENSE));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_HP));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_HP));
urutan1 [0].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_1_CHAR_1_ELEMENT);
urutan1 [0].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_1_CHAR_1_MODE);
model2_1 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_1_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_1.transform.SetParent (urutan1 [1].transform);
model2_1.transform.localPosition = urutan1 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_1.transform.localScale = urutan1 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_1.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_1.name = "Genderuwo_Fire";
model2_1.transform.SetParent (urutan1 [1].transform.Find ("COPY_POSITION"));
effect2_1 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_1_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_1.transform.SetParent (urutan1 [1].transform);
effect2_1.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_1.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_1.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_1.transform.SetParent (urutan1 [1].transform.Find ("COPY_POSITIONE"));
effect2_1.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_ATTACK));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_DEFENSE));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_HP));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_HP));
urutan1 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_1_ELEMENT);
urutan1 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_1_MODE);
model2_2 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_2_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_2.transform.SetParent (urutan2 [1].transform);
model2_2.transform.localPosition = urutan2 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_2.transform.localScale = urutan2 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_2.transform.localEulerAngles = urutan2 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_2.name = "Genderuwo_Fire";
model2_2.transform.SetParent (urutan2 [1].transform.Find ("COPY_POSITION"));
effect2_2 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_2_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_2.transform.SetParent (urutan2 [1].transform);
effect2_2.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_2.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_2.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_2.transform.SetParent (urutan2 [1].transform.Find ("COPY_POSITIONE"));
effect2_2.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_ATTACK));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_DEFENSE));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_HP));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_HP));
urutan2 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_2_ELEMENT);
urutan2 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_2_MODE);
model2_3 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_3_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_3.transform.SetParent (urutan3 [1].transform);
model2_3.transform.localPosition = urutan3 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_3.transform.localScale = urutan3 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_3.transform.localEulerAngles = urutan3 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_3.name = "Genderuwo_Fire";
model2_3.transform.SetParent (urutan3 [1].transform.Find ("COPY_POSITION"));
effect2_3 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_3_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_3.transform.SetParent (urutan3 [1].transform);
effect2_3.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_3.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_3.transform.localEulerAngles = urutan3 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_3.transform.SetParent (urutan3[1].transform.Find ("COPY_POSITIONE"));
effect2_3.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_ATTACK));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_DEFENSE));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_HP));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_HP));
urutan3 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_3_ELEMENT);
urutan3 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_3_MODE);
}
else if (PlayerPrefs.GetString ("PLAY_TUTORIAL")=="TRUE") {
healthA2.SetActive (false);
healthA3.SetActive (false);
model1_1 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_1_CHAR_1_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model1_1.transform.SetParent (urutan1 [0].transform);
model1_1.transform.localPosition = urutan1 [0].transform.Find ("COPY_POSITION").transform.localPosition;
model1_1.transform.localScale = urutan1 [0].transform.Find ("COPY_POSITION").transform.localScale;
model1_1.transform.localEulerAngles = urutan1 [0].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model1_1.name = "Genderuwo_Fire";
model1_1.transform.SetParent (urutan1 [0].transform.Find ("COPY_POSITION"));
effect1_1 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_1_CHAR_1_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect1_1.transform.SetParent (urutan1 [0].transform);
effect1_1.transform.localPosition = urutan1 [0].transform.Find ("COPY_POSITIONE").transform.localPosition;
effect1_1.transform.localScale = new Vector3(.26f,.26f,.26f);
effect1_1.transform.localEulerAngles = urutan1 [0].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect1_1.transform.SetParent (urutan1 [0].transform.Find ("COPY_POSITIONE"));
effect1_1.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_ATTACK));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_DEFENSE));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_HP));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_HP));
urutan1 [0].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_1_CHAR_1_ELEMENT);
urutan1 [0].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_1_CHAR_1_MODE);
model2_1 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_1_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_1.transform.SetParent (urutan1 [1].transform);
model2_1.transform.localPosition = urutan1 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_1.transform.localScale = urutan1 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_1.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_1.name = "Genderuwo_Fire";
model2_1.transform.SetParent (urutan1 [1].transform.Find ("COPY_POSITION"));
effect2_1 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_1_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_1.transform.SetParent (urutan1 [1].transform);
effect2_1.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_1.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_1.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_1.transform.SetParent (urutan1 [1].transform.Find ("COPY_POSITIONE"));
effect2_1.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_ATTACK));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_DEFENSE));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_HP));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_HP));
urutan1 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_1_ELEMENT);
urutan1 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_1_MODE);
model2_2 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_2_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_2.transform.SetParent (urutan2 [1].transform);
model2_2.transform.localPosition = urutan2 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_2.transform.localScale = urutan2 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_2.transform.localEulerAngles = urutan2 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_2.name = "Genderuwo_Fire";
model2_2.transform.SetParent (urutan2 [1].transform.Find ("COPY_POSITION"));
effect2_2 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_2_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_2.transform.SetParent (urutan2 [1].transform);
effect2_2.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_2.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_2.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_2.transform.SetParent (urutan2 [1].transform.Find ("COPY_POSITIONE"));
effect2_2.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_ATTACK));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_DEFENSE));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_HP));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_HP));
urutan2 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_2_ELEMENT);
urutan2 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_2_MODE);
model2_3 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_3_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_3.transform.SetParent (urutan3 [1].transform);
model2_3.transform.localPosition = urutan3 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_3.transform.localScale = urutan3 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_3.transform.localEulerAngles = urutan3 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_3.name = "Genderuwo_Fire";
model2_3.transform.SetParent (urutan3 [1].transform.Find ("COPY_POSITION"));
effect2_3 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_3_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_3.transform.SetParent (urutan3 [1].transform);
effect2_3.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_3.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_3.transform.localEulerAngles = urutan3 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_3.transform.SetParent (urutan3[1].transform.Find ("COPY_POSITIONE"));
effect2_3.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_ATTACK));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_DEFENSE));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_HP));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_HP));
urutan3 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_3_ELEMENT);
urutan3 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_3_MODE);
}
else {
PlayerHPCurrent = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_HP))+ float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_2_HP))+ float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_3_HP));
PlayerHPMax=PlayerHPCurrent;
EnemiesHPCurrent = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_HP))+ float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_HP))+ float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_HP));
EnemiesHPMax=EnemiesHPCurrent;
model1_1 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_1_CHAR_1_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model1_1.transform.SetParent (urutan1 [0].transform);
model1_1.transform.localPosition = urutan1 [0].transform.Find ("COPY_POSITION").transform.localPosition;
model1_1.transform.localScale = urutan1 [0].transform.Find ("COPY_POSITION").transform.localScale;
model1_1.transform.localEulerAngles = urutan1 [0].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model1_1.name = "Genderuwo_Fire";
model1_1.transform.SetParent (urutan1 [0].transform.Find ("COPY_POSITION"));
effect1_1 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_1_CHAR_1_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect1_1.transform.SetParent (urutan1 [0].transform);
effect1_1.transform.localPosition = new Vector3 (0, .15f, 0);
effect1_1.transform.localScale = new Vector3(.26f,.26f,.26f);
effect1_1.transform.localEulerAngles = urutan1 [0].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect1_1.transform.SetParent (urutan1 [0].transform.Find ("COPY_POSITIONE"));
effect1_1.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
print(PlayerPrefs.GetString (Link.POS_1_CHAR_1_DEFENSE));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_ATTACK));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_DEFENSE));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_HP));
urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_1_HP));
urutan1 [0].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_1_CHAR_1_ELEMENT);
urutan1 [0].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_1_CHAR_1_MODE);
//SERTA DATA LAIN, MUNGKIN AKAN DIPERLUKAN NANTI
//PlayerPrefs.GetString(Link.POS_1_CHAR_1_GRADE);
//PlayerPrefs.GetString(Link.POS_1_CHAR_1_LEVEL);
model2_1 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_1_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_1.transform.SetParent (urutan1 [1].transform);
model2_1.transform.localPosition = urutan1 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_1.transform.localScale = urutan1 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_1.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_1.name = "Genderuwo_Fire";
model2_1.transform.SetParent (urutan1 [1].transform.Find ("COPY_POSITION"));
effect2_1 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_1_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_1.transform.SetParent (urutan1 [1].transform);
effect2_1.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_1.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_1.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_1.transform.SetParent (urutan1 [1].transform.Find ("COPY_POSITIONE"));
effect2_1.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_ATTACK));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_DEFENSE));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_HP));
urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_1_HP));
urutan1 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_1_ELEMENT);
urutan1 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_1_MODE);
model1_2 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_1_CHAR_2_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model1_2.transform.SetParent (urutan2 [0].transform);
model1_2.transform.localPosition = urutan2 [0].transform.Find ("COPY_POSITION").transform.localPosition;
model1_2.transform.localScale = urutan2 [0].transform.Find ("COPY_POSITION").transform.localScale;
model1_2.transform.localEulerAngles = urutan2 [0].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model1_2.name = "Genderuwo_Fire";
model1_2.transform.SetParent (urutan2 [0].transform.Find ("COPY_POSITION"));
effect1_2 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_1_CHAR_2_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect1_2.transform.SetParent (urutan2 [0].transform);
effect1_2.transform.localPosition = new Vector3 (0, .15f, 0);
effect1_2.transform.localScale = new Vector3(.26f,.26f,.26f);
effect1_2.transform.localEulerAngles = urutan2 [0].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect1_2.transform.SetParent (urutan2 [0].transform.Find ("COPY_POSITIONE"));
effect1_2.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan2 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_2_ATTACK));
urutan2 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_2_DEFENSE));
urutan2 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_2_HP));
urutan2 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_2_HP));
urutan2 [0].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_1_CHAR_2_ELEMENT);
urutan2 [0].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_1_CHAR_2_MODE);
//SERTA DATA LAIN, MUNGKIN AKAN DIPERLUKAN NANTI
//PlayerPrefs.GetString(Link.POS_1_CHAR_2_GRADE);
//PlayerPrefs.GetString(Link.POS_1_CHAR_2_LEVEL);
model2_2 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_2_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_2.transform.SetParent (urutan2 [1].transform);
model2_2.transform.localPosition = urutan2 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_2.transform.localScale = urutan2 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_2.transform.localEulerAngles = urutan2 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_2.name = "Genderuwo_Fire";
model2_2.transform.SetParent (urutan2 [1].transform.Find ("COPY_POSITION"));
effect2_2 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_2_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_2.transform.SetParent (urutan2 [1].transform);
effect2_2.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_2.transform.localEulerAngles = urutan1 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_2.transform.SetParent (urutan2 [1].transform.Find ("COPY_POSITIONE"));
effect2_2.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_2.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_ATTACK));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_DEFENSE));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_HP));
urutan2 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_2_HP));
urutan2 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_2_ELEMENT);
urutan2 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_2_MODE);
//if (PlayerPrefs.GetString(Link.JENIS) == "SINGLE")
//{
// urutan2[1].transform.Find("Canvas2").transform.FindChild("Image").GetComponent<filled>().damage = float.Parse(PlayerPrefs.GetString(Link.POS_2_CHAR_2_ATTACK));
// urutan2[1].transform.Find("Canvas2").transform.FindChild("Image").GetComponent<filled>().defend = float.Parse(PlayerPrefs.GetString(Link.POS_2_CHAR_2_DEFENSE));
// urutan2[1].transform.Find("Canvas2").transform.FindChild("Image").GetComponent<filled>().maxhealth = float.Parse(PlayerPrefs.GetString(Link.POS_2_CHAR_2_HP));
// urutan2[1].transform.Find("Canvas2").transform.FindChild("Image").GetComponent<filled>().currenthealth = float.Parse(PlayerPrefs.GetString(Link.POS_2_CHAR_2_HP));
//}
//SERTA DATA LAIN, MUNGKIN AKAN DIPERLUKAN NANTI
//PlayerPrefs.GetString(Link.POS_2_CHAR_2_GRADE);
//PlayerPrefs.GetString(Link.POS_2_CHAR_2_LEVEL);
model1_3 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_1_CHAR_3_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model1_3.transform.SetParent (urutan3 [0].transform);
model1_3.transform.localPosition = urutan3 [0].transform.Find ("COPY_POSITION").transform.localPosition;
model1_3.transform.localScale = urutan3 [0].transform.Find ("COPY_POSITION").transform.localScale;
model1_3.transform.localEulerAngles = urutan3 [0].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model1_3.name = "Genderuwo_Fire";
model1_3.transform.SetParent (urutan3 [0].transform.Find ("COPY_POSITION"));
effect1_3 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_1_CHAR_3_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect1_3.transform.SetParent (urutan3 [0].transform);
effect1_3.transform.localPosition = new Vector3 (0, .15f, 0);
effect1_3.transform.localScale = new Vector3(.26f,.26f,.26f);
effect1_3.transform.localEulerAngles = urutan3 [0].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect1_3.transform.SetParent (urutan3 [0].transform.Find ("COPY_POSITIONE"));
effect1_3.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan3 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_3_ATTACK));
urutan3 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_3_DEFENSE));
urutan3 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_3_HP));
urutan3 [0].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_1_CHAR_3_HP));
urutan3 [0].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_1_CHAR_3_ELEMENT);
urutan3 [0].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_1_CHAR_3_MODE);
//SERTA DATA LAIN, MUNGKIN AKAN DIPERLUKAN NANTI
//PlayerPrefs.GetString(Link.POS_1_CHAR_3_GRADE);
//PlayerPrefs.GetString(Link.POS_1_CHAR_3_LEVEL);
model2_3 = Instantiate (Resources.Load ("PrefabsChar/" + PlayerPrefs.GetString (Link.POS_2_CHAR_3_FILE)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
model2_3.transform.SetParent (urutan3 [1].transform);
model2_3.transform.localPosition = urutan3 [1].transform.Find ("COPY_POSITION").transform.localPosition;
model2_3.transform.localScale = urutan3 [1].transform.Find ("COPY_POSITION").transform.localScale;
model2_3.transform.localEulerAngles = urutan3 [1].transform.Find ("COPY_POSITION").transform.localEulerAngles;
model2_3.name = "Genderuwo_Fire";
model2_3.transform.SetParent (urutan3 [1].transform.Find ("COPY_POSITION"));
effect2_3 = Instantiate (Resources.Load ("Prefabs/" + PlayerPrefs.GetString (Link.POS_2_CHAR_3_ELEMENT)) as GameObject, new Vector3 (0f, 0f, 0f), Quaternion.identity);
effect2_3.transform.SetParent (urutan3 [1].transform);
effect2_3.transform.localPosition = new Vector3 (0, .15f, 0);
effect2_3.transform.localScale = new Vector3(.26f,.26f,.26f);
effect2_3.transform.localEulerAngles = urutan3 [1].transform.Find ("COPY_POSITIONE").transform.localEulerAngles;
effect2_3.transform.SetParent (urutan3[1].transform.Find ("COPY_POSITIONE"));
effect2_3.name = "CriticalEffect";
//LANGSUNG SY MASUKKAN ATT,HP,DEFENSE
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_ATTACK));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_DEFENSE));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().maxhealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_HP));
urutan3 [1].transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().currenthealth = float.Parse (PlayerPrefs.GetString (Link.POS_2_CHAR_3_HP));
urutan3 [1].GetComponent<PlayAnimation> ().element = PlayerPrefs.GetString (Link.POS_2_CHAR_3_ELEMENT);
urutan3 [1].GetComponent<PlayAnimation> ().TypeS = PlayerPrefs.GetString (Link.POS_2_CHAR_3_MODE);
}
//if (PlayerPrefs.GetString(Link.JENIS) == "SINGLE")
//{
// urutan3[1].transform.Find("Canvas2").transform.FindChild("Image").GetComponent<filled>().damage = float.Parse(PlayerPrefs.GetString(Link.POS_2_CHAR_2_ATTACK));
// urutan3[1].transform.Find("Canvas2").transform.FindChild("Image").GetComponent<filled>().defend = float.Parse(PlayerPrefs.GetString(Link.POS_2_CHAR_2_DEFENSE));
// urutan3[1].transform.Find("Canvas2").transform.FindChild("Image").GetComponent<filled>().maxhealth = float.Parse(PlayerPrefs.GetString(Link.POS_2_CHAR_2_HP));
// urutan3[1].transform.Find("Canvas2").transform.FindChild("Image").GetComponent<filled>().currenthealth = float.Parse(PlayerPrefs.GetString(Link.POS_2_CHAR_2_HP));
//}
//SERTA DATA LAIN, MUNGKIN AKAN DIPERLUKAN NANTI
//PlayerPrefs.GetString(Link.POS_2_CHAR_3_GRADE);
//PlayerPrefs.GetString(Link.POS_2_CHAR_3_LEVEL);
if (PlayerPrefs.GetString ("berburu") != "ya")
{
if (PlayerPrefs.GetString ("PLAY_TUTORIAL")=="TRUE")
{
hantugom2.transform.Find ("Canvas").Find ("bg").gameObject.SetActive (false);
hantugom3.transform.Find ("Canvas").Find ("bg").gameObject.SetActive (false);
model11a = model1_1.GetComponent<Animation> ();
model21a = model2_1.GetComponent<Animation> ();
//model12a = model1_2.GetComponent<Animation> ();
model22a = model2_2.GetComponent<Animation> ();
//model13a = model1_3.GetComponent<Animation> ();
model23a = model2_3.GetComponent<Animation> ();
}
else
{
model11a = model1_1.GetComponent<Animation> ();
model21a = model2_1.GetComponent<Animation> ();
model12a = model1_2.GetComponent<Animation> ();
model22a = model2_2.GetComponent<Animation> ();
model13a = model1_3.GetComponent<Animation> ();
model23a = model2_3.GetComponent<Animation> ();
}
}
else {
hantugom2.transform.Find ("Canvas").Find ("bg").gameObject.SetActive (false);
hantugom3.transform.Find ("Canvas").Find ("bg").gameObject.SetActive (false);
model11a = model1_1.GetComponent<Animation> ();
model21a = model2_1.GetComponent<Animation> ();
//model12a = model1_2.GetComponent<Animation> ();
model22a = model2_2.GetComponent<Animation> ();
//model13a = model1_3.GetComponent<Animation> ();
model23a = model2_3.GetComponent<Animation> ();
}
// ModelAllStatus (false);
//PlayerPrefs.DeleteAll ();
//ganti perbandingan nilai N apabila jumlah monster bertambah
if (PlayerPrefs.GetInt ("pos") == 1) {
if (PlayerPrefs.GetString(Link.SEARCH_BATTLE) == "JOUSTING")
{
joustingnameA.text = PlayerPrefs.GetString(Link.USER_2);
joustingnameA1.text = PlayerPrefs.GetString(Link.USER_2);
joustingnameA2.text = PlayerPrefs.GetString(Link.USER_2);
joustingnameB.text = PlayerPrefs.GetString(Link.USER_1);
joustingnameB1.text = PlayerPrefs.GetString(Link.USER_1);
joustingnameB2.text = PlayerPrefs.GetString(Link.USER_1);
}
User2.text = PlayerPrefs.GetString (Link.USER_1);
User1.text = PlayerPrefs.GetString (Link.USER_2);
icon1.sprite = Resources.Load<Sprite>("icon_char/" + PlayerPrefs.GetString(Link.POS_1_CHAR_1_FILE));
icon2.sprite = Resources.Load<Sprite>("icon_char/" + PlayerPrefs.GetString(Link.POS_1_CHAR_2_FILE));
icon3.sprite = Resources.Load<Sprite>("icon_char/" + PlayerPrefs.GetString(Link.POS_1_CHAR_3_FILE));
} else {
if (PlayerPrefs.GetString(Link.SEARCH_BATTLE) == "JOUSTING")
{
joustingnameA.text = PlayerPrefs.GetString(Link.USER_1);
joustingnameB.text = PlayerPrefs.GetString(Link.USER_2);
joustingnameA1.text = PlayerPrefs.GetString(Link.USER_1);
joustingnameB1.text = PlayerPrefs.GetString(Link.USER_2);
joustingnameA2.text = PlayerPrefs.GetString(Link.USER_1);
joustingnameB2.text = PlayerPrefs.GetString(Link.USER_2);
}
User1.text = PlayerPrefs.GetString (Link.USER_1);
User2.text = PlayerPrefs.GetString (Link.USER_2);
icon1.sprite = Resources.Load<Sprite>("icon_char/" + PlayerPrefs.GetString(Link.POS_2_CHAR_1_FILE));
icon2.sprite = Resources.Load<Sprite>("icon_char/" + PlayerPrefs.GetString(Link.POS_2_CHAR_2_FILE));
icon3.sprite = Resources.Load<Sprite>("icon_char/" + PlayerPrefs.GetString(Link.POS_2_CHAR_3_FILE));
}
urutan1 = new GameObject[2];
urutan2 = new GameObject[2];
urutan3 = new GameObject[2];
healthBar1 = new GameObject[2];
healthBar2 = new GameObject[2];
healthBar3 = new GameObject[2];
suit1 = new string[2];
suit2 = new string[2];
suit3 = new string[2];
health1 = new float[2];
health2 = new float[2];
health3 = new float[2];
if (PlayerPrefs.GetString ("berburu") != "ya") {
if(PlayerPrefs.GetString("PLAY_TUTORIAL")=="TRUE")
{
health1 [0] = healthA1.GetComponent<filled> ().maxhealth;
health1 [1] = healthB1.GetComponent<filled> ().maxhealth;
health2 [1] = healthB2.GetComponent<filled> ().maxhealth;
health3 [1] = healthB3.GetComponent<filled> ().maxhealth;
}
else
{
health1 [0] = healthA1.GetComponent<filled> ().maxhealth;
health1 [1] = healthB1.GetComponent<filled> ().maxhealth;
health2 [0] = healthA2.GetComponent<filled> ().maxhealth;
health2 [1] = healthB2.GetComponent<filled> ().maxhealth;
health3 [0] = healthA3.GetComponent<filled> ().maxhealth;
health3 [1] = healthB3.GetComponent<filled> ().maxhealth;
}
} else {
health1 [0] = healthA1.GetComponent<filled> ().maxhealth;
health1 [1] = healthB1.GetComponent<filled> ().maxhealth;
//health2 [0] = healthA2.GetComponent<filled> ().maxhealth;
health2 [1] = healthB2.GetComponent<filled> ().maxhealth;
//health3 [0] = healthA3.GetComponent<filled> ().maxhealth;
health3 [1] = healthB3.GetComponent<filled> ().maxhealth;
}
StartCoroutine (areuReady());
//SY TAMBAHIN JIKA SINGLE KE SINI
}
public void autooff(){
auto = false;
}
public void automatic(){
auto = true;
if (PlayerPrefs.GetString ("1player") != "mati" && PlayerPrefs.GetString ("2player") != "mati" &&PlayerPrefs.GetString ("3player") != "mati") {
int urut = Random.Range (0, 2);
if (urut == 0) {
pilihanInputSuit [0].transform.Find ("Batu").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
pilihanInputSuit [5].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [1].transform.Find ("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [3].SetActive (false);
pilihanInputSuit [5].SetActive (false);
}
if (urut == 2) {
pilihanInputSuit [2].transform.Find ("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
pilihanInputSuit [3].SetActive (false);
}
}
if (PlayerPrefs.GetString ("1player") == "mati" && PlayerPrefs.GetString ("2player") != "mati") {
int urut = Random.Range(0,1);
pilihanInputSuit [3].SetActive (false);
if (urut == 0)
{
pilihanInputSuit [2].transform.Find("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [1].transform.Find("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
pilihanInputSuit [1].transform.Find("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
}
if (PlayerPrefs.GetString ("1player") == "mati" && PlayerPrefs.GetString ("3player") != "mati") {
int urut = Random.Range (0, 1);
pilihanInputSuit [3].SetActive (false);
if (urut == 0)
{
pilihanInputSuit [2].transform.Find("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [1].transform.Find("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
pilihanInputSuit [2].transform.Find("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
}
}
if (PlayerPrefs.GetString ("2player") == "mati" && PlayerPrefs.GetString ("1player") != "mati") {
int urut = Random.Range (0, 1);
pilihanInputSuit [4].SetActive (false);
if (urut == 0) {
pilihanInputSuit [0].transform.Find ("Batu").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [2].transform.Find ("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [3].SetActive (false);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
pilihanInputSuit [0].transform.Find ("Batu").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
}
if (PlayerPrefs.GetString ("2player") == "mati" && PlayerPrefs.GetString ("3player") != "mati") {
int urut = Random.Range (0, 1);
pilihanInputSuit [4].SetActive (false);
if (urut == 0) {
pilihanInputSuit [0].transform.Find ("Batu").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [2].transform.Find ("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [3].SetActive (false);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
pilihanInputSuit [2].transform.Find ("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [3].SetActive (false);
}
}
}
void multiplayer(){
// if (PlayerPrefs.GetInt ("pos") == 1) {
// if (PlayerPrefs.GetString ("Urutan1") == "Hantu1A") {
// pilihanInputSuit [0].GetComponent<RandomClick> ().RandomPilih ();
//
//
// // if (hantuchoose2.activeSelf) {
// // hantuchoose2.GetComponent<RandomClick> ().RandomPilih ();
// // }
// // yield return new WaitForSeconds(1);
// //
// // if (hantuchoose3.activeSelf) {
// // hantuchoose3.GetComponent<RandomClick> ().RandomPilih ();
// // }
// // if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
// // firstTimerTanding ();
// // //StartCoroutine (urutanPlay());
// //
// // }
// }
//
// if (PlayerPrefs.GetString ("Urutan1") == "Hantu2A") {
// pilihanInputSuit [1].GetComponent<RandomClick> ().RandomPilih ();
// }
//
// if (PlayerPrefs.GetString ("Urutan1") == "Hantu3A") {
//
//
// pilihanInputSuit [2].GetComponent<RandomClick> ().RandomPilih ();
// }
// }
// else {
// if (PlayerPrefs.GetString ("Urutan1") == "Hantu1B") {
// pilihanInputSuit [0].GetComponent<RandomClick> ().RandomPilih ();
//
//
// // if (hantuchoose2.activeSelf) {
// // hantuchoose2.GetComponent<RandomClick> ().RandomPilih ();
// // }
// // yield return new WaitForSeconds(1);
// //
// // if (hantuchoose3.activeSelf) {
// // hantuchoose3.GetComponent<RandomClick> ().RandomPilih ();
// // }
// // if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
// // firstTimerTanding ();
// // //StartCoroutine (urutanPlay());
// //
// // }
// }
//
// if (PlayerPrefs.GetString ("Urutan1") == "Hantu2B") {
// pilihanInputSuit [1].GetComponent<RandomClick> ().RandomPilih ();
// }
//
// if (PlayerPrefs.GetString ("Urutan1") == "Hantu3B") {
//
//
// pilihanInputSuit [2].GetComponent<RandomClick> ().RandomPilih ();
// }
// }
if (PlayerPrefs.GetString ("1player") != "mati" && PlayerPrefs.GetString ("2player") != "mati" &&PlayerPrefs.GetString ("3player") != "mati") {
int urut = Random.Range (0, 2);
if (urut == 0) {
pilihanInputSuit [0].transform.Find ("Batu").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
pilihanInputSuit [5].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [1].transform.Find ("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [3].SetActive (false);
pilihanInputSuit [5].SetActive (false);
}
if (urut == 2) {
pilihanInputSuit [2].transform.Find ("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
pilihanInputSuit [3].SetActive (false);
}
}
if (PlayerPrefs.GetString ("1player") == "mati" && PlayerPrefs.GetString ("2player") != "mati") {
int urut = Random.Range(0,1);
pilihanInputSuit [3].SetActive (false);
if (urut == 0)
{
pilihanInputSuit [2].transform.Find("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [1].transform.Find("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
pilihanInputSuit [1].transform.Find("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
}
if (PlayerPrefs.GetString ("1player") == "mati" && PlayerPrefs.GetString ("3player") != "mati") {
int urut = Random.Range (0, 1);
pilihanInputSuit [3].SetActive (false);
if (urut == 0)
{
pilihanInputSuit [2].transform.Find("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [1].transform.Find("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
pilihanInputSuit [2].transform.Find("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [4].SetActive (false);
}
}
if (PlayerPrefs.GetString ("2player") == "mati" && PlayerPrefs.GetString ("1player") != "mati") {
int urut = Random.Range (0, 1);
pilihanInputSuit [4].SetActive (false);
if (urut == 0) {
pilihanInputSuit [0].transform.Find ("Batu").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [2].transform.Find ("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [3].SetActive (false);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
pilihanInputSuit [0].transform.Find ("Batu").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
}
if (PlayerPrefs.GetString ("2player") == "mati" && PlayerPrefs.GetString ("3player") != "mati") {
int urut = Random.Range (0, 1);
pilihanInputSuit [4].SetActive (false);
if (urut == 0) {
pilihanInputSuit [0].transform.Find ("Batu").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [5].SetActive (false);
}
if (urut == 1) {
pilihanInputSuit [2].transform.Find ("Batu (1)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [3].SetActive (false);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
pilihanInputSuit [2].transform.Find ("Batu (2)").GetComponent<ButtonInput> ().OnPilih ();
bermain ();
pilihanInputSuit [3].SetActive (false);
}
}
timer = 3;
multitime = true;
}
public void ModelAllStatus (bool status) {
model1_1.SetActive (status);
model2_1.SetActive (status);
model1_2.SetActive (status);
model2_2.SetActive (status);
model1_3.SetActive (status);
model2_3.SetActive (status);
}
public void gameObject_Scale(){
// model1_1.gameObject.lo
// model2_1.
// model1_2.
// model2_2.
// model1_3.
// model2_3.
}
public void canvasEnd(){
canvas1.SetActive (false);
canvas2.SetActive (false);
canvas3.SetActive (false);
canvas4.SetActive (false);
canvas5.SetActive (false);
canvas6.SetActive (false);
}
public void monsterInfo(){
Debug.Log ("monsterinfo");
playerhantuid1 = PlayerPrefs.GetString (Link.CHAR_1_ID);
playerhantuid2 = PlayerPrefs.GetString (Link.CHAR_2_ID);
playerhantuid3 = PlayerPrefs.GetString (Link.CHAR_3_ID);
MonsterLevel1 = int.Parse(PlayerPrefs.GetString (Link.CHAR_1_LEVEL));
MonsterLevel2 = int.Parse(PlayerPrefs.GetString (Link.CHAR_2_LEVEL));
MonsterLevel3 = int.Parse(PlayerPrefs.GetString (Link.CHAR_3_LEVEL));
MonsterGrade1 = int.Parse(PlayerPrefs.GetString (Link.CHAR_1_GRADE));
MonsterGrade2 = int.Parse(PlayerPrefs.GetString (Link.CHAR_2_GRADE));
MonsterGrade3 = int.Parse(PlayerPrefs.GetString (Link.CHAR_3_GRADE));
Monster1GO.transform.Find ("Level").GetComponent<Text> ().text = MonsterLevel1.ToString();
Monster2GO.transform.Find ("Level").GetComponent<Text> ().text = MonsterLevel2.ToString();
Monster3GO.transform.Find ("Level").GetComponent<Text> ().text = MonsterLevel3.ToString();
Monster1GO.transform.Find ("Icon_Char").GetComponent<Image> ().sprite = Resources.Load<Sprite> ("icon_char_Maps/" + PlayerPrefs.GetString (Link.CHAR_1_FILE));
Monster2GO.transform.Find ("Icon_Char").GetComponent<Image> ().sprite = Resources.Load<Sprite> ("icon_char_Maps/" + PlayerPrefs.GetString (Link.CHAR_2_FILE));
Monster3GO.transform.Find ("Icon_Char").GetComponent<Image> ().sprite = Resources.Load<Sprite> ("icon_char_Maps/" + PlayerPrefs.GetString (Link.CHAR_3_FILE));
monstercurrentexp1= float.Parse( PlayerPrefs.GetString (Link.CHAR_1_MONSTEREXP));
MonsterEXP1= int.Parse( PlayerPrefs.GetString (Link.CHAR_1_MONSTEREXP));
Targetnextlevel1= float.Parse(PlayerPrefs.GetString (Link.CHAR_1_TARGETNL));
monstercurrentexp2= float.Parse(PlayerPrefs.GetString (Link.CHAR_2_MONSTEREXP));
MonsterEXP2= int.Parse( PlayerPrefs.GetString (Link.CHAR_2_MONSTEREXP));
Targetnextlevel2= float.Parse(PlayerPrefs.GetString (Link.CHAR_2_TARGETNL));
monstercurrentexp3= float.Parse(PlayerPrefs.GetString (Link.CHAR_3_MONSTEREXP));
MonsterEXP3= int.Parse( PlayerPrefs.GetString (Link.CHAR_3_MONSTEREXP));
Targetnextlevel3= float.Parse(PlayerPrefs.GetString (Link.CHAR_3_TARGETNL));
}
public IEnumerator areuReady () {
yield return new WaitForSeconds (.5f);
karaB.transform.localPosition = (karaB.transform.localPosition + new Vector3 (0, .0001f, 0));
yield return new WaitForSeconds (.5f);
getReady.SetActive (true);
bukuBB.transform.localPosition = (bukuBB.transform.localPosition + new Vector3 (0, .0001f, 0));
yield return new WaitForSeconds (1f);
getReady.SetActive (false);
Nyala.SetActive (true);
yield return new WaitForSeconds (.2f);
//ModelAllStatus (true);
yield return new WaitForSeconds (.5f);
// karaA.transform.FindChild ("Buku").GetComponent<SkinnedMeshRenderer> ().updateWhenOffscreen = false;
// karaB.transform.FindChild ("Buku").GetComponent<SkinnedMeshRenderer> ().updateWhenOffscreen = false;
if (PlayerPrefs.GetString ("berburu") != "ya") {
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
model11a.Play ("select");
model21a.Play ("select");
model22a.Play ("select");
model23a.Play ("select");
model11a.PlayQueued ("idle");
model21a.PlayQueued ("idle");
model22a.PlayQueued ("idle");
model23a.PlayQueued ("idle");
}
else
{
model11a.Play ("select");
model21a.Play ("select");
model12a.Play ("select");
model22a.Play ("select");
model13a.Play ("select");
model23a.Play ("select");
model11a.PlayQueued ("idle");
model21a.PlayQueued ("idle");
model12a.PlayQueued ("idle");
model22a.PlayQueued ("idle");
model13a.PlayQueued ("idle");
model23a.PlayQueued ("idle");
}
} else {
model11a.Play ("select");
model21a.Play ("select");
model22a.Play ("select");
model23a.Play ("select");
model11a.PlayQueued ("idle");
model21a.PlayQueued ("idle");
model22a.PlayQueued ("idle");
model23a.PlayQueued ("idle");
}
//UI Pilih gerakan character
// pilihanInputSuit [0].SetActive (true);
// pilihanInputSuit [1].SetActive (true);
// pilihanInputSuit [2].SetActive (true);
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") != "TRUE") {
StartCoroutine (randomenemiesmovement ());
} else {
StartCoroutine (randomenemiesmovement ());
//firstTimerTanding ();
}
}
yield return new WaitForSeconds (2);
if (PlayerPrefs.GetString (Link.JENIS) != "SINGLE") {
getReadyStatus = true;
}
}
void suitanimation(){
}
public void hidegameobject(GameObject one, GameObject two)
{
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
if(one.name=="Hantu2A"||two.name=="Hantu2A")
return;
}
one.transform.Find("Canvas").GetComponent<Animator>().enabled=false;
two.transform.Find("Canvas").GetComponent<Animator>().enabled=false;
one.transform.Find("Canvas").gameObject.SetActive(false);
two.transform.Find("Canvas").gameObject.SetActive(false);
one.transform.Find("COPY_POSITION").GetComponentInChildren<SkinnedMeshRenderer>().enabled=false;
two.transform.Find("COPY_POSITION").GetComponentInChildren<SkinnedMeshRenderer>().enabled=false;
}
void firstTimerTanding(){
// if (urutan1 [1].gameObject.name != "") {
if (urutan1 [1].gameObject.name == "Hantu1B") {
if (suit1 [1] == "Charge") {
suit1 [0] = "Focus";
// urutan1[0].GetComponent<>
}
if (suit1 [1] == "Focus") {
suit1 [0] = "Block";
}
if (suit1 [1] == "Block") {
suit1 [0] = "Charge";
}
}
if (urutan1 [1].gameObject.name == "Hantu2B") {
if (suit1 [1] == "Charge") {
suit1 [0] = "Focus";
// urutan1[0].GetComponent<>
}
if (suit1 [1] == "Focus") {
suit1 [0] = "Block";
}
if (suit1 [1] == "Block") {
suit1 [0] = "Charge";
}
}
if (urutan1 [1].gameObject.name == "Hantu3B") {
if (suit1 [1] == "Charge") {
suit1 [0] = "Focus";
// urutan1[0].GetComponent<>
}
if (suit1 [1] == "Focus") {
suit1 [0] = "Block";
}
if (suit1 [1] == "Block") {
suit1 [0] = "Charge";
}
}
//kondisi 2
// if (urutan2 [1].gameObject.name == "Hantu1B") {
// if (suit1 [1] == "Charge") {
// suit2 [0] = "Focus";
// // urutan1[0].GetComponent<>
// }
// if (suit1 [1] == "Focus") {
// suit2 [0] = "Block";
// }
// if (suit1 [1] == "Block") {
// suit2 [0] = "Charge";
// }
// }
// if (urutan2 [1].gameObject.name == "Hantu2B") {
// if (suit2 [1] == "Charge") {
// suit2 [0] = "Focus";
// // urutan1[0].GetComponent<>
// }
// if (suit2 [1] == "Focus") {
// suit2 [0] = "Block";
// }
// if (suit2 [1] == "Block") {
// suit2 [0] = "Charge";
// }
// }
// if (urutan2 [1].gameObject.name == "Hantu3B") {
// if (suit3 [1] == "Charge") {
// suit2 [0] = "Focus";
// // urutan1[0].GetComponent<>
// }
// if (suit3 [1] == "Focus") {
// suit2 [0] = "Block";
// }
// if (suit3 [1] == "Block") {
// suit2 [0] = "Charge";
// }
// }
//
// //kondisi 3
//
// if (urutan3 [1].gameObject.name == "Hantu1B") {
// if (suit1 [1] == "Charge") {
// suit3 [0] = "Focus";
// // urutan1[0].GetComponent<>
// }
// if (suit1 [1] == "Focus") {
// suit3 [0] = "Block";
// }
// if (suit1 [1] == "Block") {
// suit3 [0] = "Charge";
// }
// }
// if (urutan3 [1].gameObject.name == "Hantu2B") {
// if (suit2 [1] == "Charge") {
// suit3 [0] = "Focus";
// // urutan1[0].GetComponent<>
// }
// if (suit2 [1] == "Focus") {
// suit3 [0] = "Block";
// }
// if (suit2 [1] == "Block") {
// suit3 [0] = "Charge";
// }
// }
// if (urutan3 [1].gameObject.name == "Hantu3B") {
// if (suit3 [1] == "Charge") {
// suit3 [0] = "Focus";
// // urutan1[0].GetComponent<>
// }
// if (suit3 [1] == "Focus") {
// suit3 [0] = "Block";
// }
// if (suit3 [1] == "Block") {
// suit3 [0] = "Charge";
// }
// }
//}
}
public void bermain(){
PlayerPrefs.SetString ("Main", "ya");
}
void Update () {
if (PlayerPrefs.GetString(Link.SEARCH_BATTLE) == "JOUSTING")
{
sh1a.transform.Find("Dark-MagicCircle").gameObject.SetActive(false);
sh2a.transform.Find("Dark-MagicCircle").gameObject.SetActive(false);
sh3a.transform.Find("Dark-MagicCircle").gameObject.SetActive(false);
sh1.transform.Find("Dark-MagicCircle").gameObject.SetActive(false);
sh2.transform.Find("Dark-MagicCircle").gameObject.SetActive(false);
sh3.transform.Find("Dark-MagicCircle").gameObject.SetActive(false);
pilihanInputSuit[3].SetActive(false);
pilihanInputSuit[4].SetActive(false);
pilihanInputSuit[5].SetActive(false);
if (Input.GetMouseButtonDown(0))
{
Ray ray = CameraAR2.GetComponent<Camera>().ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (PlayerPrefs.GetInt("pos") == 1)
{
h1cubeb.SetActive(false);
h2cubeb.SetActive(false);
h3cubeb.SetActive(false);
if (Physics.Raycast(ray, out hit, 1000.0F) && hit.transform.name == "Hantu1")
{
pilihanInputSuit[3].GetComponent<Button>().onClick.Invoke();
h2cubea.SetActive(false);
h3cubea.SetActive(false);
}
else if (Physics.Raycast(ray, out hit, 1000.0F) && hit.transform.tag == "Hantu2")
{
pilihanInputSuit[4].GetComponent<Button>().onClick.Invoke();
h1cubea.SetActive(false);
h3cubea.SetActive(false);
}
else if (Physics.Raycast(ray, out hit, 1000.0F) && hit.transform.tag == "Hantu3")
{
pilihanInputSuit[5].GetComponent<Button>().onClick.Invoke();
h2cubea.SetActive(false);
h1cubea.SetActive(false);
}
else {
Debug.Log("kay2pos1");
// Debug.Log(hit.transform.name);
}
}
else {
h1cubea.SetActive(false);
h2cubea.SetActive(false);
h3cubea.SetActive(false);
if (Physics.Raycast(ray, out hit, 1000.0F) && hit.transform.tag == "Hantu1")
{
pilihanInputSuit[3].GetComponent<Button>().onClick.Invoke();
h2cubeb.SetActive(false);
h3cubeb.SetActive(false);
}
else if (Physics.Raycast(ray, out hit, 1000.0F) && hit.transform.tag == "Hantu2")
{
pilihanInputSuit[4].GetComponent<Button>().onClick.Invoke();
h1cubeb.SetActive(false);
h3cubeb.SetActive(false);
}
else if (Physics.Raycast(ray, out hit, 1000.0F) && hit.transform.tag == "Hantu3")
{
pilihanInputSuit[5].GetComponent<Button>().onClick.Invoke();
h2cubeb.SetActive(false);
h1cubeb.SetActive(false);
}
else {
Debug.Log("kay2pos2");
// Debug.Log(hit.transform.name);
}
}
}
}
else {
h1cubeb.SetActive(false);
h2cubeb.SetActive(false);
h3cubeb.SetActive(false);
h1cubea.SetActive(false);
h2cubea.SetActive(false);
h3cubea.SetActive(false);
}
if (PlayerPrefs.GetInt ("win") == 1 && karaBanimation.isPlaying==false) {
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
}
if (level1 == false) {
times -= Time.deltaTime;
}
if (times <= 0 && attacking >= 3&&tanding==false&& PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
critical = true;
PlayerPrefs.SetString ("Critical", "y");
}
//Debug.Log(PlayerPrefs.GetString ("Urutan1"));
//Debug.Log(PlayerPrefs.GetString ("Suit1"));
//Debug.Log (Random.value);
//Debug.Log(PlayerPrefs.GetInt ("Jumlah"));
dg.text = PlayerPrefs.GetInt ("pos").ToString ();
//Debug.Log (PlayerPrefs.GetString (Link.JENIS));
//Debug.Log (PlayerPrefs.GetInt ("Jumlah"));
//Debug.Log (panggil_url);
// Debug.Log (timeUps);
if (PlayerPrefs.GetString ("Main") == "ya") {
// pilihanInputSuit [0].SetActive (false);
// pilihanInputSuit [1].SetActive (false);
// pilihanInputSuit [2].SetActive (false);
//urutan2 [1].SetActive (false);
//urutan3 [1].SetActive (false);
if (PlayerPrefs.GetInt ("pos") == 1) {
if (PlayerPrefs.GetString ("Urutan1m") == "Hantu1A") {
sh1a.SetActive (true);
// hantuchoose1.SetActive (true);
if (PlayerPrefs.GetInt ("Jumlah") == 0) {
pilihanInputSuit [0].SetActive (true);
}
} else if (PlayerPrefs.GetString ("Urutan1m") == "Hantu2A") {
sh2a.SetActive (true);
//hantuchoose2.SetActive (true);
if (PlayerPrefs.GetInt ("Jumlah") == 0) {
pilihanInputSuit [1].SetActive (true);
}
} else {
sh3a.SetActive (true);
//hantuchoose3.SetActive (true);
if (PlayerPrefs.GetInt ("Jumlah") == 0) {
pilihanInputSuit [2].SetActive (true);
}
}
} else {
if (PlayerPrefs.GetString ("Urutan1") == "Hantu1B") {
sh1.SetActive (true);
// hantuchoose1.SetActive (true);
if (PlayerPrefs.GetInt ("Jumlah") == 0) {
pilihanInputSuit [0].SetActive (true);
}
} else if (PlayerPrefs.GetString ("Urutan1") == "Hantu2B") {
sh2.SetActive (true);
//hantuchoose2.SetActive (true);
if (PlayerPrefs.GetInt ("Jumlah") == 0) {
pilihanInputSuit [1].SetActive (true);
}
} else {
sh3.SetActive (true);
//hantuchoose3.SetActive (true);
if (PlayerPrefs.GetInt ("Jumlah") == 0) {
pilihanInputSuit [2].SetActive (true);
}
}
}
// cameraB.transform.position = new Vector3 (8.75f, 9.98f, 12.7f);
// cameraB.transform.rotation = Quaternion.Euler (0, 295.4f, 0);
// cameraB.transform.FindChild ("Plane").gameObject.SetActive (true);
//Time.timeScale = 0.3f;
getReadyStatus = true;
}
else {
}
if (PlayerPrefs.GetInt ("Jumlah") == 1) {
sh1.SetActive (false);
sh2.SetActive (false);
sh3.SetActive (false);
sh1a.SetActive (false);
sh2a.SetActive (false);
sh3a.SetActive (false);
//if (PlayerPrefs.GetString ("Urutan1") == "Hantu1B") {
//
// pilihanInputSuit [0].SetActive (true);
// if (PlayerPrefs.GetString ("Suit1")!="Kosong") {
// hantugo2.SetActive(false);
// hantugo3.SetActive(false);
// }
//
// }
// else if (PlayerPrefs.GetString ("Urutan1") == "Hantu2B") {
// hantugo1.SetActive(false);
// hantugo3.SetActive(false);
// hantuchoose2.SetActive (true);
// pilihanInputSuit [1].SetActive (true);
// if (PlayerPrefs.GetString ("Suit1")!="Kosong") {
// hantugo1.SetActive(false);
// hantugo3.SetActive(false);
// }
// }
// else{
// hantugo1.SetActive(false);
// hantugo2.SetActive(false);
// hantuchoose3.SetActive (true);
// pilihanInputSuit [2].SetActive (true);
// if (PlayerPrefs.GetString ("Suit1")!="Kosong") {
// hantugo1.SetActive(false);
// hantugo2.SetActive(false);
// }
// }
//
//
//
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
//INI SAYA TARUH DISINI.
}
timeUps = true;
if (panggil_url == false) {
panggil_url = true;
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
//urutan1 [0] = GameObject.Find ("Hantu1A");
urutan1 [1] = GameObject.Find (PlayerPrefs.GetString ("Urutan1"));
healthBar1 [0] = urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").gameObject;
healthBar1 [1] = urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").gameObject;
//suit1 [0] = "Block";
suit1 [1] = PlayerPrefs.GetString ("Suit1");
urutan2 [0] = GameObject.Find ("Hantu2A");
urutan2 [1] = GameObject.Find (PlayerPrefs.GetString ("Urutan2"));
healthBar2 [0] = urutan2 [0].transform.Find ("Canvas").transform.Find ("Image").gameObject;
// healthBar2 [1] = urutan2 [1].transform.FindChild ("Canvas").transform.FindChild ("Image").gameObject;
//suit2 [0] = "Charge";
suit2 [1] = PlayerPrefs.GetString ("Suit2");
urutan3 [0] = GameObject.Find ("Hantu3A");
urutan3 [1] = GameObject.Find (PlayerPrefs.GetString ("Urutan3"));
healthBar3 [0] = urutan3 [0].transform.Find ("Canvas").transform.Find ("Image").gameObject;
//healthBar3 [1] = urutan3 [1].transform.FindChild ("Canvas").transform.FindChild ("Image").gameObject;
//suit3 [0] = "Focus";
suit3 [1] = PlayerPrefs.GetString ("Suit3");
waiting.SetActive (false);
//information.SetActive (true);
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
//firstTimerTanding ();
//StartCoroutine (randomenemiesmovement ());
StartCoroutine (urutanPlay ());
} else {
StartCoroutine (urutanPlay ());
}
}
else {
StartCoroutine (sendFormation ());
}
}
}
else {
//pilihanInputSuit [0].SetActive (true);
}
if (getReadyStatus) {
timer -= Time.deltaTime;
scrollBar.transform.Find("Scrollbar").GetComponent<Scrollbar>().size = timer / 3f;
}
if (timer < 0 && timeUps == false) {
timeUps = true;
// for (int i = 0; i < alpha.Count; i++) {
// string temp = alpha [0];
// int randomIndex = Random.Range (i, alpha.Count);
// alpha [i] = alpha [randomIndex];
// alpha [randomIndex] = temp;
// }
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
StartCoroutine (randomPilihanInput ());
} else {
// multiplayer ();
}
}
if (timer < 0 && multitime) {
//StartCoroutine (randomPilihanInput ());
multitime = false;
}
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE" && PlayerPrefs.GetInt ("win") == 1 && levelingmate) {
float fExp1 = MonsterEXP1 / Targetnextlevel1;
float fExp2 = MonsterEXP2 / Targetnextlevel2;
float fExp3 = MonsterEXP3 / Targetnextlevel3;
//Debug.Log (fExp);
Monster1GO.transform.Find ("EXPBar1").transform.Find ("Expbar").GetComponent<Image> ().fillAmount = fExp1;
Monster2GO.transform.Find ("EXPBar2").transform.Find ("Expbar").GetComponent<Image> ().fillAmount = fExp2;
Monster3GO.transform.Find ("EXPBar3").transform.Find ("Expbar").GetComponent<Image> ().fillAmount = fExp3;
// Level.text = MonsterLevel.ToString ();
if (Targetnextlevel1 != 0) {
if (MonsterEXP1 >= Targetnextlevel1) {
tempmonsterexp1 = monstercurrentexp1 - Targetnextlevel1;
MonsterEXP1 = (int)tempmonsterexp1;
monstercurrentexp1 = tempmonsterexp1;
MonsterLevel1 += 1;
MonsterEXP1 = (int)Mathf.MoveTowards (0, monstercurrentexp1, 10 * MonsterLevel1);
}
}
if (Targetnextlevel2 != 0) {
if (MonsterEXP2 >= Targetnextlevel2) {
tempmonsterexp2 = monstercurrentexp2 - Targetnextlevel2;
MonsterEXP2 = (int)tempmonsterexp2;
monstercurrentexp2 = tempmonsterexp2;
MonsterLevel2 += 1;
MonsterEXP2 = (int)Mathf.MoveTowards (0, monstercurrentexp2, 10 * MonsterLevel1);
}
}
if (Targetnextlevel3 != 0) {
if (MonsterEXP3 >= Targetnextlevel3) {
tempmonsterexp3 = monstercurrentexp3 - Targetnextlevel3;
MonsterEXP3 = (int)tempmonsterexp3;
monstercurrentexp3 = tempmonsterexp3;
MonsterLevel3 += 1;
MonsterEXP3 = (int)Mathf.MoveTowards (0, monstercurrentexp3, 10 * MonsterLevel1);
}
}
MonsterEXP1 = (int)Mathf.MoveTowards (MonsterEXP1, monstercurrentexp1, 10*MonsterLevel1);
MonsterEXP2 = (int)Mathf.MoveTowards (MonsterEXP2, monstercurrentexp2, 10*MonsterLevel1);
MonsterEXP3 = (int)Mathf.MoveTowards (MonsterEXP3, monstercurrentexp3, 10*MonsterLevel1);
//Debug.Log (MonsterEXP);
// untuk effect level up
if (Monster1GO.transform.Find ("EXPBar1").transform.Find ("Expbar").GetComponent<Image> ().fillAmount >= 1f) {
Debug.Log ("levelup");
Monster1GO.transform.Find ("leveluptext").gameObject.SetActive (true);
Monster1GO.transform.Find ("Level").GetComponent<Text> ().text = MonsterLevel1.ToString();
GameObject blam = Instantiate (effect, m1);
//gethantunextlevel.OnClick ();
//gethantuuser.Reload ();
Targetnextlevel1 = PlayerPrefs.GetFloat ("target1");
} else {
}
if (Monster2GO.transform.Find ("EXPBar2").transform.Find ("Expbar").GetComponent<Image> ().fillAmount >= 1f) {
Debug.Log ("levelup");
Monster2GO.transform.Find ("leveluptext").gameObject.SetActive (true);
Monster2GO.transform.Find ("Level").GetComponent<Text> ().text = MonsterLevel2.ToString();
GameObject blam = Instantiate (effect, m2);
//gethantunextlevel.OnClick ();
//gethantuuser.Reload ();
Targetnextlevel2 = PlayerPrefs.GetFloat ("target2");
}
else {
}
if (Monster3GO.transform.Find ("EXPBar3").transform.Find ("Expbar").GetComponent<Image> ().fillAmount >= 1f) {
Debug.Log ("levelup");
Monster3GO.transform.Find ("leveluptext").gameObject.SetActive (true);
Monster3GO.transform.Find ("Level").GetComponent<Text> ().text = MonsterLevel3.ToString();
GameObject blam = Instantiate (effect, m3);
//gethantunextlevel.OnClick ();
//gethantuuser.Reload ();
Targetnextlevel3 = PlayerPrefs.GetFloat ("target3");
} else {
}
switch (MonsterGrade1) {
case 1:
Monster1GO.transform.Find ("bintangsusunstats").transform.Find ("bintang1").gameObject.SetActive (true);
if (MonsterLevel1 == 15) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
}
else {
// buttonactivate ();
}
break;
case 2:
Monster1GO.transform.Find ("bintangsusunstats").transform.Find ("bintang2").gameObject.SetActive (true);
if (MonsterLevel1 == 20) {
//Level.text = "Max";
//Mexp.text = "Max";
//EXPBar.fillAmount = 1;
//buttondeactivate ();
} else {
// buttonactivate ();
}
break;
case 3:
Monster1GO.transform.Find ("bintangsusunstats").transform.Find ("bintang3").gameObject.SetActive (true);
if (MonsterLevel1 == 25) {
//Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 4:
Monster1GO.transform.Find ("bintangsusunstats").transform.Find ("bintang4").gameObject.SetActive (true);
if (MonsterLevel1 == 30) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 5:
Monster1GO.transform.Find ("bintangsusunstats").transform.Find ("bintang5").gameObject.SetActive (true);
if (MonsterLevel1 == 35) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
//buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 6:
Monster1GO.transform.Find ("bintangsusunstats").transform.Find ("bintang6").gameObject.SetActive (true);
if (MonsterLevel1 == 40) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
}
switch (MonsterGrade2) {
case 1:
Monster2GO.transform.Find ("bintangsusunstats").transform.Find ("bintang1").gameObject.SetActive (true);
if (MonsterLevel1 == 15) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
// buttonactivate ();
}
break;
case 2:
Monster2GO.transform.Find ("bintangsusunstats").transform.Find ("bintang2").gameObject.SetActive (true);
if (MonsterLevel1 == 20) {
//Level.text = "Max";
//Mexp.text = "Max";
//EXPBar.fillAmount = 1;
//buttondeactivate ();
} else {
// buttonactivate ();
}
break;
case 3:
Monster2GO.transform.Find ("bintangsusunstats").transform.Find ("bintang3").gameObject.SetActive (true);
if (MonsterLevel1 == 25) {
//Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 4:
Monster2GO.transform.Find ("bintangsusunstats").transform.Find ("bintang4").gameObject.SetActive (true);
if (MonsterLevel1 == 30) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 5:
Monster2GO.transform.Find ("bintangsusunstats").transform.Find ("bintang5").gameObject.SetActive (true);
if (MonsterLevel1 == 35) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
//buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 6:
Monster2GO.transform.Find ("bintangsusunstats").transform.Find ("bintang6").gameObject.SetActive (true);
if (MonsterLevel1 == 40) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
}
switch (MonsterGrade3) {
case 1:
Monster3GO.transform.Find ("bintangsusunstats").transform.Find ("bintang1").gameObject.SetActive (true);
if (MonsterLevel1 == 15) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
// buttonactivate ();
}
break;
case 2:
Monster3GO.transform.Find ("bintangsusunstats").transform.Find ("bintang2").gameObject.SetActive (true);
if (MonsterLevel1 == 20) {
//Level.text = "Max";
//Mexp.text = "Max";
//EXPBar.fillAmount = 1;
//buttondeactivate ();
} else {
// buttonactivate ();
}
break;
case 3:
Monster3GO.transform.Find ("bintangsusunstats").transform.Find ("bintang3").gameObject.SetActive (true);
if (MonsterLevel1 == 25) {
//Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 4:
Monster3GO.transform.Find ("bintangsusunstats").transform.Find ("bintang4").gameObject.SetActive (true);
if (MonsterLevel1 == 30) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 5:
Monster3GO.transform.Find ("bintangsusunstats").transform.Find ("bintang5").gameObject.SetActive (true);
if (MonsterLevel1 == 35) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
//buttondeactivate ();
} else {
//buttonactivate ();
}
break;
case 6:
Monster3GO.transform.Find ("bintangsusunstats").transform.Find ("bintang6").gameObject.SetActive (true);
if (MonsterLevel1 == 40) {
// Level.text = "Max";
// Mexp.text = "Max";
// EXPBar.fillAmount = 1;
// buttondeactivate ();
} else {
//buttonactivate ();
}
break;
}
// levelingmate = false;
}
// healthA1.GetComponent<filled> ().currenthealth = health1 [0];
// healthA2.GetComponent<filled> ().currenthealth = health2 [0];
// healthA3.GetComponent<filled> ().currenthealth = health3 [0];
// healthB1.GetComponent<filled> ().currenthealth = health1 [1];
// healthB2.GetComponent<filled> ().currenthealth = health2 [1];
// healthB3.GetComponent<filled> ().currenthealth = health3 [1];
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE" && presentDone == false) {
if (PlayerPrefs.GetInt ("win") == 1) {
if (PlayerPrefs.GetString ("berburu") == "ya") {
StartCoroutine (sendSummon (PlayerPrefs.GetString (Link.POS_1_CHAR_1_FILE), "Kumon"));
presentDone = true;
}
else {
// if (!replay) {
if(PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE")
{
}
else
{
nextornot();
StartCoroutine(Stage());
}
// }
WinnerPresent (PlayerPrefs.GetString(Link.SEARCH_BATTLE));
// presentDone = true;
}
SceneManagerHelper.LoadSoundFX("Win");
// if (CurrentbankExp1 < 1000) {
//
// transform.FindChild ("1000").GetComponent<Button> ().interactable = false;
//
// if (CurrentbankExp < 100) {
// transform.FindChild ("100").GetComponent<Button> ().interactable = false;
// if (CurrentbankExp < 10) {
//
// transform.FindChild ("10").GetComponent<Button> ().interactable = false;
// }
// }
// } else {
// buttonactivate ();
// }
} else {
}
}
// Multiplayer
if (PlayerPrefs.GetString (Link.JENIS) == "MULTIPLE" && presentDone == false)
{
if (PlayerPrefs.GetInt ("win") == 1) {
WinnerPresent (PlayerPrefs.GetString(Link.SEARCH_BATTLE));
SceneManagerHelper.LoadSoundFX("Win");
StartCoroutine (SendReward2 ());
presentDone = true;
} else {
}
}
//done
}
void hilangkanenvi(){
if (PlayerPrefs.GetString (Link.LOKASI) == "Warehouse") {
warehouse.SetActive (false);
} else if (PlayerPrefs.GetString (Link.LOKASI) == "School") {
school.SetActive (false);
} else if (PlayerPrefs.GetString (Link.LOKASI) == "Hospital") {
hospital.SetActive (false);
} else if (PlayerPrefs.GetString (Link.LOKASI) == "Bridge") {
bridge.SetActive (false);
} else if (PlayerPrefs.GetString (Link.LOKASI) == "Graveyard") {
graveyard.SetActive (false);
}else if (PlayerPrefs.GetString (Link.LOKASI )== "ArenaDuel"){
ArenaDuel.SetActive (false);
}
else if (PlayerPrefs.GetString(Link.LOKASI) == "ArenaDuelAR")
{
ArenaDuelAR.SetActive(false);
}
else {
oldhouse.SetActive (false);
}
}
void EndingOption(int whichEnding)
{
switch(whichEnding)
{
case 1:
EndOptionButton.transform.Find ("Arena").gameObject.SetActive (true);
EndOptionButton.transform.Find ("Replay").gameObject.SetActive (false);
EndOptionButton.transform.Find ("Home").gameObject.SetActive (false);
EndOptionButton.transform.Find ("Next").gameObject.SetActive (false);
break;
}
}
void monsterleveling(){
StartCoroutine(sendEXPtri(playerhantuid1,playerhantuid2,playerhantuid3,mapexpsimpan));
}
void monsterleveling2(){
if (MonsterGrade2 == 1) {
if (MonsterLevel2 >= 15) {
Targetnextlevel2=999999;
//do nothing
} else {
StartCoroutine(sendEXP2(playerhantuid2,mapexpsimpan));
}
}
if (MonsterGrade2 == 2) {
if (MonsterLevel2 >= 20) {
Targetnextlevel2=999999;
//do nothing
} else {
StartCoroutine(sendEXP2(playerhantuid2,mapexpsimpan));
}
}
if (MonsterGrade2 == 3) {
if (MonsterLevel2 >= 25) {
Targetnextlevel2=999999;
//do nothing
} else {
StartCoroutine(sendEXP2(playerhantuid2,mapexpsimpan));
}
}
if (MonsterGrade2 == 4) {
if (MonsterLevel2 >= 30) {
Targetnextlevel2=999999;
//do nothing
} else {
StartCoroutine(sendEXP2(playerhantuid2,mapexpsimpan));
}
}
if (MonsterGrade2 == 5) {
if (MonsterLevel2 >= 35) {
Targetnextlevel2=999999;
//do nothing
} else {
StartCoroutine(sendEXP2(playerhantuid2,mapexpsimpan));
}
}
if (MonsterGrade2 == 6) {
if (MonsterLevel2 >= 40) {
Targetnextlevel2=999999;
//do nothing
} else {
StartCoroutine(sendEXP2(playerhantuid2,mapexpsimpan));
}
}
}
void monsterleveling3(){
if (MonsterGrade3 == 1) {
if (MonsterLevel3 >= 15) {
Targetnextlevel3=999999;
//do nothing
} else {
StartCoroutine(sendEXP3(playerhantuid3,mapexpsimpan));
}
}
if (MonsterGrade3 == 2) {
if (MonsterLevel3 >= 20) {
Targetnextlevel3=999999;
//do nothing
} else {
StartCoroutine(sendEXP3(playerhantuid3,mapexpsimpan));
}
}
if (MonsterGrade3 == 3) {
if (MonsterLevel3 >= 25) {
Targetnextlevel3=999999;
//do nothing
} else {
StartCoroutine(sendEXP3(playerhantuid3,mapexpsimpan));
}
}
if (MonsterGrade3 == 4) {
if (MonsterLevel3 >= 30) {
Targetnextlevel3=999999;
//do nothing
} else {
StartCoroutine(sendEXP3(playerhantuid3,mapexpsimpan));
}
}
if (MonsterGrade3 == 5) {
if (MonsterLevel3 >= 35) {
Targetnextlevel3=999999;
//do nothing
} else {
StartCoroutine(sendEXP3(playerhantuid3,mapexpsimpan));
}
}
if (MonsterGrade3 == 6) {
if (MonsterLevel3 >= 40) {
Targetnextlevel3=999999;
//do nothing
} else {
StartCoroutine(sendEXP3(playerhantuid3,mapexpsimpan));
}
}
}
public void levelingbro(){
levelingmate = true;
}
private IEnumerator sendSummon(string file, string jenis)
{
string url = Link.url + "huntGhost";
WWWForm form = new WWWForm ();
form.AddField ("MY_ID", PlayerID);
form.AddField ("FILE", file);
form.AddField ("JENIS", jenis);
form.AddField ("LOCATION",PlayerPrefs.GetString ("kodetempat"));
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
//testsummonings
var jsonString = JSON.Parse (www.text);
Debug.Log(jsonString ["data"] ["id"] );
Debug.Log(jsonString);
hasilburu.GetComponent<Image>().sprite = Resources.Load<Sprite>("icon_charLama/" + PlayerPrefs.GetString(Link.POS_1_CHAR_1_FILE));
hasilburu.transform.Find("backname").Find("Namegreen").Find("Name").GetComponent<Text>().text = jsonString["databuru"]["name"];
hasilburu.transform.Find("Stats").Find("ElementText").GetComponent<Text>().text = jsonString["databuru"]["type"];
hasilburu.transform.Find("Stats").Find("TypeText").GetComponent<Text>().text = jsonString["databuru"]["element"];
hasilburu.transform.Find("Stats").Find("DefendText").GetComponent<Text>().text = jsonString["databuru"]["DEFEND"];
hasilburu.transform.Find("Stats").Find("AttackText").GetComponent<Text>().text = jsonString["databuru"]["ATTACK"];
hasilburu.transform.Find("Stats").Find("HPText").GetComponent<Text>().text = jsonString["databuru"]["HP"];
int test;
var angka = int.TryParse(jsonString["databuru"]["grade"], out test);
if (test != null || test != 0)
{
switch (test)
{
case 1:
bintang1.SetActive(true);
bintang2.SetActive(false);
bintang3.SetActive(false);
bintang4.SetActive(false);
bintang5.SetActive(false);
break;
case 2:
bintang2.SetActive(true);
bintang1.SetActive(false);
bintang3.SetActive(false);
bintang4.SetActive(false);
bintang5.SetActive(false);
break;
case 3:
bintang3.SetActive(true);
bintang1.SetActive(false);
bintang2.SetActive(false);
bintang4.SetActive(false);
bintang5.SetActive(false);
break;
case 4:
bintang4.SetActive(true);
bintang1.SetActive(false);
bintang2.SetActive(false);
bintang3.SetActive(false);
bintang5.SetActive(false);
break;
case 5:
bintang5.SetActive(true);
bintang1.SetActive(false);
bintang2.SetActive(false);
bintang3.SetActive(false);
bintang4.SetActive(false);
break;
}
}
Debug.Log (www.text);
} else {
//failed
}
}
public void WinnerPresent(string battletype){
if(battletype=="ONLINE")
{
DropRewardsImage[0].sprite=Resources.Load<Sprite>("icon_item/" + "ArenaPoint");
ClaimText.text = PlayerPrefs.GetString (Link.ArenaGetPoint, "50") ;
StartCoroutine (SendReward2 ());
//ClaimUI.SetActive (true);
presentDone = true;
}
else
{
var presentcode = RandomWeighted();
var winning = Random.value;
var emas = 0;
EXPValueText.text = "100";
var presentType = PlayerPrefs.GetString("RewardItemType"+presentcode.ToString());
var presentQuantity = PlayerPrefs.GetString("RewardItemQuantity"+presentcode.ToString());
var presentName = PlayerPrefs.GetString("RewardItemName"+presentcode.ToString());
var presentFileName = PlayerPrefs.GetString("RewardItemFN"+presentcode.ToString());
if(presentType=="Item")
{
if(presentFileName=="Coin")
{
emas = int.Parse(presentQuantity);
}
else
{
formkirimreward.AddField(presentName, presentQuantity);
}
DropRewardsImage[0].sprite=Resources.Load<Sprite>("icon_item/" + presentFileName);
ClaimText.text = presentQuantity + " " + presentName;
}
else
{
DropRewardsImage[1].sprite=Resources.Load<Sprite>("icon_item/" + presentFileName);
//formkirimreward.AddField(presentName, presentQuantity);
formkirimreward.AddField ("ITEM", presentName);
ClaimText.text = presentQuantity + " " + presentName;
}
//formkirimreward.AddField ("GOLD", 100);
EXPValueText.text = "100";
formkirimreward.AddField ("GOLD", 100 + emas);
StartCoroutine (SendReward ());
//StartCoroutine (sendEXP (idhantuplayer, 1000));
// }
ClaimUI.SetActive (true);
presentDone = true;
PlayerPrefs.SetString ("1player", "selesai");
PlayerPrefs.SetString ("2player", "selesai");
PlayerPrefs.SetString ("3player", "selesai");
}
}
IEnumerator SendReward(){
yield return new WaitForSeconds (.5f);
//var expsingle = PlayerPrefs.GetInt ("MAPSEXP") * 3;
// Debug.Log (expsingle);
string url = Link.url + "update_data_user";
//WWWForm form = new WWWForm ();
//formkirimreward.AddField ("JumlahXpTransfer", (expsingle));
formkirimreward.AddField ("MY_ID", PlayerID);
formkirimreward.AddField ("MODE", PlayerPrefs.GetString(Link.SEARCH_BATTLE));
formkirimreward.AddField ("WIN", 1);
formkirimreward.AddField ("xpm", mapexpsimpan);
formkirimreward.AddField ("xpp", "100");
//formkirimreward.AddField ("ITEM", equipmentreward[0]);
WWW www = new WWW(url,formkirimreward);
yield return www;
if (www.error == null) {
var jsonStringer = JSON.Parse (www.text);
PlayerPrefs.SetString("MaxE",jsonStringer["data"]["MaxEnergy"]);
monsterleveling();
//berburuselesai
}
Debug.Log ("sendreward");
// var jsonString = JSON.Parse (www.text);
//PlayerPrefs.SetString ("BATU", jsonString ["data"]);
}
IEnumerator SendReward2(){
//yield return new WaitForSeconds (.5f);
//var expsingle = PlayerPrefs.GetInt ("MAPSEXP") * 3;
// Debug.Log (expsingle);
string url = Link.url + "update_data_user";
//WWWForm form = new WWWForm ();
//formkirimreward.AddField ("JumlahXpTransfer", (expsingle));
formkirimreward.AddField ("MY_ID", PlayerID);
formkirimreward.AddField ("ar", PlayerPrefs.GetString (Link.ArenaGetPoint, "50"));
formkirimreward.AddField ("MODE", PlayerPrefs.GetString(Link.SEARCH_BATTLE));
formkirimreward.AddField ("WIN", 1);
//formkirimreward.AddField ("ITEM", equipmentreward[0]);
WWW www = new WWW(url,formkirimreward);
yield return www;
if (www.error == null) {
var jsonStringer = JSON.Parse (www.text);
print(www.text);
PlayerPrefs.SetString("MaxE",jsonStringer["data"]["MaxEnergy"]);
monsterleveling();
//berburuselesai
}
Debug.Log ("sendreward");
// var jsonString = JSON.Parse (www.text);
//PlayerPrefs.SetString ("BATU", jsonString ["data"]);
}
private IEnumerator sendEXPtri(string hantuplayerid1,string hantuplayerid2, string hantuplayerid3, int Exp)
{
Debug.Log ("TES");
Debug.Log (PlayerID);
Debug.Log (hantuplayerid1);
Debug.Log (hantuplayerid2);
Debug.Log (hantuplayerid3);
Debug.Log (Exp);
string url = Link.url + "send_xp_tri";
WWWForm form = new WWWForm ();
form.AddField ("MY_ID", PlayerID);
form.AddField ("PlayerHantuID1", hantuplayerid1);
form.AddField ("PlayerHantuID2", hantuplayerid2);
form.AddField ("PlayerHantuID3", hantuplayerid3);
form.AddField ("EXPERIENCE", Exp);
//form.AddField ("CURRENTEXPB", Latestexpbank);
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
var jsonString = JSON.Parse (www.text);
PlayerPrefs.SetFloat("target1", float.Parse(jsonString ["code"] ["Targetnextlevel1"]));
PlayerPrefs.SetFloat("target2", float.Parse(jsonString ["code"] ["Targetnextlevel2"]));
PlayerPrefs.SetFloat("target3", float.Parse(jsonString ["code"] ["Targetnextlevel3"]));
monstercurrentexp1 += Exp;
monstercurrentexp2 += Exp;
monstercurrentexp3 += Exp;
PlayerPrefs.SetString (Link.CHAR_1_MONSTEREXP, jsonString ["code"] ["monstercurrentexp1"]);
PlayerPrefs.SetString(Link.CHAR_1_TARGETNL,PlayerPrefs.GetFloat("target1").ToString());
PlayerPrefs.SetString (Link.CHAR_1_LEVEL, jsonString ["code"] ["HantuLevel1"]);
PlayerPrefs.SetString (Link.CHAR_2_MONSTEREXP,jsonString ["code"] ["monstercurrentexp2"]);
PlayerPrefs.SetString(Link.CHAR_2_TARGETNL,PlayerPrefs.GetFloat("target2").ToString());
PlayerPrefs.SetString (Link.CHAR_2_LEVEL,jsonString ["code"] ["HantuLevel2"]);
PlayerPrefs.SetString (Link.CHAR_3_MONSTEREXP,jsonString ["code"] ["monstercurrentexp3"]);
PlayerPrefs.SetString(Link.CHAR_3_TARGETNL,PlayerPrefs.GetFloat("target3").ToString());
PlayerPrefs.SetString (Link.CHAR_3_LEVEL,jsonString ["code"] ["HantuLevel3"]);
Debug.Log (www.text);
// monsterleveling2();
} else {
Debug.Log (www.text);
Debug.Log (www.error);
Debug.Log ("Failed kirim data");
yield return new WaitForSeconds (5);
}
}
private IEnumerator sendEXP2(string hantuplayerid, int Exp)
{
Debug.Log ("TES");
string url = Link.url + "send_xp_enchance";
WWWForm form = new WWWForm ();
form.AddField ("MY_ID", PlayerID);
form.AddField ("PlayerHantuID", hantuplayerid);
form.AddField ("EXPERIENCE", Exp);
//form.AddField ("CURRENTEXPB", Latestexpbank);
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
var jsonString = JSON.Parse (www.text);
PlayerPrefs.SetFloat("target2", float.Parse(jsonString ["code"] ["Targetnextlevel"]));
monstercurrentexp2 += Exp;
PlayerPrefs.SetString (Link.CHAR_2_MONSTEREXP,monstercurrentexp2.ToString());
PlayerPrefs.SetString(Link.CHAR_2_TARGETNL,PlayerPrefs.GetFloat("target2").ToString());
PlayerPrefs.SetString (Link.CHAR_2_LEVEL,MonsterLevel2.ToString());
monsterleveling3();
} else {
Debug.Log ("Failed kirim data");
yield return new WaitForSeconds (5);
}
}
private IEnumerator sendEXP3(string hantuplayerid, int Exp)
{
Debug.Log ("TES");
string url = Link.url + "send_xp_enchance";
WWWForm form = new WWWForm ();
form.AddField ("MY_ID", PlayerID);
form.AddField ("PlayerHantuID", hantuplayerid);
form.AddField ("EXPERIENCE", Exp);
//form.AddField ("CURRENTEXPB", Latestexpbank);
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
var jsonString = JSON.Parse (www.text);
PlayerPrefs.SetFloat("target3", float.Parse(jsonString ["code"] ["Targetnextlevel"]));
monstercurrentexp3 += Exp;
PlayerPrefs.SetString (Link.CHAR_3_MONSTEREXP,monstercurrentexp3.ToString());
PlayerPrefs.SetString(Link.CHAR_3_TARGETNL,PlayerPrefs.GetFloat("target3").ToString());
PlayerPrefs.SetString (Link.CHAR_3_LEVEL,MonsterLevel3.ToString());
} else {
Debug.Log ("Failed kirim data");
yield return new WaitForSeconds (5);
}
}
//tambah exp habis game single player
IEnumerator DistribusiEXPMonsterItem(string hantuplayerid1,string hantuplayerid2,string hantuplayerid3,string hantuplayerid1item1,string hantuplayerid1item2,string hantuplayerid1item3,string hantuplayerid1item4,string hantuplayerid2item1,string hantuplayerid2item2,string hantuplayerid2item3,string hantuplayerid2item4,string hantuplayerid3item1,string hantuplayerid3item2,string hantuplayerid3item3,string hantuplayerid3item4, int Exp){
Debug.Log ("TES");
string url = Link.url + "send_xp_enchance";
WWWForm form = new WWWForm ();
form.AddField ("MY_ID", PlayerID);
form.AddField ("PlayerHantuID1", hantuplayerid1);
form.AddField ("PlayerHantuID2", hantuplayerid2);
form.AddField ("PlayerHantuID3", hantuplayerid3);
form.AddField ("PlayerHantuID1item1", hantuplayerid1item1);
form.AddField ("PlayerHantuID2item1", hantuplayerid2item1);
form.AddField ("PlayerHantuID3item1", hantuplayerid3item1);
form.AddField ("PlayerHantuID1item2", hantuplayerid1item2);
form.AddField ("PlayerHantuID2item2", hantuplayerid2item2);
form.AddField ("PlayerHantuID3item2", hantuplayerid3item2);
form.AddField ("PlayerHantuID1item3", hantuplayerid1item3);
form.AddField ("PlayerHantuID2item3", hantuplayerid2item3);
form.AddField ("PlayerHantuID3item3", hantuplayerid3item3);
form.AddField ("PlayerHantuID1item4", hantuplayerid1item4);
form.AddField ("PlayerHantuID2item4", hantuplayerid2item4);
form.AddField ("PlayerHantuID3item4", hantuplayerid3item4);
form.AddField ("EXPERIENCE", Exp);
//form.AddField ("CURRENTEXPB", Latestexpbank);
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
var jsonString = JSON.Parse (www.text);
PlayerPrefs.SetFloat("target", float.Parse(jsonString ["code"] ["Targetnextlevel"]));
//monstercurrentexp += Exp;
monstercurrentexp1 += Exp;
monstercurrentexp2 += Exp;
monstercurrentexp3 += Exp;
} else {
Debug.Log ("Failed kirim data");
//yield return new WaitForSeconds (5);
//StartCoroutine (updateData());
}
}
IEnumerator Apimusuh(string musuh)
{
if (ulang) {
if (musuh == "Hantu1A") {
sh1a.SetActive (true);
}
if (musuh == "Hantu2A") {
sh2a.SetActive (true);
}
if (musuh == "Hantu3A") {
sh3a.SetActive (true);
}
}
else {
yield return new WaitForSeconds (.5f);
if (musuh == "Hantu1A") {
sh1a.SetActive (true);
}
if (musuh == "Hantu2A") {
sh2a.SetActive (true);
}
if (musuh== "Hantu3A") {
sh3a.SetActive (true);
}
}
}
IEnumerator randomenemiesmovement(){
Debug.Log ("sekali");
int j = Random.Range (0, 3);
int k = Random.Range (0, 3);
int l = Random.Range (0, 3);
if (PlayerPrefs.GetString ("berburu") != "ya") {
if(PlayerPrefs.GetString("PLAY_TUTORIAL")=="TRUE")
{
urutan1 [0] = GameObject.Find ("Hantu1A");
StartCoroutine (Apimusuh (urutan1[0].name));
PlayerPrefs.SetString ("Urutan1m", urutan1 [0].name);
PlayerPrefs.SetString ("hantumusuh", urutan1 [0].name);
}
else
{
if (PlayerPrefs.GetString ("musuh1") != "mati" && PlayerPrefs.GetString ("musuh2") != "mati" && PlayerPrefs.GetString ("musuh3") != "mati") {
int urut = Random.Range (0, 3);
//urutan
if (urut == 0) {
urutan1 [0] = GameObject.Find ("Hantu1A");
}
if (urut == 1) {
urutan1 [0] = GameObject.Find ("Hantu2A");
}
if (urut == 2) {
urutan1 [0] = GameObject.Find ("Hantu3A");
} else {
urut = Random.Range (0, 2);
//urutan
if (urut == 0) {
urutan1 [0] = GameObject.Find ("Hantu1A");
}
if (urut == 1) {
urutan1 [0] = GameObject.Find ("Hantu2A");
}
if (urut == 2) {
urutan1 [0] = GameObject.Find ("Hantu3A");
}
}
}
if (PlayerPrefs.GetString ("musuh1") == "mati" && PlayerPrefs.GetString ("musuh2") != "mati") {
int urut = Random.Range (0, 1);
if (urut == 0) {
urutan1 [0] = GameObject.Find ("Hantu2A");
}
if (urut == 1) {
urutan1 [0] = GameObject.Find ("Hantu3A");
}
if (PlayerPrefs.GetString ("musuh3") == "mati") {
urutan1 [0] = GameObject.Find ("Hantu2A");
}
}
if (PlayerPrefs.GetString ("musuh1") == "mati" && PlayerPrefs.GetString ("musuh3") != "mati") {
int urut = Random.Range (0, 1);
if (urut == 0) {
urutan1 [0] = GameObject.Find ("Hantu2A");
}
if (urut == 1) {
urutan1 [0] = GameObject.Find ("Hantu3A");
}
if (PlayerPrefs.GetString ("musuh2") == "mati") {
urutan1 [0] = GameObject.Find ("Hantu3A");
}
}
if (PlayerPrefs.GetString ("musuh2") == "mati" && PlayerPrefs.GetString ("musuh3") != "mati") {
int urut = Random.Range (0, 1);
if (urut == 0) {
urutan1 [0] = GameObject.Find ("Hantu1A");
}
if (urut == 1) {
urutan1 [0] = GameObject.Find ("Hantu3A");
}
if (PlayerPrefs.GetString ("musuh1") == "mati") {
urutan1 [0] = GameObject.Find ("Hantu3A");
}
}
if (PlayerPrefs.GetString ("musuh2") == "mati" && PlayerPrefs.GetString ("musuh1") != "mati") {
int urut = Random.Range (0, 1);
if (urut == 0) {
urutan1 [0] = GameObject.Find ("Hantu1A");
}
if (urut == 1) {
urutan1 [0] = GameObject.Find ("Hantu3A");
}
if (PlayerPrefs.GetString ("musuh3") == "mati") {
urutan1 [0] = GameObject.Find ("Hantu1A");
}
}
if (PlayerPrefs.GetString ("musuh3") == "mati" && PlayerPrefs.GetString ("musuh1") != "mati") {
int urut = Random.Range (0, 1);
if (urut == 0) {
urutan1 [0] = GameObject.Find ("Hantu1A");
}
if (urut == 1) {
urutan1 [0] = GameObject.Find ("Hantu2A");
}
if (PlayerPrefs.GetString ("musuh2") == "mati") {
urutan1 [0] = GameObject.Find ("Hantu1A");
}
}
if (PlayerPrefs.GetString ("musuh3") == "mati" && PlayerPrefs.GetString ("musuh2") != "mati") {
int urut = Random.Range (0, 1);
if (urut == 0) {
urutan1 [0] = GameObject.Find ("Hantu1A");
}
if (urut == 1) {
urutan1 [0] = GameObject.Find ("Hantu2A");
}
if (PlayerPrefs.GetString ("musuh1") == "mati") {
urutan1 [0] = GameObject.Find ("Hantu2A");
}
}
StartCoroutine (Apimusuh (urutan1[0].name));
PlayerPrefs.SetString ("Urutan1m", urutan1 [0].name);
PlayerPrefs.SetString ("hantumusuh", urutan1 [0].name);
}
}
else {
urutan1 [0] = GameObject.Find ("Hantu1A");
StartCoroutine (Apimusuh (urutan1[0].name));
PlayerPrefs.SetString ("Urutan1m", urutan1 [0].name);
PlayerPrefs.SetString ("hantumusuh", urutan1 [0].name);
}
//urutan
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") != "TRUE") {
if (j == 0) {
suit1 [0] = "Charge";
}
if (j == 1) {
suit1 [0] = "Block";
}
if (j == 2) {
suit1 [0] = "Focus";
}
//yield return new WaitForSeconds(1);
if (k == 0) {
suit2 [0] = "Charge";
}
if (k == 1) {
suit2 [0] = "Block";
}
if (k == 2) {
suit2 [0] = "Focus";
}
//
if (l == 0) {
suit3 [0] = "Charge";
}
if (l == 1) {
suit3 [0] = "Block";
}
if (l == 2) {
suit3 [0] = "Focus";
}
StartCoroutine (Apimusuh (urutan1[0].name));
Debug.Log (urutan1[0].name);
PlayerPrefs.SetString ("Urutan1m", urutan1 [0].name);
}
yield return null;
PlayerPrefs.SetString("hantumusuh",urutan1[0].name);
}
IEnumerator randomPilihanInput(){
//int j = Random.Range (0, 2);
if (PlayerPrefs.GetInt ("pos") == 1) {
if (PlayerPrefs.GetString ("Urutan1") == "Hantu1A") {
pilihanInputSuit [0].GetComponent<RandomClick> ().RandomPilih ();
// if (hantuchoose2.activeSelf) {
// hantuchoose2.GetComponent<RandomClick> ().RandomPilih ();
// }
// yield return new WaitForSeconds(1);
//
// if (hantuchoose3.activeSelf) {
// hantuchoose3.GetComponent<RandomClick> ().RandomPilih ();
// }
// if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
// firstTimerTanding ();
// //StartCoroutine (urutanPlay());
//
// }
}
if (PlayerPrefs.GetString ("Urutan1") == "Hantu2A") {
pilihanInputSuit [1].GetComponent<RandomClick> ().RandomPilih ();
}
if (PlayerPrefs.GetString ("Urutan1") == "Hantu3A") {
pilihanInputSuit [2].GetComponent<RandomClick> ().RandomPilih ();
}
} else {
if (PlayerPrefs.GetString ("Urutan1") == "Hantu1B") {
pilihanInputSuit [0].GetComponent<RandomClick> ().RandomPilih ();
// if (hantuchoose2.activeSelf) {
// hantuchoose2.GetComponent<RandomClick> ().RandomPilih ();
// }
// yield return new WaitForSeconds(1);
//
// if (hantuchoose3.activeSelf) {
// hantuchoose3.GetComponent<RandomClick> ().RandomPilih ();
// }
// if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
// firstTimerTanding ();
// //StartCoroutine (urutanPlay());
//
// }
}
if (PlayerPrefs.GetString ("Urutan1") == "Hantu2B") {
pilihanInputSuit [1].GetComponent<RandomClick> ().RandomPilih ();
}
if (PlayerPrefs.GetString ("Urutan1") == "Hantu3B") {
pilihanInputSuit [2].GetComponent<RandomClick> ().RandomPilih ();
}
}
// else if (j == 3) {
//
//
// if (pilihanInputSuit [2].activeSelf) {
// pilihanInputSuit [2].GetComponent<RandomClick> ().RandomPilih ();
// }
// yield return new WaitForSeconds(1);
// if (pilihanInputSuit [1].activeSelf) {
// pilihanInputSuit [1].GetComponent<RandomClick> ().RandomPilih ();
// }
//
// yield return new WaitForSeconds(1);
// if (pilihanInputSuit [0].activeSelf) {
// pilihanInputSuit [0].GetComponent<RandomClick> ().RandomPilih ();
// }if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
// firstTimerTanding ();
// //StartCoroutine (urutanPlay());
//
// }
//
//
// }
yield return null;
}
private IEnumerator sendFormation()
{
ImDoneForSendBool = true;
StartCoroutine (ImDoneForSend ());
Debug.Log ("send prrogress");
string url = Link.url + "send_formation";
WWWForm form = new WWWForm ();
form.AddField (Link.ID, PlayerID);
form.AddField ("pos", PlayerPrefs.GetInt("pos").ToString());
if (PlayerPrefs.GetInt ("pos") == 1) {
form.AddField ("urutan_1", PlayerPrefs.GetString ("Urutan1m"));
} else {
form.AddField ("urutan_1", PlayerPrefs.GetString ("Urutan1"));
}
form.AddField ("suit_1", PlayerPrefs.GetString("Suit1"));
//form.AddField ("urutan_2", PlayerPrefs.GetString("Urutan2"));
//form.AddField ("suit_2", PlayerPrefs.GetString("Suit2"));
//form.AddField ("urutan_3", PlayerPrefs.GetString("Urutan3"));
//form.AddField ("suit_3", PlayerPrefs.GetString("Suit3"));
form.AddField ("room_name", PlayerPrefs.GetString ("RoomName"));
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
Debug.Log ("send success");
var jsonString = JSON.Parse (www.text);
int a = 0;
for (int i = 0; i < int.Parse (jsonString ["code"]); i++) {
a++;
}
if (a == 1) {
ImDoneForSendInteger = 0;
ImDoneForSendBool = false;
ImDoneForWaitingBool = true;
StartCoroutine (ImDoneForWaiting ());
StartCoroutine (onCoroutine());
} else {
Debug.Log ("fail");
}
} else {
Debug.Log ("fail");
}
}
public bool ImDoneForWaitingBool = true;
public int ImDoneForWaitingInteger = 0;
public GameObject done;
public void waitplayer() {
ImDoneForWaitingInteger = 0;
StartCoroutine(ImDoneForWaiting());
}
IEnumerator ImDoneForWaiting () {
while(ImDoneForWaitingBool)
{
Debug.Log ("TikTok : " + ImDoneForWaitingInteger.ToString ());
ImDoneForWaitingInteger++;
if (ImDoneForWaitingInteger>30) {
done.SetActive (true);
}
yield return new WaitForSeconds(1f);
}
}
public void OnClickDone () {
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
PlayerPrefs.SetString ("FightUdah", "TRUE");
PlayerPrefs.SetString ("lewat","ya");
}
SceneManagerHelper.LoadScene ("Home");
}
public bool ImDoneForSendBool = true;
public int ImDoneForSendInteger = 0;
public GameObject Send;
IEnumerator ImDoneForSend () {
while(ImDoneForSendBool)
{
Debug.Log ("TikTok : " + ImDoneForSendInteger.ToString ());
ImDoneForSendInteger++;
if (ImDoneForSendInteger>30) {
Send.SetActive (true);
}
yield return new WaitForSeconds(1f);
}
}
public void OnClickSend () {
SceneManagerHelper.LoadScene ("Home");
}
IEnumerator onCoroutine(){
while(data_belum_ada)
{
StartCoroutine (cekFormation());
yield return new WaitForSeconds(1f);
}
}
private IEnumerator cekFormation()
{
if (data_belum_ada) {
string url = Link.url + "cek_formation";
WWWForm form = new WWWForm ();
form.AddField (Link.ID, PlayerID);
form.AddField ("room_name", PlayerPrefs.GetString ("RoomName"));
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
var jsonString = JSON.Parse (www.text);
int a = 0;
// int c = 0;
//
for (int i = 0; i < int.Parse (jsonString ["code"]); i++) {
a++;
}
if (a == 2 && data_belum_ada) {
data_belum_ada = false;
ImDoneForWaitingBool = false;
ImDoneForWaitingInteger = 0;
Debug.Log ("SUDAH DI FALSE KAN !!!!");
Debug.Log (data_belum_ada);
urutan1 [0] = GameObject.Find (jsonString ["data"] [0] ["urutan_1"]);
urutan1 [1] = GameObject.Find (jsonString ["data"] [1] ["urutan_1"]);
healthBar1 [0] = urutan1 [0].transform.Find ("Canvas").transform.Find ("Image").gameObject;
healthBar1 [1] = urutan1 [1].transform.Find ("Canvas").transform.Find ("Image").gameObject;
suit1 [0] = jsonString ["data"] [0] ["suit_1"];
suit1 [1] = jsonString ["data"] [1] ["suit_1"];
//urutan2 [0] = GameObject.Find (jsonString ["data"] [0] ["urutan_2"]);
//urutan2 [1] = GameObject.Find (jsonString ["data"] [1] ["urutan_2"]);
// healthBar2 [0] = urutan2 [0].transform.FindChild ("Canvas").transform.FindChild ("Image").gameObject;
// healthBar2 [1] = urutan2 [1].transform.FindChild ("Canvas").transform.FindChild ("Image").gameObject;
//suit2 [0] = jsonString ["data"] [0] ["suit_2"];
//suit2 [1] = jsonString ["data"] [1] ["suit_2"];
//urutan3 [0] = GameObject.Find (jsonString ["data"] [0] ["urutan_3"]);
//urutan3 [1] = GameObject.Find (jsonString ["data"] [1] ["urutan_3"]);
//healthBar3 [0] = urutan3 [0].transform.FindChild ("Canvas").transform.FindChild ("Image").gameObject;
// healthBar3 [1] = urutan3 [1].transform.FindChild ("Canvas").transform.FindChild ("Image").gameObject;
//suit3 [0] = jsonString ["data"] [0] ["suit_3"];
//suit3 [1] = jsonString ["data"] [1] ["suit_3"];
waiting.SetActive (false);
//information.SetActive (true);
if (PlayerPrefs.GetInt ("pos") == 1) {
PlayerPrefs.SetString ("Urutan1", urutan1 [1].name);
PlayerPrefs.SetString ("hantumusuh", urutan1 [1].name);
PlayerPrefs.SetString ("Suit1", suit1 [1]);
} else {
Debug.Log(PlayerPrefs.GetString ("Urutan1m"));
PlayerPrefs.SetString ("Urutan1m",urutan1 [0].name);
PlayerPrefs.SetString ("hantumusuh", urutan1 [0].name);
PlayerPrefs.SetString ("Suit1", suit1 [0]);
}
StartCoroutine (urutanPlay());
}
else {
waiting.SetActive (true);
}
} else {
Debug.Log ("fail");
}
}
}
public Image[] kertasButton;
public Image[] batuButton;
public Image[] guntingButton;
public Sprite kertasSprite;
public Sprite batuSprite;
public Sprite guntingSprite;
public void GetCriticalValue()
{
GetCritical = Random.Range(0,10);
}
IEnumerator urutanPlay(){
tanding = true;
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
firstTimerTanding ();
}
cameraB.GetComponent<Animator> ().SetBool ("vanny", false);
if (critical && attacking>=3 && PlayerPrefs.GetString(Link.JENIS) == "SINGLE") {
effect1_1.SetActive (true);
effect2_1.SetActive (true);
effect1_2.SetActive (true);
effect2_2.SetActive (true);
effect1_3.SetActive (true);
effect2_3.SetActive (true);
level1 = true;
cameraB.transform.Find ("PlaneP").gameObject.SetActive (true);
cameraB.GetComponent<Animator> ().SetBool ("vanny", true);
cameraB.GetComponent<Camera> ().cullingMask = -139265;
times = 100;
PlayerPrefs.SetString ("Critical", "n");
karaA.GetComponent<Animation>().PlayQueued("seranggame",QueueMode.PlayNow);
karaBanimation.PlayQueued("seranggame",QueueMode.PlayNow);
yield return new WaitForSeconds (1f);
}
yield return new WaitForSeconds (.1f);
sebelumwar (GetCritical);
if(GetCritical<=1)
{
yield return new WaitForSeconds (2);
sebelumwar2 ();
}
else
{
if (critical && attacking>=3 && PlayerPrefs.GetString(Link.JENIS) == "SINGLE")
{
yield return new WaitForSeconds (2);
sebelumwar2 ();
}
}
// yield return new WaitForSeconds (1);
scrollBar.SetActive (false);
cameraA.GetComponent<Animator> ().SetBool ("Fighting", true);
// yield return new WaitForSeconds(1f);
// vs.SetActive (true);
Aobject.GetComponent<Animator> ().SetBool ("LeftFight", true);
Bobject.GetComponent<Animator> ().SetBool ("RightFight", true);
// Aaobject.GetComponent<Animator> ().SetBool ("LeftFight", true);
// Baobject.GetComponent<Animator> ().SetBool ("RightFight", true);
if (suit1 [0] == "Charge") {
Aobject.GetComponent<Animator> ().SetBool ("FightCharge", true);
}
if (suit1 [0] == "Focus") {
Aobject.GetComponent<Animator> ().SetBool ("FightFocus", true);
}
if (suit1 [0] == "Block") {
Aobject.GetComponent<Animator> ().SetBool ("FightBlock", true);
}
if (suit1 [1] == "Charge") {
Bobject.GetComponent<Animator> ().SetBool ("FightCharge", true);
}
if (suit1 [1] == "Focus") {
Bobject.GetComponent<Animator> ().SetBool ("FightFocus", true);
}
if (suit1 [1] == "Block") {
Bobject.GetComponent<Animator> ().SetBool ("FightBlock", true);
}
StartCoroutine (War(urutan1[0],urutan1[1],suit1[0],suit1[1],1,GetCritical));
pilihanInputSuit [0].SetActive (false);
pilihanInputSuit [1].SetActive (false);
pilihanInputSuit [2].SetActive (false);
if (PlayerPrefs.GetString(Link.JENIS) == "SINGLE")
{
//healthBar1[1].SetActive(false);
//healthBar2[1].SetActive(false);
//healthBar3[1].SetActive(false);
}
//cameraB.GetComponent<Animator> ().SetBool ("Fighting", false);
// yield return new WaitForSeconds(5f);
// cameraB.GetComponent<Animator> ().SetBool ("Fighting", true);
// cameraA.GetComponent<Animator> ().SetBool ("Fighting", true);
// Aobject.GetComponent<Animator> ().SetBool ("LeftFight", true);
// Bobject.GetComponent<Animator> ().SetBool ("RightFight", true);
// // Aaobject.GetComponent<Animator> ().SetBool ("LeftFight", true);
// // Baobject.GetComponent<Animator> ().SetBool ("RightFight", true);
//
// if (suit2 [0] == "Charge") {
// Aobject.GetComponent<Animator> ().SetBool ("FightCharge", true);
// }
// if (suit2 [0] == "Focus") {
// Aobject.GetComponent<Animator> ().SetBool ("FightFocus", true);
// }
// if (suit2 [0] == "Block") {
// Aobject.GetComponent<Animator> ().SetBool ("FightBlock", true);
// }
// if (suit2 [1] == "Charge") {
// Bobject.GetComponent<Animator> ().SetBool ("FightCharge", true);
// }
// if (suit2 [1] == "Focus") {
// Bobject.GetComponent<Animator> ().SetBool ("FightFocus", true);
// }
// if (suit2 [1] == "Block") {
// Bobject.GetComponent<Animator> ().SetBool ("FightBlock", true);
// }
//
//
// StartCoroutine (War(urutan2[0],urutan2[1],suit2[0],suit2[1],2));
//
// yield return new WaitForSeconds(5.3f);
// cameraB.GetComponent<Animator> ().SetBool ("Fighting", true);
// cameraA.GetComponent<Animator> ().SetBool ("Fighting", true);
// Aobject.GetComponent<Animator> ().SetBool ("LeftFight", true);
// Bobject.GetComponent<Animator> ().SetBool ("RightFight", true);
//
// // Aaobject.GetComponent<Animator> ().SetBool ("LeftFight", true);
// // Baobject.GetComponent<Animator> ().SetBool ("RightFight", true);
//
//
// if (suit3 [0] == "Charge") {
// Aobject.GetComponent<Animator> ().SetBool ("FightCharge", true);
// }
// if (suit3 [0] == "Focus") {
// Aobject.GetComponent<Animator> ().SetBool ("FightFocus", true);
// }
// if (suit3 [0] == "Block") {
// Aobject.GetComponent<Animator> ().SetBool ("FightBlock", true);
// }
// if (suit3 [1] == "Charge") {
// Bobject.GetComponent<Animator> ().SetBool ("FightCharge", true);
// }
// if (suit3 [1] == "Focus") {
// Bobject.GetComponent<Animator> ().SetBool ("FightFocus", true);
// }
// if (suit3 [1] == "Block") {
// Bobject.GetComponent<Animator> ().SetBool ("FightBlock", true);
// }
//
//
//
// StartCoroutine (War(urutan3[0],urutan3[1],suit3[0],suit3[1],3));
//
yield return new WaitForSeconds(1.4f);
cameraB.GetComponent<Animator> ().SetBool ("Fighting", false);
cameraA.GetComponent<Animator> ().SetBool ("Fighting", false);
cameraB.GetComponent<Animator> ().SetBool ("vanny", false);
//cameraB.GetComponent<Camera> ().cullingMask = -8193;
cameraB.GetComponent<Animator> ().SetBool ("idling", false);
cameraB.GetComponent<Animator> ().SetBool ("hitted", false);
cameraA.GetComponent<Animator> ().SetBool ("idling", false);
cameraA.GetComponent<Animator> ().SetBool ("hitted", false);
//urutan1 [1].GetComponent<Animator> ().enabled = false;
urutan1 [1].GetComponent<Animator> ().Play ("New State");
urutan1 [0].GetComponent<Animator> ().Play ("New State");
kertasButton [0].sprite = kertasSprite;
kertasButton [1].sprite = kertasSprite;
kertasButton [2].sprite = kertasSprite;
batuButton [0].sprite = batuSprite;
batuButton [1].sprite = batuSprite;
batuButton [2].sprite = batuSprite;
guntingButton [0].sprite = guntingSprite;
guntingButton [1].sprite = guntingSprite;
guntingButton [2].sprite = guntingSprite;
kertasButton [0].transform.GetComponent<ButtonInput> ().tekan = true;
kertasButton [1].transform.GetComponent<ButtonInput> ().tekan = true;
kertasButton [2].transform.GetComponent<ButtonInput> ().tekan = true;
batuButton [0].transform.GetComponent<ButtonInput> ().tekan = true;
batuButton [1].transform.GetComponent<ButtonInput> ().tekan = true;
batuButton [2].transform.GetComponent<ButtonInput> ().tekan = true;
guntingButton [0].transform.GetComponent<ButtonInput> ().tekan = true;
guntingButton [1].transform.GetComponent<ButtonInput> ().tekan = true;
guntingButton [2].transform.GetComponent<ButtonInput> ().tekan = true;
scrollBar.SetActive (true);
// vs.SetActive (false);
hantugo1.SetActive(true);
hantugo2.SetActive(true);
hantugo3.SetActive(true);
hantugo1.transform.Find("COPY_POSITION").GetComponentInChildren<SkinnedMeshRenderer>().enabled=true;
hantugo2.transform.Find("COPY_POSITION").GetComponentInChildren<SkinnedMeshRenderer>().enabled=true;
hantugo3.transform.Find("COPY_POSITION").GetComponentInChildren<SkinnedMeshRenderer>().enabled=true;
hantugo1.transform.localPosition= new Vector3 (0.3f, 0.011f, 0.444f);
hantugo2.transform.localPosition= new Vector3 (0f, 0.011f, 0.444f);
hantugo3.transform.localPosition= new Vector3 (-0.3f, 0.011f, 0.444f);
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") != "TRUE")
{
hantugom2.transform.Find("COPY_POSITION").GetComponentInChildren<SkinnedMeshRenderer>().enabled=true;
hantugom3.transform.Find("COPY_POSITION").GetComponentInChildren<SkinnedMeshRenderer>().enabled=true;
}
hantugom1.transform.Find("COPY_POSITION").GetComponentInChildren<SkinnedMeshRenderer>().enabled=true;
hantugo1.transform.Find("Canvas").gameObject.SetActive(true);
hantugo2.transform.Find("Canvas").gameObject.SetActive(true);
hantugo3.transform.Find("Canvas").gameObject.SetActive(true);
hantugom1.transform.Find("Canvas").gameObject.SetActive(true);
hantugom2.transform.Find("Canvas").gameObject.SetActive(true);
hantugom3.transform.Find("Canvas").gameObject.SetActive(true);
hantugom1.SetActive(true);
hantugom2.SetActive(true);
hantugom3.SetActive(true);
hantugom1.transform.localPosition= new Vector3 (-0.3f, 0.011f, -.523f);
hantugom2.transform.localPosition= new Vector3 (0f, 0.011f, -.523f);
hantugom3.transform.localPosition= new Vector3 (0.3f, 0.011f, -.523f);
if (level1) {
effect1_1.SetActive (true);
effect2_1.SetActive (true);
effect1_2.SetActive (true);
effect2_2.SetActive (true);
effect1_3.SetActive (true);
effect2_3.SetActive (true);
}
if (repeat) {
ulang = true;
if (Time.timeScale == .6f) {
Time.timeScale = 1f;
}
attacking++;
Debug.Log (PlayerPrefs.GetString ("musuh1") + "1");
Debug.Log (PlayerPrefs.GetString ("musuh2") + "2");
Debug.Log (PlayerPrefs.GetString ("musuh3") + "3");
Debug.Log ("Repeat");
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") != "TRUE") {
StartCoroutine (randomenemiesmovement ());
}
else {
//firstTimerTanding ();
StartCoroutine (randomenemiesmovement ());
//StartCoroutine (randomenemiesmovement ());
}
}
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
karaBbukuskin.enabled = true;
karaBskin.enabled = true;
karaBanimation.PlayQueued ("idlegame", QueueMode.PlayNow);
speedOption.SetActive (true);
scrollBar.transform.Find ("Scrollbar").GetComponent<Scrollbar> ().size = 1;
timer = 3f;
timeUps = false;
panggil_url = false;
data_belum_ada = true;
PlayerPrefs.SetInt ("Jumlah", 0);
PlayerPrefs.SetString ("Main", "tidak");
PlayerPrefs.SetString ("Urutan1", "Kosong");
PlayerPrefs.SetString ("Suit1", "Kosong");
cameraB.transform.position = new Vector3 (12.9f, 25.5f, 63.7f);
cameraB.transform.rotation = Quaternion.Euler (23.09f, 191.491f, 1.302f);
cameraB.transform.Find ("Plane").gameObject.SetActive (false);
// hantugo1.SetActive(true);
// hantugo2.SetActive(true);
// hantugo3.SetActive(true);
hantuchoose1.SetActive (false);
hantuchoose2.SetActive (false);
hantuchoose3.SetActive (false);
hantugo1.transform.localPosition = new Vector3 (0.3f, 0.011f, 0.444f);
hantugo2.transform.localPosition = new Vector3 (0f, 0.011f, 0.444f);
hantugo3.transform.localPosition = new Vector3 (-0.3f, 0.011f, 0.444f);
if (PlayerPrefs.GetString ("kenahit") == "w") {
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
karaBanimation.PlayQueued ("idlegame", QueueMode.CompleteOthers);
} else {
karaBanimation.PlayQueued ("kalahgame", QueueMode.PlayNow);
karaBanimation.PlayQueued ("idlegame", QueueMode.CompleteOthers);
}
if (critical && attacking >= 3) {
critical = false;
attacking = 0;
}
tanding = false;
if (PlayerPrefs.GetString ("berburu") != "ya" && !PlayerPrefs.HasKey ("win")) {
if (PlayerPrefs.GetString("PLAY_TUTORIAL")=="TRUE") {
if(!PlayerPrefs.HasKey("win")){
hantugom1.transform.localPosition = new Vector3 (0f, 0.011f, -.523f);
if (PlayerPrefs.GetString ("musuh1") == "selesai") {
model11a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh1") == "mati") {
model11a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
}
if (PlayerPrefs.GetString ("1player") == "selesai") {
model21a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [3].SetActive (true);
h1cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
model21a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small3");
}
if (PlayerPrefs.GetString ("2player") == "selesai") {
model22a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [4].SetActive (true);
h2cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
model22a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small4");
}
if (PlayerPrefs.GetString ("3player") == "selesai") {
model23a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [5].SetActive (true);
h3cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
model23a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small5");
}
}
}
else{
if (PlayerPrefs.GetString ("musuh1") == "selesai") {
model11a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh2") == "selesai") {
model12a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh3") == "selesai") {
model13a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh1") == "mati") {
model11a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small");
}
if (PlayerPrefs.GetString ("musuh2") == "mati") {
model12a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small1");
}
if (PlayerPrefs.GetString ("musuh3") == "mati") {
model13a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small2");
}
if (PlayerPrefs.GetString ("1player") == "selesai") {
model21a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [3].SetActive (true);
h1cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
model21a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small3");
}
if (PlayerPrefs.GetString ("2player") == "selesai") {
model22a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [4].SetActive (true);
h2cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
model22a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small4");
}
if (PlayerPrefs.GetString ("3player") == "selesai") {
model23a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [5].SetActive (true);
h3cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
model23a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small5");
}
}
}
else {
if(!PlayerPrefs.HasKey("win")){
hantugom1.transform.localPosition = new Vector3 (0f, 0.011f, -.523f);
if (PlayerPrefs.GetString ("musuh1") == "selesai") {
model11a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh1") == "mati") {
model11a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
}
if (PlayerPrefs.GetString ("1player") == "selesai") {
model21a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [3].SetActive (true);
h1cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
model21a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small3");
}
if (PlayerPrefs.GetString ("2player") == "selesai") {
model22a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [4].SetActive (true);
h2cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
model22a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small4");
}
if (PlayerPrefs.GetString ("3player") == "selesai") {
model23a.PlayQueued ("idle", QueueMode.PlayNow);
pilihanInputSuit [5].SetActive (true);
h3cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
model23a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small5");
}
}
}
getReadyStatus = false;
// PlayerPrefs.SetString ("id_device","2");
// PlayerPrefs.SetString ("pos","2");
PlayerPrefs.SetString ("RoomName", "SINGLE");
// plihan1.SetActive (true);
// plihan2.SetActive (true);
// plihan3.SetActive (true);
if (PlayerPrefs.GetString(Link.JENIS) == "SINGLE")
{
if (auto) {
Debug.Log ("ulang");
automatic ();
}
// healthBar1[1].SetActive(true);
// healthBar2[1].SetActive(true);
// healthBar3[1].SetActive(true);
}
}
else {
if (PlayerPrefs.GetInt ("pos") == 1)
{
if (PlayerPrefs.GetString ("musuh1") == "selesai") {
pilihanInputSuit[3].SetActive (true);
h1cubea.SetActive(true);
}
if (PlayerPrefs.GetString ("musuh2") == "selesai") {
pilihanInputSuit[4].SetActive (true);
h2cubea.SetActive(true);
}
if (PlayerPrefs.GetString ("musuh3") == "selesai") {
pilihanInputSuit[5].SetActive (true);
h3cubea.SetActive(true);
}
if (PlayerPrefs.GetString ("musuh1") == "mati")
{
pilihanInputSuit[3].SetActive (false);
h1cubea.SetActive(false);
}
if (PlayerPrefs.GetString ("musuh2") == "mati")
{
pilihanInputSuit[4].SetActive (false);
h2cubea.SetActive(false);
}
if (PlayerPrefs.GetString ("musuh3") == "mati")
{
pilihanInputSuit[5].SetActive (false);
h3cubea.SetActive(false);
}
}
else
{
if (PlayerPrefs.GetString ("1player") == "selesai") {
pilihanInputSuit[3].SetActive (true);
h1cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("2player") == "selesai") {
pilihanInputSuit[4].SetActive (true);
h2cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("3player") == "selesai") {
pilihanInputSuit[5].SetActive (true);
h3cubeb.SetActive(true);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
pilihanInputSuit[3].SetActive (false);
h1cubeb.SetActive(false);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
pilihanInputSuit[4].SetActive (false);
h2cubeb.SetActive(false);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
pilihanInputSuit[5].SetActive (false);
h3cubeb.SetActive(false);
}
}
if (PlayerPrefs.GetString ("berburu") != "ya" && !PlayerPrefs.HasKey ("win")) {
if(PlayerPrefs.GetString("PLAY_TUTORIAL")=="TRUE") {
if(!PlayerPrefs.HasKey("win")){
hantugom1.transform.localPosition = new Vector3 (0f, 0.011f, -.523f);
if (PlayerPrefs.GetString ("musuh1") == "selesai") {
model11a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh1") == "mati") {
model11a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
}
if (PlayerPrefs.GetString ("1player") == "selesai") {
model21a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [3].SetActive (true);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
model21a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small3");
}
if (PlayerPrefs.GetString ("2player") == "selesai") {
model22a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [4].SetActive (true);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
model22a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small4");
}
if (PlayerPrefs.GetString ("3player") == "selesai") {
model23a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [5].SetActive (true);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
model23a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small5");
}
}
}
else {
if (PlayerPrefs.GetString ("musuh1") == "selesai") {
model11a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh2") == "selesai") {
model12a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh3") == "selesai") {
model13a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh1") == "mati") {
model11a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small");
}
if (PlayerPrefs.GetString ("musuh2") == "mati") {
model12a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small1");
}
if (PlayerPrefs.GetString ("musuh3") == "mati") {
model13a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small2");
}
if (PlayerPrefs.GetString ("1player") == "selesai") {
model21a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [3].SetActive (true);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
model21a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small3");
}
if (PlayerPrefs.GetString ("2player") == "selesai") {
model22a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [4].SetActive (true);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
model22a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small4");
}
if (PlayerPrefs.GetString ("3player") == "selesai") {
model23a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [5].SetActive (true);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
model23a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small5");
}
}
} else {
if(!PlayerPrefs.HasKey("win")){
hantugom1.transform.localPosition = new Vector3 (0f, 0.011f, -.523f);
if (PlayerPrefs.GetString ("musuh1") == "selesai") {
model11a.PlayQueued ("idle", QueueMode.PlayNow);
}
if (PlayerPrefs.GetString ("musuh1") == "mati") {
model11a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
}
if (PlayerPrefs.GetString ("1player") == "selesai") {
model21a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [3].SetActive (true);
}
if (PlayerPrefs.GetString ("1player") == "mati") {
model21a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small3");
}
if (PlayerPrefs.GetString ("2player") == "selesai") {
model22a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [4].SetActive (true);
}
if (PlayerPrefs.GetString ("2player") == "mati") {
model22a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small4");
}
if (PlayerPrefs.GetString ("3player") == "selesai") {
model23a.PlayQueued ("idle", QueueMode.PlayNow);
// pilihanInputSuit [5].SetActive (true);
}
if (PlayerPrefs.GetString ("3player") == "mati") {
model23a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small5");
}
}
}
hantuchoose1.SetActive (false);
hantuchoose2.SetActive (false);
hantuchoose3.SetActive (false);
PlayerPrefs.SetString ("hantumusuh", "kosong");
StartCoroutine (resetFormation());
}
//repeat = false;
}
else {
if (PlayerPrefs.GetString ("musuh1") == "mati") {
model11a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small");
}
if (PlayerPrefs.GetString ("musuh2") == "mati") {
model12a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small1");
}
if (PlayerPrefs.GetString ("musuh3") == "mati") {
model13a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugom3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small2");
} if (PlayerPrefs.GetString ("2player") == "mati") {
model22a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small4");
}if (PlayerPrefs.GetString ("3player") == "mati") {
model23a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small5");
} if (PlayerPrefs.GetString ("1player") == "mati") {
model21a.PlayQueued ("kalah", QueueMode.PlayNow);
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo1.transform.Find ("COPY_POSITION").GetComponent<Animator> ().Play ("small3");
}
karaBbukuskin.enabled = true;
karaBskin.enabled = true;
karaA.transform.Find ("book001").GetComponent<SkinnedMeshRenderer> ().enabled = true;
karaA.GetComponent<SkinnedMeshRenderer> ().enabled = true;
urutan1 [0] = GameObject.Find ("Hantu1A");
urutan1 [1] = GameObject.Find ("Hantu1B");
urutan2 [0] = GameObject.Find ("Hantu2A");
urutan2 [1] = GameObject.Find ("Hantu2B");
urutan3 [0] = GameObject.Find ("Hantu3A");
urutan3 [1] = GameObject.Find ("Hantu3B");
resetDatabaseYo = true;
if (PlayerPrefs.GetString ("berburu") != "ya") {
if(PlayerPrefs.GetString("PLAY_TUTORIAL")=="TRUE")
{
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
if (Bb) {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
// urutan2 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
// urutan3 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
winner.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
} else {
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
// urutan2 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
// urutan3 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaBanimation.PlayQueued ("kalahend", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
losser2.SetActive (true);
winner3.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
}
}
else
{
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
if (Bb) {
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
if (ApakahCameraA) {
Debug.Log ("KALAH");
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
karaBanimation.PlayQueued ("kalahend", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
EndOption[5].SetActive (true);
losser.SetActive (true);
winner.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
} else {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
winner.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
}
}
//Multiplayer
//Multiplayer
//Multiplayer
else {
if (ApakahCameraA) {
Debug.Log ("KALAH");
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
karaA.GetComponent<Animation> ().PlayQueued ("kalahend", QueueMode.PlayNow);
// karaB.GetComponent<Animation> ().PlayQueued ("menanggame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
EndOption[5].SetActive (true);
losser.SetActive (true);
winner2.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
} else {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
// karaA.GetComponent<Animation> ().PlayQueued ("kalahgame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
winner2.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
}
}
} else {//kondisi A menang
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
if (ApakahCameraA) {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
//EndOptionButton.SetActive (true);
winner2.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
} else {
Debug.Log ("KALAH");
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaBanimation.PlayQueued ("kalahend", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
EndOption[5].SetActive (true);
losser.SetActive (true);
winner2.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
}
} else { //multiplayer
if (ApakahCameraA) {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaA.GetComponent<Animation> ().PlayQueued ("menanggame", QueueMode.PlayNow);
//karaB.GetComponent<Animation> ().PlayQueued ("kalahgame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
winner2.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
} else {
Debug.Log ("KALAH");
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaBanimation.PlayQueued ("kalahend", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
EndOption[5].SetActive (true);
losser.SetActive (true);
winner2.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
}
}
}
}
}
//berburu
else {
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
if (Bb) {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
// urutan2 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
// urutan3 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
winner3.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
} else {
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
// urutan2 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
// urutan3 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaBanimation.PlayQueued ("kalahend", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
losser2.SetActive (true);
winner3.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
}
}
if (ApakahCameraA) {
CameraEndA.SetActive (true);
canvasEnd ();
} else {
CameraEnd.SetActive (true);
canvasEnd ();
}
Debug.Log (PlayerPrefs.GetInt ("win"));
}
}
public GameObject winner, winner2,winner3;
public GameObject losser,losser2;
private IEnumerator resetFormation()
{
Debug.Log ("RESET !!");
string url = Link.url + "reset_formation";
WWWForm form = new WWWForm ();
form.AddField (Link.ID, PlayerID);
form.AddField ("room_name", PlayerPrefs.GetString ("RoomName"));
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
timer = 3f;
timeUps = false;
panggil_url = false;
data_belum_ada = true;
PlayerPrefs.SetInt ("Jumlah", 0);
PlayerPrefs.SetString ("Main", "tidak");
PlayerPrefs.SetString ("Urutan1", "Kosong");
PlayerPrefs.SetString ("Urutan1m", "Kosong");
PlayerPrefs.SetString ("Suit1", "Kosong");
cameraB.transform.position = new Vector3 (12.9f, 25.5f, 63.7f);
cameraB.transform.rotation = Quaternion.Euler (23.09f, 191.491f, 1.302f);
cameraB.transform.Find ("Plane").gameObject.SetActive (false);
hantuchoose1.SetActive (false);
hantuchoose2.SetActive (false);
hantuchoose3.SetActive (false);
//pilihanInputSuit [3].SetActive (true);
//pilihanInputSuit [4].SetActive (true);
//pilihanInputSuit [5].SetActive (true);
// plihan1.SetActive (true);
// plihan2.SetActive (true);
// plihan3.SetActive (true);
}
}
bool resetDatabaseYo = false;
private IEnumerator resetDatabase()
{
waiting.SetActive (false);
string url = Link.url + "reset_database";
WWWForm form = new WWWForm ();
form.AddField (Link.ID,PlayerID);
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
SceneManagerHelper.LoadScene ("Home");
}
}
public void PlaySajaLah(int i) {
if (i==1) {
StartCoroutine (War(GameObject.Find("Hantu1A"),GameObject.Find("Hantu2B"),"Charge","Block",1,GetCritical));
}
else if (i==2) {
StartCoroutine (War(GameObject.Find("Hantu2A"),GameObject.Find("Hantu3B"),"Block","Focus",1,GetCritical));
}
else if (i==3) {
StartCoroutine (War(GameObject.Find("Hantu2A"),GameObject.Find("Hantu3B"),"Charge","Focus",1,GetCritical));
}
else if (i==4) {
StartCoroutine (War(GameObject.Find("Hantu2A"),GameObject.Find("Hantu3B"),"Charge","Charge",1,GetCritical));
}
}
IEnumerator War (GameObject aObject, GameObject bObject, string pilA, string pilB, int urutan, int getCritical) {
Debug.Log (pilA + " " + pilB);
dg.text = (pilA + " " + pilB);
//aObject.GetComponent<PlayAnimation> ().PlayMaju ();
//bObject.GetComponent<PlayAnimation> ().PlayMaju ();
switch (pilA) {
case "Charge":
// Aobject.GetComponent<Animator> ().SetBool ("FightCharge", true);
Aobject.GetComponent<Image> ().sprite = Charge;
break;
case "Block":
// Aobject.GetComponent<Animator> ().SetBool ("FightBlock", true);
Aobject.GetComponent<Image> ().sprite = Block;
break;
case "Focus":
//Aobject.GetComponent<Animator> ().SetBool ("FightFocus", true);
Aobject.GetComponent<Image> ().sprite = Focus;
break;
}
switch (pilB) {
case "Charge":
//bObject.transform.FindChild ("Select").GetComponent<SpriteRenderer>().sprite = Charge;
Bobject.GetComponent<Animator> ().SetBool ("FightCharge", true);
Bobject.GetComponent<Image> ().sprite = Charge;
break;
case "Block":
//bObject.transform.FindChild ("Select").GetComponent<SpriteRenderer> ().sprite = Block;
Bobject.GetComponent<Animator> ().SetBool ("FightBlock", true);
Bobject.GetComponent<Image> ().sprite = Block;
break;
case "Focus":
//bObject.transform.FindChild ("Select").GetComponent<SpriteRenderer>().sprite = Focus;
Bobject.GetComponent<Animator> ().SetBool ("FightFocus", true);
Bobject.GetComponent<Image> ().sprite = Focus;
break;
}
// yield return new WaitForSeconds (1f);
if (pilA == "Charge" && pilB == "Block") {
damage = bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +50 ));
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (level1 == true) {
damage = damage * 2;
}
else {
if(getCritical<=1f)
{
damage = damage*1.25f;
}
else
{
damage = damage;
}
}
Bobject.GetComponent<Animator> ().SetBool ("win", true);
Aobject.GetComponent<Animator> ().SetBool ("chargekalah", true);
Debug.Log ("CB");
//aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("attack",QueueMode.PlayNow);
//
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("nangkis",QueueMode.PlayNow);
//
yield return new WaitForSeconds (0.1f);
// Seri_Bdef.Play ();
//
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle",QueueMode.PlayNow,PlayMode.StopAll);
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("attackbaru2",QueueMode.PlayNow);
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("hitbaru",QueueMode.PlayNow);
//yield return new WaitForSeconds (.5f);
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
yield return new WaitForSeconds (0.3f);
damageA.gameObject.SetActive (true);
int damaged = (int)damage;
damageA.text = "- "+damaged.ToString ();
damageB.text = "- "+damaged.ToString ();
HealthReduction (urutan,0,damage);
A.Play ();
playoneshot(0);
PlayerPrefs.SetString ("kenahit","w") ;
}
if (pilA == "Block" && pilB == "Charge") {
Debug.Log ("BC");
//bObject.GetComponent<Animator> ().enabled = true;
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +50) );
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (level1 == true) {
damage = damage * 2;
}
else {
damage = damage;
}
int damaged = (int)damage;
damageA.text = "- "+damaged.ToString ();
damageB.text = "- "+damaged.ToString ();
Aobject.GetComponent<Animator> ().SetBool ("win", true);
Bobject.GetComponent<Animator> ().SetBool ("chargekalah", true);
if (getCritical<=1){
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play("attackbaru2");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
}
else
{
Debug.Log("this animation");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued("attackbaru2",QueueMode.PlayNow);
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("hitbaru",QueueMode.PlayNow);
}
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
yield return new WaitForSeconds (0.3f);
damageB.gameObject.SetActive (true);
HealthReduction (urutan,1,damage);
B.Play ();
playoneshot(0);
PlayerPrefs.SetString ("kenahit","l") ;
}
if (pilA == "Block" && pilB == "Focus") {
Debug.Log ("BF");
damage = bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +50 ));
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (level1 == true) {
damage = damage * 2;
}
else {
damage = damage;
}
Bobject.GetComponent<Animator> ().SetBool ("win", true);
Aobject.GetComponent<Animator> ().SetBool ("blokkalah", true);
Debug.Log ("CB");
//aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("attack",QueueMode.PlayNow);
//
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("nangkis",QueueMode.PlayNow);
//
yield return new WaitForSeconds (0.1f);
// Seri_Bdef.Play ();
//
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle",QueueMode.PlayNow,PlayMode.StopAll);
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("attackbaru2",QueueMode.PlayNow);
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("hitbaru",QueueMode.PlayNow);
//yield return new WaitForSeconds (.5f);
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
yield return new WaitForSeconds (0.3f);
damageA.gameObject.SetActive (true);
int damaged = (int)damage;
damageA.text = "- "+damaged.ToString ();
damageB.text = "- "+damaged.ToString ();
HealthReduction (urutan,0,damage);
A.Play ();
playoneshot(0);
PlayerPrefs.SetString ("kenahit","w") ;
}
if (pilA == "Focus" && pilB == "Block") {
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +50 ));
// bObject.GetComponent<PlayAnimation> ().PlayMaju ();
// cameraB.GetComponent<Animator> ().SetBool ("hitted", true);
// //bObject.GetComponent<Animator> ().enabled = true;
// Debug.Log ("FB");
// damage = aObject.transform.FindChild ("Canvas").transform.FindChild ("Image").GetComponent<filled> ().damage- bObject.transform.FindChild ("Canvas").transform.FindChild ("Image").GetComponent<filled> ().defend/2;
// if (damage <= 0) {
// damage = 0;
// }damageA.text = "- "+damage.ToString ();
// damageB.text = "- "+damage.ToString ();
// Aobject.GetComponent<Animator> ().SetBool ("win", true);
// Bobject.GetComponent<Animator> ().SetBool ("blokkalah", true);
// //bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
// //aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle",QueueMode.PlayNow);
//// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("charge",QueueMode.PlayNow);
////
//// Charge_A.Play ();
//// //
//// // aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//// // bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
////
////
////
//// yield return new WaitForSeconds (1f);
////
//// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("attack");
//
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("nangkis_loss",QueueMode.PlayNow);
// yield return new WaitForSeconds (0.5f);
// damageB.gameObject.SetActive (true);
//
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//
// yield return new WaitForSeconds (0.3f);
// HealthReduction (urutan,1,damage);
// B.Play ();
// hitYa.Play ();
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (level1 == true) {
damage = damage * 2;
}
else {
damage = damage;
}
int damaged = (int)damage;
damageA.text = "- "+damaged.ToString ();
damageB.text = "- "+damaged.ToString ();
Aobject.GetComponent<Animator> ().SetBool ("win", true);
Bobject.GetComponent<Animator> ().SetBool ("blokkalah", true);
//bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("attack",QueueMode.PlayNow);
//
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("nangkis",QueueMode.PlayNow);
// yield return new WaitForSeconds (.5f);
// Seri_Adef.Play ();
//
//
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle",QueueMode.PlayNow,PlayMode.StopAll);
//
//
//
//
if (getCritical<=1){
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play("attackbaru2");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
}
else
{
Debug.Log("this animation");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued("attackbaru2",QueueMode.PlayNow);
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("hitbaru",QueueMode.PlayNow);
}
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
yield return new WaitForSeconds (0.3f);
damageB.gameObject.SetActive (true);
HealthReduction (urutan,1,damage);
B.Play ();
playoneshot(0);
PlayerPrefs.SetString ("kenahit","l") ;
}
if (pilA == "Focus" && pilB == "Charge") {
Debug.Log ("FC");
damage = bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +50 ));
// damage = bObject.transform.FindChild ("Canvas").transform.FindChild ("Image").GetComponent<filled> ().damage- aObject.transform.FindChild ("Canvas").transform.FindChild ("Image").GetComponent<filled> ().defend/2;
// if (damage <= 0) {
// damage = 0;
// }damageA.text = "- "+damage.ToString ();
// damageB.text = "- "+damage.ToString ();
// Bobject.GetComponent<Animator> ().SetBool ("win", true);
// Aobject.GetComponent<Animator> ().SetBool ("fokuskalah", true);
// //aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
// //bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("charge",QueueMode.PlayNow);
//// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle",QueueMode.PlayNow);
////
//// Charge_A.Play ();
////
//// // aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//// // bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
////
////
////
//// yield return new WaitForSeconds (.5f);
////
//// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("attack");
//
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hit");
// yield return new WaitForSeconds (0.5f);
// damageA.gameObject.SetActive (true);
//
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//
//
// yield return new WaitForSeconds (0.3f);
// HealthReduction (urutan,0,damage);
// A.Play ();
// hitYa.Play ();
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (level1 == true) {
damage = damage * 2;
}
else {
damage = damage;
}
Bobject.GetComponent<Animator> ().SetBool ("win", true);
Aobject.GetComponent<Animator> ().SetBool ("fokuskalah", true);
// Debug.Log ("CB");
//aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("attack",QueueMode.PlayNow);
//
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("nangkis",QueueMode.PlayNow);
//
yield return new WaitForSeconds (0.1f);
// Seri_Bdef.Play ();
//
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle",QueueMode.PlayNow,PlayMode.StopAll);
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("attackbaru2",QueueMode.PlayNow);
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("hitbaru",QueueMode.PlayNow);
//yield return new WaitForSeconds (.5f);
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
yield return new WaitForSeconds (0.3f);
damageA.gameObject.SetActive (true);
int damaged = (int)damage;
damageA.text = "- "+damaged.ToString ();
damageB.text = "- "+damaged.ToString ();
HealthReduction (urutan,0,damage);
A.Play ();
playoneshot(0);
PlayerPrefs.SetString ("kenahit","w") ;
}
if (pilA == "Charge" && pilB == "Focus") {
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +50 ));
//bObject.GetComponent<Animator> ().enabled = true;
// cameraB.GetComponent<Animator> ().SetBool ("hitted", true);
// Debug.Log ("CF");
// damage = aObject.transform.FindChild ("Canvas").transform.FindChild ("Image").GetComponent<filled> ().damage- bObject.transform.FindChild ("Canvas").transform.FindChild ("Image").GetComponent<filled> ().defend/2;
// if (damage <= 0) {
// damage = 0;
// }damageA.text = "- "+damage.ToString ();
// damageB.text = "- "+damage.ToString ();
// Aobject.GetComponent<Animator> ().SetBool ("win", true);
// Bobject.GetComponent<Animator> ().SetBool ("fokuskalah", true);
// //bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
// //aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued("charge",QueueMode.PlayNow);
//// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
////
//// Charge_B.Play ();
////
//// // aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//// // bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
////
////
//// yield return new WaitForSeconds (.5f);
//// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("attack");
//
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hit");
// yield return new WaitForSeconds (0.5f);
// damageB.gameObject.SetActive (true);
// //
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//
// yield return new WaitForSeconds (0.1f);
// HealthReduction (urutan,1,damage);
// B.Play ();
// hitYa.Play ();
//
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Fire" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Water" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Wind") {
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Fire") {
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (bObject.GetComponent<PlayAnimation> ().element == "Wind" && aObject.GetComponent<PlayAnimation> ().element == "Water") {
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage+=damage*5/100;
}
if (again == 1) {
damage-=damage*5/100;
}
ReallyStriking();
}
if (level1 == true) {
damage = damage * 2;
}
else {
damage = damage;
}
int damaged = (int)damage;
damageA.text = "- "+damaged.ToString ();
damageB.text = "- "+damaged.ToString ();
Aobject.GetComponent<Animator> ().SetBool ("win", true);
Bobject.GetComponent<Animator> ().SetBool ("fokuskalah", true);
//bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("attack",QueueMode.PlayNow);
//
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("nangkis",QueueMode.PlayNow);
// yield return new WaitForSeconds (.5f);
// Seri_Adef.Play ();
//
//
// bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle",QueueMode.PlayNow,PlayMode.StopAll);
//
//
//
//
print(getCritical);
if (getCritical<=1){
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play("attackbaru2");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
}
else
{
Debug.Log("this animation");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued("attackbaru2",QueueMode.PlayNow);
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("hitbaru",QueueMode.PlayNow);
}
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
yield return new WaitForSeconds (0.3f);
damageB.gameObject.SetActive (true);
HealthReduction (urutan,1,damage);
B.Play ();
playoneshot(0);
PlayerPrefs.SetString ("kenahit","l") ;
}
if (pilA == "Focus" && pilB == "Focus") {
//air
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage2 += damage2 * 20 / 100;
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage2+=damage2*5/100;
damage+=damage2*5/100;
}
if (again == 1) {
damage2-=damage2*5/100;
damage-=damage*5/100;
}
Debug.Log("musuh api, player air");
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("musuh api, player angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage2 -= damage2 * 20 / 100;
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage2+=damage2*5/100;
damage+=damage2*5/100;
}
if (again == 1) {
damage2-=damage2*5/100;
damage-=damage*5/100;
}
Debug.Log("sama api");
}
//Api
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
Debug.Log("musuh air, player api");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage2 -= damage2 * 20 / 100;
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage2+=damage2*5/100;
damage+=damage2*5/100;
}
if (again == 1) {
damage2-=damage2*5/100;
damage-=damage*5/100;
}
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
Debug.Log("sama air");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("musuh air, player angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
damage2 += damage2 * 20 / 100;
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage2+=damage2*5/100;
damage+=damage2*5/100;
}
if (again == 1) {
damage2-=damage2*5/100;
damage-=damage*5/100;
}
}
//angin
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
Debug.Log("musuh angin, player api");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
damage2 += damage2 * 20 / 100;
damage -= damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage2+=damage2*5/100;
damage+=damage2*5/100;
}
if (again == 1) {
damage2-=damage2*5/100;
damage-=damage*5/100;
}
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
Debug.Log("musuh angin, player air");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
damage2 -= damage2 * 20 / 100;
damage += damage * 20 / 100;
int again = Random.Range (0, 1);
if (again == 0) {
damage2+=damage2*5/100;
damage+=damage2*5/100;
}
if (again == 1) {
damage2-=damage2*5/100;
damage-=damage*5/100;
}
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("sama angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
//bObject.GetComponent<Animator> ().enabled = true;
cameraB.GetComponent<Animator> ().SetBool ("hitted", true);
bObject.GetComponent<PlayAnimation> ().PlayMaju ();
//bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
// aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//
Bobject.GetComponent<Animator> ().SetBool ("fokuskalah", true);
Aobject.GetComponent<Animator> ().SetBool ("fokuskalah", true);
//bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("draw");
//aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("draw");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//Seri_A.Play ();
yield return new WaitForSeconds (.25f);
int damaged = (int)damage;
int damaged2 = (int)damage2;
damageA.text = "- "+damaged2.ToString ();
damageB.text = "- "+damaged.ToString ();
HealthReduction (urutan,1,damage);
HealthReduction (urutan,0,damage2);
damageA.gameObject.SetActive (true);
damageB.gameObject.SetActive (true);
Seri_A.Play ();
playoneshot(1);
PlayerPrefs.SetString ("kenahit","l") ;
}
if (pilA == "Charge" && pilB == "Charge") {
//air
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
Debug.Log("musuh api, player air");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("musuh api, player angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
//Api
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
Debug.Log("musuh air, player api");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
Debug.Log("sama air");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("musuh air, player angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
//angin
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
Debug.Log("musuh angin, player api");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
Debug.Log("musuh angin, player air");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("sama angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
//bObject.GetComponent<Animator> ().enabled = true;
cameraB.GetComponent<Animator> ().SetBool ("hitted", true);
bObject.GetComponent<PlayAnimation> ().PlayMaju ();
//bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
// aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//
Bobject.GetComponent<Animator> ().SetBool ("chargekalah", true);
Aobject.GetComponent<Animator> ().SetBool ("chargekalah", true);
//bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("draw");
//aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("draw");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//Seri_A.Play ();
yield return new WaitForSeconds (.25f);
int damaged = (int)damage;
int damaged2 = (int)damage2;
damageA.text = "- "+damaged2.ToString ();
damageB.text = "- "+damaged.ToString ();
damageA.gameObject.SetActive (true);
damageB.gameObject.SetActive (true);
HealthReduction (urutan,1,damage);
HealthReduction (urutan,0,damage2);
Seri_A.Play ();
playoneshot(1);
PlayerPrefs.SetString ("kenahit","l") ;
}
if (pilA == "Block" && pilB == "Block") {
//air
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
Debug.Log("musuh api, player air");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Fire" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("musuh api, player angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
//Api
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
Debug.Log("musuh air, player api");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
Debug.Log("sama air");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Water" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("musuh air, player angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
//angin
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Fire") {
Debug.Log("musuh angin, player api");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Water") {
Debug.Log("musuh angin, player air");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
if (urutan1[0].GetComponent<PlayAnimation> ().element == "Wind" && urutan1[1].GetComponent<PlayAnimation> ().element =="Wind") {
Debug.Log("sama angin");
damage2=bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
damage = aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage* (aObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().damage/( bObject.transform.Find ("Canvas").transform.Find ("Image").GetComponent<filled> ().defend +100 ));
Debug.Log("sama api");
}
//bObject.GetComponent<Animator> ().enabled = true;
cameraB.GetComponent<Animator> ().SetBool ("hitted", true);
bObject.GetComponent<PlayAnimation> ().PlayMaju ();
//bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
//aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("maju");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().Play ("hitbaru");
// aObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
// bObject.transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//
Bobject.GetComponent<Animator> ().SetBool ("blokkalah", true);
Aobject.GetComponent<Animator> ().SetBool ("blokkalah", true);
//bObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("draw");
//aObject.transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().Play ("draw");
aObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
bObject.transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("idle");
//Seri_A.Play ();
yield return new WaitForSeconds (.25f);
int damaged = (int)damage;
int damaged2 = (int)damage2;
damageA.text = "- "+damaged2.ToString ();
damageB.text = "- "+damaged.ToString ();
damageA.gameObject.SetActive (true);
damageB.gameObject.SetActive (true);
HealthReduction (urutan,1,damage);
HealthReduction (urutan,0,damage2);
Seri_A.Play ();
playoneshot(1);
PlayerPrefs.SetString ("kenahit","l") ;
}
yield return new WaitForSeconds (.5f);
aObject.transform.Find ("Select").GetComponent<SpriteRenderer>().sprite = null;
bObject.transform.Find ("Select").GetComponent<SpriteRenderer>().sprite = null;
//aObject.GetComponent<PlayAnimation> ().PlayBalik();
//bObject.GetComponent<PlayAnimation> ().PlayBalik();
Aobject.GetComponent<Animator> ().SetBool ("LeftFight", false);
Bobject.GetComponent<Animator> ().SetBool ("RightFight", false);
Aobject.GetComponent<Animator> ().SetBool ("blokkalah", false);
Bobject.GetComponent<Animator> ().SetBool ("blokkalah", false);
Aobject.GetComponent<Animator> ().SetBool ("chargekalah", false);
Bobject.GetComponent<Animator> ().SetBool ("chargekalah", false);
Aobject.GetComponent<Animator> ().SetBool ("fokuskalah", false);
Bobject.GetComponent<Animator> ().SetBool ("fokuskalah", false);
Aobject.GetComponent<Animator> ().SetBool ("FightCharge", false);
Bobject.GetComponent<Animator> ().SetBool ("FightCharge", false);
Aobject.GetComponent<Animator> ().SetBool ("FightFocus", false);
Bobject.GetComponent<Animator> ().SetBool ("FightFocus", false);
Aobject.GetComponent<Animator> ().SetBool ("FightBlock", false);
Bobject.GetComponent<Animator> ().SetBool ("FightBlock", false);
Bobject.GetComponent<Animator> ().SetBool ("win", false);
Aobject.GetComponent<Animator> ().SetBool ("win", false);
damageA.gameObject.SetActive (false);
damageB.gameObject.SetActive (false);
//
// pilihanInputSuit [0].SetActive (true);
// pilihanInputSuit [1].SetActive (true);
// pilihanInputSuit [2].SetActive (true);
// Aaobject.GetComponent<Animator> ().SetBool ("LeftFight", false);
// Baobject.GetComponent<Animator> ().SetBool ("RightFight", false);
}
public Sprite half;
public Sprite empty;
IEnumerator tunggudulu(string posisihantu){
if (posisihantu == "1") {
yield return new WaitForSeconds (3);
model21a.enabled = false;
}
if (posisihantu == "2") {
yield return new WaitForSeconds (3);
model22a.enabled = false;
}
if (posisihantu == "3") {
yield return new WaitForSeconds (3);
model23a.enabled = false;
}
}
IEnumerator tunggudulu2(string posisihantu){
if (posisihantu == "1") {
yield return new WaitForSeconds (3);
model11a.enabled = false;
}
if (posisihantu == "2") {
yield return new WaitForSeconds (3);
model12a.enabled = false;
}
if (posisihantu == "3") {
yield return new WaitForSeconds (3);
model13a.enabled = false;
}
}
public void HealthReduction (int urutan, int player,float damaged) {
if (urutan == 1) {
if (player == 1) {
PlayerHPCurrent=PlayerHPCurrent-damaged;
var z = (PlayerHPCurrent/PlayerHPMax);
if(PlayerHPCurrent< 0){
z=0;
}
PlayerHP.GetComponent<Image>().fillAmount=z;
Debug.Log("Player Damaged"+ damaged);
healthBar1 [1].GetComponent<filled> ().currenthealth = healthBar1 [1].GetComponent<filled> ().currenthealth - damaged;
//healthBar1 [1].GetComponent<filled> ().currenthealth = health1 [1];
//healthBar1[1].GetComponent<filled>().currenthealth = healthBar1[1].GetComponent<filled>().currenthealth - damaged;
if (healthBar1 [1].GetComponent<filled> ().currenthealth <=0) {
// repeat = false;
//
// if (Bb == false) {
// Ab = true;
Debug.Log ("1 mati");
// }
if(urutan1[1].name=="Hantu1B")
{
PlayerPrefs.SetString("1player","mati");
model21a.PlayQueued ("kalah",QueueMode.CompleteOthers);
pilihanInputSuit[3].SetActive(false);
h1cubeb.SetActive(false);
StartCoroutine (tunggudulu ("1"));
//healthBar1 [1].GetComponent<SpriteRenderer> ().sprite = empty;
}
if(urutan1[1].name=="Hantu2B")
{
PlayerPrefs.SetString("2player","mati");
model22a.PlayQueued ("kalah",QueueMode.CompleteOthers);
pilihanInputSuit[4].SetActive(false);
h2cubeb.SetActive(false);
StartCoroutine (tunggudulu ("2"));
//healthBar1 [1].GetComponent<SpriteRenderer> ().sprite = empty;
}
if(urutan1[1].name=="Hantu3B")
{
PlayerPrefs.SetString("3player","mati");
model23a.PlayQueued ("kalah",QueueMode.CompleteOthers);
pilihanInputSuit[5].SetActive(false);
h3cubeb.SetActive(false);
StartCoroutine (tunggudulu ("3"));
//healthBar1 [1].GetComponent<SpriteRenderer> ().sprite = empty;
}
}
//healthBar1[1].transform.localScale = new Vector3(health1[1], healthBar1[1].transform.localScale.y, healthBar1[1].transform.localScale.z);
} else {
EnemiesHPCurrent=EnemiesHPCurrent-damaged;
var z = (EnemiesHPCurrent/EnemiesHPMax);
if(EnemiesHPCurrent< 0){
z=0;
}
EnemiesHP.GetComponent<Image>().fillAmount=z;
Debug.Log("Enemies Damaged"+ damaged);
//healthBar1[0].GetComponent<filled>().currenthealth = healthBar1[0].GetComponent<filled>().currenthealth - damaged;
//health1 [0] = health1 [0] - damaged;
// healthBar1 [0].GetComponent<filled> ().currenthealth = health1 [0];
healthBar1 [0].GetComponent<filled> ().currenthealth= healthBar1 [0].GetComponent<filled> ().currenthealth-damaged;
//health1 [0] = health1 [0] - damaged;
//healthBar1 [0].transform.localScale = new Vector3 (health1 [0], healthBar1 [0].transform.localScale.y, healthBar1 [0].transform.localScale.z);
if (healthBar1 [0].GetComponent<filled> ().currenthealth <= 0) {
if(urutan1[0].name=="Hantu1A")
{
PlayerPrefs.SetString("musuh1","mati");
model11a.PlayQueued ("kalah",QueueMode.CompleteOthers);
//pilihanInputSuit[3].SetActive(false);
StartCoroutine (tunggudulu2 ("1"));
//healthBar1 [1].GetComponent<SpriteRenderer> ().sprite = empty;
Debug.Log ("1a mati");
}
if(urutan1[0].name=="Hantu2A")
{
PlayerPrefs.SetString("musuh2","mati");
model12a.PlayQueued ("kalah",QueueMode.CompleteOthers);
//pilihanInputSuit[4].SetActive(false);
StartCoroutine (tunggudulu2 ("2"));
//healthBar1 [1].GetComponent<SpriteRenderer> ().sprite = empty;
Debug.Log ("2a mati");
}
if(urutan1[0].name=="Hantu3A")
{
PlayerPrefs.SetString("musuh3","mati");
model13a.PlayQueued ("kalah",QueueMode.CompleteOthers);
//pilihanInputSuit[5].SetActive(false);
StartCoroutine (tunggudulu2 ("3"));
Debug.Log ("3a mati");
//healthBar1 [1].GetComponent<SpriteRenderer> ().sprite = empty;
}
//repeat = false;
//if (Ab == false) {
// Bb = true;
//}
//healthBar1 [0].GetComponent<SpriteRenderer> ().sprite = empty;
}
}
}
// else if (urutan == 2) {
//
// if (player == 1) {
// // health2 [1] = health2 [1] - damaged;
// //health2 [1] = health2 [1] - damaged;
// healthBar2 [1].GetComponent<filled> ().currenthealth = healthBar2 [1].GetComponent<filled> ().currenthealth-damaged;
// //healthBar2[1].GetComponent<filled>().currenthealth = healthBar2[1].GetComponent<filled>().currenthealth - damaged;
// //healthBar2[1].transform.localScale = new Vector3(health2[1], healthBar2[1].transform.localScale.y, healthBar2[1].transform.localScale.z);
//
// if (healthBar2 [1].GetComponent<filled> ().currenthealth <= 0) {
////
//// repeat = false;
//// if (Bb == false) {
//// Ab = true;
// PlayerPrefs.SetString("2player","mati");
// Debug.Log ("2player mati");
// model2_2.GetComponent<Animation> ().PlayQueued ("kalah",QueueMode.PlayNow);
// pilihanInputSuit[4].SetActive(false);
//// }
// //healthBar2 [1].GetComponent<SpriteRenderer> ().sprite = empty;
// }
//
// } else {
// //health2 [0] = health2 [0] - damaged;
// //health2 [0] = health2 [0] - damaged;
// healthBar2 [0].GetComponent<filled> ().currenthealth = healthBar2 [0].GetComponent<filled> ().currenthealth - damaged;
// //healthBar2[0].GetComponent<filled>().currenthealth = healthBar2[0].GetComponent<filled>().currenthealth - damaged;
// //healthBar2 [0].transform.localScale = new Vector3 (health2 [0], healthBar2 [0].transform.localScale.y, healthBar2 [0].transform.localScale.z);
//
// if (healthBar2 [0].GetComponent<filled> ().currenthealth <= 0) {
// repeat = false;
// if (Ab == false) {
// Bb = true;
// Debug.Log ("Its Done Dude B is the Winner");
// }
// //healthBar2 [0].GetComponent<SpriteRenderer> ().sprite = empty;
// }
//
// }
//
// } else {
//
// if (player == 1) {
// //health3 [1] = health3 [1] - damaged;
// //health3 [1] = health3 [1] - damaged;
// healthBar3 [1].GetComponent<filled> ().currenthealth = healthBar3 [1].GetComponent<filled> ().currenthealth - damaged;
// //healthBar3[1].GetComponent<filled>().currenthealth = healthBar3[1].GetComponent<filled>().currenthealth - damaged;
// //healthBar3[1].transform.localScale = new Vector3(health3[1], healthBar3[1].transform.localScale.y, healthBar3[1].transform.localScale.z);
//
//
// if (healthBar3 [1].GetComponent<filled> ().currenthealth <= 0) {
//
//// repeat = false;
//// if (Bb == false) {
//// Ab = true;
// PlayerPrefs.SetString("3player","mati");
// Debug.Log ("3player mati");
// model2_3.GetComponent<Animation> ().PlayQueued ("kalah",QueueMode.PlayNow);
// pilihanInputSuit[5].SetActive(false);
//// }
// //healthBar3 [1].GetComponent<SpriteRenderer> ().sprite = empty;
// }
//
// } else {
// // health3 [0] = health3 [0] - damaged;
// healthBar3 [0].GetComponent<filled> ().currenthealth = healthBar3 [0].GetComponent<filled> ().currenthealth - damaged;
// //healthBar3 [0].transform.localScale = new Vector3 (health3 [0], healthBar3 [0].transform.localScale.y, healthBar3 [0].transform.localScale.z);
//
// if (healthBar3 [0].GetComponent<filled> ().currenthealth <= 0) {
//
// repeat = false;
// if (Ab == false) {
// Bb = true;
// Debug.Log ("Its Done Dude B is the Winner");
// }
// // healthBar3 [0].GetComponent<SpriteRenderer> ().sprite = empty;
// }
//
// }
//
//
//
// }
if (PlayerPrefs.GetString ("berburu") != "ya") {
if (PlayerPrefs.GetString ("1player") == "mati" && PlayerPrefs.GetString ("2player") == "mati" && PlayerPrefs.GetString ("3player") == "mati") {
repeat = false;
ulang = false;
Ab = true;
Debug.Log ("Its Done Dude A is the Winner");
}
if(PlayerPrefs.GetString("PLAY_TUTORIAL")=="TRUE")
{
if (PlayerPrefs.GetString ("musuh1") == "mati" )
{
repeat = false;
ulang = false;
Bb = true;
Debug.Log ("Its Done Dude B is the Winner");
}
}
else
{
if (PlayerPrefs.GetString ("musuh1") == "mati" && PlayerPrefs.GetString ("musuh2") == "mati" && PlayerPrefs.GetString ("musuh3") == "mati") {
repeat = false;
ulang = false;
Bb = true;
Debug.Log ("Its Done Dude B is the Winner");
}
}
}
else {
if (PlayerPrefs.GetString ("1player") == "mati" && PlayerPrefs.GetString ("2player") == "mati" && PlayerPrefs.GetString ("3player") == "mati") {
repeat = false;
ulang = false;
Ab = true;
Debug.Log ("Its Done Dude A is the Winner");
}
if (PlayerPrefs.GetString ("musuh1") == "mati" ) {
repeat = false;
ulang = false;
Bb = true;
Debug.Log ("Its Done Dude B is the Winner");
}
}
}
public void Replay () {
if (PlayerPrefs.GetString (Link.JENIS) != "SINGLE"||PlayerPrefs.GetString (Link.SEARCH_BATTLE)=="ONLINE") {
SceneManagerHelper.LoadScene (Link.Arena);
} else {
if (pressed) {
StartCoroutine (kurangEnergy ());
}
}
}
private IEnumerator kurangEnergy ()
{
string url = Link.url + "energy";
WWWForm form = new WWWForm ();
form.AddField (Link.ID,PlayerID);
form.AddField ("EUsed", PlayerPrefs.GetInt("EUsed").ToString());
form.AddField("DID", PlayerPrefs.GetString(Link.DEVICE_ID));
WWW www = new WWW(url,form);
yield return www;
if (www.error == null) {
var jsonString = JSON.Parse (www.text);
Debug.Log (www.text);
PlayerPrefs.SetString (Link.FOR_CONVERTING, jsonString["code"]);
if (int.Parse(PlayerPrefs.GetString(Link.FOR_CONVERTING))==1) {
lf.lostLife (PlayerPrefs.GetInt("EUsed"),int.Parse(jsonString["data"]["energy"]));
PlayerPrefs.SetString (Link.ENERGY,jsonString["data"]["energy"]);
//yield return new WaitForSeconds (1);
SceneManagerHelper.LoadScene ("Game 1");
}
else if (PlayerPrefs.GetString(Link.FOR_CONVERTING) == "33")
{
validationError.SetActive(true);
}
} else {
pressed = false;
//trouble.SetActive (true);
Debug.Log ("GAGAL");
}
}
public void KurangEnergy()
{
StartCoroutine(kurangEnergy());
}
public void Berburu () {
PlayerPrefs.SetString ("berburu", "tidak");
if (PlayerPrefs.GetInt ("win") == 1) {
SceneManagerHelper.LoadScene("Home");
} else {
SceneManagerHelper.LoadScene ("Home");
}
}
public void Berburu2 () {
PlayerPrefs.SetString ("berburu", "tidak");
SceneManagerHelper.LoadScene ("Home");
}
public void Map () {
if (PlayerPrefs.GetString ("PLAY_TUTORIAL") == "TRUE") {
PlayerPrefs.SetString ("Tutorgame", "TRUE");
}
SceneManagerHelper.LoadScene (Link.Map);
}
public void GameSpeed(int speed){
Time.timeScale = speed;
PlayerPrefs.SetInt ("speedscale", speed);
}
public void givingup(){
Ab = true;
repeat = false;
ulang = false;
PlayerPrefs.SetInt ("win", 0);
karaBbukuskin.enabled = true;
karaBskin.enabled = true;
karaA.transform.Find ("book001").GetComponent<SkinnedMeshRenderer> ().enabled = true;
karaA.GetComponent<SkinnedMeshRenderer> ().enabled = true;
urutan1 [0] = GameObject.Find ("Hantu1A");
urutan1 [1] = GameObject.Find ("Hantu1B");
urutan2 [0] = GameObject.Find ("Hantu2A");
urutan2 [1] = GameObject.Find ("Hantu2B");
urutan3 [0] = GameObject.Find ("Hantu3A");
urutan3 [1] = GameObject.Find ("Hantu3B");
resetDatabaseYo = true;
// model11a.enabled = true;
// model21a.enabled = true;
// model12a.enabled = true;
// model22a.enabled = true;
// model13a.enabled = true;
// model23a.enabled = true;
if (PlayerPrefs.GetString ("berburu") != "ya") {
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
if (Bb) {
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
if (ApakahCameraA) {
Debug.Log ("KALAH");
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
karaBanimation.PlayQueued ("kalahend", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
EndOption[5].SetActive (true);
losser.SetActive (true);
winner.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
} else {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
winner.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
}
}
//Multiplayer
//Multiplayer
//Multiplayer
} else {//kondisi A menang
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
if (ApakahCameraA) {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
//EndOptionButton.SetActive (true);
winner2.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
} else {
Debug.Log ("KALAH");
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaBanimation.PlayQueued ("kalahend", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
EndOption[5].SetActive (true);
losser.SetActive (true);
winner2.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
}
}
}
}
//berburu
else {
hantugo1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugo3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom1.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom2.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
hantugom3.transform.Find ("COPY_POSITIONE").gameObject.SetActive (false);
if (Bb) {
Debug.Log ("MENANG");
PlayerPrefs.SetInt ("win", 1);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
// urutan2 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
// urutan3 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
//winner3.transform.FindChild("KartuHantu").GetComponent<Image>().overrideSprite=Resources.Load<Sprite>("icon_char_Maps/" + PlayerPrefs.GetString (Link.POS_1_CHAR_1_FILE));
karaBanimation.PlayQueued ("menanggame", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
// CameraEnd.SetActive (true);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
winner3.SetActive (true);
losser.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Win");
} else {
PlayerPrefs.SetInt ("win", 0);
urutan1 [0].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
// urutan2 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
// urutan3 [0].transform.FindChild ("COPY_POSITION").transform.FindChild ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("menang", QueueMode.PlayNow);
urutan1 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan2 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
urutan3 [1].transform.Find ("COPY_POSITION").transform.Find ("Genderuwo_Fire").GetComponent<Animation> ().PlayQueued ("kalah", QueueMode.PlayNow);
karaBanimation.PlayQueued ("kalahend", QueueMode.PlayNow);
cameraA.SetActive (false);
cameraB.SetActive (false);
plihan1.SetActive (false);
plihan2.SetActive (false);
plihan3.SetActive (false);
// EndOptionButton.SetActive (true);
losser2.SetActive (true);
winner3.SetActive (false);
scrollBar.SetActive (false);
speedOption.SetActive (false);
Time.timeScale = 1;
SceneManagerHelper.LoadSoundFX("Lose");
}
}
if (ApakahCameraA) {
CameraEndA.SetActive (true);
canvasEnd ();
} else {
CameraEnd.SetActive (true);
canvasEnd ();
}
}
public void testeronly(){
StartCoroutine (SendReward ());
}
public void ReallyStriking()
{
if(PlayerPrefs.GetString("PLAY_TUTORIAL")=="TRUE")
{
if(Strike_Ele==0)
{
Strike_Ele++;
SceneManagerHelper.LoadTutorial("Game_2");
}
}
}
public void LoadTutorial(string game)
{
if(PlayerPrefs.GetString("PLAY_TUTORIAL")=="TRUE")
{
SceneManagerHelper.LoadTutorial(game);
}
if (PlayerPrefs.GetString (Link.JENIS) == "SINGLE") {
Dialogue(false);
}
}
void SetReward () {
ItemRate = new int[3]; //number of things
ItemName = new string[3];
ItemType = new string[3];
ItemQuantity = new string[3];
ItemFileName = new string[3];
//weighting of each thing, high number means more occurrance
for(int i = 0; i<3;i++)
{
ItemFileName[i] = PlayerPrefs.GetString("RewardItemFN"+i.ToString());
ItemQuantity[i] = PlayerPrefs.GetString("RewardItemQuantity"+i.ToString());
ItemType[i] = PlayerPrefs.GetString("RewardItemType"+i.ToString());
ItemName[i] = PlayerPrefs.GetString("RewardItemName"+i.ToString());
ItemRate[i] = int.Parse(PlayerPrefs.GetString("RewardItemRate"+i.ToString()));
}
weightTotal = 0;
foreach ( int w in ItemRate ) {
weightTotal += w;
}
}
public void getresult()
{
var result = RandomWeighted ();
}
int RandomWeighted () {
int result = 0, total = 0;
int randVal = Random.Range( 0, weightTotal );
for ( result = 0; result < ItemRate.Length; result++ ) {
total += ItemRate[result];
if ( total > randVal ) break;
}
print(result);
return result;
}
}
|
using Backend.Model.Enums;
using Model.Manager;
using System.ComponentModel.DataAnnotations.Schema;
namespace Backend.Model.Manager
{
public class BaseRenovation
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public int RoomId { get; set; }
[ForeignKey("RenovationPeriod")]
public int RenovationPeriod_Id { get; set; }
public virtual RenovationPeriod RenovationPeriod { get; set; }
public string Description { get; set; }
public TypeOfRenovation TypeOfRenovation { get; set; }
public BaseRenovation()
{
}
public BaseRenovation(int roomId, RenovationPeriod renovationPeriod, string description, TypeOfRenovation typeOfRenovation)
{
RoomId = roomId;
RenovationPeriod = renovationPeriod;
Description = description;
TypeOfRenovation = typeOfRenovation;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
using Moq;
using NUnit.Framework;
using Properties.Core.Interfaces;
using Properties.Core.Objects;
using Properties.Core.Services;
namespace Properties.Tests.UnitTests.Services
{
[TestFixture]
// ReSharper disable once InconsistentNaming
public class PhotoService_TestFixture
{
private const string Reference = "ABCD1234";
private Mock<IReferenceGenerator> _mockReferenceGenerator;
private Mock<IPhotoRepository> _mockRepository;
private PhotoService _photoService;
[SetUp]
public void Setup()
{
_mockReferenceGenerator = new Mock<IReferenceGenerator>();
_mockRepository = new Mock<IPhotoRepository>();
_photoService = new PhotoService(_mockRepository.Object, _mockReferenceGenerator.Object);
}
[Test]
public void PhotoService_NullRepository_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => new PhotoService(null, _mockReferenceGenerator.Object));
}
[Test]
public void PhotoService_NullReferenceGenerator_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => new PhotoService(_mockRepository.Object, null));
}
[Test]
public void GetPhotosForProperty_NullPropertyReference_ReturnsNull()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.GetPhotosForProperty(string.Empty));
}
[Test]
public void GetPhotosForProperty_CallsRepository()
{
//arrange
_mockRepository.Setup(x => x.GetPhotosForPropertyReference(Reference))
.Returns(new List<Photo> { new Photo { } });
//act
var result = _photoService.GetPhotosForProperty(Reference);
//assert
result.Should().NotBeNull();
result.Any().Should().BeTrue();
_mockRepository.Verify(x => x.GetPhotosForPropertyReference(Reference), Times.Once);
}
[Test]
public void GetPhotoForProperty_NullPropertyReference_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.GetPhotoForProperty(string.Empty, Reference));
}
[Test]
public void GetPhotoForProperty_NullPhotoReference_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.GetPhotoForProperty(Reference, string.Empty));
}
[Test]
public void GetPhotoForProperty_CallsRepository()
{
//arrange
_mockRepository.Setup(x => x.GetPhotoForPropertyReference(Reference, Reference)).Returns(new Photo());
//act
var result = _photoService.GetPhotoForProperty(Reference, Reference);
//assert
result.Should().NotBeNull();
_mockRepository.Verify(x => x.GetPhotoForPropertyReference(Reference, Reference), Times.Once);
}
[Test]
public void CreatePhoto_EmptyPropertyReference_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.CreatePhoto(null, new Photo()));
}
[Test]
public void CreatePhoto_NullPhoto_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.CreatePhoto(Reference, null));
}
[Test]
public void CreatePhoto_ValidPhoto_CallsReferenceGenerator()
{
//arrange
_mockRepository.Setup(x => x.CreatePhoto(Reference, It.IsAny<Photo>()))
.Returns(true);
_mockReferenceGenerator.Setup(x => x.CreateReference(It.IsAny<int>())).Returns(Reference);
//act
var result = _photoService.CreatePhoto(Reference, new Photo());
//assert
result.Should().Be(Reference);
_mockReferenceGenerator.Verify(x => x.CreateReference(It.IsAny<int>()), Times.Once);
}
[Test]
public void CreatePhoto_ValidPhoto_CallsRepository()
{
//arrange
_mockRepository.Setup(x => x.CreatePhoto(Reference, It.IsAny<Photo>()))
.Returns(true);
_mockReferenceGenerator.Setup(x => x.CreateReference(It.IsAny<int>())).Returns(Reference);
//act
var result = _photoService.CreatePhoto(Reference, new Photo());
//assert
result.Should().Be(Reference);
_mockRepository.Verify(x => x.CreatePhoto(Reference, It.IsAny<Photo>()), Times.Once);
}
[Test]
public void UpdatePhoto_EmptyPropertyReference_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.UpdatePhoto(null, Reference, new Photo()));
}
[Test]
public void UpdatePhoto_EmptyPhotoReference_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.UpdatePhoto(Reference, null, new Photo()));
}
[Test]
public void UpdatePhoto_NullPhoto_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.UpdatePhoto(Reference, Reference, null));
}
[Test]
public void UpdatePhoto_ValidPhoto_CallsRepository()
{
//arrange
_mockRepository.Setup(x => x.UpdatePhoto(Reference, Reference, It.IsAny<Photo>()))
.Returns(true);
//act
var result = _photoService.UpdatePhoto(Reference, Reference, new Photo());
//assert
result.Should().BeTrue();
_mockRepository.Verify(x => x.UpdatePhoto(Reference, Reference, It.IsAny<Photo>()), Times.Once);
}
[Test]
public void DeletePhoto_EmptyPropertyReference_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.DeletePhoto(null, Reference));
}
[Test]
public void DeletePhoto_EmptyPhotoReference_ThrowsException()
{
//act
Assert.Throws<ArgumentNullException>(() => _photoService.DeletePhoto(Reference, null));
}
[Test]
public void DeletePhoto_CallsRepository()
{
//arrange
_mockRepository.Setup(x => x.DeletePhoto(Reference, Reference))
.Returns(true);
//act
var result = _photoService.DeletePhoto(Reference, Reference);
//assert
result.Should().BeTrue();
_mockRepository.Verify(x => x.DeletePhoto(Reference, Reference), Times.Once);
}
}
}
|
using Cs_Gerencial.Aplicacao.ServicosApp;
using Cs_Gerencial.Dominio.Entities;
using Cs_Gerencial.Dominio.Interfaces.Servicos;
using Moq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
namespace Cs_Gerecial.Testes.AppTestes
{
public class TesteAppContas
{
[Fact]
public void AppContas_ConsultarPorPeriodo_True()
{
// Arrange
var servicoContas = new Mock<IServicoContas>();
var listaContas = new List<Contas>();
var contas = new Contas();
for (int i = 0; i < 100; i++)
{
if (i < 50)
{
contas = new Contas()
{
ContaId = i,
DataMovimento = Convert.ToDateTime("10/05/2016"),
Descricao = "TESTE " + 1
};
}
else
{
contas = new Contas()
{
ContaId = i,
DataMovimento = Convert.ToDateTime("10/04/2016"),
Descricao = "TESTE " + 1
};
}
listaContas.Add(contas);
}
servicoContas.Setup(r => r.ConsultaPorPeriodo(Convert.ToDateTime("10/05/2016"), Convert.ToDateTime("10/05/2016"))).Returns(listaContas.Where(p => p.DataMovimento >= Convert.ToDateTime("10/05/2016") && p.DataMovimento <= Convert.ToDateTime("10/05/2016")));
var appContas = new AppServicoContas(servicoContas.Object);
// Act
var retorno = appContas.ConsultaPorPeriodo(Convert.ToDateTime("10/05/2016"), Convert.ToDateTime("10/05/2016")).ToList();
// Assert
Assert.True(retorno.Count == 50);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Collections;
namespace Microsoft.WindowsMobile.SharedSource.Bluetooth
{
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
struct WSAQUERYSET
{
public Int32 dwSize; //0
public String szServiceInstanceName; //4
public IntPtr lpServiceClassId; //8
public IntPtr lpVersion; //12
public String lpszComment;
public Int32 dwNameSpace;
public IntPtr lpNSProviderId;
public String lpszContext;
public Int32 dwNumberOfProtocols;
public IntPtr lpafpProtocols;
public IntPtr lpszQueryString;
public Int32 dwNumberOfCsAddrs;
public IntPtr lpcsaBuffer;
public Int32 dwOutputFlags;
public IntPtr Blob;
}
public class myWSAQUERYSET
{
const Int32 NS_BTH = 16;
const Int32 LUP_RETURN_ALL = 0x0FF0; // see winsock1.h
const Int32 LUP_CONTAINERS = 0x0002;
WSAQUERYSET wsaqueryset = new WSAQUERYSET();
public myWSAQUERYSET()
{
}
public void discoverDevices()
{
ArrayList aDevices = GetConnectedNetworks();
}
private ArrayList GetConnectedNetworks()
{
ArrayList networkConnections = new ArrayList();
WSAQUERYSET qsRestrictions;
Int32 dwControlFlags;
Int32 valHandle = 0;
qsRestrictions = new WSAQUERYSET();
qsRestrictions.dwSize = 15 * 4 * 8;// Marshal.SizeOf(typeof(qsRestrictions));
qsRestrictions.dwNameSpace = NS_BTH;// 0; //NS_ALL;
dwControlFlags = 0x0FF0; //LUP_RETURN_ALL;
int result = SafeNativeMethods.WSALookupServiceBegin(qsRestrictions,
dwControlFlags, ref valHandle);
//CheckResult(result);
while (0 == result)
{
Int32 dwBuffer = 0x10000;
IntPtr pBuffer = Marshal.AllocHGlobal(dwBuffer);
WSAQUERYSET qsResult = new WSAQUERYSET() ;
result = SafeNativeMethods.WSALookupServiceNext(valHandle, dwControlFlags,
ref dwBuffer, pBuffer);
if (0==result)
{
Marshal.PtrToStructure(pBuffer, qsResult);
networkConnections.Add(
qsResult.szServiceInstanceName);
}
else
{
//CheckResult(result);
}
Marshal.FreeHGlobal(pBuffer);
}
result = SafeNativeMethods.WSALookupServiceEnd(valHandle);
return networkConnections;
}
}
}
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;
using System.Globalization;
using System.Threading;
using System.Runtime.InteropServices;
using DevExpress.XtraTab;
using DevExpress.XtraEditors;
using IRAP.Global;
using IRAP.Client.Global;
using IRAP.Client.Global.WarningLight;
using IRAP.Client.User;
using IRAP.Entity.MDM;
using IRAP.Entity.SSO;
using IRAP.Entity.FVS;
using IRAP.WCF.Client.Method;
namespace IRAP.Client.GUI.CAS
{
public partial class frmAndonEventCall_30 : IRAP.Client.GUI.CAS.frmCustomAndonForm
{
private string className =
MethodBase.GetCurrentMethod().DeclaringType.FullName;
private List<UserControls.ucAndonEventButton> buttons = new List<UserControls.ucAndonEventButton>();
private List<AndonEventType> andonEventTypes = new List<AndonEventType>();
/// <summary>
/// 红色告警灯状态
/// </summary>
private Enums.LightStatus redLightStatus = Enums.LightStatus.Off;
/// <summary>
/// 黄色告警灯状态
/// </summary>
private Enums.LightStatus yellowLightStatus = Enums.LightStatus.Off;
/// <summary>
/// 绿色告警灯状态
/// </summary>
private Enums.LightStatus greenLightStatus = Enums.LightStatus.Off;
/// <summary>
/// 蓝色告警灯状态
/// </summary>
private Enums.LightStatus blueLightStatus = Enums.LightStatus.Off;
/// <summary>
/// 白色告警灯状态
/// </summary>
private Enums.LightStatus whiteLightStatus = Enums.LightStatus.Off;
/// <summary>
/// 蜂鸣器状态
/// </summary>
private Enums.LightStatus buzzingStatus = Enums.LightStatus.Off;
/// <summary>
/// 是否打开了告警灯的 USB 端口
/// </summary>
private long usbOpen = -1;
private MenuInfo menuInfo = null;
public frmAndonEventCall_30()
{
InitializeComponent();
picRed.Parent = picLights;
picYellow.Parent = picLights;
picGreen.Parent = picLights;
picRed.Image = Properties.Resources.灰色;
picRed.Tag = (int)Enums.LightStatus.Off;
picYellow.Image = Properties.Resources.灰色;
picYellow.Tag = (int)Enums.LightStatus.Off;
picGreen.Image = Properties.Resources.灰色;
picGreen.Tag = (int)Enums.LightStatus.Off;
GetAndonEventTypeButtonsStatus(ref andonEventTypes, false);
CreateAndonEventButtons(andonEventTypes);
tmrRefreshLight.Enabled = true;
tmrGetAndonEventStatus.Enabled = true;
}
#region 自定义函数
private void CreateAndonEventButtons(List<AndonEventType> andonEventTypes)
{
string strProcedureName =
string.Format(
"{0}.{1}",
className,
MethodBase.GetCurrentMethod().Name);
WriteLog.Instance.WriteBeginSplitter(strProcedureName);
try
{
#region 根据获取的 Andon 事件类型列表,生成界面上的 Andon 事件点击按钮
foreach (AndonEventType andonEventType in andonEventTypes)
{
if (andonEventType.Available)
{
UserControls.ucAndonEventButton button = new UserControls.ucAndonEventButton()
{
EventTypeItem = andonEventType,
};
// 绑定 Andon 按钮点击事件
if (button.Available && button.Statue != 0)
button.MouseLeftClick += AndonEventCall;
buttons.Add(button);
}
}
#endregion
}
finally
{
WriteLog.Instance.WriteEndSplitter(strProcedureName);
}
}
private void GetAndonEventTypeButtonsStatus(ref List<AndonEventType> andonEventTypes, bool silent)
{
string strProcedureName =
string.Format(
"{0}.{1}",
className,
MethodBase.GetCurrentMethod().Name);
WriteLog.Instance.WriteBeginSplitter(strProcedureName);
try
{
int errCode = 0;
string errText = "";
IRAPMDMClient.Instance.ufn_GetList_AndonEventTypes(
IRAPUser.Instance.CommunityID,
IRAPUser.Instance.SysLogID,
ref andonEventTypes,
out errCode,
out errText);
WriteLog.Instance.Write(
string.Format(
"({0}){1}",
errCode,
errText),
strProcedureName);
if (errCode != 0 && !silent)
{
string msgTitle = "";
if (Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2) == "en")
msgTitle = "System Info";
else
msgTitle = "系统信息";
IRAPMessageBox.Instance.Show(errText, msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception error)
{
WriteLog.Instance.Write(error.Message, strProcedureName);
if (!silent)
{
string msgTitle = "";
if (Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2) == "en")
msgTitle = "System Info";
else
msgTitle = "系统信息";
IRAPMessageBox.Instance.Show(error.Message, msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
finally
{
WriteLog.Instance.WriteEndSplitter(strProcedureName);
}
}
private void AndonEventCall(object sender, EventArgs e)
{
if (sender is UserControls.ucAndonEventButton)
{
string strProcedureName =
string.Format(
"{0}.{1}",
className,
MethodBase.GetCurrentMethod().Name);
WriteLog.Instance.WriteBeginSplitter(strProcedureName);
try
{
tmrGetAndonEventStatus.Enabled = false;
AndonEventType andonEventTypeItem = ((UserControls.ucAndonEventButton)sender).EventTypeItem;
switch (andonEventTypeItem.EventTypeCode)
{
case "R":
using (frmSelectFailureModesByDeviceToCall formAndonCall =
new frmSelectFailureModesByDeviceToCall(
andonEventTypeItem,
menuInfo.OpNode,
currentProductionLine))
{
formAndonCall.ShowDialog();
}
break;
case "O":
if (IRAPUser.Instance.CommunityID == 60006)
{
// 伟世通在进行其他支持呼叫时,使用定制界面
using (frmSelectPersonsToCall formAndonCall =
new frmSelectPersonsToCall(
andonEventTypeItem,
menuInfo.OpNode,
currentProductionLine))
{
formAndonCall.ShowDialog();
}
}
else
{
// 其他支持呼叫,使用一般通用界面
using (frmSelectAndonObjectsToCall formAndonCall =
new frmSelectAndonObjectsToCall(
andonEventTypeItem,
menuInfo.OpNode,
currentProductionLine))
{
formAndonCall.ShowDialog();
}
}
break;
default:
using (frmSelectAndonObjectsToCall formAndonCall =
new frmSelectAndonObjectsToCall(
andonEventTypeItem,
menuInfo.OpNode,
currentProductionLine))
{
formAndonCall.ShowDialog();
}
break;
}
GetAndonLightsStatus();
GetAndonEventTypeButtonsStatus(ref andonEventTypes, false);
RefreshAndonEventTypeButtonsStatus(andonEventTypes, buttons);
}
finally
{
tmrGetAndonEventStatus.Enabled = true;
WriteLog.Instance.WriteEndSplitter(strProcedureName);
}
}
}
/// <summary>
/// 获取当前产线的安灯告警灯状态
/// </summary>
private void GetAndonLightsStatus()
{
string strProcedureName =
string.Format(
"{0}.{1}",
className,
MethodBase.GetCurrentMethod().Name);
WriteLog.Instance.WriteBeginSplitter(strProcedureName);
try
{
List<AndonLightStatus> lights = new List<AndonLightStatus>();
int errCode = 0;
string errText = "";
IRAPFVSClient.Instance.ufn_GetList_AndonLightStatus(
IRAPUser.Instance.CommunityID,
IRAPUser.Instance.SysLogID,
ref lights,
out errCode,
out errText);
WriteLog.Instance.Write(string.Format("({0}){1}", errCode, errText), strProcedureName);
if (errCode == 0)
{
if (lights.Count >= 7)
redLightStatus = (Enums.LightStatus)lights[6].LightStatus;
else
redLightStatus = Enums.LightStatus.Off;
if (lights.Count >= 8)
yellowLightStatus = (Enums.LightStatus)lights[7].LightStatus;
else
yellowLightStatus = Enums.LightStatus.Off;
if (lights.Count >= 9)
greenLightStatus = (Enums.LightStatus)lights[8].LightStatus;
else
greenLightStatus = Enums.LightStatus.Off;
if (lights.Count >= 10)
blueLightStatus = (Enums.LightStatus)lights[9].LightStatus;
else
blueLightStatus = Enums.LightStatus.Off;
if (lights.Count >= 11)
whiteLightStatus = (Enums.LightStatus)lights[10].LightStatus;
else
whiteLightStatus = Enums.LightStatus.Off;
if (lights.Count >= 12)
buzzingStatus = (Enums.LightStatus)lights[11].LightStatus;
else
buzzingStatus = Enums.LightStatus.Off;
}
}
catch (Exception error)
{
WriteLog.Instance.Write(error.Message, strProcedureName);
}
finally
{
WriteLog.Instance.WriteEndSplitter(strProcedureName);
}
}
/// <summary>
/// 重新布置界面上安灯时间呼叫按钮
/// </summary>
/// <param name="buttons"></param>
/// <param name="tabControl"></param>
private void ArrangeAndonEventTypeButtons(
List<UserControls.ucAndonEventButton> buttons,
XtraTabControl tabControl)
{
foreach (XtraTabPage tabPage in tabControl.TabPages)
{
tabPage.PageVisible = false;
tabPage.Controls.Clear();
}
int idxPage = 0;
XtraTabPage page = tabControl.TabPages[idxPage++];
page.Text = "第 1 页";
page.PageVisible = true;
int intRow = 1;
int intCol = 1;
int intLeft = 0;
int intTop = 0;
foreach (UserControls.ucAndonEventButton button in buttons)
{
intLeft = (intRow - 1) * (button.Width + 5) + 5;
intRow++;
if (intLeft + button.Width > tabControl.Width)
{
intRow = 1;
intCol++;
intLeft = (intRow - 1) * (button.Width + 5) + 5;
intRow++;
}
intTop = (intCol - 1) * (button.Height + 5) + 5;
if (intTop + button.Height > tabControl.Height)
{
if (idxPage >= tabControl.TabPages.Count)
return;
page = tabControl.TabPages[idxPage++];
page.Text = string.Format("第 {0} 页", idxPage);
page.PageVisible = true;
intCol = 1;
intTop = (intCol - 1) * (button.Height + 5) + 5;
}
button.Left = intLeft;
button.Top = intTop;
page.Controls.Add(button);
}
}
private void RefreshAndonEventTypeButtonsStatus(
List<AndonEventType> andonEventTypes,
List<UserControls.ucAndonEventButton> buttons)
{
int i = 0;
foreach (AndonEventType type in andonEventTypes)
{
if (i >= buttons.Count)
return;
if (type.Available)
{
buttons[i].EventTypeItem = type;
i++;
}
}
}
#endregion
private void frmAndonEventCall_30_Shown(object sender, EventArgs e)
{
string strProcedureName =
string.Format(
"{0}.{1}",
className,
MethodBase.GetCurrentMethod().Name);
WriteLog.Instance.WriteBeginSplitter(strProcedureName);
try
{
if (this.Tag is MenuInfo)
{
menuInfo = this.Tag as MenuInfo;
}
else
{
WriteLog.Instance.Write("没有正确的传入菜单参数", strProcedureName);
string msgText = "";
if (Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2) == "en")
msgText = "The menu parameters is not correct!";
else
msgText = "没有正确的传入菜单参数!";
IRAPMessageBox.Instance.Show(
msgText,
Text,
MessageBoxButtons.OK,
MessageBoxIcon.Error);
return;
}
ArrangeAndonEventTypeButtons(buttons, tcAndon);
}
finally
{
WriteLog.Instance.WriteEndSplitter(strProcedureName);
}
}
private void frmAndonEventCall_30_Resize(object sender, EventArgs e)
{
ArrangeAndonEventTypeButtons(buttons, tcAndon);
}
private void frmAndonEventCall_30_Activated(object sender, EventArgs e)
{
GetAndonLightsStatus();
}
private void tmrRefreshLight_Tick(object sender, EventArgs e)
{
switch (redLightStatus)
{
case Enums.LightStatus.Off:
picRed.Image = Properties.Resources.灰色;
picRed.Tag = (int)Enums.LightStatus.Off;
break;
case Enums.LightStatus.On:
picRed.Image = Properties.Resources.红色;
picRed.Tag = (int)Enums.LightStatus.On;
break;
case Enums.LightStatus.Flash:
if ((int)picRed.Tag == (int)Enums.LightStatus.Off)
{
picRed.Image = Properties.Resources.红色;
picRed.Tag = (int)Enums.LightStatus.On;
}
else
{
picRed.Image = Properties.Resources.灰色;
picRed.Tag = (int)Enums.LightStatus.Off;
}
break;
}
switch (yellowLightStatus)
{
case Enums.LightStatus.Off:
picYellow.Image = Properties.Resources.灰色;
picYellow.Tag = (int)Enums.LightStatus.Off;
break;
case Enums.LightStatus.On:
picYellow.Image = Properties.Resources.黄色;
picYellow.Tag = (int)Enums.LightStatus.On;
break;
case Enums.LightStatus.Flash:
if ((int)picYellow.Tag == (int)Enums.LightStatus.Off)
{
picYellow.Image = Properties.Resources.黄色;
picYellow.Tag = (int)Enums.LightStatus.On;
}
else
{
picYellow.Image = Properties.Resources.灰色;
picYellow.Tag = (int)Enums.LightStatus.Off;
}
break;
}
switch (greenLightStatus)
{
case Enums.LightStatus.Off:
picGreen.Image = Properties.Resources.灰色;
picGreen.Tag = (int)Enums.LightStatus.Off;
break;
case Enums.LightStatus.On:
picGreen.Image = Properties.Resources.绿色;
picGreen.Tag = (int)Enums.LightStatus.On;
break;
case Enums.LightStatus.Flash:
if (picGreen.Image == Properties.Resources.灰色)
{
picGreen.Image = Properties.Resources.绿色;
picGreen.Tag = (int)Enums.LightStatus.On;
}
else
{
picGreen.Image = Properties.Resources.灰色;
picGreen.Tag = (int)Enums.LightStatus.Off;
}
break;
}
try
{
int red = 0;
int yellow = 0;
int green = 0;
if ((int)picRed.Tag == (int)Enums.LightStatus.On)
red = 1;
if ((int)picYellow.Tag == (int)Enums.LightStatus.On)
yellow = 1;
if ((int)picGreen.Tag == (int)Enums.LightStatus.On)
green = 1;
switch (IRAPConst.Instance.WarningLightCtrlBoxType)
{
case "CH375":
CH375.CH375Control.SetLightStatus(red, yellow, green);
break;
case "ZLAN6042":
ZLan6042.Instance.SetLightStatus(
IRAPConst.Instance.Zlan6042IPAddress,
red,
yellow,
green);
break;
}
}
catch (Exception error)
{
WriteLog.Instance.Write(error.Message);
}
}
private void tmrGetAndonEventStatus_Tick(object sender, EventArgs e)
{
tmrGetAndonEventStatus.Enabled = false;
try
{
GetAndonLightsStatus();
GetAndonEventTypeButtonsStatus(ref andonEventTypes, true);
RefreshAndonEventTypeButtonsStatus(andonEventTypes, buttons);
}
catch
{
;
}
finally
{
tmrGetAndonEventStatus.Enabled = true;
}
}
private void frmAndonEventCall_30_FormClosed(object sender, FormClosedEventArgs e)
{
// 窗体关闭的时候,同时关闭三色告警灯
switch (IRAPConst.Instance.WarningLightCtrlBoxType)
{
case "CH375":
CH375.CH375Control.SetLightStatus(0, 0, 0);
break;
case "ZLAN6042":
ZLan6042.Instance.SetLightStatus(
IRAPConst.Instance.Zlan6042IPAddress,
0,
0,
0);
break;
}
}
}
}
|
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using Path = System.IO.Path;
namespace NotEnoughEncodes
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
//Get Number of Cores
int coreCount = 0;
foreach (var item in new System.Management.ManagementObjectSearcher("Select * from Win32_Processor").Get())
{
coreCount += int.Parse(item["NumberOfCores"].ToString());
}
//Sets the Number of Workers = Phsyical Core Count
int tempCorecount = coreCount * 1 / 2;
TextBoxNumberWorkers.Text = tempCorecount.ToString();
//Load Settings
readSettings();
//If settings.ini exist -> Set all Values
bool fileExist = File.Exists("encoded.txt");
if (fileExist)
{
MessageBox.Show("May have detected unfished / uncleared Encode. If you want to resume an unfinished Job, check the Checkbox " + '\u0022' + "Resume" + '\u0022');
}
}
public void readSettings()
{
try
{
//If settings.ini exist -> Set all Values
bool fileExist = File.Exists("settings.ini");
if (fileExist)
{
string[] lines = System.IO.File.ReadAllLines("settings.ini");
TextBoxNumberWorkers.Text = lines[0];
ComboBoxCpuUsed.Text = lines[1];
ComboBoxBitdepth.Text = lines[2];
TextBoxEncThreads.Text = lines[3];
TextBoxcqLevel.Text = lines[4];
TextBoxKeyframeInterval.Text = lines[5];
TextBoxTileCols.Text = lines[6];
TextBoxTileRows.Text = lines[7];
ComboBoxPasses.Text = lines[8];
TextBoxFramerate.Text = lines[9];
ComboBoxEncMode.Text = lines[10];
TextBoxChunkLength.Text = lines[11];
}
//Reads custom settings to settings_custom.ini
bool customFileExist = File.Exists("settings_custom.ini");
if (customFileExist)
{
string[] linesa = System.IO.File.ReadAllLines("settings_custom.ini");
TextBoxCustomSettings.Text = linesa[0];
}
}
catch { }
}
private void Button_Click_4(object sender, RoutedEventArgs e)
{
//Saves all Current Settings to a file
string maxConcurrency = TextBoxNumberWorkers.Text;
string cpuUsed = ComboBoxCpuUsed.Text;
string bitDepth = ComboBoxBitdepth.Text;
string encThreads = TextBoxEncThreads.Text;
string cqLevel = TextBoxcqLevel.Text;
string kfmaxdist = TextBoxKeyframeInterval.Text;
string tilecols = TextBoxTileCols.Text;
string tilerows = TextBoxTileRows.Text;
string nrPasses = ComboBoxPasses.Text;
string fps = TextBoxFramerate.Text;
string encMode = this.ComboBoxEncMode.Text;
string chunkLength = TextBoxChunkLength.Text;
string customSettings = TextBoxCustomSettings.Text;
//Saves custom settings in settings_custom.ini
if (CheckBoxCustomSettings.IsChecked == true)
{
string[] linescustom = { customSettings };
System.IO.File.WriteAllLines("settings_custom.ini", linescustom);
}
string[] lines = { maxConcurrency, cpuUsed, bitDepth, encThreads, cqLevel, kfmaxdist, tilecols, tilerows, nrPasses, fps, encMode, chunkLength };
System.IO.File.WriteAllLines("settings.ini", lines);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
//Open File Dialog
OpenFileDialog openFileDialog = new OpenFileDialog();
if (openFileDialog.ShowDialog() == true)
TextBoxInputVideo.Text = openFileDialog.FileName;
//If ffprobe exist -> Set all Values
bool fileExist = File.Exists("ffprobe.exe");
//Gets the Stream Framerate IF ffrpobe exist
if (fileExist)
{
getStreamFps(TextBoxInputVideo.Text);
}
}
private void ButtonOutput_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "Matroska|*.mkv";
if (saveFileDialog.ShowDialog() == true)
TextBoxOutputVideo.Text = saveFileDialog.FileName;
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
if (Cancel.CancelAll == true && CheckBoxResume.IsChecked == false)
{
//Asks the user if he wants to resume the process.
if (MessageBox.Show("It appears that you canceled a previous encode. If you want to resume an cancelled encode, press Yes.",
"Resume", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
{
CheckBoxResume.IsChecked = true;
Cancel.CancelAll = false;
pLabel.Dispatcher.Invoke(() => pLabel.Content = "Resuming...", DispatcherPriority.Background);
prgbar.Maximum = 100;
prgbar.Value = 0;
}
else
{
Cancel.CancelAll = false;
pLabel.Dispatcher.Invoke(() => pLabel.Content = "Starting...", DispatcherPriority.Background);
prgbar.Maximum = 100;
prgbar.Value = 0;
}
}
else if (Cancel.CancelAll == true && CheckBoxResume.IsChecked == true)
{
Cancel.CancelAll = false;
pLabel.Dispatcher.Invoke(() => pLabel.Content = "Resuming...", DispatcherPriority.Background);
prgbar.Maximum = 100;
prgbar.Value = 0;
}
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Clicked on Start Encode", "log.log");
}
if (TextBoxInputVideo.Text == " Input Video")
{
MessageBox.Show("No Input File selected!");
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " No Input File selected!", "log.log");
}
}
else if (TextBoxOutputVideo.Text == " Output Video")
{
MessageBox.Show("No Output Path specified!");
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " No Output Path specified!", "log.log");
}
}
else if (TextBoxInputVideo.Text != " Input Video")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Started MainClass()", "log.log");
}
//Start MainClass
MainClass();
}
}
public static class Cancel
{
//Public Cancel boolean
public static bool CancelAll = false;
}
public void MainClass()
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " MainClass started", "log.log");
}
//Sets Label
pLabel.Dispatcher.Invoke(() => pLabel.Content = "Starting...", DispatcherPriority.Background);
//Sets the working directory
string currentPath = Directory.GetCurrentDirectory();
//Checks if Chunks folder exist, if no it creates Chunks folder
if (!Directory.Exists(Path.Combine(currentPath, "Chunks")))
Directory.CreateDirectory(Path.Combine(currentPath, "Chunks"));
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Checked or Created Chunks folder", "log.log");
}
//Sets the variable for input / output of video
string videoInput = TextBoxInputVideo.Text;
string videoOutput = TextBoxOutputVideo.Text;
//Start Splitting
if (CheckBoxResume.IsChecked == false)
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Start Splitting", "log.log");
}
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
//FFmpeg Arguments
//Checks if Source needs to be reencoded
if (CheckBoxReencode.IsChecked == false)
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Splitting without reencoding", "log.log");
}
startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + videoInput + '\u0022' + " -vcodec copy -f segment -segment_time " + TextBoxChunkLength.Text + " -an " + '\u0022' + "Chunks\\out%0d.mkv" + '\u0022';
}
else if (CheckBoxReencode.IsChecked == true)
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Splitting with reencoding", "log.log");
}
startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + videoInput + '\u0022' + " -c:v utvideo -f segment -segment_time " + TextBoxChunkLength.Text + " -an " + '\u0022' + "Chunks\\out%0d.mkv" + '\u0022';
}
//Console.WriteLine(startInfo.Arguments);
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
}
//Audio Encoding
if (CheckBoxEnableAudio.IsChecked == true && CheckBoxResume.IsChecked == false)
{
encodeAudio(videoInput);
}
//Create Array List with all Chunks
string[] chunks;
//Sets the Chunks directory
string sdira = currentPath + "\\Chunks";
//Add all Files in Chunks Folder to array
chunks = Directory.GetFiles(sdira, "*mkv", SearchOption.AllDirectories).Select(x => Path.GetFileName(x)).ToArray();
if (CheckBoxResume.IsChecked == false)
{
DirectoryInfo d = new DirectoryInfo(currentPath + "\\Chunks");
FileInfo[] infos = d.GetFiles();
int numberOfChunks = chunks.Count();
//outx.mkv = 8 | outxx.mkv = 9 (99) | outxxx.mkv = 10 (999) | outxxxx.mkv = 11 (9999) | outxxxxx.mkv = 12 (99999)
//int numberOfChunks = 20000;
if (numberOfChunks >= 10 && numberOfChunks <= 99)
{
foreach (FileInfo f in infos)
{
int count = f.ToString().Count();
if (count == 8)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out0"));
}
}
}
else if (numberOfChunks >= 100 && numberOfChunks <= 999) //If you have more than 100 Chunks and less than 999
{
foreach (FileInfo f in infos)
{
int count = f.ToString().Count();
if (count == 8)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out00"));
}
if (count == 9)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out0"));
}
}
}
else if (numberOfChunks >= 1000 && numberOfChunks <= 9999) //If you have more than 1.000 Chunks and less than 9.999
{
foreach (FileInfo f in infos)
{
int count = f.ToString().Count();
if (count == 8)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out000"));
}
if (count == 9)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out00"));
}
if (count == 10)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out0"));
}
}
}
else if (numberOfChunks >= 10000 && numberOfChunks <= 99999) //If you have more than 10.000 Chunks and less than 99.999
{
foreach (FileInfo f in infos)
{
int count = f.ToString().Count();
if (count == 8)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out0000"));
}
if (count == 9)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out000"));
}
if (count == 10)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out00"));
}
if (count == 11)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out0"));
}
}
}
else if (numberOfChunks >= 100000 && numberOfChunks <= 999999)
{
foreach (FileInfo f in infos)
{
int count = f.ToString().Count();
//If you have more than 100.000 Chunks and less than 999.999
//BTW are fu*** insane?
if (count == 8)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out00000"));
}
if (count == 9)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out0000"));
}
if (count == 10)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out000"));
}
if (count == 11)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out00"));
}
if (count == 12)
{
System.IO.File.Move(d + "\\" + f, d + "\\" + f.Name.Replace("out", "out0"));
}
}
}
}
//Parse Textbox Text to String for loop threading
int maxConcurrency = Int16.Parse(TextBoxNumberWorkers.Text);
int cpuUsed = Int16.Parse(ComboBoxCpuUsed.Text);
int bitDepth = Int16.Parse(ComboBoxBitdepth.Text);
int encThreads = Int16.Parse(TextBoxEncThreads.Text);
int cqLevel = Int16.Parse(TextBoxcqLevel.Text);
int kfmaxdist = Int16.Parse(TextBoxKeyframeInterval.Text);
int tilecols = Int16.Parse(TextBoxTileCols.Text);
int tilerows = Int16.Parse(TextBoxTileRows.Text);
int nrPasses = Int16.Parse(ComboBoxPasses.Text);
string fps = TextBoxFramerate.Text;
string encMode = this.ComboBoxEncMode.Text;
bool resume = false;
//Sets Resume Mode
if (CheckBoxResume.IsChecked == true)
{
resume = true;
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Resume Mode Started", "log.log");
}
foreach (string line in File.ReadLines("encoded.txt"))
{
//Removes all Items from Arraylist which are in encoded.txt
chunks = chunks.Where(s => s != line).ToArray();
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Resume Mode - Deleting " + line + " from Array", "log.log");
}
}
//Set the Maximum Value of Progressbar
prgbar.Maximum = chunks.Count();
}
string finalEncodeMode = "";
//Sets the Encoding Mode
if (encMode == "q")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Set Encode Mode to q", "log.log");
}
finalEncodeMode = " --end-usage=q --cq-level=" + cqLevel;
}
else if (encMode == "vbr")
{
//If vbr set finalEncodeMode
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Set Encode Mode to vbr", "log.log");
}
finalEncodeMode = " --end-usage=vbr --target-bitrate=" + cqLevel;
}
else if (encMode == "cbr")
{
//If cbr set finalEncodeMode
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Set Encode Mode to cbr", "log.log");
}
finalEncodeMode = " --end-usage=cbr --target-bitrate=" + cqLevel;
}
string allSettingsAom = "";
//Sets aom settings to custom or preset
if (CheckBoxCustomSettings.IsChecked == true)
{
allSettingsAom = " " + TextBoxCustomSettings.Text;
//Console.WriteLine(allSettingsAom);
}
else if (CheckBoxCustomSettings.IsChecked == false)
{
allSettingsAom = " --cpu-used=" + cpuUsed + " --threads=" + encThreads + finalEncodeMode + " --bit-depth=" + bitDepth + " --tile-columns=" + tilecols + " --fps=" + fps + " --tile-rows=" + tilerows + " --kf-max-dist=" + kfmaxdist;
//Console.WriteLine(allSettingsAom);
}
//Sets the boolean if audio should be included -> Concat() needs this value
bool audioOutput = false;
if (CheckBoxEnableAudio.IsChecked == true)
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Set Audio Boolean to true", "log.log");
}
audioOutput = true;
}
//Starts the async task
StartTask(maxConcurrency, nrPasses, allSettingsAom, resume, videoOutput, audioOutput);
//Set Maximum of Progressbar
prgbar.Maximum = chunks.Count();
//Set the Progresslabel to 0 out of Number of chunks, because people would think that it doesnt to anything
pLabel.Dispatcher.Invoke(() => pLabel.Content = "0 / " + prgbar.Maximum, DispatcherPriority.Background);
}
//Async Class -> UI doesnt freeze
private async void StartTask(int maxConcurrency, int passes, string allSettingsAom, bool resume, string videoOutput, bool audioOutput)
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Async Task started", "log.log");
}
//Run encode class async
await Task.Run(() => encode(maxConcurrency, passes, allSettingsAom, resume, videoOutput, audioOutput));
}
//Main Encoding Class
public void encode(int maxConcurrency, int passes, string allSettingsAom, bool resume, string videoOutput, bool audioOutput)
{
//Set Working directory
string currentPath = Directory.GetCurrentDirectory();
//Create Array List with all Chunks
string[] chunks;
//Sets the Chunks directory
string sdira = currentPath + "\\Chunks";
//Add all Files in Chunks Folder to array
chunks = Directory.GetFiles(sdira, "*mkv", SearchOption.AllDirectories).Select(x => Path.GetFileName(x)).ToArray();
if (resume == true)
{
//Removes all Items from Arraylist which are in encoded.txt
foreach (string line in File.ReadLines("encoded.txt"))
{
chunks = chunks.Where(s => s != line).ToArray();
}
}
//Get Number of chunks for label of progressbar
string labelstring = chunks.Count().ToString();
//Parallel Encoding - aka some blackmagic
using (SemaphoreSlim concurrencySemaphore = new SemaphoreSlim(maxConcurrency))
{
List<Task> tasks = new List<Task>();
foreach (var items in chunks)
{
concurrencySemaphore.Wait();
var t = Task.Factory.StartNew(() =>
{
try
{
if (Cancel.CancelAll == false)
{
if (passes == 1)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + sdira + "\\" + items + '\u0022' + " -pix_fmt yuv420p -vsync 0 -f yuv4mpegpipe - | aomenc.exe - --passes=1" + allSettingsAom + " --output=Chunks\\" + items + "-av1.ivf";
process.StartInfo = startInfo;
Console.WriteLine(startInfo.Arguments);
process.Start();
process.WaitForExit();
//Progressbar +1
prgbar.Dispatcher.Invoke(() => prgbar.Value += 1, DispatcherPriority.Background);
//Label of Progressbar = Progressbar
pLabel.Dispatcher.Invoke(() => pLabel.Content = prgbar.Value + " / " + labelstring, DispatcherPriority.Background);
if (Cancel.CancelAll == false)
{
//Write Item to file for later resume if something bad happens
WriteToFileThreadSafe(items, "encoded.txt");
}
else
{
KillInstances();
}
}
else if (passes == 2)
{
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + sdira + "\\" + items + '\u0022' + " -pix_fmt yuv420p -vsync 0 -f yuv4mpegpipe - | aomenc.exe - --passes=2 --pass=1 --fpf=Chunks\\" + items + "_stats.log" + allSettingsAom + " --output=NUL";
process.StartInfo = startInfo;
//Console.WriteLine(startInfo.Arguments);
process.Start();
process.WaitForExit();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + sdira + "\\" + items + '\u0022' + " -pix_fmt yuv420p -vsync 0 -f yuv4mpegpipe - | aomenc.exe - --passes=2 --pass=2 --fpf=Chunks\\" + items + "_stats.log" + allSettingsAom + " --output=Chunks\\" + items + "-av1.ivf";
process.StartInfo = startInfo;
//Console.WriteLine(startInfo.Arguments);
process.Start();
process.WaitForExit();
prgbar.Dispatcher.Invoke(() => prgbar.Value += 1, DispatcherPriority.Background);
pLabel.Dispatcher.Invoke(() => pLabel.Content = prgbar.Value + " / " + labelstring, DispatcherPriority.Background);
if (Cancel.CancelAll == false)
{
//Write Item to file for later resume if something bad happens
WriteToFileThreadSafe(items, "encoded.txt");
}
else
{
KillInstances();
}
}
}
}
finally
{
concurrencySemaphore.Release();
}
});
tasks.Add(t);
}
Task.WaitAll(tasks.ToArray());
}
//Mux all Encoded chunks back together
concat(videoOutput, audioOutput);
}
//Mux ivf Files back together
private void concat(string videoOutput, bool audioOutput)
{
if (Cancel.CancelAll == false)
{
string currentPath = Directory.GetCurrentDirectory();
string outputfilename = videoOutput;
pLabel.Dispatcher.Invoke(() => pLabel.Content = "Muxing files", DispatcherPriority.Background);
//Lists all ivf files in mylist.txt
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
//FFmpeg Arguments
startInfo.Arguments = "/C (for %i in (Chunks\\*.ivf) do @echo file '%i') > Chunks\\mylist.txt";
//Console.WriteLine(startInfo.Arguments);
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
if (audioOutput == false)
{
//Concat the Videos
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
//FFmpeg Arguments
startInfo.Arguments = "/C ffmpeg.exe -f concat -safe 0 -i Chunks\\mylist.txt -c copy " + '\u0022' + outputfilename + '\u0022';
//Console.WriteLine(startInfo.Arguments);
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
}
else if (audioOutput == true)
{
//Concat the Videos
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
//FFmpeg Arguments
startInfo.Arguments = "/C ffmpeg.exe -f concat -safe 0 -i Chunks\\mylist.txt -c copy no_audio.mkv";
//Console.WriteLine(startInfo.Arguments);
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
//Concat the Videos
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
//FFmpeg Arguments
startInfo.Arguments = "/C ffmpeg.exe -i no_audio.mkv -i Audio\\audio.mkv -c copy " + '\u0022' + outputfilename + '\u0022';
//Console.WriteLine(startInfo.Arguments);
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
}
pLabel.Dispatcher.Invoke(() => pLabel.Content = "Muxing completed!", DispatcherPriority.Background);
}
}
//Kill all aomenc instances
private void Button_Click_2(object sender, RoutedEventArgs e)
{
Cancel.CancelAll = true;
KillInstances();
pLabel.Dispatcher.Invoke(() => pLabel.Content = "Cancled!", DispatcherPriority.Background);
}
public void KillInstances()
{
try
{
foreach (var process in Process.GetProcessesByName("aomenc"))
{
process.Kill();
}
foreach (var process in Process.GetProcessesByName("ffmpeg"))
{
process.Kill();
}
}
catch { }
}
private void Button_Click_3(object sender, RoutedEventArgs e)
{
try
{
//Delete Files, because of lazy dump****
File.Delete("encoded.txt");
Directory.Delete("Chunks", true);
Directory.Delete("Audio", true);
File.Delete("no_audio.mkv");
}
catch { }
}
//Some smaller Blackmagic, so parallel Workers won't lockdown the encoded.txt file
private static ReaderWriterLockSlim _readWriteLock = new ReaderWriterLockSlim();
public void WriteToFileThreadSafe(string text, string path)
{
// Set Status to Locked
_readWriteLock.EnterWriteLock();
try
{
// Append text to the file
using (StreamWriter sw = File.AppendText(path))
{
sw.WriteLine(text);
sw.Close();
}
}
finally
{
// Release lock
_readWriteLock.ExitWriteLock();
}
}
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
//Disables editing of preset settings if user wants to write custom settings
TextBoxCustomSettings.IsEnabled = true;
ComboBoxEncMode.IsEnabled = false;
TextBoxcqLevel.IsEnabled = false;
TextBoxEncThreads.IsEnabled = false;
ComboBoxBitdepth.IsEnabled = false;
ComboBoxCpuUsed.IsEnabled = false;
TextBoxTileCols.IsEnabled = false;
TextBoxTileRows.IsEnabled = false;
TextBoxKeyframeInterval.IsEnabled = false;
TextBoxFramerate.IsEnabled = false;
}
private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
{
//Re-enables editing of preset settings
TextBoxCustomSettings.IsEnabled = false;
ComboBoxEncMode.IsEnabled = true;
TextBoxcqLevel.IsEnabled = true;
TextBoxEncThreads.IsEnabled = true;
ComboBoxBitdepth.IsEnabled = true;
ComboBoxCpuUsed.IsEnabled = true;
TextBoxTileCols.IsEnabled = true;
TextBoxTileRows.IsEnabled = true;
TextBoxKeyframeInterval.IsEnabled = true;
TextBoxFramerate.IsEnabled = true;
}
public void encodeAudio(string videoInput)
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding started", "log.log");
}
string audioBitrate = "";
audioBitrate = TextBoxAudioBitrate.Text;
string allAudioSettings = "";
//Sets Settings for Audio Encoding
if (ComboBoxAudioCodec.Text == "Copy Audio")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Setting Encode Mode to Audio Copy", "log.log");
}
allAudioSettings = " -c:a copy";
}
else if (ComboBoxAudioCodec.Text == "Opus")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Setting Encode Mode to libopus", "log.log");
}
allAudioSettings = " -c:a libopus -b:a " + audioBitrate + "k ";
}
else if (ComboBoxAudioCodec.Text == "Opus 5.1")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Setting Encode Mode to libopus 5.1", "log.log");
}
allAudioSettings = " -c:a libopus -b:a " + audioBitrate + "k -af channelmap=channel_layout=5.1";
}
else if (ComboBoxAudioCodec.Text == "AAC CBR")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Setting Encode Mode to AAC CBR", "log.log");
}
allAudioSettings = " -c:a aac -b:a " + audioBitrate + "k ";
}
else if (ComboBoxAudioCodec.Text == "AC3")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Setting Encode Mode to AC3 CBR", "log.log");
}
allAudioSettings = " -c:a ac3 -b:a " + audioBitrate + "k ";
}
else if (ComboBoxAudioCodec.Text == "FLAC")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Setting Encode Mode to FLAC", "log.log");
}
allAudioSettings = " -c:a flac ";
}
else if (ComboBoxAudioCodec.Text == "MP3 CBR")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Setting Encode Mode to MP3 CBR", "log.log");
}
allAudioSettings = " -c:a libmp3lame -b:a " + audioBitrate + "k ";
}
else if (ComboBoxAudioCodec.Text == "MP3 VBR")
{
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Setting Encode Mode to MP3 CBR", "log.log");
}
if (Int16.Parse(TextBoxAudioBitrate.Text) >= 10)
{
MessageBox.Show("Audio VBR Range is from 0-9");
}
else if (Int16.Parse(TextBoxAudioBitrate.Text) <= 10)
{
allAudioSettings = " -c:a libmp3lame -q:a " + audioBitrate + " ";
}
}
//Sets the working directory
string currentPath = Directory.GetCurrentDirectory();
//Creates Audio Folder
if (!Directory.Exists(Path.Combine(currentPath, "Audio")))
Directory.CreateDirectory(Path.Combine(currentPath, "Audio"));
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
//FFmpeg Arguments
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Started Audio Encoding", "log.log");
}
startInfo.Arguments = "/C ffmpeg.exe -i " + '\u0022' + videoInput + '\u0022' + allAudioSettings + " -vn " + '\u0022' + "Audio\\audio.mkv" + '\u0022';
if (CheckBoxLogging.IsChecked == true)
{
WriteToFileThreadSafe(DateTime.Now.ToString("h:mm:ss tt") + " Audio Encoding Ended", "log.log");
}
//Console.WriteLine(startInfo.Arguments);
process.StartInfo = startInfo;
process.Start();
process.WaitForExit();
}
public void getStreamFps(string fileinput)
{
string input = "";
input = '\u0022' + fileinput + '\u0022';
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo = new System.Diagnostics.ProcessStartInfo()
{
UseShellExecute = false,
CreateNoWindow = true,
WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden,
FileName = "cmd.exe",
Arguments = "/C ffprobe.exe -i " + input + " -v 0 -of csv=p=0 -select_streams v:0 -show_entries stream=r_frame_rate",
RedirectStandardError = true,
RedirectStandardOutput = true
};
process.Start();
// Now read the value, parse to int and add 1 (from the original script)
//int online = int.Parse(process.StandardOutput.ReadToEnd()) + 1;
string fpsOutput = process.StandardOutput.ReadLine();
//string fpsOutputLine = new StringReader(fpsOutput).ReadLine();
TextBoxFramerate.Text = fpsOutput;
//Console.WriteLine(fpsOutput);
process.WaitForExit();
}
}
} |
using System;
using MonoTouch.UIKit;
using System.Drawing;
namespace iPadPos
{
public static class ViewExtensions
{
public static void DismissKeyboard(this UIView view)
{
var tv = new UITextField (new RectangleF(-100,-100,1,1));
view.AddSubview (tv);
tv.BecomeFirstResponder ();
tv.ResignFirstResponder ();
tv.RemoveFromSuperview ();
tv.Dispose ();
}
}
}
|
using MatrixExtension;
using System;
using System.Diagnostics;
namespace Ui_Multiply
{
class Program
{
static void Main(string[] args)
{
int size = 500;
var a = MatrixAdding.MatrixAddExtension.GetRandomMatrix(size, size);
var b = MatrixAdding.MatrixAddExtension.GetRandomMatrix(size, size);
long defaultTime;
Console.WriteLine("Multiply matrixes " + size.ToString() + "x" + size.ToString());
var sw = new Stopwatch();
sw.Start();
var m = a.Multiply(b);
sw.Stop();
Console.Write("Without multithreading: ");
defaultTime = sw.ElapsedMilliseconds;
Console.WriteLine(sw.ElapsedMilliseconds.ToString() + "ms " + "speed " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds), 3).ToString()
+ " one thread profit " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds) / 1, 3).ToString());
sw.Restart();
sw.Start();
var m1 = a.MultiplyMultithreading(b, 1);
sw.Stop();
Console.Write("1 thread: \t");
Console.WriteLine(sw.ElapsedMilliseconds.ToString() + "ms " + "speed " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds), 3).ToString()
+ " one thread profit " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds) / 1, 3).ToString());
sw.Restart();
sw.Start();
var m2 = a.MultiplyMultithreading(b, 2);
sw.Stop();
Console.Write("2 threads: \t");
Console.WriteLine(sw.ElapsedMilliseconds.ToString() + "ms " + "speed " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds), 3).ToString()
+ " one thread profit " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds) / 2, 3).ToString());
sw.Restart();
sw.Start();
var m3 = a.MultiplyMultithreading(b, 4);
sw.Stop();
Console.Write("4 threads: \t");
Console.WriteLine(sw.ElapsedMilliseconds.ToString() + "ms " + "speed " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds), 3).ToString()
+ " one thread profit " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds) / 4, 3).ToString());
sw.Restart();
sw.Start();
var m4 = a.MultiplyMultithreading(b, 6);
sw.Stop();
Console.Write("6 threads: \t");
Console.WriteLine(sw.ElapsedMilliseconds.ToString() + "ms " + "speed " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds), 3).ToString()
+ " one thread profit " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds) / 6, 3).ToString());
sw.Restart();
sw.Start();
var m5 = a.MultiplyMultithreading(b, 8);
sw.Stop();
Console.Write("8 threads: \t");
Console.WriteLine(sw.ElapsedMilliseconds.ToString() + "ms " + "speed " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds), 3).ToString()
+ " one thread profit " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds) / 8, 3).ToString());
sw.Restart();
sw.Start();
var m6 = a.MultiplyMultithreading(b, 10);
sw.Stop();
Console.Write("10 threads: \t");
Console.WriteLine(sw.ElapsedMilliseconds.ToString() + "ms " + "speed " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds), 3).ToString()
+ " one thread profit " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds) / 10, 3).ToString());
sw.Restart();
sw.Start();
var m7 = a.MultiplyMultithreading(b, 20);
sw.Stop();
Console.Write("20 threads: \t");
Console.WriteLine(sw.ElapsedMilliseconds.ToString() + "ms " + "speed " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds), 3).ToString()
+ " one thread profit " + Math.Round(((double)defaultTime / (double)sw.ElapsedMilliseconds) / 20, 3).ToString());
}
}
}
|
using MathNet.Numerics.Distributions;
using System;
namespace Utilities
{
public class Probability
{
/// <summary> Provide the cumulative probability that a value will be equal to or lower than that supplied </summary>
public static decimal? CumulativeP(IUnivariateDistribution distribution, decimal? val)
{
return val == null || distribution == null ? null : sanitiseCumulativeP((decimal?)distribution.CumulativeDistribution((double)val));
}
/// <summary> Sanitizes cumulative probability & trim decimal places </summary>
private static decimal? sanitiseCumulativeP(decimal? cp)
{
if (cp == null)
{
return null;
}
// Trim decimal places appropriately
if (cp < .00001M || cp > .9999M)
{
return Math.Round((decimal)cp * 100, 4);
}
else if (cp < .0001M || cp > .999M)
{
return Math.Round((decimal)cp * 100, 3);
}
else if (cp < .001M || cp > .99M)
{
return Math.Round((decimal)cp * 100, 2);
}
else
{
return Math.Round((decimal)cp * 100);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mercadinho.Model
{
class CarrinhoProdutos
{
private int idCompra;
private Cliente cliente;
private List<Produto> Produtos;
private List<Fatura> parcelas;
private decimal somacarrinho;
private DAO.CarrinhoProdutoDAO cdao;
public CarrinhoProdutos()
{
}
public int IdCompra { get => idCompra; set => idCompra = value; }
public decimal Somacarrinho { get => somacarrinho; set => somacarrinho = value; }
internal Cliente Cliente { get => cliente; set => cliente = value; }
internal List<Produto> Produtos1 { get => Produtos; set => Produtos = value; }
internal List<Fatura> Parcelas { get => parcelas; set => parcelas = value; }
public decimal calcularcarrinho()
{
decimal soma = 0;
foreach (Produto prod in Produtos1)
{
soma += prod.Precovenda;
}
return soma;
}
public void InserirDadosCarrinho()
{
cdao = new DAO.CarrinhoProdutoDAO();
cdao.InserirDadosCarrinho(this);
}
}
}
|
namespace Funding.Services.Models.ProjectViewModels
{
using Funding.Data.Models;
using Funding.Services.Mapping;
public class MyProjects: IMapFrom<Project>
{
public int Id { get; set; }
public string Name { get; set; }
public string ImageUrl { get; set; }
public decimal Goal { get; set; }
public decimal MoneyCollected { get; set; }
}
}
|
namespace SmartyStreets.USAutocompleteProApi
{
using System.Runtime.Serialization;
/// <remarks>
/// See "https://smartystreets.com/docs/cloud/us-autocomplete-api#http-response"
/// </remarks>
/// >
[DataContract]
public class Suggestion
{
[DataMember(Name = "street_line")]
public string Street { get; set; }
[DataMember(Name = "secondary")]
public string Secondary { get; set; }
[DataMember(Name = "city")]
public string City { get; set; }
[DataMember(Name = "state")]
public string State { get; set; }
[DataMember(Name = "zipcode")]
public string ZIPCode { get; set; }
[DataMember(Name = "entries")]
public string Entries { get; set; }
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
using UnityEngine.SceneManagement;
public class FixPanel : MonoBehaviour {
public GameObject errorPanel;
public GameObject refreshButton;
public GameObject cameraButton;
private string s = "";
private bool onOff = false;
void Start () {
s = SceneManager.GetActiveScene().name;
}
// Update is called once per frame
void Update () {
if(DefaultTrackableEventHandler.trueFalse==true)
{
errorPanel.SetActive(false);
cameraButton.SetActive(false);
}
}
public void Refresh()
{
SceneManager.LoadScene(s);
}
public void toggleFlash()
{
if(onOff==false)
{
CameraDevice.Instance.SetFlashTorchMode(true);
onOff = true;
}
else
{
CameraDevice.Instance.SetFlashTorchMode(false);
onOff = false;
}
}
}
|
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RankingSystem.Data;
using RankingSystem.Data.Models;
using RankingSystem.Web.Models;
using System;
using System.Data.Entity;
using System.Threading.Tasks;
namespace RankingSystem.Web.Controllers
{
public class AccountController : Controller
{
private readonly RankingSystemContext _context;
public AccountController(RankingSystemContext context)
{
_context = context;
}
// GET: /Account/Login
public IActionResult Login()
{
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Login(Member member)
{
try
{
Member m = await _context.Members.SingleOrDefaultAsync(q => q.Email == member.Email);
if (m != null)
{
HttpContext.Session.SetString("MemberId", m.Id.ToString());
HttpContext.Session.SetString("MemberEmail", m.Email);
HttpContext.Session.SetString("MemberIsAdmin", m.IsAdmin.ToString());
return RedirectToAction("Index", "Home");
}
return View(new LoginViewModel { Error = "Email not found or invalid." });
}
catch (Exception ex)
{
return View(new LoginViewModel { Error = ex.Message });
}
}
public IActionResult Logout()
{
// It will clear the session at the end of request
HttpContext.Session.Clear();
return RedirectToAction("Login", "Account");
}
}
} |
/*
* Creado en SharpDevelop
* Autor: IsaRoGaMX
* Fecha: 16/09/2015
* Hora: 01:37 a.m.
*
*/
using System;
using System.Collections.Generic;
namespace IsaRoGaMX.CFDI
{
public abstract class AbstractInformacionAduanera : baseObject {
public abstract string Numero
{ get; set; }
public abstract string Fecha
{ get; set; }
public abstract string Aduana
{ get; set; }
}
public class InformacionAduanera : AbstractInformacionAduanera
{
public InformacionAduanera() : base() { }
public InformacionAduanera(string numero, string fecha)
: base() {
atributos.Add("numero", numero);
atributos.Add("fecha", fecha);
}
public InformacionAduanera(string numero, string fecha, string aduana)
: base() {
atributos.Add("numero", numero);
atributos.Add("fecha", fecha);
atributos.Add("aduana", aduana);
}
public override string Numero {
get {
if(atributos.ContainsKey("numero"))
return atributos["numero"];
else
throw new Exception("InformacionAduanera::numero no puede estar vacio");
}
set {
if(atributos.ContainsKey("numero"))
atributos["numero"] = value;
else
atributos.Add("numero", value);
}
}
public override string Fecha {
get {
if(atributos.ContainsKey("fecha"))
return atributos["fecha"];
else
throw new Exception("InformacionAduanera::fecha no puede estar vacio");
}
set {
if(atributos.ContainsKey("fecha"))
atributos["fecha"] = value;
else
atributos.Add("fecha", value);
}
}
public override string Aduana {
get {
if(atributos.ContainsKey("aduana"))
return atributos["aduana"];
else
return string.Empty;
}
set {
if(atributos.ContainsKey("aduana"))
atributos["aduana"] = value;
else
atributos.Add("aduana", value);
}
}
}
}
|
namespace DmManager.Models
{
public class Player
{
public int Id { get; set; }
public string Name { get; set; }
public int CurrentInitiative { get; set; } = 0;
public int GameId { get; set; }
public Game Game { get; set; }
}
} |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Presentation.QLBSX_BUS_WebService;
/**
* Tên Đề Tài; Phần Mền Quản Lý Biển Số Xe và Vi Phạm Giao Thông(VLNM (Vehicle license number management))
* Ho tên sinh viên:
* 1. Phan Nhật Tiến 0812515
* 2. Huỳnh Công Toàn 0812527
*
* GVHD. Trần Minh Triết
**/
namespace Presentation
{
public partial class F_XoaBienSo : Form
{
private QLBSX_BUS_WebServiceSoapClient ws = new QLBSX_BUS_WebServiceSoapClient();
public F_XoaBienSo()
{
InitializeComponent();
}
private void F_XoaBienSo_Load(object sender, EventArgs e)
{
List<BienSoXe> dsBS = new List<BienSoXe>();
dsBS = ws.LayDanhSachBSXTongQuat().ToList();
foreach (BienSoXe bs in dsBS)
if(bs.VoHieuHoa == false)
cbb_BienSo.Items.Add(bs.BienSo);
}
private void bnt_Xoa_Click(object sender, EventArgs e)
{
if (cbb_BienSo.Text != "")
{
BienSoXe bs = ws.TraCuuBSXTheoBienSo(cbb_BienSo.Text);
if (MessageBox.Show("Bạn có thật sự muốn xóa biển số \"" + cbb_BienSo.Text + "\"?", "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
if (ws.VoHieuHoaBienSoXe(bs))
{
MessageBox.Show("Đã xóa biển số \"" + cbb_BienSo.Text + "\" thành công.", "Thông báo", MessageBoxButtons.OK);
//cbb_BienSo.Refresh();
cbb_BienSo.Items.Remove(cbb_BienSo.Text);
}
else
MessageBox.Show("Biến số \"" + cbb_BienSo.Text + "\" không tồn tại!", "Lỗi Dữ Liệu", MessageBoxButtons.OKCancel);
}
}
else
MessageBox.Show("Bạn chưa chọn biển số xe!", "Lỗi", MessageBoxButtons.OK);
}
private void bnt_Thoat_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
|
using System.Windows;
namespace Twitter_Killer
{
public partial class App
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
// initializing client view with data context
var clientView = new View {DataContext = new ViewModel()};
clientView.Show();
}
}
}
|
using Core.Entities.Concrete;
using Entities.Concrete;
using FluentValidation;
namespace Business.ValidationRules.FluentValidation
{
public class UserValidator : AbstractValidator<User>
{
public UserValidator()
{
RuleFor(x => x.Email).NotEmpty().EmailAddress();
RuleFor(x => x.LastName).NotEmpty();
RuleFor(x => x.FirstName).NotEmpty();
RuleFor(x => x.PasswordHash).NotEmpty();
RuleFor(x => x.PasswordSalt).NotEmpty();
}
}
}
|
namespace P08MilitaryElite.Interfaces
{
using System.Collections.Generic;
public interface IEngineer : ISpecialisedSoldier
{
IEnumerable<IPart> Repairs { get; }
}
} |
using LiveDemo_MVC.Controllers;
using LiveDemo_MVC.DataServices.Contracts;
using LiveDemo_MVC.DataServices.Models;
using LiveDemo_MVC.Models;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using System;
using TestStack.FluentMVCTesting;
namespace LiveDemo_MVC.UnitTests.LiveDemo_MVC.Controllers.BookControllerTests
{
[TestClass]
public class Details_Should
{
[TestMethod]
public void ReturnViewWithModelWithCorrectProperties_WhenThereIsAModelWithThePassedId()
{
// Arrange
var bookServiceMock = new Mock<IBookService>();
var categoryServiceMock = new Mock<ICategoryService>();
var bookModel = new BookModel()
{
Id = Guid.NewGuid(),
Author = "author",
Description = "description",
ISBN = "ISBN",
Title = "title",
WebSite = "website"
};
var bookViewModel = new BookViewModel(bookModel);
bookServiceMock.Setup(m => m.GetById(bookModel.Id)).Returns(bookModel);
BookController bookController = new BookController(bookServiceMock.Object, categoryServiceMock.Object);
// Act & Assert
bookController
.WithCallTo(b => b.Details(bookModel.Id))
.ShouldRenderDefaultView()
.WithModel<BookViewModel>(viewModel =>
{
Assert.AreEqual(bookModel.Author, viewModel.Author);
Assert.AreEqual(bookModel.ISBN, viewModel.ISBN);
Assert.AreEqual(bookModel.Title, viewModel.Title);
Assert.AreEqual(bookModel.WebSite, viewModel.WebSite);
Assert.AreEqual(bookModel.Description, viewModel.Description);
});
}
[TestMethod]
public void ReturnViewWithEmptyModel_WhenThereNoModelWithThePassedId()
{
// Arrange
var bookServiceMock = new Mock<IBookService>();
var categoryServiceMock = new Mock<ICategoryService>();
var bookViewModel = new BookViewModel();
Guid? bookId = Guid.NewGuid();
bookServiceMock.Setup(m => m.GetById(bookId.Value)).Returns((BookModel)null);
BookController bookController = new BookController(bookServiceMock.Object, categoryServiceMock.Object);
// Act & Assert
bookController
.WithCallTo(b => b.Details(bookId.Value))
.ShouldRenderDefaultView()
.WithModel<BookViewModel>(viewModel =>
{
Assert.IsNull(viewModel.Author);
Assert.IsNull(viewModel.ISBN);
Assert.IsNull(viewModel.Title);
Assert.IsNull(viewModel.WebSite);
Assert.IsNull(viewModel.Description);
});
}
[TestMethod]
public void ReturnViewWithEmptyModel_WhenParameterIsNull()
{
// Arrange
var bookServiceMock = new Mock<IBookService>();
var categoryServiceMock = new Mock<ICategoryService>();
var bookViewModel = new BookViewModel();
bookServiceMock.Setup(m => m.GetById(null)).Returns((BookModel)null);
BookController bookController = new BookController(bookServiceMock.Object, categoryServiceMock.Object);
// Act & Assert
bookController
.WithCallTo(b => b.Details(null))
.ShouldRenderDefaultView()
.WithModel<BookViewModel>(viewModel =>
{
Assert.IsNull(viewModel.Author);
Assert.IsNull(viewModel.ISBN);
Assert.IsNull(viewModel.Title);
Assert.IsNull(viewModel.WebSite);
Assert.IsNull(viewModel.Description);
});
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WireGrabObject : GrabObject {
[HideInInspector]
public Transform grabber = null;
private Rigidbody rb;
private List<Jackable> plug_list;
[HideInInspector]
public Jackable currently_plugged_in_to;
public SceneManager sceneManager;
public Wire ParentWire;
public AudioClip jackin0;
public AudioClip jackin1;
public AudioClip jackin2;
private AudioSource jackingin;
void Start()
{
rb = GetComponent<Rigidbody>();
plug_list = new List<Jackable>();
currently_plugged_in_to = null;
jackingin = GetComponent<AudioSource>();
}
public void OnTriggerEnter(Collider other)
{
if (other.GetComponent<Jackable>())
{
plug_list.Add(other.GetComponent<Jackable>());
}
}
public void OnTriggerExit(Collider other)
{
if (other.GetComponent<Jackable>())
{
plug_list.Remove(other.GetComponent<Jackable>());
}
}
public override bool grab_try_the_waters()
{
if (grabber == null)
return true;
else
return false;
}
public override void grab(GameObject controller)
{
grabber = controller.transform;
rb.isKinematic = true;
//Plug in jack
if (currently_plugged_in_to != null)
{
sceneManager.OnUnplug(currently_plugged_in_to);
currently_plugged_in_to.unplug();
currently_plugged_in_to = null;
}
}
public override void release()
{
rb.isKinematic = false;
rb.velocity = grabber.gameObject.GetComponent<Rigidbody>().velocity;
rb.angularVelocity = grabber.gameObject.GetComponent<Rigidbody>().angularVelocity;
grabber = null;
//Plug in jack
foreach (Jackable j in plug_list)
{
if (j.plug_try_the_waters())
{
j.plugin(this);
currently_plugged_in_to = j;
sceneManager.OnPlugIn(ParentWire, currently_plugged_in_to);
jackingin.Stop();
int r = Random.Range(0, 2);
if (r == 0)
jackingin.clip = jackin0;
else if (r == 1)
jackingin.clip = jackin1;
else
jackingin.clip = jackin2;
jackingin.Play();
break;
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TO;
using DAL;
using System.ComponentModel;
using System.Transactions;
using BO.Constates;
namespace BO
{
[DataObject]
public class CasoDeTesteBO
{
public static CasoDeTesteTO Obter(int pId, int pIdSubModulo, int pIdProjeto)
{
try
{
return CasoDeTesteDAL.Obter(pId, pIdSubModulo, pIdProjeto);
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao obter o caso de teste");
}
}
public static List<CasoDeTesteTO> ObterPorSubModulo(int pIdProjeto, int pIdModulo, int pIdSubModulo, string pObjetivo)
{
try
{
if (string.IsNullOrEmpty(pObjetivo))
{
pObjetivo = "";
}
if (pIdModulo == 0)
{
return new List<CasoDeTesteTO>();
}
if (pIdModulo == -1)
{
return CasoDeTesteDAL.ObterTodosPorProjeto(pIdProjeto, pObjetivo);
}
else
{
if (pIdSubModulo == -1)
{
return CasoDeTesteDAL.ObterTodosPorModuloProjeto(pIdProjeto, pIdModulo, pObjetivo);
}
else
{
return CasoDeTesteDAL.ObterPorSubModuloProjeto(pIdProjeto, pIdSubModulo, pObjetivo);
}
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao obter os casos de teste");
}
}
public static List<CasoDeTesteTO> ObterCasosPorStatusSubModulo(int pIdProjeto, int pIdModulo, int pIdSubModulo, int pStatus, string pObjetivo)
{
try
{
if (string.IsNullOrEmpty(pObjetivo))
{
pObjetivo = "";
}
if (pIdModulo == 0)
{
return new List<CasoDeTesteTO>();
}
if (pStatus == 0)
{
return new List<CasoDeTesteTO>();
}
else
{
if (pIdModulo == -1)
{
return CasoDeTesteDAL.ObterTodosPorProjetoStatus(pIdProjeto, pStatus, pObjetivo);
}
else
{
if (pIdSubModulo == -1)
{
return CasoDeTesteDAL.ObterTodosPorModuloProjetoStatus(pIdProjeto, pIdModulo, pStatus, pObjetivo);
}
else
{
return CasoDeTesteDAL.ObterPorSubModuloProjetoStatus(pIdProjeto, pIdSubModulo, pStatus, pObjetivo);
}
}
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao obter os casos de teste");
}
}
public static List<CasoDeTesteTO> ObterCasosPorStatusComplexidadePrioridadeSubModulo(int pIdProjeto, int pIdModulo, int pIdSubModulo, int pStatus, int pComplexidade, int pPrioridade, string pObjetivo)
{
try
{
if (string.IsNullOrEmpty(pObjetivo))
{
pObjetivo = "";
}
if (pIdModulo == 0)
{
return new List<CasoDeTesteTO>();
}
if (pStatus == 0)
{
return new List<CasoDeTesteTO>();
}
else
{
if (pIdModulo == -1)
{
if (pComplexidade == 0)
{
if (pPrioridade == 0)
{
return CasoDeTesteDAL.ObterTodosPorProjetoStatus(pIdProjeto, pStatus, pObjetivo);
}
else
{
return CasoDeTesteDAL.ObterTodosPorProjetoStatusPrioridade(pIdProjeto, pStatus, pPrioridade, pObjetivo);
}
}
else
{
if (pPrioridade == 0)
{
return CasoDeTesteDAL.ObterTodosPorProjetoStatusComplexidade(pIdProjeto, pStatus, pComplexidade, pObjetivo);
}
else
{
return CasoDeTesteDAL.ObterTodosPorProjetoStatusComplexidadePrioridade(pIdProjeto, pStatus, pComplexidade, pPrioridade, pObjetivo);
}
}
}
else
{
if (pIdSubModulo == -1)
{
if (pComplexidade == 0)
{
if (pPrioridade == 0)
{
return CasoDeTesteDAL.ObterTodosPorModuloProjetoStatus(pIdProjeto, pIdModulo, pStatus, pObjetivo);
}
else
{
return CasoDeTesteDAL.ObterTodosPorModuloProjetoStatusPrioridade(pIdProjeto, pIdModulo, pStatus, pPrioridade, pObjetivo);
}
}
else
{
if (pPrioridade == 0)
{
return CasoDeTesteDAL.ObterTodosPorModuloProjetoStatusComplexidade(pIdProjeto, pIdModulo, pStatus, pComplexidade, pObjetivo);
}
else
{
return CasoDeTesteDAL.ObterTodosPorModuloProjetoStatusComplexidadePrioridade(pIdProjeto, pIdModulo, pStatus, pComplexidade, pPrioridade, pObjetivo);
}
}
}
else
{
if (pComplexidade == 0)
{
if (pPrioridade == 0)
{
return CasoDeTesteDAL.ObterPorSubModuloProjetoStatus(pIdProjeto, pIdSubModulo, pStatus, pObjetivo);
}
else
{
return CasoDeTesteDAL.ObterPorSubModuloProjetoStatusPrioridade(pIdProjeto, pIdSubModulo, pStatus, pPrioridade, pObjetivo);
}
}
else
{
if (pPrioridade == 0)
{
return CasoDeTesteDAL.ObterPorSubModuloProjetoStatusComplexidade(pIdProjeto, pIdSubModulo, pStatus, pComplexidade, pObjetivo);
}
else
{
return CasoDeTesteDAL.ObterPorSubModuloProjetoStatusComplexidadePrioridade(pIdProjeto, pIdSubModulo, pStatus, pComplexidade, pPrioridade, pObjetivo);
}
}
}
}
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao obter os casos de teste");
}
}
public static List<CasoDeTesteTO> ObterCasosPorTestador(int pIdTestador, string pObjetivo)
{
try
{
if (string.IsNullOrEmpty(pObjetivo))
{
pObjetivo = "";
}
return CasoDeTesteDAL.ObterTodosPorTestador(pIdTestador, StatusCasoTeste.DISTRIBUIDO , pObjetivo);
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao obter os casos de teste");
}
}
public static void Cadastrar(CasoDeTesteTO pCaso)
{
try
{
using (TransactionScope scope = new TransactionScope())
{
//Calcular Complexidade
List<ComplexidadeContratoTO> listComplexidade = ComplexidadeContratoBO.ObterPorProjeto(pCaso.IdProjeto);
int nrEntradas = pCaso.Entrada.ToString().Split('\n').Count(i => !string.IsNullOrWhiteSpace(i));
int nrProcedimentos = pCaso.Procedimento.ToString().Split('\n').Count(i => !string.IsNullOrWhiteSpace(i));
int nrSaidas = pCaso.Saida.ToString().Split('\n').Count(i => !string.IsNullOrWhiteSpace(i));
foreach (ComplexidadeContratoTO complexidade in listComplexidade)
{
pCaso.Complexidade = complexidade.NrTipo;
if (nrEntradas <= complexidade.Entradas && nrProcedimentos <= complexidade.Procedimentos && nrSaidas <= complexidade.Saidas)
{
break;
}
}
pCaso.Id = ObterIdCasoDeTeste(pCaso.IdSubModulo, pCaso.IdProjeto);
pCaso.Letra = ModulosProjetoBO.ObterLetraModulo(pCaso.IdSubModulo);
CasoDeTesteDAL.Cadastrar(pCaso);
scope.Complete();
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao cadastrar o caso de teste");
}
}
public static void CadastrarImportacao(CasoDeTesteTO pCaso)
{
try
{
using (TransactionScope scope = new TransactionScope())
{
pCaso.Entrada = string.Empty;
pCaso.Procedimento = string.Empty;
pCaso.Saida = string.Empty;
pCaso.Prioridade = 0;
pCaso.Id = ObterIdCasoDeTeste(pCaso.IdSubModulo, pCaso.IdProjeto);
CasoDeTesteDAL.Cadastrar(pCaso);
scope.Complete();
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao cadastrar o caso de teste");
}
}
private static int ObterIdCasoDeTeste(int pIdSubModulo, int pIdProjeto)
{
try
{
return CasoDeTesteDAL.ObterProximoID(pIdSubModulo, pIdProjeto);
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao obter o identificador do caso de teste");
}
}
public static int Alterar(CasoDeTesteTO pCaso)
{
try
{
using (TransactionScope scope = new TransactionScope())
{
//Calcular Complexidade
List<ComplexidadeContratoTO> listComplexidade = ComplexidadeContratoBO.ObterPorProjeto(pCaso.IdProjeto);
int nrEntradas = pCaso.Entrada.ToString().Split('\n').Count(i => !string.IsNullOrWhiteSpace(i));
int nrProcedimentos = pCaso.Procedimento.ToString().Split('\n').Count(i => !string.IsNullOrWhiteSpace(i));
int nrSaidas = pCaso.Saida.ToString().Split('\n').Count(i => !string.IsNullOrWhiteSpace(i));
foreach (ComplexidadeContratoTO complexidade in listComplexidade)
{
pCaso.Complexidade = complexidade.NrTipo;
if (nrEntradas <= complexidade.Entradas && nrProcedimentos <= complexidade.Procedimentos && nrSaidas <= complexidade.Saidas)
{
break;
}
}
int retorno = CasoDeTesteDAL.Alterar(pCaso);
scope.Complete();
return retorno;
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao alterar o caso de teste");
}
}
public static int Excluir(CasoDeTesteTO pCaso)
{
try
{
using (TransactionScope scope = new TransactionScope())
{
int retorno = CasoDeTesteDAL.Excluir(pCaso.Id, pCaso.IdSubModulo, pCaso.IdProjeto);
scope.Complete();
return retorno;
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao remover o caso de teste");
}
}
public static void ImportarCasosDeTeste(List<CasoDeTesteTO> pListCasos, int pIdProjetoDestino, int pIdSubModuloDestino, int pIdAnalista)
{
try
{
using (TransactionScope scope = new TransactionScope())
{
CasoDeTesteTO caso;
CasoDeTesteTO novoCaso;
foreach (CasoDeTesteTO pCaso in pListCasos)
{
caso = new CasoDeTesteTO();
caso = Obter(pCaso.Id, pCaso.IdSubModulo, pCaso.IdProjeto);
novoCaso = new CasoDeTesteTO();
novoCaso.Id = ObterIdCasoDeTeste(pIdSubModuloDestino, pIdProjetoDestino);
novoCaso.IdSubModulo = pIdSubModuloDestino;
novoCaso.Letra = pCaso.Letra;
novoCaso.IdProjeto = pIdProjetoDestino;
novoCaso.IdAnalista = pIdAnalista;
novoCaso.Prioridade = caso.Prioridade;
novoCaso.Complexidade = caso.Complexidade;
novoCaso.Condicao = caso.Condicao;
novoCaso.Objetivo = caso.Objetivo;
novoCaso.CasoAutomatico = caso.CasoAutomatico;
novoCaso.Status = StatusCasoTeste.CADASTRADO;
novoCaso.Entrada = caso.Entrada;
novoCaso.Procedimento = caso.Procedimento;
novoCaso.Saida = caso.Saida;
novoCaso.Observacao = "";
CasoDeTesteDAL.Cadastrar(novoCaso);
}
scope.Complete();
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao importar os casos de teste");
}
}
public static void LiberacaoCasosDeTeste(List<CasoDeTesteTO> pListCasos)
{
try
{
using (TransactionScope scope = new TransactionScope())
{
foreach (CasoDeTesteTO pCaso in pListCasos)
{
pCaso.Status = StatusCasoTeste.LIBERADO;
pCaso.DtLiberacao = DateTime.Now;
CasoDeTesteDAL.LiberarCasoDeTeste(pCaso);
}
scope.Complete();
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao liberar os casos de teste");
}
}
public static void DistribuicaoCasosDeTeste(List<CasoDeTesteTO> pListCasos)
{
try
{
using (TransactionScope scope = new TransactionScope())
{
foreach (CasoDeTesteTO pCaso in pListCasos)
{
pCaso.Status = StatusCasoTeste.DISTRIBUIDO;
pCaso.DtDistribuicao = DateTime.Now;
CasoDeTesteDAL.DistribuirCasoDeTeste(pCaso);
}
scope.Complete();
}
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao distribuir os casos de teste");
}
}
public static void AlterarTestador(int pIdCaso, int pIdSubModulo, int pIdProjeto, int pIdTestador)
{
try
{
CasoDeTesteDAL.AlterarTestador(pIdCaso, pIdSubModulo, pIdProjeto, pIdTestador);
}
catch (Exception ex)
{
throw new ApplicationException("Falha ao alterar o testadord do caso de teste");
}
}
}
}
|
namespace MySurveys.Web.Areas.Surveys.ViewModels.Filling
{
using System.Web.Mvc;
using AutoMapper;
using Models;
using MvcTemplate.Web.Infrastructure.Mapping;
public class AnswerViewModel : IMapFrom<Answer>, IHaveCustomMappings
{
[HiddenInput(DisplayValue = false)]
public int Id { get; set; }
public int QuestionId { get; set; }
public int PossibleAnswerId { get; set; }
public int ResponseId { get; set; }
public void CreateMappings(IMapperConfiguration configuration)
{
configuration.CreateMap<Answer, AnswerViewModel>()
.ForMember(s => s.QuestionId, opt => opt.MapFrom(r => r.QuestionId))
.ForMember(s => s.PossibleAnswerId, opt => opt.MapFrom(r => r.PossibleAnswerId))
.ForMember(s => s.ResponseId, opt => opt.MapFrom(r => r.ResponseId))
.ReverseMap();
}
}
} |
using Caliburn.Micro;
using Caliburn.Micro.Xamarin.Forms;
using RRExpress.Api.V1.Methods;
using RRExpress.AppCommon;
using RRExpress.AppCommon.Attributes;
using RRExpress.Express.ViewModels;
using RRExpress.Service.Entity;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace RRExpress.ViewModels {
/// <summary>
/// 第一页
/// </summary>
[Regist(InstanceMode.Singleton)]
public class HomeViewModel : BaseVM {
public override string Title {
get {
return "人人快递";
}
}
public ObservableCollection<Ad> AdImgs {
get; private set;
}
public ICommand SendCmd { get; }
public ICommand SellerCmd { get; }
public ICommand StoreCmd { get; }
private SimpleContainer Container;
private INavigationService NS;
public HomeViewModel(SimpleContainer container, INavigationService ns) {
this.Container = container;
this.NS = ns;
//this.AdImgs = new List<string>() {
// "http://www.jiaojianli.com/wp-content/uploads/2013/12/banner_send.jpg",
// "http://img1.100ye.com/img2/4/1230/627/10845627/msgpic/62872955.jpg",
// "http://static.3158.com/im/image/20140820/20140820022157_32140.jpg"
//};
this.SendCmd = new Command(async () => {
await this.NS.NavigateToViewModelAsync<SendStep1ViewModel>();
});
this.SellerCmd = new Command(async () => {
await this.NS.NavigateToViewModelAsync<Seller.ViewModels.AddGoodsViewModel>();
});
this.StoreCmd = new Command(async () => {
await this.NS.NavigateToViewModelAsync<Store.ViewModels.RootViewModel>();
});
Task.Delay(500)
.ContinueWith(async t => await this.LoadAds());
}
private async Task LoadAds() {
var mth = new GetADs() {
AllowCache = true,
Type = AdTypes.MobileAdMiddle
};
var datas = await ApiClient.ApiClient.Instance.Value.GetDataFromCache(mth);
if (datas == null) {
datas = await ApiClient.ApiClient.Instance.Value.Execute(mth);
}
this.AdImgs = new ObservableCollection<Ad>(datas);
this.NotifyOfPropertyChange(() => this.AdImgs);
}
//private async void GetLocation() {
// var locator = CrossGeolocator.Current;
// locator.DesiredAccuracy = 100; //100 is new default
// var position = await locator.GetPositionAsync(timeoutMilliseconds: 10000);
//}
}
}
|
using Microsoft.Xna.Framework;
using ProjectMini.src.engine;
using ProjectSLN.darkcomsoft.src;
using System;
using System.Collections.Generic;
using System.Text;
namespace ProjectMini.src.entitys
{
public class Entity : GameObject
{
public void Start()
{
v_activated = true;
OnStart();
}
protected override void OnDispose()
{
base.OnDispose();
}
protected virtual void OnStart() { }
public static Entity SpawnEntity(Entity entity)
{
return EntityManager.AddEntity(entity);
}
public static void DestroyEntity(Entity entity)
{
EntityManager.RemoveEntity(entity);
}
}
} |
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Islands;
using FluentAssertions;
namespace Islands.Tests
{
[TestClass]
public class IslandDetectorTests
{
public IslandDetector _sut;
[TestInitialize]
public void Initialize()
{
_sut = new IslandDetector();
}
[TestMethod]
public void FourCornersTest()
{
char[,] sea = new char[,]
{
{ 'X', ' ', ' ', 'X'},
{ ' ', ' ', ' ', ' '},
{ ' ', ' ', ' ', ' '},
{ 'X', ' ', ' ', 'X'},
};
var result = _sut.GetIslandCount(sea);
result.Should().Be(4);
}
[TestMethod]
public void FourConnectedCornersTest()
{
char[,] sea = new char[,]
{
{'X', 'X'},
{'X', 'X'}
};
var result = _sut.GetIslandCount(sea);
result.Should().Be(1);
}
[TestMethod]
public void VShapedIslandTest()
{
char[,] sea = new char[,]
{
{ 'X', ' ', ' ', ' ', 'X'},
{ ' ', 'X', ' ', 'X', ' '},
{ ' ', ' ', 'X', ' ', ' '},
{ ' ', ' ', ' ', ' ', 'X'},
{ 'X', 'X', ' ', 'X', 'X'},
};
var result = _sut.GetIslandCount(sea);
result.Should().Be(3);
}
[TestMethod]
public void CircularIslandTest()
{
char[,] sea = new char[,]
{
{ ' ', ' ', 'X', ' ', ' '},
{ ' ', 'X', ' ', 'X', ' '},
{ 'X', ' ', 'X', ' ', 'X'},
{ ' ', 'X', ' ', 'X', ' '},
{ ' ', ' ', 'X', ' ', ' '},
};
var result = _sut.GetIslandCount(sea);
result.Should().Be(1);
}
[TestMethod]
public void CircularIslandWithCornersTest()
{
char[,] sea = new char[,]
{
{ 'X', ' ', 'X', ' ', 'X'},
{ ' ', 'X', ' ', 'X', ' '},
{ 'X', ' ', 'X', ' ', 'X'},
{ ' ', 'X', ' ', 'X', ' '},
{ 'X', ' ', 'X', ' ', 'X'},
};
var result = _sut.GetIslandCount(sea);
result.Should().Be(1);
}
[TestMethod]
public void PlusShapedIslandWithDisconnectedCornersTest()
{
char[,] sea = new char[,]
{
{ 'X', ' ', 'X', ' ', 'X'},
{ ' ', ' ', 'X', ' ', ' '},
{ 'X', 'X', 'X', 'X', 'X'},
{ ' ', ' ', 'X', ' ', ' '},
{ 'X', ' ', 'X', ' ', 'X'},
};
var result = _sut.GetIslandCount(sea);
result.Should().Be(5);
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DropShadow : MonoBehaviour {
public Vector3 offset = new Vector3(.1f, -.1f);
public GameObject shadow;
public Material material;
public bool isDynamic;
// Use this for initialization
void Start () {
if (PlayerPrefs.GetInt("isShadows") < 1)
{
createFixedShadow();
}
else{
enabled = false;
}
}
public void createDynamicShadow(){
shadow = new GameObject("shadow");
//shadow.transform.parent = gameObject.transform;
shadow.transform.position = gameObject.transform.position + offset;
shadow.transform.rotation = Quaternion.identity;
shadow.transform.localScale = transform.localScale;
SpriteRenderer renderer = GetComponent<SpriteRenderer>();
SpriteRenderer sr = shadow.AddComponent<SpriteRenderer>(); //making a renderer for this one.
sr.sprite = renderer.sprite; //makes shadow the same shape as this sprite
sr.material = material;
sr.sortingLayerName = renderer.sortingLayerName;
sr.sortingOrder = -10;
Color black = new Color(0, 0, 0);
sr.color = black;
}
public void createFixedShadow(){
shadow = new GameObject("shadow");
shadow.transform.parent = gameObject.transform;
shadow.transform.localPosition = offset;
shadow.transform.localRotation = Quaternion.identity;
shadow.transform.localScale = new Vector3(1, 1, 1);
SpriteRenderer renderer = GetComponent<SpriteRenderer>();
SpriteRenderer sr = shadow.AddComponent<SpriteRenderer>(); //making a renderer for this one.
sr.sprite = renderer.sprite; //makes shadow the same shape as this sprite
sr.material = material;
sr.sortingLayerName = renderer.sortingLayerName;
sr.sortingOrder = -10;
Color black = new Color(0, 0, 0);
sr.color = black;
}
public void moveFixedShadow(){
shadow.transform.localPosition = offset;
}
public void moveDynamicShadow(){
shadow.transform.position = gameObject.transform.position + offset;
}
// Update is called once per frame
void Update () {
if(isDynamic){
moveDynamicShadow();
}else{
moveFixedShadow();
}
}
}
|
using System;
using Newtonsoft.Json;
namespace MoonSliver.Code
{
[Serializable]
public class Setting
{
public Setting()
{
FliterOn = true;
SuperMode = false;
WithdrawAll = true;
WithdrawDelay = true;
ShutUp = true;
ShutUpTime = 600;
ShutUpAll = true;
ShutUpAllDelay = true;
}
public bool FliterOn { get; set; }
public bool SuperMode { get; set; }
public bool WithdrawAll { get; set; }
public bool WithdrawDelay { get; set; }
public bool ShutUp { get; set; }
public int ShutUpTime { get; set; }
public bool ShutUpAll { get; set; }
public bool ShutUpAllDelay { get; set; }
/// <summary>
/// 利用JSON获取Setting
/// </summary>
/// <param name="json"></param>
/// <returns></returns>
public static Setting GetSetting(string json)
{
try
{
var set = JsonConvert.DeserializeObject<Setting>(json);
if (set == null)
{
set = new Setting();
}
return set;
}
catch (Exception ex)
{
return new Setting();
}
}
}
} |
using Zesty.Core.Entities;
namespace Zesty.Core.Api.System
{
public class Token : ApiHandlerBase
{
public override ApiHandlerOutput Process(ApiInputHandler input)
{
TokenRequest request = GetEntity<TokenRequest>(input);
return GetOutput(new TokenResponse()
{
Text = Business.Authorization.GetToken(input.Context.Session.Id, request == null ? false : request.IsReusable)
});
}
}
public class TokenResponse
{
public string Text { get; set; }
}
public class TokenRequest
{
public bool IsReusable { get; set; }
}
}
|
using System;
using Newtonsoft.Json;
using Pathoschild.SlackArchiveSearch.Framework;
namespace Pathoschild.SlackArchiveSearch.Models
{
/// <summary>Basic information about a Slack channel message.</summary>
public class Message
{
/****
** Fields from archive
****/
/// <summary>When the message was posted.</summary>
[JsonProperty("ts")]
[JsonConverter(typeof(UnixDateTimeConverter))]
public DateTimeOffset Date { get; set; }
/// <summary>The message author's unique identifier.</summary>
[JsonProperty("user")]
public string UserID { get; set; }
/// <summary>The message author's display name, if the username was overridden. This typically only applies for bot messages.</summary>
[JsonProperty("username")]
public string CustomUserName { get; set; }
/// <summary>The message type (typically 'message').</summary>
public MessageType Type { get; set; }
/// <summary>The message subtype (like 'channel_purpose' or 'channel_join'); this is null for normal user messages.</summary>
public MessageSubtype Subtype { get; set; }
/// <summary>The message text (with Slack formatting markup).</summary>
public string Text { get; set; }
/****
** Injected fields
****/
/// <summary>A unique ID for search lookup.</summary>
public string MessageID { get; set; }
/// <summary>The channel to which the message was posted.</summary>
/// <remarks>This value is populated after parsing.</remarks>
public string ChannelID { get; set; }
/// <summary>The name of the channel to which the message was posted.</summary>
/// <remarks>This value is populated after parsing.</remarks>
public string ChannelName { get; set; }
/// <summary>The display name of the message author.</summary>
public string AuthorName { get; set; }
/// <summary>The username of the message author.</summary>
public string AuthorUsername { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace RoadSimLib
{
public class Instance : IInstance
{
public IMap Map
{
get;
set;
}
public IDeck Deck
{
get;
set;
}
public Instance()
{
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FadeOut : MonoBehaviour
{
float time = 0;
float fades = 1;
public UnityEngine.UI.Image fade;
void Update()
{
time += Time.deltaTime;
if (fades > 0 && time >= 0.1f)
{
fades -= 0.1f;
fade.color = new Color(255, 255, 255, fades);
time = 0;
}
}
}
|
using FBS.Domain.Booking.Aggregates;
using FBS.Domain.Core;
using System;
using System.Collections.Generic;
using System.Text;
namespace FBS.Domain.Booking.Commands
{
public class ReleaseFlightCommand : ICommand
{
public Guid Id { get; set; }
public int Capacity { get; set; }
public Location From { get; set; }
public Location To { get; set; }
public DateTime Date { get; set; }
public TimeSpan Duration { get; set; }
public string Gate { get; set; }
public string Number { get; set; }
public string PlaneModel { get; set; }
}
} |
using Discord.Commands;
using Discord.WebSocket;
using System;
using System.Threading.Tasks;
namespace Discord_Bot
{
public class FunSample : ModuleBase<SocketCommandContext>
{
[Command("hello")] // Command name.
[Summary("Say hello to the bot.")] // Command summary.
public async Task Hello()
=> await ReplyAsync($"Hello there, **{Context.User.Username}**!");
[Command("pick")]
[Alias("choose")] // Aliases that will also trigger the command.
[Summary("Pick something.")]
public async Task Pick([Remainder]string message = "")
{
string[] options = message.Split(new string[] { " or " }, StringSplitOptions.RemoveEmptyEntries);
string selection = options[new Random().Next(options.Length)];
// ReplyAsync() is a shortcut for Context.Channel.SendMessageAsync()
await ReplyAsync($"I choose **{selection}**");
}
[Command("cookie")]
[Summary("Give someone a cookie.")]
public async Task Cookie(SocketGuildUser user)
{
if (Context.Message.Author.Id == user.Id)
await ReplyAsync($"{Context.User.Mention} doesn't have anyone to share a cookie with... :(");
else
await ReplyAsync($"{Context.User.Mention} shared a cookie with **{user.Username}** :cookie:");
}
[Command("amiadmin")]
[Summary("Check your administrator status")]
public async Task AmIAdmin()
{
if ((Context.User as SocketGuildUser).GuildPermissions.Administrator)
await ReplyAsync($"Yes, **{Context.User.Username}**, you're an admin!");
else
await ReplyAsync($"No, **{Context.User.Username}**, you're **not** an admin!");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Interview_WebAPI.Models
{
public class Usuario
{
// cliente.detalhes.cliente_id
public int id { get; set; }
// cliente.detalhes.cliente_nome
public string nome { get; set; }
// cliente.detalhes.cliente_email
public string email { get; set; }
// cliente.detalhes.cliente_telefone
public string telefone { get; set; }
// cliente.detalhes.cliente_nascimento
public DateTime nascimento { get; set; }
// Cadastro em um curso por vez:
// Parte da chave primária em cliente.cursos
public int curso_id { get; set; }
}
} |
using Xunit;
using ZKCloud.Datas.Sql.Queries.Builders.Conditions;
namespace ZKCloud.Test.Datas.Sql.Conditions
{
/// <summary>
/// Sql相等查询条件测试
/// </summary>
public class EqualConditionTest
{
/// <summary>
/// 获取条件
/// </summary>
[Fact]
public void Test()
{
var condition = new EqualCondition("Name", "@Name");
Assert.Equal("Name=@Name", condition.GetCondition());
}
}
} |
using System;
using System.Collections.Generic;
using System.Text;
namespace Cdiscount.Alm.Sonar.Api.Wrapper.Core.Measures.Component.Parameters
{
public enum MetricKeys
{
coverage,
ncloc,
comment_lines_density,
complexity,
bugs,
vulnerabilities,
code_smells,
duplicated_lines_density,
sqale_rating,
security_rating,
reliability_rating
}
public class SonarComponentArgs
{
/// <summary>
/// Constructor
/// </summary>
public SonarComponentArgs()
{
MetricKeys = new List<MetricKeys>();
}
/// <summary>
/// Comma-separated list of Metric keys
/// </summary>
public List<MetricKeys> MetricKeys { get; set; }
public string ComponentKey { get; set; }
public string ComponentId { get; set; }
public string DeveloperId { get; set; }
public string DeveloperKey { get; set; }
public override string ToString()
{
var result = new StringBuilder();
SonarHelpers.AppendUrl(result, "metricKeys", MetricKeys);
SonarHelpers.AppendUrl(result, "componentKey", ComponentKey);
SonarHelpers.AppendUrl(result, "componentId", ComponentId);
SonarHelpers.AppendUrl(result, "developerId", DeveloperKey);
SonarHelpers.AppendUrl(result, "developerKey", DeveloperId);
return result.Length > 0 ? "?" + result : string.Empty;
}
}
}
|
using System;
using System.Runtime.CompilerServices;
using iSukces.Code.Interfaces;
namespace iSukces.Code.Tests.EqualityGenerator
{
/// <summary>
/// Identyfikuje unikalne połączenie (dwóch jeśli instalacja jest poprawna) drutów
/// </summary>
[Auto.EqualityGeneratorAttribute(nameof(IsEmpty), GetHashCodeProperties = new[] {nameof(HashCode)})]
public partial struct TestStructWithSpecialHashCodeField
{
public TestStructWithSpecialHashCodeField(string name)
{
Name = name?.Trim();
_hasValue = !string.IsNullOrEmpty(Name);
HashCode = _hasValue ? StringComparer.Ordinal.GetHashCode(Name) : 0;
}
[Auto.EqualityGeneratorSkipAttribute]
public bool IsGround
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return Name == "GROUND"; }
}
public bool IsEmpty
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get { return !_hasValue; }
}
[Auto.StringComparison.OrdinalIgnoreCaseAttribute]
public string Name { get; }
[Auto.EqualityGeneratorSkipAttribute]
private int HashCode { get; }
private readonly bool _hasValue;
}
} |
namespace P08MilitaryElite.Interfaces.Factories
{
public interface IMissionFactory
{
IMission CreateMission(string codeName, string state);
}
} |
using Microsoft.Xna.Framework;
using ProjectBueno.Engine;
using ProjectBueno.Game.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectBueno.Game.Spells
{
class ProjectileBall : Projectile
{
public ProjectileBall(Spell spell, GameHandler game, Entity target, Entity owner, Vector2 pos, Vector2 direction, float speed) : base(spell, game, target, owner)
{
this.pos = pos;
this.speed = speed;
moveSpeed = direction * speed;
lifetime = TIMEOUT;
lastCollide = null;
}
protected Vector2 pos;
protected float speed;
protected Vector2 moveSpeed;
protected Entity lastCollide;
public override bool toRemove
{
get
{
return lifetime <= 0;
}
}
public override void Draw()
{
Main.spriteBatch.Draw(projTexture.texture, pos, projTexture.getCurFrame(), Color.White);
}
public override void Update()
{
--lifetime;
foreach (var entity in game.entities)
{
if (!entity.isAlly && entity != lastCollide && entity.checkCollision(pos, size))
{
entity.dealDamage(spell.getDamage(entity), Vector2.Normalize(moveSpeed) * 5f, spell.shape.dmgCooldown);
entity.control += spell.getControl(entity);
entity.updateState();
if (arcCount <= 0)
{
lifetime = 0;
}
else
{
target = entity.GetClosest(game.entities.Where(ent => !ent.isAlly));
moveSpeed = Vector2.Normalize(target.pos - pos) * speed;
}
arcCount -= 1;
break;
}
}
pos += moveSpeed;
projTexture.incrementAnimation();
}
public override void DrawDebug()
{
Main.spriteBatch.Draw(Main.boxel, pos, new Rectangle(0, 0, (int)size.X, (int)size.Y), Color.Red * 0.5f);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace BaseDeDatosClinicaPatologica
{
public partial class Informes : UserControl
{
MyWebReference.clinicaPatologiaWebServiceSoapClient myWebReference;
String usuario;
int anio = 0;
int mes = 0;
int totalCitologias = 0;
int totalBiopsias = 0;
public Informes(MyWebReference.clinicaPatologiaWebServiceSoapClient myWebReference, String usuario)
{
this.myWebReference = myWebReference;
this.usuario = usuario;
InitializeComponent();
for (int i = 2010; i < 2101; i++)
{
medicoAno.Items.Add(i);
}
for (int i = 0; i < 13; i++)
{
medicoMes.Items.Add(i);
}
medicoMes.SelectedIndex = 0;
scrollViewer1.Height = Application.Current.Host.Content.ActualHeight - 15;
}
private void paginaPrincipal_btn_Click(object sender, RoutedEventArgs e)
{
this.Content = new mainPage(myWebReference, usuario);
}
private void button1_Click(object sender, RoutedEventArgs e)
{
try
{
totalBiopsias = 0;
totalCitologias = 0;
totalCitologias_txt.Text = "";
totalBiopsias_txt.Text = "";
busquedaStatus.Content = "Obteniendo datos...";
button1.IsEnabled = false;
if (medicoAno.SelectedItem.ToString().CompareTo("") != 0)
{
anio = Convert.ToInt16(medicoAno.SelectedItem.ToString());
}
mes = Convert.ToInt16(medicoMes.SelectedItem.ToString());
myWebReference.consultaMedicoBiopsiasCompleted
+= new EventHandler<MyWebReference.consultaMedicoBiopsiasCompletedEventArgs>(WebS_consultaMedicoBiopsia);
myWebReference.consultaMedicoBiopsiasAsync(anio, mes);
}
catch (Exception exp)
{
busquedaStatus.Content = "Ingrese el Año y/o Mes";
button1.IsEnabled = true;
}
}
void WebS_consultaMedicoBiopsia(object sender, MyWebReference.consultaMedicoBiopsiasCompletedEventArgs e)
{
string[] content;
content = e.Result.Split(';');
List<estadisticaMedico> valores = new List<estadisticaMedico>();
valores.Capacity = content.Length;
for (int i = 0; i < content.Length - 1; i++)
{
if (i % 3 == 0)
{
valores.Add(new estadisticaMedico()
{
Medico = content[i],
Muestras = content[i + 2]
});
totalBiopsias += Convert.ToInt16(content[i + 2]);
}
}
listadoMedicosBiopsia.ItemsSource = valores;
totalBiopsias_txt.Text = totalBiopsias.ToString();
totalBiopsias = 0;
myWebReference.consultaMedicoCitologiaCompleted += new EventHandler<MyWebReference.consultaMedicoCitologiaCompletedEventArgs>(WebS_consultaMedicoCitologia);
myWebReference.consultaMedicoCitologiaAsync(anio, mes);
}
void WebS_consultaMedicoCitologia(object sender, MyWebReference.consultaMedicoCitologiaCompletedEventArgs e)
{
button1.IsEnabled = true;
busquedaStatus.Content = "Busqueda Finalizada";
string[] content;
content = e.Result.Split(';');
List<estadisticaMedico> valores = new List<estadisticaMedico>();
valores.Capacity = content.Length;
for (int i = 0; i < content.Length - 1; i++)
{
if (i % 3 == 0)
{
valores.Add(new estadisticaMedico()
{
Medico = content[i],
Muestras = content[i + 2]
});
totalCitologias += Convert.ToInt16(content[i + 2]);
}
}
listadoMedicosCitologia.ItemsSource = valores;
totalCitologias_txt.Text = totalCitologias.ToString();
totalCitologias = 0;
}
private void buscar_btn_Click(object sender, RoutedEventArgs e)
{
buscar_btn.IsEnabled = false;
dataGrid1.ItemsSource = null;
String tabla = "Examen";
if (radioButton1.IsChecked == true)
tabla = "Citologia";
if (radioButton2.IsChecked == true)
tabla = "Biopsia";
muestra_txt.Content = tabla;
categoria_txt.Content = ((ComboBoxItem)(comboBox1.SelectedItem)).Content.ToString();
rangoEdad_txt.Content = ((ComboBoxItem)(rangoEdadCombo.SelectedItem)).Content.ToString();
myWebReference.getCantidadDeExamenesCompleted +=
new EventHandler<MyWebReference.getCantidadDeExamenesCompletedEventArgs>(WebS_CantidadExamenes);
myWebReference.getCantidadDeExamenesAsync(tabla, ((ComboBoxItem)(rangoEdadCombo.SelectedItem)).Content.ToString(),
getFechaEnFormatoMysql(fechaMuestra.Text), getFechaEnFormatoMysql(datePicker1.Text), ((ComboBoxItem)(comboBox1.SelectedItem)).Content.ToString());
estado.Content = "Esperando Respuesta...";
}
void WebS_CantidadExamenes(object sender, MyWebReference.getCantidadDeExamenesCompletedEventArgs e)
{
buscar_btn.IsEnabled = true;
estado.Content = "Datos Recibidos!";
String tabla = "Examen";
if (radioButton1.IsChecked == true)
tabla = "Citologia";
if (radioButton2.IsChecked == true)
tabla = "Biopsia";
if (e.Result.ToString().CompareTo("-1") != 0)
{
textBox5.Text = e.Result.ToString();
estadoMuestras.Content = "Cargando Datos...";
myWebReference.getExamenesFiltradosCompleted += new EventHandler<MyWebReference.getExamenesFiltradosCompletedEventArgs>(myWebReference_getExamenesFiltradosCompleted);
myWebReference.getExamenesFiltradosAsync(tabla, ((ComboBoxItem)(rangoEdadCombo.SelectedItem)).Content.ToString(),
getFechaEnFormatoMysql(fechaMuestra.Text), getFechaEnFormatoMysql(datePicker1.Text), ((ComboBoxItem)(comboBox1.SelectedItem)).Content.ToString());
}
else
estado.Content = "No se recibio Respuesta...";
}
void myWebReference_getExamenesFiltradosCompleted(object sender, MyWebReference.getExamenesFiltradosCompletedEventArgs e)
{
if (e.Result.ToString().CompareTo("") != 0)
{
estadoMuestras.Content = "Datos recibidos!";
string[] content;
content = e.Result.Split(';');
List<dataExamen> valores = new List<dataExamen>();
valores.Capacity = content.Length;
for (int i = 0; i < content.Length - 1; i++)
{
if (i % 12 == 0)
{
valores.Add(new dataExamen()
{
Muestra = content[i],
Nombre = content[i + 1] + " " + content[i + 2],
Apellido = content[i + 3] + " " + content[i + 4],
Edad = content[i + 5],
Expediente = content[i + 6],
Medico = content[i + 7],
Precio = content[i + 8],
FechaCalendario = content[i + 9],
Fecha = content[i + 10],
Registrado_Por = content[i + 11],
});
}
}
dataGrid1.ItemsSource = valores;
}
else
{
estadoMuestras.Content = "No se encontraron muestras";
dataGrid1.ItemsSource = null;
}
}
private string getFechaEnFormatoMysql(String fecha)
{
if (fecha.CompareTo("") == 0)
return "";
String[] split = fecha.Split('/');
return split[2] + "-" + split[0] + "-" + split[1];
}
private void radioButton2_Checked(object sender, RoutedEventArgs e)
{
//comboBox1 = new ComboBox();
comboBox1.SelectedIndex = 0;
comboBox1.IsEnabled = false;
}
private void radioButton2_Unchecked(object sender, RoutedEventArgs e)
{
comboBox1.IsEnabled = true;
}
}
}
|
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using System;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace Marvel.Api
{
public class PersonagemService
{
private readonly IHttpClient client;
private readonly Configuracao config;
readonly Relogio relogio;
public PersonagemService(IHttpClient client, Configuracao config, Relogio relogio) =>
(this.client, this.config, this.relogio) = (client, config, relogio);
public async Task<Personagem> ObterPersonagemAsync(string nome)
{
var url = new Uri(GerarUrl(nome));
HttpResponseMessage response = await client.GetAsync(url);
if (!response.IsSuccessStatusCode)
return new Personagem();
string conteudo = response.Content.ReadAsStringAsync().Result;
dynamic resultado = JsonConvert.DeserializeObject(conteudo);
var personagem = new Personagem
{
Nome = resultado.data.results[0].name,
Descricao = resultado.data.results[0].description,
UrlImagem = resultado.data.results[0].thumbnail.path + "." + resultado.data.results[0].thumbnail.extension,
UrlWiki = resultado.data.results[0].urls[1].url
};
return personagem;
}
private string GerarUrl(string nome)
{
string ts = relogio.ObterStringTicks();
string publicKey = config.PublicKey;
string hash = GerarHash(ts, publicKey, config.PrivateKey);
return config.Uri +
$"characters?ts={ts}&apikey={publicKey}&hash={hash}&" +
$"name={Uri.EscapeUriString(nome)}";
}
private string GerarHash(string ts, string publicKey, string privateKey)
{
byte[] bytes = Encoding.UTF8.GetBytes(ts + privateKey + publicKey);
var gerador = MD5.Create();
byte[] bytesHash = gerador.ComputeHash(bytes);
return BitConverter.ToString(bytesHash).ToLower().Replace("-", String.Empty);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LaunchpadMonitor
{
class DiffingLaunchpadRenderer : ILaunchpad, IDisposable
{
Launchpad.Color[,] grid = new Launchpad.Color[8, 8];
Launchpad.Color[,] oldGrid = new Launchpad.Color[8, 8];
Launchpad.Controller controller = new Launchpad.Controller();
public void Dispose()
{
controller.Reset();
}
public void Clear()
{
for (int x = 0; x < 8; x++)
for (int y = 0; y < 8; y++)
grid[x, y] = Launchpad.Color.off;
}
public void Set(int x, int y, Launchpad.Color c)
{
grid[x, y] = c;
}
public Launchpad.Color Get(int x, int y)
{
return grid[x, y];
}
public void Present()
{
for (int x = 0; x < 8; x++)
{
for (int y = 0; y < 8; y++)
{
if (oldGrid[x,y] != grid[x,y])
controller.Set(x, y, grid[x, y]);
oldGrid[x,y] = grid[x,y];
}
}
}
public Launchpad.ButtonPressDelegate UpButtonPressDelegate { set { controller.UpButtonPressDelegate = value; } }
public Launchpad.ButtonPressDelegate DownButtonPressDelegate { set {controller.DownButtonPressDelegate = value; } }
public Launchpad.ButtonPressDelegate LeftButtonPressDelegate { set {controller.LeftButtonPressDelegate = value; } }
public Launchpad.ButtonPressDelegate RightButtonPressDelegate { set { controller.RightButtonPressDelegate = value; } }
public Launchpad.GridButtonPressDelegate GridButtonPressDelegate { set {controller.GridButtonPressDelegate = value; } }
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace FillInfo
{
class VolumeFileReader
{
int m_Slices = 0;
private List<string> Parse(IEnumerable<string> lines)
{
if (lines.Count() % m_Slices != 0)
{
throw new Exception("incorrect line count, should be: " + m_Slices.ToString());
}
List<string> allVolumes = new List<string>();
while(lines.Count() > 0)
{
var thisBatchLines = lines.Take(m_Slices);
lines = lines.Skip(m_Slices);
allVolumes.AddRange(GetVolThisRegion(thisBatchLines));
}
return allVolumes;
}
private IEnumerable<string> GetVolThisRegion(IEnumerable<string> thisBatchLines)
{
List<List<string>> volumes = new List<List<string>>();
foreach(string line in thisBatchLines)
{
volumes.Add(line.Split(',').ToList());
}
int nSlices = volumes.Count;
int batchTips = volumes[0].Count;
List<string> result = new List<string>();
for( int tipIndex = 0; tipIndex < batchTips; tipIndex++)
{
if (double.Parse(volumes[0][tipIndex]) < 0)
continue;
for(int i = 0; i< nSlices; i++)
{
result.Add(ConvertFormat(volumes[i][tipIndex]));
}
}
return result;
}
private string ConvertFormat(string x)
{
if (x == "")
return x;
double val = double.Parse(x);
return val <= 0 ? "0" : val.ToString("0.0");
}
public IEnumerable<string> Read(string file, int slices)
{
m_Slices = slices;
var lines = File.ReadAllLines(file);
lines = lines.Skip(1).ToArray();
return Parse(lines);
}
}
}
|
using System;
namespace DataService_BpmOnline_CRUD
{
class TryParseProperty
{
public static string TryParseStringProperty(string propertyName, string entityName)
{
Console.WriteLine(String.Format(Localize.Input, propertyName, entityName, String.Format(Localize.TypeOnly, Localize.String)));
string nameParseResult = Console.ReadLine();
return nameParseResult;
}
public static int TryParseIntProperty(string propertyName, string entityName)
{
int propertyParseResult = 0;
bool propertyParseResultIsSuccess = false;
int attemptCount = 0;
string propertyInputString = String.Format(Localize.Input, propertyName, entityName, String.Format(Localize.TypeOnly, Localize.Integer));
while (propertyParseResultIsSuccess == false)
{
if (attemptCount == 0)
Console.WriteLine(propertyInputString);
else if (attemptCount < 5)
Console.WriteLine(String.Format(Localize.TypeMismatch, Localize.Integer) + " " + propertyInputString);
else
Environment.Exit(0);
string completeness = Console.ReadLine();
propertyParseResultIsSuccess = int.TryParse(completeness, out propertyParseResult);
attemptCount += 1;
}
return propertyParseResult;
}
public static DateTime TryParseDateTimeProperty(string propertyName, string entityName)
{
DateTime propertyParseResult = new DateTime();
bool propertyParseResultIsSuccess = false;
int attemptCount = 0;
string propertyInputString = String.Format(Localize.Input, propertyName, entityName, String.Format(Localize.TypeOnly, Localize.DateTime));
while (propertyParseResultIsSuccess == false)
{
if (attemptCount == 0)
Console.WriteLine(propertyInputString);
else if (attemptCount < 5)
Console.WriteLine(String.Format(Localize.TypeMismatch, Localize.DateTime) + " " + propertyInputString);
else
Environment.Exit(0);
string completeness = Console.ReadLine();
propertyParseResultIsSuccess = DateTime.TryParse(completeness, out propertyParseResult);
attemptCount += 1;
}
return propertyParseResult;
}
public static Guid TryParseGuidProperty(string propertyName, string entityName)
{
Guid propertyParseResult = Guid.Empty;
bool propertyParseResultIsSuccess = false;
int attemptCount = 0;
string propertyInputString = String.Format(Localize.Input, propertyName, entityName, String.Format(Localize.TypeOnly, Localize.Guid));
while (propertyParseResultIsSuccess == false)
{
if (attemptCount == 0)
Console.WriteLine(propertyInputString);
else if (attemptCount < 5)
Console.WriteLine(String.Format(Localize.TypeMismatch, Localize.Guid) + " " + propertyInputString);
else
Environment.Exit(0);
string completeness = Console.ReadLine();
propertyParseResultIsSuccess = Guid.TryParse(completeness, out propertyParseResult);
attemptCount += 1;
}
return propertyParseResult;
}
}
}
|
using Fleck;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
using UNO.Model;
namespace UNO
{
class Program
{
const int HttpPort = 1337;
const int WebSocketPort = 666;
static string Ip = GetLocalIPAddress();
static List<ISpieler> AllSpieler = new List<ISpieler>();
static Spielfeld DasSpielfeld;
static Lobby MeineLobby;
static void Main(string[] args)
{
new SimpleHTTPServer("Web", HttpPort);
WebSocketServer wss = new WebSocketServer($"ws://{Ip}:{WebSocketPort}");
wss.Start(socket => {
socket.OnOpen = () => socket.Send("Halloasdasdasd");
socket.OnOpen = () => NewSpieler(socket);
});
#if DEBUG
//Process.Start($"http://{Ip}:{HttpPort}");
#endif
}
private static void NewSpieler(IWebSocketConnection socket)
{
Spieler NewSpieler = new Spieler("Spieler" + AllSpieler.Count, socket);
NewSpieler.Socket.OnMessage = (string message) => NewSpieler.OnSend(message);
AllSpieler.Add(NewSpieler);
if(AllSpieler.Count == 1)
{
DasSpielfeld = new Spielfeld(AllSpieler);
MeineLobby = new Lobby(DasSpielfeld, NewSpieler);
MeineLobby.Init();
} else
{
MeineLobby.UpdateSpieler(AllSpieler);
}
}
private static string GetLocalIPAddress()
{
var host = Dns.GetHostEntry(Dns.GetHostName());
foreach (var ip in host.AddressList)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
return ip.ToString();
}
}
throw new Exception("No network adapters with an IPv4 address in the system!");
}
}
}
|
using UnityEngine;
using System.Collections.Generic;
using System;
public abstract class BasicMove : Move
{
protected List<Constraint> defaultConstraints = DefaultConstraints.CloneDefaultSet();
protected List<Constraint> manualAddedConstraints = new List<Constraint> ();
protected abstract List<Vector3> CalcEndPoints(Vector3 start, Board[] boards);
public abstract Move Clone ();
public List<Vector3> GetMovesFrom (Vector3 startPosition, Board[] boards)
{
List<Vector3> endPoints = CalcEndPoints (startPosition, boards);
foreach(Constraint c in defaultConstraints) {
c.ChangeMove (endPoints, startPosition, boards);
}
/* Workaround to avoid InvalidOperationException from (presumably) CheckConstraint */
var cloneConstraints = new List<Constraint>(manualAddedConstraints);
foreach (Constraint c in cloneConstraints)
{
c.ChangeMove(endPoints, startPosition, boards);
}
/*
foreach (Constraint c in manualAddedConstraints)
{
vs.Add(c.GetType().ToString());
c.ChangeMove(endPoints, startPosition, boards);
}
*/
return endPoints;
}
private bool isNotAddedConstraintType(Type addingConstraintType) {
foreach (Constraint c in manualAddedConstraints) {
if (c.GetType () == addingConstraintType)
return false;
}
return true;
}
public Move AddConstraint (params Constraint[] c)
{
foreach (Constraint constraint in c) {
if (isNotAddedConstraintType(constraint.GetType()))
manualAddedConstraints.Add(constraint);
}
return this;
}
public void RemoveConstraint (Type constraintClass)
{
foreach (Constraint c in manualAddedConstraints) {
if (c.GetType() == constraintClass) {
manualAddedConstraints.Remove(c);
break;
}
}
foreach (Constraint c in defaultConstraints) {
if (c.GetType() == constraintClass) {
defaultConstraints.Remove(c);
break;
}
}
}
}
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GodMorgon.StateMachine
{
public abstract class State : IGameState
{
public virtual void OnStartState() { }
public void OnEndState() { }
}
} |
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
namespace Prime31
{
public class ReplayKitEventListener : MonoBehaviour
{
#if UNITY_IPHONE
void OnEnable()
{
// Listen to all events for illustration purposes
ReplayKitManager.recordingFailedToStartEvent += recordingFailedToStartEvent;
ReplayKitManager.recordingStartedEvent += recordingStartedEvent;
ReplayKitManager.recordingFailedToStopEvent += recordingFailedToStopEvent;
ReplayKitManager.recordingStoppedEvent += recordingStoppedEvent;
ReplayKitManager.previewControllerFinishedEvent += previewControllerFinishedEvent;
}
void OnDisable()
{
// Remove all event handlers
ReplayKitManager.recordingFailedToStartEvent -= recordingFailedToStartEvent;
ReplayKitManager.recordingStartedEvent -= recordingStartedEvent;
ReplayKitManager.recordingFailedToStopEvent -= recordingFailedToStopEvent;
ReplayKitManager.recordingStoppedEvent -= recordingStoppedEvent;
ReplayKitManager.previewControllerFinishedEvent -= previewControllerFinishedEvent;
}
void recordingFailedToStartEvent( string error )
{
Debug.Log( "recordingFailedToStartEvent: " + error );
}
void recordingStartedEvent()
{
Debug.Log( "recordingStartedEvent" );
}
void recordingFailedToStopEvent( string error )
{
Debug.Log( "recordingFailedToStopEvent: " + error );
}
void recordingStoppedEvent()
{
Debug.Log( "recordingStoppedEvent" );
}
void previewControllerFinishedEvent( List<string> activityTypes )
{
Debug.Log( "previewControllerFinishedEvent" );
Utils.logObject( activityTypes );
}
#endif
}
} |
using System;
using System.Windows.Forms;
namespace HTBWorldView
{
public partial class DebugWindow
{
public DebugWindow()
{
InitializeComponent();
}
static DebugWindow Instance__instance = new DebugWindow();
public static DebugWindow Instance
{
get
{
return Instance__instance;
}
}
public void AddItem(string text)
{
if (DebugList.Items.Count > 1000)
{
DebugList.Items.RemoveAt(0);
}
DebugList.Items.Add(text);
DebugList.SetSelected(DebugList.Items.Count - 1, true);
}
public void Clear()
{
DebugList.Items.Clear();
}
public void DebugWindow_FormClosing(object sender, FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing)
{
e.Cancel = true;
}
}
public void DebugWindow_Load(object sender, EventArgs e)
{
DebugList.UseCustomTabOffsets = true;
}
private void DebugList_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
|
using System;
using System.Linq;
class Program
{
static void Main()
{
int select = -1;
var types = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => typeof(IDesingPattern).IsAssignableFrom(p)
&& p != typeof(IDesingPattern)).ToList();
start:
for (int i = 0; i < types.Count; i++)
Console.WriteLine($"{i,-4} : {types[i].FullName}");
if (select < 0 || select > types.Count)
{
if (ConvertInRange(Console.ReadLine(), types.Count, out var ret))
select = ret;
else
{
Console.Clear();
goto start;
}
}
var dp = (IDesingPattern)Activator.CreateInstance(types[select]);
Console.WriteLine($"{dp} Created\n");
dp.RunPattern();
}
static bool ConvertInRange(string str, int max, out int value)
{
if (int.TryParse(str, out var ret) && ret >= 0 && ret < max)
{
value = ret;
return true;
}
else
{
value = -1;
return false;
}
}
}
interface IDesingPattern
{
void RunPattern();
} |
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using MvvmCross.Platform.Converters;
using ResidentAppCross.Resources;
public class SharedIconsConverter : MvxValueConverter<SharedResources.Icons, string>
{
protected override string Convert(SharedResources.Icons value, Type targetType, object parameter, CultureInfo culture)
{
return value.ToString().ToLower();
}
}
public class ByteArrayToImage : MvxValueConverter<byte[], Bitmap>
{
protected override Bitmap Convert(byte[] value, Type targetType, object parameter, CultureInfo culture)
{
var decodeByteArray = BitmapFactory.DecodeByteArray(value, 0, value.Length);
return decodeByteArray;
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using mr.bBall_Lib;
public partial class Master : System.Web.UI.MasterPage
{
private Uporabnik uporabnik;
protected string _title = "";
protected string _message = "";
public string SelectedBox = "";
protected string _js = "";
protected DateTime m_dt = DateTime.Today;
protected string m_davcna = "";
protected string m_davcne = "";
protected string m_qs = "";
private string m_stran;
public string Davcna
{
get { return m_davcna; }
set
{
m_davcna = value;
Session["davcna"] = m_davcna;
}
}
public DateTime Date
{
get { return m_dt; }
set
{
m_dt = value;
Session["dt"] = m_dt;
}
}
public Uporabnik Uporabnik
{
get
{
return uporabnik;
}
}
public string Title
{
get
{
return _title;
}
set
{
_title = value;
}
}
public string Stran
{
get
{
return m_stran;
}
}
private void AddLinkBox(string text, string href, string css, string ocena, bool selected, bool right)
{
linkboxes.Controls.Add(new LiteralControl("<li class=\"linkbox " + css + "\" style=\"" + (right ? "float:right;" : "") + (linkboxes.Controls.Count == 1 ? "margin-right:0px;" : "") + (selected && right ? ("margin-top:15px;") : "") + "\"><span class=\"ocena\">" + (string.IsNullOrWhiteSpace(ocena) ? " " : ocena) + "</span><a href=\"" + href + "\">" + text + "</a></li>"));
}
public void SetMessage(string title, string message, string type, string js)
{
if (!string.IsNullOrEmpty(title) || !string.IsNullOrEmpty(message)) _js += "dialog(\"" + title.Replace("\n", "<br />").Replace("\r", "") + "\",\"" + Splosno.JsSafe(message) + "\",\"" + type + "\");" + js;
}
public void SetMessage(string title, string message, string type)
{
SetMessage(title, message, type, "");
}
public void SetMessage(string title)
{
SetMessage(title, "", "i", "");
}
public void SetMessage(string title, string message)
{
SetMessage(title, message, "i", "");
}
public void SetMessage(Exception exception)
{
SetMessage("Prišlo je do programske napake", exception.Message, "x");
}
/*
public void EnableDavcna()
{
int i_davcna;
if (int.TryParse(Request.QueryString["davcna"], out i_davcna) && uporabnik.Davcne.Contains(i_davcna.ToString()))
{
m_davcna = i_davcna.ToString();
Session["davcna"] = i_davcna;
}
else if (Session["davcna"] != null && uporabnik.Davcne.Contains((string)Session["davcna"])) m_davcna = (string)Session["davcna"];
else m_davcna = uporabnik.Davcna;
string[] tab = Request.QueryString.ToString().Split('&');
foreach (string pair in tab)
{
if (string.IsNullOrEmpty(pair) || pair.StartsWith("davcna=")) continue;
m_qs += pair + '&';
}
string[] l_davcne = uporabnik.Davcne.Split(',');
for (int i = 0; i < l_davcne.Length; i++) m_davcne += "<option" + (l_davcne[i] == m_davcna ? " selected=\"selected\"" : "") + " value=\"" + l_davcne[i] + "\">" + (i + 1) + "</option>";
ph_davcna.Visible = l_davcne.Length > 1;
}
*/
public void EnableDatePicker()
{
if (DateTime.TryParse("1.1." + Request.QueryString["dt"], out m_dt)) Session["dt"] = m_dt;
else if (Session["dt"] != null) m_dt = (DateTime)Session["dt"];
else m_dt = new DateTime(DateTime.Today.Year, 1, 1);
string[] tab = Request.QueryString.ToString().Split('&');
foreach (string pair in tab)
{
if (string.IsNullOrEmpty(pair) || pair.StartsWith("dt=")) continue;
m_qs += pair + '&';
}
ph_dt.Visible = true;
}
protected override void OnInit(EventArgs e)
{
try
{
uporabnik = new Uporabnik(Session);
if (!uporabnik.AppLogedIn) Response.Redirect("Default.aspx");
string[] parts = Request.FilePath.Split('/');
m_stran = parts[parts.Length - 1].Split('.')[0];
}
catch (Exception ee)
{
SetMessage(ee);
}
}
protected void Page_Load(object sender, EventArgs e)
{
int c = 0;
if (Uporabnik.Pravice.Contains("pregled")) AddLinkBox("Pregled", "Pregled.aspx", "nazaj", "", SelectedBox == "", c++ > 0);
AddLinkBox("Osebno", "Osebno.aspx", "nazaj", "<span onclick=\"window.location='Default.aspx?action=logout'\">Odjava</span>", SelectedBox == "Osebno", c++ > 0);
if (Uporabnik.Pravice.Contains("ostalo")) AddLinkBox("Ostalo", "Ostalo.aspx", "nastavitve", "", SelectedBox == "Ostalo", c++ > 0);
if (Uporabnik.PraviceL.Contains("naprave")) AddLinkBox("Aplikacije", "Devices.aspx", "finance1", "", SelectedBox == "Aplikacije", c++ > 0);
//if (Uporabnik.PraviceL.Contains("0")) AddLinkBox("Najave", "Najave.aspx", "stopnja", "Vse: " + Convert.ToInt32(Izdaje.Get(uporabnik.StoreID, 0).Rows.Count + Prevzemi.Get(uporabnik.StoreID, 0).Rows.Count).ToString(), SelectedBox == "Najave", c++ > 0);
//if (Uporabnik.PraviceL.Contains("0")) AddLinkBox("Opravila", "Opravila.aspx", "alumni", "Vse: " + Convert.ToInt32(Opravila.Get(uporabnik.StoreID,0,200).Rows.Count).ToString(), SelectedBox == "Opravila", c++ > 0);
}
protected override void OnUnload(EventArgs e)
{
try
{
if (uporabnik != null) { uporabnik.Dispose(); }
}
catch (Exception ee)
{
}
}
}
|
using gView.Framework.Data;
using gView.Framework.UI;
using System;
using System.Windows.Forms;
namespace gView.Plugins.DbTools.Relates
{
public partial class TableRelationsDialog : Form
{
private IFeatureLayer _layer;
private IMapDocument _mapDocument;
public TableRelationsDialog(IMapDocument mapDocument, IFeatureLayer layer)
{
InitializeComponent();
_mapDocument = mapDocument;
_layer = layer;
FillList();
}
#region Gui
private void FillList()
{
lstRelates.Items.Clear();
if (_mapDocument.TableRelations != null)
{
foreach (ITableRelation relation in _mapDocument.TableRelations)
{
lstRelates.Items.Add(new TableRelationItem() { TableRelation = relation });
}
}
btnEdit.Enabled = btnRemove.Enabled = false;
}
#endregion
#region Events
private void btnAdd_Click(object sender, EventArgs e)
{
AddTableRelationDialog dlg = new AddTableRelationDialog(_mapDocument, _layer);
if (dlg.ShowDialog() == DialogResult.OK)
{
ITableRelation relation = dlg.TableRelation;
if (relation != null && relation.LeftTable != null && relation.RightTable != null)
{
_mapDocument.TableRelations.Add(relation);
relation.LeftTable.FirePropertyChanged();
relation.RightTable.FirePropertyChanged();
FillList();
}
}
}
private void btnEdit_Click(object sender, EventArgs e)
{
if (!(lstRelates.SelectedItem is TableRelationItem))
{
return;
}
ITableRelation relation = ((TableRelationItem)lstRelates.SelectedItem).TableRelation;
AddTableRelationDialog dlg = new AddTableRelationDialog(_mapDocument, _layer);
dlg.TableRelation = relation;
if (dlg.ShowDialog() == DialogResult.OK)
{
ITableRelation newRelation = dlg.TableRelation;
if (newRelation != null && newRelation.LeftTable != null && newRelation.RightTable != null)
{
_mapDocument.TableRelations.Remove(relation);
_mapDocument.TableRelations.Add(newRelation);
if (relation.LeftTable != null && relation.RightTable != null)
{
relation.LeftTable.FirePropertyChanged();
relation.RightTable.FirePropertyChanged();
}
newRelation.LeftTable.FirePropertyChanged();
newRelation.RightTable.FirePropertyChanged();
FillList();
}
}
}
private void btnRemove_Click(object sender, EventArgs e)
{
if (!(lstRelates.SelectedItem is TableRelationItem))
{
return;
}
ITableRelation relation = ((TableRelationItem)lstRelates.SelectedItem).TableRelation;
if (relation != null)
{
_mapDocument.TableRelations.Remove(relation);
if (relation.LeftTable != null)
{
relation.LeftTable.FirePropertyChanged();
}
if (relation.RightTable != null)
{
relation.RightTable.FirePropertyChanged();
}
}
FillList();
}
private void lstRelates_SelectedIndexChanged(object sender, EventArgs e)
{
btnEdit.Enabled = btnRemove.Enabled = (lstRelates.SelectedIndex >= 0);
}
#endregion
#region Item Classes
private class TableRelationItem
{
public ITableRelation TableRelation { get; set; }
public override string ToString()
{
if (TableRelation == null)
{
return base.ToString();
}
return TableRelation.RelationName;
}
}
#endregion
}
}
|
namespace qbq.EPCIS.Repository.Custom.Entities
{
class EpcisEventExtenstionType
{
//-----------------------------------------------------------------
//-- Tabelle zum Zwischenspeichern der Extension-Typen wie
//-----------------------------------------------------------------
//create table #EPCISEvent_ExtenstionType
//(
//EPCISEventID bigint not null,
//ExtensionTypeURN nvarchar(512) not null,
//ExtensionTypeTypeURN nvarchar(512) not null
//);
public long EpcisEventId { get; set; }
public string ExtensionTypeUrn { get; set; }
public string ExtensionTypeTypeUrn{ get; set; }
}
}
|
using GesCMS.Core.Common;
namespace GesCMS.Core.Entities
{
public class Widget : BaseEntity
{
public string Title { get; set; }
public int? ParentID { get; set; }
}
}
|
using System;
namespace MinistryPlatform.Translation.Repositories.Interfaces
{
public interface IGroupLookupRepository
{
int GetGroupId(DateTime birthDate, int? gradeGroupAttributeId);
int GetGradeAttributeId(int gradeGroupId);
}
}
|
using EasyWebApp.Data.Entities.AuthenticationEnties;
using EasyWebApp.Data.Entities.SystemEntities;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace EasyWebApp.Data.DbContext
{
public class CustomerDbContext : IdentityDbContext<ApplicationUser>
{
public CustomerDbContext(DbContextOptions<CustomerDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.Entity<SystemMasterConfig>()
.HasQueryFilter(p => !p.IsDeleted)
.HasIndex(p => new { p.ConfigName})
.IsUnique();
modelBuilder.Entity<SystemTableConfig>()
.HasQueryFilter(p => !p.IsDeleted)
.HasIndex(p => new { p.Name})
.IsUnique();
modelBuilder.Entity<SystemTableColumnConfig>()
.HasQueryFilter(p => !p.IsDeleted)
.HasIndex(p => new { p.TableId, p.Name})
.IsUnique();
modelBuilder.Entity<SystemTableForeingKeyConfig>().HasQueryFilter(p => !p.IsDeleted);
}
public DbSet<SystemMasterConfig> SystemMasterConfigs { get; set; }
public DbSet<SystemTableConfig> SystemTableConfigs { get; set; }
public DbSet<SystemTableColumnConfig> SystemTableColumnConfigs { get; set; }
public DbSet<SystemTableForeingKeyConfig> SystemTableForeingKeyConfigs { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using Chess.Data.Entities;
using Microsoft.AspNet.Identity.EntityFramework;
namespace Chess.Data
{
public class ChessContext : DbContext, IUnitOfWork
{
public ChessContext()
: base("ChessContext")
{
}
public DbSet<Game> Games { get; set; }
public DbSet<Square> Squares { get; set; }
public DbSet<Challenge> Challenges { get; set; }
public DbSet<Move> Moves { get; set; }
public DbSet<ChessPiece> ChessPieces { get; set; }
public DbSet<ChessUser> ChessUsers { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();
modelBuilder.Conventions.Remove<ManyToManyCascadeDeleteConvention>();
modelBuilder.Entity<IdentityUserLogin>().HasKey<string>(l => l.UserId);
modelBuilder.Entity<IdentityRole>().HasKey<string>(r => r.Id);
modelBuilder.Entity<IdentityUserRole>().HasKey(r => new { r.RoleId, r.UserId });
modelBuilder.Entity<Challenge>().HasRequired(x => x.LightPlayer);
modelBuilder.Entity<Challenge>().HasRequired(x => x.DarkPlayer);
modelBuilder.Entity<Challenge>().HasRequired(x => x.ChallengingPlayer);
modelBuilder.Entity<Game>().HasRequired(x => x.LightPlayer);
modelBuilder.Entity<Game>().HasRequired(x => x.DarkPlayer);
modelBuilder.Entity<Game>().HasOptional(x => x.WinnerPlayer);
modelBuilder.Entity<Game>().HasMany(x => x.Squares);
modelBuilder.Entity<Game>().HasMany(x => x.Moves);
modelBuilder.Entity<Game>().HasRequired(x => x.Challenge);
base.OnModelCreating(modelBuilder);
}
public T Find<T>(params object[] keyValues) where T : class, IEntity
{
return Set<T>().Find(keyValues);
}
public T Find<T>(Func<T, bool> predicate) where T : class, IEntity
{
return Set<T>().FirstOrDefault(predicate);
}
public IEnumerable<T> All<T>() where T : class, IEntity
{
return Set<T>();
}
public IEnumerable<T> All<T>(Func<T, bool> predicate) where T : class, IEntity
{
return Set<T>().Where(predicate);
}
public void Remove<T>(T entity) where T : class, IModifiable
{
Set<T>().Remove(entity);
}
public void Remove<T>(IEnumerable<T> entities) where T : class, IModifiable
{
foreach (var entity in entities)
Set<T>().Remove(entity);
}
public void Add<T>(T entity) where T : class, IModifiable
{
Set<T>().Add(entity);
}
public void Attach<T>(T entity) where T : class, IModifiable
{
Set<T>().Attach(entity);
}
public bool Exists<T>(T entity) where T : class, IModifiable
{
return Set<T>().Local.Any(e => e == entity);
}
public void Commit()
{
SaveChanges();
}
}
}
|
using Alabo.Domains.Entities;
using Alabo.UI.Design.AutoReports;
using Alabo.UI.Design.AutoReports.Dtos;
using System.Collections.Generic;
namespace Alabo.Domains.Services.Report {
public interface IReportStore<TEntity, in TKey> where TEntity : class, IAggregateRoot<TEntity, TKey> {
/// <summary>
/// 查询按日期 count 统计
/// </summary>
List<AutoReport> GetCountReport(CountReportInput inputParas);
PagedList<CountReportTable> GetCountTable(CountReportInput inputParas);
List<AutoReport> GetSumReport(SumTableInput inputParas);
PagedList<SumReportTable> GetSumReportTable(SumTableInput inputParas);
/// <summary>
/// 获取单条数据
/// </summary>
/// <returns></returns>
decimal GetSingleReportData(SingleReportInput singleReportInput);
}
} |
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Autofac.Extras.DynamicProxy;
using Autofac.Integration.WebApi;
using KMS.Twelve.Controllers;
using KMS.Twelve.Message;
using KMS.Twelve.Test;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Linq;
using System.Reflection;
namespace KMS.Twelve
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public static IContainer AutofacContainer;
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
/// <summary>
/// ASP.NET Core中的Autofac
/// 首先在Project.json的Dependency节点为中添加如下引用:
/// "Microsoft.Extensions.DependencyInjection": "1.0.0",
/// "Autofac.Extensions.DependencyInjection": "4.0.0",
/// 接着我们也修改Startup文件中的ConfigureServices方法,
/// 为了接管默认的DI,我们要为函数添加返回值AutofacServiceProvider;
/// 【ASP.NET Core如何替换其它的IOC容器】
/// 这会给我们的初始化带来一些便利性,我们来看看如何替换Autofac到ASP.NET Core。
/// 我们只需要把Startup类里面的 ConfigureService的 返回值从 void改为 IServiceProvider即可。
/// 而返回的则是一个AutoServiceProvider。
///作者:段邵华
///链接:https://www.jianshu.com/p/e83afc8e80fd
///来源:简书
///著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
public IServiceProvider ConfigureServices(IServiceCollection services)
{
//services.AddApplicationInsightsTelemetry(Configuration);
//替换控制器所有者
services.Replace(ServiceDescriptor.Transient<IControllerActivator, ServiceBasedControllerActivator>());
//services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddMvc();
//services.AddDbContext<BloggingContext>();
services.AddDirectoryBrowser();
var containerBuilder = new ContainerBuilder();
////属性注入控制器
//containerBuilder.RegisterType<AutoDIController>().PropertiesAutowired();
//模块化注入
containerBuilder.RegisterModule<DefaultModule>();
containerBuilder.RegisterModule<DefaultModuleRegister>();
//containerBuilder.RegisterTypes(Controllers.Select(ti => ti.AsType()).ToArray()).PropertiesAutowired();
containerBuilder.Populate(services);
//创建容器.
AutofacContainer = containerBuilder.Build();
//使用容器创建 AutofacServiceProvider
return new AutofacServiceProvider(AutofacContainer);
//return RegisterAutofac(services);
// 其中很大的一个变化在于,Autofac 原来的一个生命周期InstancePerRequest,将不再有效。
// 正如我们前面所说的,整个request的生命周期被ASP.NET Core管理了,所以Autofac的这个将不再有效。
// 我们可以使用 InstancePerLifetimeScope ,同样是有用的,对应了我们ASP.NET Core DI 里面的Scoped。
//作者:段邵华
//链接:https://www.jianshu.com/p/e83afc8e80fd
// 来源:简书
// 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
//
}
#region Old【ConfigureServices】
//public void ConfigureServices(IServiceCollection services)
//{
// services.AddMvc();
// //services.AddDbContext<BloggingContext>();
// //这里就是注入服务
// services.AddTransient<ITestService, TestService>();
// services.AddScoped<ITestService2, TestService2>();
// services.AddSingleton<ITestService3, TestService3>();
// services.AddDirectoryBrowser();
//}
#endregion Old【ConfigureServices】
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app
, IHostingEnvironment env
, IApplicationLifetime appLifetime)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseMvc();
//程序停止调用函数
appLifetime.ApplicationStopped.Register(() => { AutofacContainer.Dispose(); });
}
/// <summary>
/// NET Core 整合Autofac和Castle
/// https://www.cnblogs.com/Leo_wl/p/5936941.html
/// ASP.NET Core 整合Autofac和Castle实现自动AOP拦截 (2016-10-17 13:15:12)
/// http://blog.sina.com.cn/s/blog_16544e8090102x922.html
///
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
private IServiceProvider RegisterAutofac(IServiceCollection services)
{
var builder = new ContainerBuilder();
builder.Populate(services);
var assembly = this.GetType().GetTypeInfo().Assembly;
builder.RegisterType<AopInterceptor>();
builder.RegisterAssemblyTypes(assembly)
.Where(type =>
typeof(IDependency).IsAssignableFrom(type) && !type.GetTypeInfo().IsAbstract)
.AsImplementedInterfaces()
.InstancePerLifetimeScope().EnableInterfaceInterceptors().InterceptedBy(typeof(AopInterceptor));
AutofacContainer = builder.Build();
return new AutofacServiceProvider(AutofacContainer);
}
public static void SetAutofacContainer()
{
//https://blog.csdn.net/weixin_30614587/article/details/98129699
var builder = new ContainerBuilder();
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
//builder.RegisterType<InMemoryCache>().As<ICache>().InstancePerLifetimeScope();
builder.RegisterAssemblyTypes(typeof(AutoDIController).Assembly)
.Where(t => t.Name.EndsWith("Controller") || t.Name.EndsWith("AppService"))
//builder.RegisterAssemblyTypes(typeof(StuEducationRepo).Assembly)
// .Where(t => t.Name.EndsWith("Repo"))
// .AsImplementedInterfaces().InstancePerLifetimeScope();
//builder.RegisterAssemblyTypes(typeof(StudentRegisterDmnService).Assembly)
// .Where(t => t.Name.EndsWith("DmnService"))
// .AsImplementedInterfaces().InstancePerLifetimeScope();
//builder.RegisterAssemblyTypes(typeof(StuEducationAppService).Assembly)
// .Where(t => t.Name.EndsWith("AppService"))
.AsImplementedInterfaces().InstancePerLifetimeScope();
//builder.RegisterWebApiFilterProvider(GlobalConfiguration.Configuration);
//IContainer container = builder.Build();
//var resolver = new AutofacWebApiDependencyResolver(container);
//// Configure Web API with the dependency resolver.
//GlobalConfiguration.Configuration.DependencyResolver = resolver;
}
}
} |
using PluginBase;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ReplaceDateTime
{
public class Plugn : IDev
{
public string PluginName => "时间替换";
public string PluginDesc => "将参数插件替换为当前时间";
public string PluginPara => "{DateTime}";
public string Execute(string str)
{
return str.Replace(this.PluginPara, DateTime.Now.ToString());
}
}
}
|
using StardewValley.TerrainFeatures;
namespace StardewValleyMP.States
{
public class HoeDirtState : State
{
public bool crop;
public int cropPhase = 0, cropDayPhase = 0;
public bool cropGrown = false;
public int state, fertilizer;
public HoeDirtState(HoeDirt dirt)
{
crop = (dirt.crop != null);
if (crop)
{
cropPhase = dirt.crop.currentPhase;
cropDayPhase = dirt.crop.dayOfCurrentPhase;
cropGrown = dirt.crop.fullyGrown;
}
state = dirt.state;
fertilizer = dirt.fertilizer;
}
public override bool isDifferentEnoughFromOldStateToSend(State obj)
{
HoeDirtState dirt = obj as HoeDirtState;
if (dirt == null) return false;
if (crop != dirt.crop) return true;
if (crop && cropPhase != dirt.cropPhase) return true;
if (crop && cropDayPhase != dirt.cropDayPhase) return true;
if (crop && cropGrown != dirt.cropGrown) return true;
if (state != dirt.state) return true;
if (fertilizer != dirt.fertilizer) return true;
return false;
}
public override string ToString()
{
return base.ToString() + " " + crop + " " + cropPhase + " " + cropDayPhase + " " + cropGrown + " " + state + " " + fertilizer;
}
};
}
|
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Concurrent;
using TPLFiber;
using System.Threading;
using System.Linq;
using System.Threading.Tasks;
namespace Tests
{
[TestClass]
public class FiberTests
{
[TestMethod]
public void WriteExecutionOrderIsCorrect()
{
const int WRITE_COUNT = 10000;
ConcurrentQueue<int?> queue = new ConcurrentQueue<int?>();
Fiber fiber = new Fiber();
for (int i = 0; i < WRITE_COUNT; i++)
{
int? x = i;
fiber.Enqueue(() =>
{
queue.Enqueue(x);
});
}
while (queue.Count != WRITE_COUNT)
{
Thread.Sleep(0);
}
Assert.IsTrue(queue.Zip(Enumerable.Range(0, WRITE_COUNT), (i, j) => i == j).All(b => b));
}
[TestMethod]
public void ReadWriteExecutionOrderIsCorrect()
{
int? state = 0;
Fiber fiber = new Fiber();
fiber.Enqueue(() =>
{
Thread.Sleep(100);
Assert.AreEqual(state.Value, 0);
}, false);
fiber.Enqueue(() =>
{
state = 1;
});
Task finalTask = fiber.Enqueue(() =>
{
Assert.AreEqual(state.Value, 1);
}, false);
finalTask.Wait();
}
[TestMethod]
public void ReadsCorrectValue()
{
Fiber fiber = new Fiber();
int random = new Random().Next();
Task<int> result = fiber.Enqueue(() => random, false);
result.Wait();
Assert.AreEqual(result.Result, random);
}
[TestMethod]
public void ScheduleFinishesOnTime()
{
bool? state = false;
Fiber fiber = new Fiber();
TimeSpan waitTime = TimeSpan.FromMilliseconds(250);
DateTime startTime = DateTime.Now;
Task t = fiber.Schedule(() =>
{
state = true;
}, waitTime, false);
t.Wait();
Assert.IsTrue(DateTime.Now - startTime > waitTime);
Assert.IsTrue(state.Value);
}
}
}
|
using System;
namespace csharp.Items
{
public class Conjured : BaseItem
{
protected override void SetQuality()
{
Quality = Math.Max(Quality - 2, 0);
if (SellIn < 0)
{
Quality = Math.Max(Quality - 2, 0);
}
}
}
} |
using Confluent.Kafka;
using Core.IServices.IOrderServices;
using Kafka1.ViewModels;
using KafkaPubSub;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Shared.Constants;
using Shared.Enums;
using Shared.Response;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Kafka1.Controllers
{
[ApiController]
[Route("api/core/v1/[controller]")]
public class OrderController : ControllerBase
{
private readonly ProducerConfig _producerConfig;
private readonly IProcessOrderServices _processingOrderService;
public OrderController(ProducerConfig producerConfig, IProcessOrderServices processOrderService)
{
this._producerConfig = producerConfig;
this._processingOrderService = processOrderService;
}
/// <summary>
/// Create order service
/// Cause at the moment only have one topic and one event handle for create order service
/// </summary>
/// <param name="orderRequest"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[Route("createorder")]
[HttpPut]
public async Task<IActionResult> CreateOrder([FromBody] OrderRequestViewModel orderRequest, CancellationToken cancellationToken)
{
string messageDefault = $"Your order is error. Please check again!";
ApiResponse result = new ApiResponse((int)EnumExtension.ApiCodeResponse.error, messageDefault);
if (!ModelState.IsValid)
return BadRequest(ModelState);
//Serialize
var model = orderRequest.getObject();
string serializedOrder = JsonConvert.SerializeObject(model);
switch (KafkaConfig.Instance.status)
{
case (int)EnumExtension.KafkaStatus.enable:
//Send with Kafka
var producer = new ProducerWrapper(this._producerConfig, KafkaHelper.orderRequestTopic, model.orderId);
var res = await producer.writeMessage(serializedOrder);
if (!string.IsNullOrEmpty(res))
{
result.code = (int)EnumExtension.ApiCodeResponse.success;
result.message = $"Your order is in progress with id is {res}";
return Ok(result);
}
break;
default:
//Send direction
var res1 = await _processingOrderService.CreateOrderAsync(model, cancellationToken);
if (!string.IsNullOrEmpty(res1))
{
result.code = (int)EnumExtension.ApiCodeResponse.success;
result.message = $"Your order is in progress with id is {res1}";
return Ok(result);
}
break;
}
return BadRequest(result);
}
/// <summary>
/// update order
/// Kaka has not built yet
/// </summary>
/// <param name="orderRequest"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[Route("updateorder")]
[HttpPost]
public async Task<IActionResult> UpdateOrder([FromBody] OrderRequestViewModel orderRequest, CancellationToken cancellationToken)
{
string messageDefault = $"Your update is error. Please check again!";
ApiResponse result = new ApiResponse((int)EnumExtension.ApiCodeResponse.error, messageDefault);
if (!ModelState.IsValid)
return BadRequest(ModelState);
if (string.IsNullOrEmpty(orderRequest.orderId))
return BadRequest(new ApiResponse((int)EnumExtension.ApiCodeResponse.error, "Parameters is invalid!"));
//Serialize
var model = orderRequest.getUpdateObject();
string serializedOrder = JsonConvert.SerializeObject(model);
switch (KafkaConfig.Instance.status)
{
case (int)EnumExtension.KafkaStatus.enable:
//Send with Kafka
break;
default:
//Send direction
var res1 = await _processingOrderService.UpdateOrderAsync(model, cancellationToken);
if (!string.IsNullOrEmpty(res1))
{
result.code = (int)EnumExtension.ApiCodeResponse.success;
result.message = $"Your order is updated with id is {res1}";
return Ok(result);
}
break;
}
return BadRequest(result);
}
/// <summary>
/// Delete order
/// </summary>
/// <param name="deleteViewModel"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[Route("deleteorder")]
[HttpDelete]
public async Task<IActionResult> DeleteOrder([FromBody] DeleteViewModel deleteViewModel, CancellationToken cancellationToken)
{
string messageDefault = $"Your delete is error. Please check again!";
ApiResponse result = new ApiResponse((int)EnumExtension.ApiCodeResponse.error, messageDefault);
if (!ModelState.IsValid)
return BadRequest(ModelState);
if (string.IsNullOrEmpty(deleteViewModel.id))
return BadRequest(new ApiResponse((int)EnumExtension.ApiCodeResponse.error, "Parameters is invalid!"));
switch (KafkaConfig.Instance.status)
{
case (int)EnumExtension.KafkaStatus.enable:
//Send with Kafka
break;
default:
//Send direction
var res1 = await _processingOrderService.DeleteOrderAsync(deleteViewModel.id, cancellationToken);
if (!string.IsNullOrEmpty(res1))
{
result.code = (int)EnumExtension.ApiCodeResponse.success;
result.message = $"Your order is deleted with id is {res1}";
return Ok(result);
}
break;
}
return BadRequest(result);
}
/// <summary>
/// Get order by Id
/// </summary>
/// <param name="id"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[Route("getorderbyid")]
[HttpGet]
public async Task<IActionResult> GetOrderById([FromQuery] string id, CancellationToken cancellationToken)
{
string messageDefault = $"Your order can not found. Please check again!";
ApiResponse result = new ApiResponse((int)EnumExtension.ApiCodeResponse.error, messageDefault);
if (string.IsNullOrEmpty(id))
return BadRequest(result);
if (!ModelState.IsValid)
return BadRequest(ModelState);
var res1 = await _processingOrderService.GetOrderById(id, cancellationToken);
if (res1 != null)
{
result.code = (int)EnumExtension.ApiCodeResponse.success;
result.message = $"Your order is gotten successfully and it's id is {res1}";
result.data = res1;
return Ok(result);
}
return BadRequest(result);
}
/// <summary>
/// Get all orders
/// </summary>
/// <param name="cancellationToken"></param>
/// <returns></returns>
[Route("getallorders")]
[HttpGet]
public async Task<IActionResult> GetAllOrders(CancellationToken cancellationToken)
{
string messageDefault = $"Your orders can not found. Please check again!";
ApiResponse result = new ApiResponse((int)EnumExtension.ApiCodeResponse.error, messageDefault);
if (!ModelState.IsValid)
return BadRequest(ModelState);
var res1 = await _processingOrderService.GetAllOrderAsync(cancellationToken);
if (res1 != null)
{
result.code = (int)EnumExtension.ApiCodeResponse.success;
result.message = $"Your order is gotten successfully";
result.data = res1;
return Ok(result);
}
return BadRequest(result);
}
}
}
|
/* Author: Mitchell Spryn (mitchell.spryn@gmail.com)
* There is no warranty with this code. I provide it with the intention of being interesting/helpful, but make no
* guarantees about its correctness or robustness.
* This code is free to use as you please, as long as this header comment is left in all of the files and credit is attributed to me for the original content that I have created.
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace NNGen
{
/// <summary>
/// The main user interface form for testing the application
/// Not much documentation is provided, as these aren't meant to be public members. They are very straightforward, and can be used as example cod,e however.
/// </summary>
public partial class Form1 : Form
{
/// <summary>
/// The constructor for the form
/// </summary>
public Form1()
{
InitializeComponent();
}
private void testSigmoidPoly_Click(object sender, EventArgs e)
{
Port testPort = new Port(Port.portDirection.IN, "input", Utilities.VHDLDataType.SIGNED_FIXED_POINT, 9, -8);
Sigmoid_PolyApprox sp = new Sigmoid_PolyApprox(testPort, 4, 4, "sigmoid_fracApprox_intFrac");
if (!sp.writeVHDL("sigmoid_fracApprox_intFrac.vhd"))
{
MessageBox.Show("Error writing sigmoid_fracApprox");
return;
}
testPort = new Port(Port.portDirection.IN, "input", Utilities.VHDLDataType.SIGNED_FIXED_POINT, 6, -8);
sp = new Sigmoid_PolyApprox(testPort, 2, 4, "sigmoid_fracApprox_fracOnly");
if (!sp.writeVHDL("sigmoid_fracApprox_fracOnly.vhd"))
{
MessageBox.Show("Error writing sigmoid_fracOnly");
return;
}
MessageBox.Show("Files successfully written");
return;
}
private void testNeuron_Click(object sender, EventArgs e)
{
Port[] neuronPorts = new Port[2];
neuronPorts[0] = new Port(Port.portDirection.IN, "in_0", Utilities.VHDLDataType.SIGNED_FIXED_POINT, 3, -4);
neuronPorts[1] = new Port(Port.portDirection.IN, "in_1", Utilities.VHDLDataType.SIGNED_FIXED_POINT, 3, -4);
AsyncNeuron n = new AsyncNeuron(neuronPorts, 4, 4, 4, AsyncNeuron.NeuronActivationType.SIGMOID_POLY_APPROX, "neuron_intfrac");
if (!n.writeVHDL("neuron_intfrac.vhd"))
{
MessageBox.Show("Problem in writing neuron_intfrac.vhd");
return;
}
MessageBox.Show("Files successfully written.");
return;
}
private void testNN_Click(object sender, EventArgs e)
{
int[] neuronCounts = new int[3] { 3, 2, 1 };
double[] biasValues = new double[2] { 0, 0 };
AsyncNeuron.NeuronActivationType[] activations = new AsyncNeuron.NeuronActivationType[2] { AsyncNeuron.NeuronActivationType.SIGMOID_POLY_APPROX, AsyncNeuron.NeuronActivationType.SIGMOID_POLY_APPROX };
int numIntBits = 4;
int numFracBits = 4;
int numWeightUpperBits = 4;
bool isClassifier = true;
double[] classifierThresholds = new double[1];
classifierThresholds[0] = 0.5;
List<double> weights = new List<double>();
weights.Add(0.0);
weights.Add(1.0);
weights.Add(-1.0);
weights.Add(0.0);
weights.Add(1.0);
weights.Add(-1.0);
AsyncNeuralNetwork nn = new AsyncNeuralNetwork(neuronCounts, biasValues, activations, numIntBits, numFracBits, numWeightUpperBits, isClassifier, classifierThresholds, weights);
string outFile = Directory.GetCurrentDirectory() + "\\testOne\\";
System.IO.FileInfo f = new FileInfo(outFile);
f.Directory.Create();
if (!(nn.writeVHDL(outFile)))
{
MessageBox.Show("Error in writing nn");
return;
}
/*File.Copy throws an exception if the file already exists. Delete it if it does*/
string fft_filepath = outFile + "\\fixed_float_types.vhd";
string fpkg_filepath = outFile + "\\fixed_pkg.vhd";
if (File.Exists(fft_filepath))
{
File.Delete(fft_filepath);
}
if (File.Exists(fpkg_filepath))
{
File.Delete(fpkg_filepath);
}
if (!File.Exists(outFile + "\\fixed_pkg.vhd"))
{
File.Copy("fixed_float_types.vhd", outFile + "\\fixed_float_types.vhd");
File.Copy("fixed_pkg.vhd", outFile + "\\fixed_pkg.vhd");
}
MessageBox.Show("Files successfully written.");
return;
}
private void syncNeuronTestBtn_Click(object sender, EventArgs e)
{
Port[] neuronPorts = new Port[2];
neuronPorts[0] = new Port(Port.portDirection.IN, "in_0", Utilities.VHDLDataType.SIGNED_FIXED_POINT, 3, -4);
neuronPorts[1] = new Port(Port.portDirection.IN, "in_1", Utilities.VHDLDataType.SIGNED_FIXED_POINT, 3, -4);
SyncNeuron sn = new SyncNeuron(neuronPorts, 4, 4, 4, "Neuron_Sync");
if (!sn.writeVHDL(""))
{
MessageBox.Show("Error writing Neuron_Sync.vhd");
return;
}
MessageBox.Show("File written.");
return;
}
private void TestTransferMemBtn_Click(object sender, EventArgs e)
{
SyncTransferFunctionMem sm = new SyncTransferFunctionMem(2, 1, TransferFunctionWrapper.MemoryActivationType.UNIPOLAR_SIGMOID, "aa");
if (!sm.writeVHDL(""))
{
MessageBox.Show("Error writing TransferMem file");
return;
}
MessageBox.Show("File written.");
return;
}
private void TestSyncNNBtn_Click(object sender, EventArgs e)
{
List<double> weights = new List<double>();
/*first layer*/
weights.Add(0.0);
weights.Add(1.0);
weights.Add(-1.0);
weights.Add(1.0);
weights.Add(0.5);
weights.Add(-0.5);
/*Second layer*/
weights.Add(0.0);
weights.Add(1.0);
weights.Add(-1.0);
weights.Add(1.0);
weights.Add(1.0);
weights.Add(0.5);
SyncNeuralNetwork snn = new SyncNeuralNetwork(new int[] { 2, 2, 2 }, new double[] { -1, 1, 0 }, new TransferFunctionWrapper.MemoryActivationType[] { TransferFunctionWrapper.MemoryActivationType.UNIPOLAR_SIGMOID, TransferFunctionWrapper.MemoryActivationType.UNIPOLAR_SIGMOID }, 4, 4, 4, false, null, weights);
string outFile = Directory.GetCurrentDirectory() + "\\proj\\";
System.IO.FileInfo f = new FileInfo(outFile);
if (!File.Exists(outFile + "\\fixed_pkg.vhd"))
{
File.Copy("fixed_float_types.vhd", outFile + "\\fixed_float_types.vhd");
File.Copy("fixed_pkg.vhd", outFile + "\\fixed_pkg.vhd");
}
f.Directory.Create();
if (!snn.writeVHDL(outFile))
{
MessageBox.Show("Problem writing sync neural network");
}
MessageBox.Show("File Written");
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using FunctionalProgramming.Helpers;
using FunctionalProgramming.Monad;
namespace FunctionalProgramming.Basics
{
/// <summary>
/// A monoid is a semi-group for which an identity value can be defined such that MAppend MZero 'T -> 'T
/// </summary>
/// <typeparam name="T">The set for which this monoid is defined</typeparam>
public interface IMonoid<T>
{
/// <summary>
/// The identity value for the semigroup T
/// </summary>
T MZero { get; }
/// <summary>
/// A binary operation for the semigroup T that respects the MZero relationship
/// </summary>
/// <param name="t1">A value from semigroup T</param>
/// <param name="t2">Another value from semigroup T</param>
/// <returns></returns>
T MAppend(T t1, T t2);
}
/// <summary>
/// Proof that strings are a monoid
/// </summary>
public sealed class StringMonoid : IMonoid<string>
{
/// <summary>
/// This proof is represented as a singleton (as proofs should not have multiple instances)
/// </summary>
public static IMonoid<string> Only = new StringMonoid();
/// <summary>
/// Default constructor marked as private to prevent multiple instances of this proof
/// </summary>
private StringMonoid()
{
}
/// <summary>
/// The identity value for the string monoid is the empty string
/// </summary>
public string MZero { get { return string.Empty; } }
/// <summary>
/// The binary operation for the string monoid is concatenation.
///
/// Monoid property: Mappend("anyString", MZero) == "anyString"
/// </summary>
/// <param name="s1">Any value from the monoid string</param>
/// <param name="s2">Any value from the monoid string</param>
/// <returns>'s2' appended to 's1'</returns>
public string MAppend(string s1, string s2)
{
return string.Format("{0}{1}", s1, s2);
}
}
/// <summary>
/// Proof that ints are a monoid
/// </summary>
public sealed class IntMonoid : IMonoid<int>
{
/// <summary>
/// This proof is represented as a singleton (as proofs should not have multiple instances)
/// </summary>
public static IMonoid<int> Only = new IntMonoid();
/// <summary>
/// Default constructor marked as private to prevent multiple instances of this proof from
/// being created
/// </summary>
private IntMonoid()
{
}
/// <summary>
/// The identity value for the int monoid is zero
/// </summary>
public int MZero { get { return 0; } }
/// <summary>
/// The binary operation for the int monoid is addition
///
/// Monoid property: MAppend(13, MZero) == 13
/// </summary>
/// <param name="a">Any value from the monoid int</param>
/// <param name="b">Any value from the monoid int</param>
/// <returns>'a' + 'b'</returns>
public int MAppend(int a, int b)
{
return a + b;
}
}
/// <summary>
/// A monoid for sequences whereby MZero is an empty sequence and MAppend is concatenation
/// </summary>
/// <typeparam name="T">The type of elements in the sequence</typeparam>
public sealed class EnumerableMonoid<T> : IMonoid<IEnumerable<T>>
{
/// <summary>
/// As this represents a mathematical capability and not a value, there should not be more than
/// one of these things ever.
/// </summary>
public static IMonoid<IEnumerable<T>> Only = new EnumerableMonoid<T>();
private EnumerableMonoid()
{
}
/// <summary>
/// The identity value for the enumerable monoid is 'Enumerable.Empty'
/// </summary>
public IEnumerable<T> MZero { get { return Enumerable.Empty<T>(); } }
/// <summary>
/// The binary operation for enumerables is concatenation
///
/// Monoid property: MAppend(new [] {1,2,3}, MZero) == [1, 2, 3]
/// </summary>
/// <param name="t1">Any value from the monoid enumerable</param>
/// <param name="t2">Any value from the monoid enumerable</param>
/// <returns>'t1'.Concat('t2')</returns>
public IEnumerable<T> MAppend(IEnumerable<T> t1, IEnumerable<T> t2)
{
return t1.Concat(t2);
}
}
public sealed class BooleanAndMonoid : IMonoid<bool>
{
public static IMonoid<bool> Only = new BooleanAndMonoid();
private BooleanAndMonoid()
{
}
public bool MZero { get { return true; } }
public bool MAppend(bool t1, bool t2)
{
return t1 && t2;
}
}
public sealed class FuncMonoid<T> : IMonoid<Func<T, T>>
{
public static IMonoid<Func<T, T>> Only = new FuncMonoid<T>();
private FuncMonoid()
{
}
public Func<T, T> MZero { get { return BasicFunctions.Identity; } }
public Func<T, T> MAppend(Func<T, T> f, Func<T, T> g)
{
return g.Compose(f);
}
}
public sealed class ConsListMonoid<T> : IMonoid<IConsList<T>>
{
public static IMonoid<IConsList<T>> Only = new ConsListMonoid<T>();
private ConsListMonoid() { }
public IConsList<T> MZero { get { return ConsList.Nil<T>(); } }
public IConsList<T> MAppend(IConsList<T> t1, IConsList<T> t2)
{
return t1.Concat(t2);
}
}
}
|
using Common.Data;
using Common.Exceptions;
using Common.Extensions;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Runtime.Serialization;
namespace Entity
{
[DataContract]
public partial class AutomationNewModuleRulesMediaInfo : IMappable
{
#region Constructors
public AutomationNewModuleRulesMediaInfo()
{ }
#endregion
#region Public Properties
/// <summary>
/// Gets the name of the table to which this object maps.
/// </summary>
public string TableName
{
get { return "Automation_New_Module_Rules_MediaInfo"; }
}
[DataMember]
public Int32? Index_CTR { get; set; }
[DataMember]
public Int32? Module_ID { get; set; }
[DataMember]
public Int32? Grid_ID { get; set; }
[DataMember]
public string Template_Name { get; set; }
[DataMember]
public string Asset_To_Update { get; set; }
[DataMember]
public Int32? Result_Runtime { get; set; }
[DataMember]
public Int32? Result_FrameRate { get; set; }
[DataMember]
public Int32? Result_AspectRatio { get; set; }
[DataMember]
public Int32? Result_FileFormat { get; set; }
[DataMember]
public Int32? Result_FrameSize { get; set; }
[DataMember]
public Int32? Result_Interlacing { get; set; }
[DataMember]
public Int32? Only_Update_Missing_Data { get; set; }
#endregion
#region Public Methods
public AutomationNewModuleRulesMediaInfo GetRecord(string connectionString, string sql, SqlParameter[] parameters = null)
{
AutomationNewModuleRulesMediaInfo result = null;
using (Database database = new Database(connectionString))
{
try
{
CommandType commandType = CommandType.Text;
if (parameters != null)
commandType = CommandType.StoredProcedure;
using (DataTable table = database.ExecuteSelect(sql, commandType, parameters))
{
if (table.HasRows())
{
Mapper<AutomationNewModuleRulesMediaInfo> m = new Mapper<AutomationNewModuleRulesMediaInfo>();
result = m.MapSingleSelect(table);
}
}
}
catch (Exception e)
{
throw new EntityException(sql, e);
}
}
return result;
}
public List<AutomationNewModuleRulesMediaInfo> GetList(string connectionString, string sql, SqlParameter[] parameters = null)
{
List<AutomationNewModuleRulesMediaInfo> result = new List<AutomationNewModuleRulesMediaInfo>();
using (Database database = new Database(connectionString))
{
try
{
CommandType commandType = CommandType.Text;
if (parameters != null)
commandType = CommandType.StoredProcedure;
using (DataTable table = database.ExecuteSelect(sql, commandType, parameters))
{
if (table.HasRows())
{
Mapper<AutomationNewModuleRulesMediaInfo> m = new Mapper<AutomationNewModuleRulesMediaInfo>();
result = m.MapListSelect(table);
}
}
}
catch (Exception e)
{
throw new EntityException(sql, e);
}
}
return result;
}
#endregion
}
} |
using System;
using System.Linq;
using System.Net;
using System.Web.Http;
using AutoMapper;
using KnowledgePortal.Dtos;
using KnowledgePortal.Models;
using Microsoft.AspNet.Identity;
using PagedList;
using System.Configuration;
namespace KnowledgePortal.Api
{
public class PostsController : ApiController
{
private ApplicationDbContext _context;
public PostsController()
{
_context = new ApplicationDbContext();
}
// GET /api/customers
// public IHttpActionResult IEnumerable<PostsDto> GetPosts(string searchString, int? page)
public IHttpActionResult GetPosts(string searchString, int? page)
{
var posts = (from t in _context.Posts orderby t.LastUpdated descending select t).Take(10);
if (!String.IsNullOrEmpty(searchString))
{
posts = _context.Posts.Where(s => s.TagNames.Contains(searchString));
}
var path = int.Parse(ConfigurationManager.AppSettings["PageSize"]);
var userid = User.Identity.GetUserId();
return Ok(posts.ToList().ToPagedList(page ?? 1, path).Select(Mapper.Map<Post,PostsDto>));
// return _context.Posts.ToList().Select(Mapper.Map<Post, PostsDto>);
}
// GET /api/customers/1
public IHttpActionResult GetPosts(int id)
{
var post = _context.Posts.SingleOrDefault(c => c.Id == id);
if (post == null)
return NotFound();
return Ok(Mapper.Map<Post, PostsDto>(post));
}
// POST /api/customers
[HttpPost]
public IHttpActionResult CreatePost(PostsDto postDto)
{
if (!ModelState.IsValid)
return BadRequest();
var post = Mapper.Map<PostsDto, Post>(postDto);
_context.Posts.Add(post);
_context.SaveChanges();
postDto.Id = post.Id;
return Created(new Uri(Request.RequestUri + "/" + post.Id), postDto);
}
// PUT /api/customers/1
[HttpPut]
public void UpdateCustomer(int id, PostsDto postDto)
{
if (!ModelState.IsValid)
throw new HttpResponseException(HttpStatusCode.BadRequest);
var postInDb = _context.Posts.SingleOrDefault(c => c.Id == id);
if (postInDb == null)
throw new HttpResponseException(HttpStatusCode.NotFound);
Mapper.Map(postDto, postInDb);
_context.SaveChanges();
}
// DELETE /api/customers/1
[HttpDelete]
public void DeleteCustomer(int id)
{
var postInDb = _context.Posts.SingleOrDefault(c => c.Id == id);
if (postInDb == null)
throw new HttpResponseException(HttpStatusCode.NotFound);
_context.Posts.Remove(postInDb);
_context.SaveChanges();
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Foundry.Security;
namespace Foundry.Website.Extensions
{
public class UserFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
const string key = "user";
if (filterContext.ActionParameters.ContainsKey(key))
{
var user = filterContext.HttpContext.User as FoundryUser;
if (user != null)
{
filterContext.ActionParameters[key] = user;
}
}
base.OnActionExecuting(filterContext);
}
}
} |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AttackAnimation : MonoBehaviour
{
public GameObject target;
public BaseAttack attack;
public Item item;
public float attackDur;
public float itemDur;
GameObject attackAnim;
GameObject addedEffectAnim;
List<ParticleSystem> playingAnims = new List<ParticleSystem>();
List<BaseAttackAudio> attackSoundEffects = new List<BaseAttackAudio>();
List<BaseAttackAudio> addedEffectSoundEffects = new List<BaseAttackAudio>();
public bool addedEffectAchieved;
bool buttonPressed;
bool enemyAttemptedAE;
public int enemyAEChance;
int frame = 0;
int frameAEThresholdMin = 0;
int frameAEThresholdMax = 0;
int AEframe = 0;
bool inAnimation;
public void Update()
{
if (inAnimation)
{
frame++;
//Debug.Log("Attack frame: " + frame);
if (GameObject.Find("BattleManager").GetComponent<BattleStateMachine>().PerformList[0].attackerType == Types.HERO)
{
if (ButtonPressedDuringAnimation(frame))
{
Debug.Log("Button pressed on frame " + frame);
}
} else
{
if (!enemyAttemptedAE)
{
EnemyAttackAddedEffect(frame);
}
}
PlayAttackSE(frame, attackSoundEffects);
}
if (addedEffectAchieved)
{
AEframe++;
//Debug.Log("AE frame: " + AEframe);
PlayAttackSE(AEframe, addedEffectSoundEffects);
}
}
/// <summary>
/// Generates new animation GameObject, and builds specific animation based on attack on the new GameObject
/// </summary>
public void BuildAnimation()
{
attackAnim = new GameObject
{
tag = "AttackAnimation",
name = attack.name + " animation"
};
//Physical attacks
if (attack.name == "Slash")
Slash();
//Magic attacks
if (attack.name == "Fire 1")
Fire1();
if (attack.name == "Bio 1")
Bio1();
if (attack.name == "Cure 1")
Cure1();
}
/// <summary>
/// Coroutine. Plays the animation and begins 'inAnimation' process in Update method for checking if user gets added effect
/// </summary>
public IEnumerator PlayAnimation()
{
Debug.Log("beginning animation");
foreach (Transform child in attackAnim.transform)
{
child.GetComponent<ParticleSystem>().Play();
playingAnims.Add(child.GetComponent<ParticleSystem>());
}
foreach (ParticleSystem ps in playingAnims)
{
if (!ps.isPlaying)
{
yield return new WaitForSeconds(.01f);
}
}
playingAnims.Clear();
inAnimation = true;
Debug.Log("duration: " + attackDur);
yield return new WaitForSeconds(attackDur);
Debug.Log("ending animation");
attackDur = 0;
frame = 0;
AEframe = 0;
enemyAEChance = 0;
frameAEThresholdMin = 0;
frameAEThresholdMax = 0;
inAnimation = false;
buttonPressed = false;
enemyAttemptedAE = false;
attackSoundEffects.Clear();
addedEffectSoundEffects.Clear();
}
/// <summary>
/// Plays animation for added effect for attack
/// </summary>
void PlayAddedEffectAnimation()
{
addedEffectAnim = new GameObject
{
tag = "AttackAnimation",
name = attack.name + " added effect animation"
};
if (attack.name == "Fire 1")
{
Fire1AddedEffect();
}
if (attack.name == "Bio 1")
{
Bio1AddedEffect();
}
if (attack.name == "Cure 1")
{
Cure1AddedEffect();
}
if (attack.name == "Slash")
{
SlashAddedEffect();
}
foreach (Transform child in addedEffectAnim.transform)
{
child.GetComponent<ParticleSystem>().Play();
}
}
#region -----Physical Attack Animations-----
void Slash()
{
//Animation
GameObject piece1 = Instantiate(AttackPrefabManager.Instance.slash, attackAnim.transform);
attackAnim.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, 0f);
piece1.transform.localScale = new Vector3(1f, 1f);
piece1.GetComponent<Renderer>().sortingLayerName = "Foreground";
attackDur = piece1.GetComponent<ParticleSystem>().main.duration;
//Audio
BaseAttackAudio se = new BaseAttackAudio
{
frame = 1,
SE = AudioManager.instance.slash
};
attackSoundEffects.Add(se);
//Added effect threshold
frameAEThresholdMin = 10;
frameAEThresholdMax = 40;
}
void SlashAddedEffect()
{
//Animation
GameObject piece1 = Instantiate(AttackPrefabManager.Instance.slash, addedEffectAnim.transform);
addedEffectAnim.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, 0f);
piece1.transform.localScale = new Vector3(1f, 1f);
piece1.transform.rotation = new Quaternion(180f, 180f, 1f, 1f);
piece1.GetComponent<Renderer>().sortingLayerName = "Foreground";
//Audio
BaseAttackAudio se = new BaseAttackAudio
{
frame = 1,
SE = AudioManager.instance.slashAE
};
addedEffectSoundEffects.Add(se);
}
#endregion
#region -----Magic Attack Animations-----
public void PlayCastingAnimation(GameObject caster)
{
//Animation
GameObject castAnimation = Instantiate(AttackPrefabManager.Instance.magicCast, caster.transform);
castAnimation.name = "Casting animation";
castAnimation.transform.position = new Vector3(caster.transform.position.x, caster.transform.position.y, 0f);
castAnimation.transform.localScale = new Vector3(3f, 3f);
castAnimation.GetComponent<Renderer>().sortingLayerName = "Foreground";
AudioManager.instance.PlaySE(AudioManager.instance.magicCast);
}
void Fire1()
{
//Animation
GameObject piece1 = Instantiate(AttackPrefabManager.Instance.fire, attackAnim.transform);
attackAnim.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, 0f);
piece1.transform.localScale = new Vector3(3f, 3f);
piece1.GetComponent<Renderer>().sortingLayerName = "Foreground";
attackDur = piece1.GetComponent<ParticleSystem>().main.duration;
//Audio
BaseAttackAudio se = new BaseAttackAudio
{
frame = 1,
SE = AudioManager.instance.fire1
};
attackSoundEffects.Add(se);
//Added effect threshold
frameAEThresholdMin = 10;
frameAEThresholdMax = 40;
}
void Fire1AddedEffect()
{
//Animation
GameObject piece1 = Instantiate(AttackPrefabManager.Instance.fire, addedEffectAnim.transform);
addedEffectAnim.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, 0f);
piece1.transform.localScale = new Vector3(8f, 8f);
piece1.GetComponent<Renderer>().sortingLayerName = "Foreground";
//Audio
BaseAttackAudio se = new BaseAttackAudio
{
frame = 1,
SE = AudioManager.instance.fire1AE
};
addedEffectSoundEffects.Add(se);
}
void Bio1()
{
//Animation
GameObject piece1 = Instantiate(AttackPrefabManager.Instance.bio, attackAnim.transform);
attackAnim.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, 0f);
piece1.transform.localScale = new Vector3(3f, 3f);
piece1.GetComponent<Renderer>().sortingLayerName = "Foreground";
attackDur = piece1.GetComponent<ParticleSystem>().main.duration;
//Audio
BaseAttackAudio se = new BaseAttackAudio
{
frame = 1,
SE = AudioManager.instance.bio1
};
attackSoundEffects.Add(se);
//Added effect threshold
frameAEThresholdMin = 10;
frameAEThresholdMax = 40;
}
void Bio1AddedEffect()
{
}
void Cure1()
{
//Animation
GameObject piece1 = Instantiate(AttackPrefabManager.Instance.cure, attackAnim.transform);
attackAnim.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, 0f);
piece1.transform.localScale = new Vector3(3f, 3f);
piece1.GetComponent<Renderer>().sortingLayerName = "Foreground";
attackDur = piece1.GetComponent<ParticleSystem>().main.duration;
//Audio
BaseAttackAudio se = new BaseAttackAudio
{
frame = 1,
SE = AudioManager.instance.cure1
};
attackSoundEffects.Add(se);
//Added effect threshold
frameAEThresholdMin = 10;
frameAEThresholdMax = 40;
}
void Cure1AddedEffect()
{
}
#endregion
#region -----Item Animations-----
public void PlayUsingItemAnimation(GameObject user)
{
//Animation of user actually using item not yet implemented
}
/// <summary>
/// Generates new animation GameObject, and builds specific animation based on attack on the new GameObject
/// </summary>
public void BuildItemAnimation()
{
attackAnim = new GameObject
{
tag = "AttackAnimation",
name = item.name + " animation"
};
if (item.name == "Potion")
Potion();
if (item.name == "Ether")
Ether();
}
/// <summary>
/// Coroutine. Plays the animation and begins 'inAnimation' process in Update method for checking if user gets added effect
/// </summary>
public IEnumerator PlayItemAnimation()
{
Debug.Log("beginning animation");
foreach (Transform child in attackAnim.transform)
{
child.GetComponent<ParticleSystem>().Play();
playingAnims.Add(child.GetComponent<ParticleSystem>());
}
foreach (ParticleSystem ps in playingAnims)
{
if (!ps.isPlaying)
{
yield return new WaitForSeconds(.01f);
}
}
playingAnims.Clear();
inAnimation = true;
Debug.Log("duration: " + itemDur);
yield return new WaitForSeconds(itemDur);
Debug.Log("ending animation");
itemDur = 0;
frame = 0;
AEframe = 0;
frameAEThresholdMin = 0;
frameAEThresholdMax = 0;
inAnimation = false;
buttonPressed = false;
attackSoundEffects.Clear();
addedEffectSoundEffects.Clear();
}
void Potion()
{
//Animation
GameObject piece1 = Instantiate(AttackPrefabManager.Instance.cure, attackAnim.transform);
attackAnim.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, 0f);
piece1.transform.localScale = new Vector3(3f, 3f);
piece1.GetComponent<Renderer>().sortingLayerName = "Foreground";
itemDur = piece1.GetComponent<ParticleSystem>().main.duration;
//Audio
BaseAttackAudio se = new BaseAttackAudio
{
frame = 1,
SE = AudioManager.instance.cure1
};
attackSoundEffects.Add(se);
//Added effect threshold
frameAEThresholdMin = 10;
frameAEThresholdMax = 40;
}
void PotionAddedEffect()
{
}
void Ether()
{
//Animation
GameObject piece1 = Instantiate(AttackPrefabManager.Instance.cure, attackAnim.transform);
attackAnim.transform.position = new Vector3(target.transform.position.x, target.transform.position.y, 0f);
piece1.transform.localScale = new Vector3(3f, 3f);
piece1.GetComponent<Renderer>().sortingLayerName = "Foreground";
attackDur = piece1.GetComponent<ParticleSystem>().main.duration;
//Audio
BaseAttackAudio se = new BaseAttackAudio
{
frame = 1,
SE = AudioManager.instance.cure1
};
attackSoundEffects.Add(se);
//Added effect threshold
frameAEThresholdMin = 10;
frameAEThresholdMax = 40;
}
void EtherAddedEffect()
{
}
#endregion
//Tools for above methods
/// <summary>
/// Adds given GameObject to the attack animation object
/// </summary>
/// <param name="prefab">GameObject to be added to the attack animation</param>
void AddPrefabToAnimation(GameObject prefab)
{
GameObject prefabToAdd = new GameObject();
prefabToAdd.transform.SetParent(attackAnim.transform);
}
/// <summary>
/// Returns true if button is pressed during animation, and checks if it was pressed during correct frame threshold
/// </summary>
/// <param name="frame">Frame the button was pressed on</param>
bool ButtonPressedDuringAnimation(int frame)
{
if (Input.GetButtonDown("Confirm") && !buttonPressed)
{
buttonPressed = true;
if (frame >= frameAEThresholdMin && frame <= frameAEThresholdMax)
{
Debug.Log("Added effect!");
addedEffectAchieved = true;
PlayAddedEffectAnimation();
}
return true;
}
else
{
return false;
}
}
void EnemyAttackAddedEffect(int frame)
{
if (frame >= frameAEThresholdMin && frame <= frameAEThresholdMax)
{
int rand = Random.Range(1, 100);
if (rand <= enemyAEChance)
{
Debug.Log("Enemy added effect!");
addedEffectAchieved = true;
PlayAddedEffectAnimation();
}
enemyAttemptedAE = true;
}
}
/// <summary>
/// Plays sound effect at correct frame configured in attack build
/// </summary>
/// <param name="frame">Frame to play the sound effect</param>
/// <param name="BAAs">List of BaseAttackAudio to check</param>
void PlayAttackSE(int frame, List<BaseAttackAudio> BAAs)
{
foreach (BaseAttackAudio BAA in BAAs)
{
if (BAA.frame == frame)
{
GameObject.Find("GameManager/BGS").GetComponent<AudioSource>().PlayOneShot(BAA.SE);
}
}
}
}
|
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Effect : ReusableObject
{
private float m_time = 1f;
public float M_Time
{
get
{
return m_time;
}
set
{
m_time = value;
}
}
IEnumerator DestroyCoroutine()
{
yield return new WaitForSeconds(M_Time);
Game.M_Instance.M_ObjectPool.UnSpawn(gameObject);
}
public override void OnSpawn()
{
StartCoroutine(DestroyCoroutine());
}
public override void OnUnSpawn()
{
StopAllCoroutines();
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
namespace AndroidAirHockey
{
/// <summary>
/// This is a game component that implements IUpdateable.
/// </summary>
public static class CollisionTools
{
public static bool CheckPaddleWallCollision()
{
return false;
}
public static bool CheckPaddlePuckCollision(Point paddle, Puck puck)
{
int intDistanceX = (int)(paddle.X + 32) - (int)puck.CenterX;
int intDistanceY = (int)(paddle.Y + 32) - (int)puck.CenterY;
int intRadii = 32 + puck.Radius;
if ((intDistanceX * intDistanceX) + (intDistanceY * intDistanceY) < intRadii * intRadii)
{
return true;
}
return false;
}
public static bool CheckPuckWallCollision(Rectangle rectangle, Puck puck, Table table)
{
int intDistanceLeftX = Math.Abs(rectangle.Left - (int)puck.CenterX);
int intDistanceRightX = Math.Abs(rectangle.Right - (int)puck.CenterX);
int intDistanceTopY = Math.Abs(rectangle.Top - (int)puck.CenterY);
int intDistanceBottomY = Math.Abs(rectangle.Bottom - (int)puck.CenterY);
int intDistanceTopGoalLeftX = Math.Abs(table.TopGoal.Left - (int)puck.CenterX);
int intDistanceTopGoalRightX = Math.Abs(table.TopGoal.Right - (int)puck.CenterX);
int intDistanceTopGoalBottomY = Math.Abs(table.TopGoal.Bottom - (int)puck.CenterY);
int intDistanceBottomGoalLeftX = Math.Abs(table.BottomGoal.Left - (int)puck.CenterX);
int intDistanceBottomGoalRightX = Math.Abs(table.BottomGoal.Right - (int)puck.CenterX);
int intDistanceBottomGoalTopY = Math.Abs(table.BottomGoal.Top - (int)puck.CenterY);
if (intDistanceLeftX <= puck.Radius)
{
PuckHitsWallCollision(puck, "Side");
return true;
}
if (intDistanceRightX <= puck.Radius)
{
PuckHitsWallCollision(puck, "Side");
return true;
}
if (intDistanceTopY <= puck.Radius)
{
if (table.TopGoal.Contains((int)puck.CenterX, (int)puck.Y) && intDistanceTopGoalBottomY <= puck.Radius)
{
puck.CenterX = 0;
puck.CenterY = 0;
table.GoalA = true;
return true;
}
PuckHitsWallCollision(puck, "");
return true;
}
if (intDistanceBottomY <= puck.Radius)
{
if (table.BottomGoal.Contains((int)puck.CenterX, ((int)puck.CenterY + puck.Radius)) && intDistanceBottomGoalTopY <= puck.Radius)
{
puck.CenterX = 0;
puck.CenterY = 0;
table.GoalB = true;
return true;
}
PuckHitsWallCollision(puck, "");
return true;
}
return false;
}
public static void PuckHitsWallCollision(Puck puck, string strWall)
{
if (strWall == "Side")
{
puck.SpeedX = puck.SpeedX * -1;
puck.SpeedY = puck.SpeedY * 1;
}
else
{
puck.SpeedX = puck.SpeedX * 1;
puck.SpeedY = puck.SpeedY * -1;
}
}
//public static Point PaddlePuckCollisionDest(Paddle paddle, Puck puck)
//{
// Point point = new Point();
// //Standing puck, Moving paddle
// double dblCollisionDist = Math.Sqrt(Math.Pow(puck.CenterX - paddle.CenterX, 2) + Math.Pow(puck.CenterY - paddle.CenterY, 2));
// double n_x = (puck.CenterX - paddle.X) / dblCollisionDist;
// double n_Y = (puck.CenterY - paddle.Y) / dblCollisionDist;
// double p = 2 * (paddle.StartCenterX * n_x + paddle.StartCenterY * n_Y) / (paddle.Mass + puck.Mass); //Division is for the mass of an object
// double w_x = paddle.StartCenterX - p * paddle.Mass * n_x - p * paddle.CenterX * n_x;
// double w_y = paddle.StartCenterY - p * paddle.Mass * n_Y - p * paddle.CenterY * n_Y;
// //puck.Speed = (float)(Math.Abs(p) / 20);
// point.X = (int)w_x;
// point.Y = (int)w_y;
// return point;
//}
public static void MovingPaddleCollision(Paddle paddle, Puck puck, float force)
{
//lower the force number the faster the puck goes
float DirX = (paddle.CenterX - puck.CenterX) / force;
float DirY = (paddle.CenterY - puck.CenterY) / force;
DirX = DirX * -1;
DirY = DirY * -1;
puck.SpeedX = DirX;
puck.SpeedY = DirY;
}
public static float DistanceBetweenPaddle(Point startingDistance, Paddle currentPosition)
{
double distanceX = Math.Pow((double)currentPosition.CenterX - (double)startingDistance.X, 2);
double distanceY = Math.Pow((double)currentPosition.CenterY - (double)startingDistance.Y, 2);
double dblDistance = Math.Round(Math.Sqrt(distanceX + distanceY), 2);
float returnDistance = (float)Math.Abs(dblDistance);
if (returnDistance > 150)
{
return 2.0f;
}
else if (returnDistance > 100 && returnDistance <= 150)
{
return 2.5f;
}
else if (returnDistance >= 50 && returnDistance <= 100)
{
return 3.0f;
}
else if (returnDistance < 50 && returnDistance > 30)
{
return 4.0f;
}
else if (returnDistance <= 30 && returnDistance > 15)
{
return 5.0f;
}
else
{
return 7.0f;
}
}
public static void MovingPuckCollision(Paddle paddle, Puck puck)
{
MovingPaddleCollision(paddle, puck, 10);
}
}
}
|
using Unity.Entities;
[GenerateAuthoringComponent]
public struct LifeTimeData : IComponentData {
public bool infiniteLifetime;
public float lifeLeft;
public bool alive;
}
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class Timer : MonoBehaviour {
[SerializeField]
private Text timerText;
private float time;
private int minutes;
private int seconds;
private int fraction;
public bool Run { get; set; }
// Use this for initialization
void Start () {
time = 0;
timerText.text = "00:00";
}
// Update is called once per frame
void Update () {
if (Run)
{
time += Time.deltaTime;
minutes = (int) time / 60;
seconds = (int) time % 60;
fraction = (int) (time * 100) % 100;
timerText.text = string.Format("{0:00}:{1:00}", minutes, seconds);
}
}
}
|
using System;
using UnityEngine;
public class MyCamera : MonoBehaviour
{
GameResource.HumanNature _nature;
float _move_Speed;
float _y;
Renderer _end_Point;
SkinnedMeshRenderer _human_Render;
bool _success_Bool;
public static bool GameEnd { get; set; }
public static float _jump_speed;
// Use this for initialization
void Start()
{
_nature = HumanManager.Nature;
_move_Speed = _nature.Run_Speed;
if (_move_Speed <= 0)
{
Debug.Log("移动速度不能为0或为负!");
return;
}
_end_Point = _nature.End_Point;
_human_Render = GameObject.FindGameObjectWithTag("Player").GetComponent<SkinnedMeshRenderer>();
_success_Bool = true;
GameEnd = false;
}
public void Update()
{
if (MyKeys.Pause_Game)
return;
if (ItemColliction.DeadDash.IsRun())
{
transform.Translate(0, _move_Speed * 1.5f, 0, Space.World);
}
if (_nature.HumanManager_Script.CurrentState == HumanState.Dead)
return;
if (_end_Point.isVisible)
{
if (_nature.Human_Script.transform.position.y >= _end_Point.transform.position.y && _success_Bool)
{
GameUIManager method = Transform.FindObjectOfType<GameUIManager>();
method.TheClicked(GameUI.GameUI_Pass);
MyKeys.Pause_Game = true;
_success_Bool = false;
}
GameEnd = true;
return;
}
if (!ItemColliction.DeadDash.IsRun())
{
if (ItemColliction.Dash.IsRun() || ItemColliction.StartDash.IsRun() || ItemColliction.SuperMan.WhetherSpeedUp())
{
transform.Translate(0, _move_Speed * 1.5f, 0, Space.World);
}
else
{
transform.Translate(0, _move_Speed, 0, Space.World);
}
}
}
}
|
using System;
using System.Runtime.Serialization;
using System.Xml;
namespace TRPO_labe_6.Models
{
[DataContract]
public class Product : IEquatable<Product>
{
public Product()
{
}
public override string ToString()
{
return $"Product - {nameof(Name)}: {Name}, {nameof(Price)}: {Price}";
}
[DataMember]
public string Name { get; set; }
[DataMember]
public int Price { get; set; }
[DataMember]
public int Count { get; set; }
public Product(string name, int price)
{
Price = price;
Name = name;
Count = 1;
}
public bool Equals(Product other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return string.Equals(Name, other.Name) && Price == other.Price;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((Product) obj);
}
public override int GetHashCode()
{
unchecked
{
var hashCode = Price;
hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
hashCode = (hashCode * 397) ^ Price;
return hashCode;
}
}
}
}
|
using FeriaVirtual.Domain.SeedWork;
using Oracle.ManagedDataAccess.Client;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace FeriaVirtual.Infrastructure.Persistence.OracleContext.Queries
{
class StoredProcedureQuery
: QueryParameter
{
private StoredProcedureQuery(OracleCommand command)
: base(command) { }
public static StoredProcedureQuery BuildQuery(OracleCommand command) =>
new(command);
public async Task ExcecuteAsync<TEntity>
(string spName, TEntity entity)
where TEntity : EntityBase
{
if(string.IsNullOrWhiteSpace(spName)) {
throw new QueryExecutorFailedException("No ha especificado un nombre de procedimiento almacenado para ejecutar.");
}
ConfigureCommand(spName);
if(entity.GetPrimitives() != null)
CreateStoredProcedureParameters(entity);
await _command.ExecuteNonQueryAsync();
}
public async Task ExcecuteAsync
(string spName, Dictionary<string, object> parameters = null)
{
if(string.IsNullOrWhiteSpace(spName)) {
throw new QueryExecutorFailedException("No ha especificado un nombre de procedimiento almacenado para ejecutar.");
}
ConfigureCommand(spName);
if(parameters != null)
CreateQueryParameters(parameters);
await _command.ExecuteNonQueryAsync();
}
private void ConfigureCommand(string spName)
{
ClearParameters();
_command.CommandType = System.Data.CommandType.StoredProcedure;
_command.CommandText = spName;
}
}
}
|
using DAL.Models;
using DTO.Convertors;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
public class MenuLogic : IMenuLogic
{
private MenuCalculatorContext _context;
public MenuLogic(MenuCalculatorContext context)
{
_context = context;
}
public MenuDto AddMenu(MenuDto u)
{
try
{
Menu m = MenuConvertors.ToMenu(u);
_context.Menu.Add(m);
_context.SaveChanges();
return MenuConvertors.ToMenuDto(m);
}
catch (Exception e)
{
throw e;
}
}
public MenuDto DeletMenu(MenuDto u)
{
_context.Menu.Remove(MenuConvertors.ToMenu(u));
_context.SaveChanges();
return u;
}
public List<MenuDto> GetAllMenus()
{
return MenuConvertors.ToMenuDtoList(_context.Menu.ToList());
}
public MenuDto GetMenuById(int id)
{
try
{
return MenuConvertors.ToMenuDto(_context.Menu.FirstOrDefault(p => p.MenuCode == id));
}
catch (Exception e)
{
throw e;
}
}
public MenuDto GetMenuByName(string name)
{
try
{
return MenuConvertors.ToMenuDto(_context.Menu.FirstOrDefault(p => p.MenuName == name));
}
catch (Exception e)
{
throw e;
}
}
public MenuDto UpdateMenu(MenuDto u)
{
Menu U = _context.Menu.FirstOrDefault(w => w.MenuCode == u.MenuCode);
if (u == null)
return null;
U.MenuName = u.MenuName;
U.UserCode = u.UserCode;
U.ViewsNumber = u.ViewsNumber;
U.Links = u.Links;
U.Discription = u.Discription;
U.DateUpdated = u.DateUpdated;
u.DateCreated = u.DateCreated;
_context.SaveChanges();
return MenuConvertors.ToMenuDto(U);
}
}
}
|
using System.Collections.Generic;
namespace DamianTourBackend.Application.UpdateProfile
{
public class UpdateProfileDTO
{
public string Email { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string PhoneNumber { get; set; }
public string DateOfBirth { get; set; }
//public string Wachtwoord { get; set; } Wachtwoord kan momenteel nog niet veranderd worden (nog te bespreken)
public List<string> Friends { get; set; }
public int Privacy { get; set; }
}
}
|
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class DialogControl : MonoBehaviour
{
public Button next;
public Button skip;
public string LeftCharName;
public string RightCharName;
public GameObject DialogBox;
public GameObject LeftCharacter;
public GameObject RightCharacter;
public Text MainDialog;
public Text LeftCharDialog;
public Text RightCharDialog;
public bool DialogBoxActive = true; // initialises dialog box
public TextAsset TextFile;
public string[] DialogLines;
private int CourrentLine; // keeps track of courent line
private int EndLine; // stops script at the end of the text
private string EndString = "END";
private string BothString = "BOTH";
private string NoneString = "NONE";
public GameObject redImage;
public GameObject witchImage;
// Use this for initialization
void Start()
{
witchImage.gameObject.SetActive(false);
redImage.gameObject.SetActive(false);
skip.gameObject.SetActive(false);
skip.onClick.AddListener(Change);
RightCharDialog.text = RightCharName;
LeftCharDialog.text = LeftCharName;
if (TextFile != null)
{
DialogLines = (TextFile.text.Split('\n'));
}
if (EndLine == 0)
{
EndLine = DialogLines.Length - 1;
}
DisableEnemyNameBox();
next.onClick.AddListener(TaskOnClick);
Debug.Log("Total Line: " + EndLine);
}
// Update is called once per frame
void Update()
{
if (CourrentLine == 5)
{
Debug.Log("HELLLO!");
skip.gameObject.SetActive(true);
}
if (DialogLines[CourrentLine].Contains(LeftCharName))
{
redImage.gameObject.SetActive(true);
witchImage.gameObject.SetActive(false);
DisableEnemyNameBox();
EnableCharacterNameBox();
CourrentLine++;
}
else if (DialogLines[CourrentLine].Contains(RightCharName))
{
redImage.gameObject.SetActive(false);
witchImage.gameObject.SetActive(true);
DisableCharacterNameBox();
EnableEnemyNameBox();
CourrentLine++;
}
else if (DialogLines[CourrentLine].Contains(BothString))
{
Debug.Log("BOTH");
DialogBox.SetActive(true);
LeftCharacter.SetActive(true);
RightCharacter.SetActive(true);
CourrentLine++;
}
else if (DialogLines[CourrentLine].Contains(NoneString))
{
redImage.SetActive(false);
witchImage.SetActive(false);
Debug.Log("NONE");
DialogBox.SetActive(true);
LeftCharacter.SetActive(false);
RightCharacter.SetActive(false);
CourrentLine++;
}
else if (DialogLines[CourrentLine].Contains(EndString))
{
DialogBox.SetActive(false);
LeftCharacter.SetActive(false);
RightCharacter.SetActive(false);
DialogBoxActive = false;
next.GetComponent<ChangeScene>().loadScene();
}
MainDialog.text = DialogLines[CourrentLine];
if (DialogBoxActive == false)
{
DisableCharacterNameBox();
DisableEnemyNameBox();
}
}
void Change()
{
skip.GetComponent<ChangeScene>().loadScene();
}
void TaskOnClick()
{
if(CourrentLine < EndLine)
{
CourrentLine++;
}
Debug.Log("Just Changed Line: " + CourrentLine);
}
// turns on dialog, character and enemy name boxes
public void EnableDialogBox()
{
DialogBox.SetActive(true); // turns on dialog box
}
public void EnableCharacterNameBox()
{
LeftCharacter.SetActive(true); // turns on character name box
}
public void EnableEnemyNameBox()
{
RightCharacter.SetActive(true); // turns on enemy name box
}
//turns off dialog, character and enemy name boxes
public void DisableDialogBox()
{
DialogBox.SetActive(false); // turns off dialog box
}
public void DisableCharacterNameBox()
{
LeftCharacter.SetActive(false); // turns off character name box
}
public void DisableEnemyNameBox()
{
RightCharacter.SetActive(false); // Turns off enemy name box
}
//Reload the script with diffrent textfile for diffrent scenes????
public void ReloadScript(TextAsset NewTextFile)
{
if (TextFile != null)
{
DialogLines = new string[1];
DialogLines = (NewTextFile.text.Split('\n'));
}
}
}
|
using UnityEngine;
namespace Assets.Scripts.InventoryFolder
{
public abstract class GeneralItem
{
public Vector2 Position { get; set; }
public Texture Texture { get; set; }
public Rect Rect { get; set; }
protected const int ITEMSIZE = 48;
}
}
|
using System;
namespace Vlc.DotNet.Core
{
public sealed class VlcMediaPlayerBackwardEventArgs : EventArgs
{
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
namespace SimpleTaskListSPA.Data
{
//класс, необходимый для подключения к базе данных
public class DataContext : DbContext
{
public DataContext(DbContextOptions<DataContext> options) : base(options) { }
//таблица задач в бд
public DbSet<TaskItem> Tasks { get; set; }
//таблица списка задач в бд
public DbSet<Category> Categories { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TaskItem>().Property(t => t.IsOverdue)
.HasComputedColumnSql(@"
CAST(CASE
WHEN CONVERT(date, PlanningDate) < CONVERT(date, GETDATE()) THEN 1
WHEN PlanningDate IS NULL THEN 0
WHEN CONVERT(date, PlanningDate) >= CONVERT(date, GETDATE()) THEN 0
END AS BIT)");
}
}
}
|
using System;
using System.Collections.Generic;
using JCI.ITC.COMP2.Common.SettingsEnrichers;
using JCI.ITC.Nuget.Logging.SettingsEnrichers;
using Serilog.Events;
namespace Ajf.NugetWatcher.Settings
{
public class NugetWatcherSettings: INugetWatcherSettings
{
public NugetWatcherSettings()
{
LoggingSettingsEnricher.Enrich(this);
NugetWatcherSettingsEnricher.Enrich(this);
MailSenderSettingsEnricher.Enrich(this);
}
public string ReleaseNumber { get; set; }
public string ComponentName { get; set; }
public string SuiteName { get; set; }
public string Environment { get; set; }
public string LogFileDirectory { get; set; }
public string FileName { get; set; }
public string EsLoggingUrl { get; set; }
public IEnumerable<Uri> EsLoggingUri { get; set; }
public LogEventLevel LoggingLevel { get; set; }
public string PathToNuget { get; set; }
public string[] NotificationReceivers { get; set; }
public string SendGridApiKey { get; set; }
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.